std_modrpc/
proto.rs

1use core::convert::TryFrom;
2use mproto::{BaseLen, Compatible, Decode, DecodeCursor, DecodeError, DecodeResult, Encode, EncodeCursor, Lazy, Owned};
3
4#[derive(Copy, Clone, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)]
5pub struct PropertyUpdate<T> {
6    pub new_value: T,
7}
8
9pub struct PropertyUpdateLazy<'a, T> {
10    buffer: &'a [u8],
11    offset: usize,
12    _t: core::marker::PhantomData<T>,
13}
14
15pub struct PropertyUpdateGen<
16    NewValue: Encode,
17> {
18    pub new_value: NewValue,
19}
20
21impl<
22    T: Owned,
23    NewValue: Encode + Compatible<T>
24> Compatible<PropertyUpdate<T>> for PropertyUpdateGen<NewValue> { }
25impl<
26    T: Owned,
27    NewValue: Encode + Compatible<T>
28> Compatible<PropertyUpdateGen<NewValue>> for PropertyUpdate<T> { }
29
30impl<
31    NewValue: Encode,
32> BaseLen for PropertyUpdateGen<NewValue> {
33    const BASE_LEN: usize = NewValue::BASE_LEN;
34}
35
36impl<
37    NewValue: Encode,
38> Encode for PropertyUpdateGen<NewValue> {
39    fn scratch_len(&self) -> usize {
40        self.new_value.scratch_len()
41    }
42
43    fn encode(&self, cursor: &mut EncodeCursor) {
44        self.new_value.encode(cursor);
45    }
46}
47
48impl<T: Owned> Owned for PropertyUpdate<T> {
49    type Lazy<'a> = PropertyUpdateLazy<'a, T>;
50
51    fn lazy_to_owned(lazy: Self::Lazy<'_>) -> DecodeResult<Self> {
52        TryFrom::try_from(lazy)
53    }
54}
55
56impl<'a, T: Owned> Lazy<'a> for PropertyUpdateLazy<'a, T> {
57    type Owned = PropertyUpdate<T>;
58}
59
60impl<'a, T: Owned> Compatible<PropertyUpdateLazy<'a, T>> for PropertyUpdate<T> { }
61impl<'a, T: Owned> Compatible<PropertyUpdate<T>> for PropertyUpdateLazy<'a, T> { }
62
63impl<'a, T: Owned> PropertyUpdateLazy<'a, T> {
64
65    pub fn new_value(&self) -> DecodeResult<T::Lazy<'a>> {
66        Decode::decode(&DecodeCursor::at_offset(self.buffer, self.offset + 0))
67    }
68}
69
70impl<T: BaseLen> BaseLen for PropertyUpdate<T> {
71    const BASE_LEN: usize = T::BASE_LEN;
72}
73
74impl<T: Encode> Encode for PropertyUpdate<T> {
75    fn scratch_len(&self) -> usize {
76        self.new_value.scratch_len()
77    }
78
79    fn encode(&self, cursor: &mut EncodeCursor) {
80        self.new_value.encode(cursor);
81    }
82}
83
84impl<'a, T: Decode<'a>> Decode<'a> for PropertyUpdate<T> {
85    fn decode(cursor: &DecodeCursor<'a>) -> DecodeResult<Self> {
86        let new_value = Decode::decode(cursor)?;
87
88        Ok(PropertyUpdate {
89            new_value,
90        })
91    }
92}
93
94impl<'a, T: Owned> BaseLen for PropertyUpdateLazy<'a, T> {
95    const BASE_LEN: usize = T::BASE_LEN;
96}
97
98impl<'a, T: Owned> Encode for PropertyUpdateLazy<'a, T> {
99    fn scratch_len(&self) -> usize {
100        let new_value: T::Lazy<'a> = Decode::decode(&DecodeCursor::at_offset(self.buffer, self.offset + 0)).unwrap();
101        new_value.scratch_len()
102    }
103
104    fn encode(&self, cursor: &mut EncodeCursor) {
105        let new_value: T::Lazy<'a> = Decode::decode(&DecodeCursor::at_offset(self.buffer, self.offset + 0)).unwrap();
106        new_value.encode(cursor);
107    }
108}
109
110impl<'a, T: Owned> Decode<'a> for PropertyUpdateLazy<'a, T> {
111    fn decode(cursor: &DecodeCursor<'a>) -> DecodeResult<Self> {
112        let offset = cursor.offset();
113        cursor.advance(Self::BASE_LEN);
114        Ok(PropertyUpdateLazy {
115            buffer: cursor.buffer(),
116            offset,
117            _t: core::marker::PhantomData,
118        })
119    }
120}
121
122impl<'a, T: Owned> TryFrom<PropertyUpdateLazy<'a, T>> for PropertyUpdate<T> {
123    type Error = DecodeError;
124
125    fn try_from(other: PropertyUpdateLazy<'a, T>) -> Result<Self, Self::Error> {
126        let cursor = DecodeCursor::at_offset(other.buffer, other.offset);
127        Decode::decode(&cursor)
128    }
129}
130
131impl<'a, T> Copy for PropertyUpdateLazy<'a, T> { }
132
133impl<'a, T> Clone for PropertyUpdateLazy<'a, T> {
134    fn clone(&self) -> Self {
135        Self {
136            buffer: self.buffer,
137            offset: self.offset,
138            _t: core::marker::PhantomData,
139        }
140    }
141}
142
143impl<'a, T> core::fmt::Debug for PropertyUpdateLazy<'a, T> {
144    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
145        f.debug_struct("PropertyUpdateLazy")
146            .finish()
147    }
148}
149
150impl<'a, T: Owned> PartialEq for PropertyUpdateLazy<'a, T> {
151    fn eq(&self, other: &Self) -> bool {
152        self.new_value().unwrap() == other.new_value().unwrap()
153    }
154}
155
156#[derive(Copy, Clone, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)]
157pub struct Request<T> {
158    pub request_id: u32,
159    pub worker: u16,
160    pub payload: T,
161}
162
163pub struct RequestLazy<'a, T> {
164    buffer: &'a [u8],
165    offset: usize,
166    _t: core::marker::PhantomData<T>,
167}
168
169pub struct RequestGen<
170    Payload: Encode,
171> {
172    pub request_id: u32,
173    pub worker: u16,
174    pub payload: Payload,
175}
176
177impl<
178    T: Owned,
179    Payload: Encode + Compatible<T>
180> Compatible<Request<T>> for RequestGen<Payload> { }
181impl<
182    T: Owned,
183    Payload: Encode + Compatible<T>
184> Compatible<RequestGen<Payload>> for Request<T> { }
185
186impl<
187    Payload: Encode,
188> BaseLen for RequestGen<Payload> {
189    const BASE_LEN: usize = 6 + Payload::BASE_LEN;
190}
191
192impl<
193    Payload: Encode,
194> Encode for RequestGen<Payload> {
195    fn scratch_len(&self) -> usize {
196        self.request_id.scratch_len() + self.worker.scratch_len() + self.payload.scratch_len()
197    }
198
199    fn encode(&self, cursor: &mut EncodeCursor) {
200        self.request_id.encode(cursor);
201        self.worker.encode(cursor);
202        self.payload.encode(cursor);
203    }
204}
205
206impl<T: Owned> Owned for Request<T> {
207    type Lazy<'a> = RequestLazy<'a, T>;
208
209    fn lazy_to_owned(lazy: Self::Lazy<'_>) -> DecodeResult<Self> {
210        TryFrom::try_from(lazy)
211    }
212}
213
214impl<'a, T: Owned> Lazy<'a> for RequestLazy<'a, T> {
215    type Owned = Request<T>;
216}
217
218impl<'a, T: Owned> Compatible<RequestLazy<'a, T>> for Request<T> { }
219impl<'a, T: Owned> Compatible<Request<T>> for RequestLazy<'a, T> { }
220
221impl<'a, T: Owned> RequestLazy<'a, T> {
222
223    pub fn request_id(&self) -> DecodeResult<u32> {
224        Decode::decode(&DecodeCursor::at_offset(self.buffer, self.offset + 0))
225    }
226
227    pub fn worker(&self) -> DecodeResult<u16> {
228        Decode::decode(&DecodeCursor::at_offset(self.buffer, self.offset + 4))
229    }
230
231    pub fn payload(&self) -> DecodeResult<T::Lazy<'a>> {
232        Decode::decode(&DecodeCursor::at_offset(self.buffer, self.offset + 6))
233    }
234}
235
236impl<T: BaseLen> BaseLen for Request<T> {
237    const BASE_LEN: usize = 6 + T::BASE_LEN;
238}
239
240impl<T: Encode> Encode for Request<T> {
241    fn scratch_len(&self) -> usize {
242        self.request_id.scratch_len() + self.worker.scratch_len() + self.payload.scratch_len()
243    }
244
245    fn encode(&self, cursor: &mut EncodeCursor) {
246        self.request_id.encode(cursor);
247        self.worker.encode(cursor);
248        self.payload.encode(cursor);
249    }
250}
251
252impl<'a, T: Decode<'a>> Decode<'a> for Request<T> {
253    fn decode(cursor: &DecodeCursor<'a>) -> DecodeResult<Self> {
254        let request_id = Decode::decode(cursor)?;
255        let worker = Decode::decode(cursor)?;
256        let payload = Decode::decode(cursor)?;
257
258        Ok(Request {
259            request_id,
260            worker,
261            payload,
262        })
263    }
264}
265
266impl<'a, T: Owned> BaseLen for RequestLazy<'a, T> {
267    const BASE_LEN: usize = 6 + T::BASE_LEN;
268}
269
270impl<'a, T: Owned> Encode for RequestLazy<'a, T> {
271    fn scratch_len(&self) -> usize {
272        let request_id: u32 = Decode::decode(&DecodeCursor::at_offset(self.buffer, self.offset + 0)).unwrap();
273        let worker: u16 = Decode::decode(&DecodeCursor::at_offset(self.buffer, self.offset + 4)).unwrap();
274        let payload: T::Lazy<'a> = Decode::decode(&DecodeCursor::at_offset(self.buffer, self.offset + 6)).unwrap();
275        request_id.scratch_len() + worker.scratch_len() + payload.scratch_len()
276    }
277
278    fn encode(&self, cursor: &mut EncodeCursor) {
279        let request_id: u32 = Decode::decode(&DecodeCursor::at_offset(self.buffer, self.offset + 0)).unwrap();
280        let worker: u16 = Decode::decode(&DecodeCursor::at_offset(self.buffer, self.offset + 4)).unwrap();
281        let payload: T::Lazy<'a> = Decode::decode(&DecodeCursor::at_offset(self.buffer, self.offset + 6)).unwrap();
282        request_id.encode(cursor);
283        worker.encode(cursor);
284        payload.encode(cursor);
285    }
286}
287
288impl<'a, T: Owned> Decode<'a> for RequestLazy<'a, T> {
289    fn decode(cursor: &DecodeCursor<'a>) -> DecodeResult<Self> {
290        let offset = cursor.offset();
291        cursor.advance(Self::BASE_LEN);
292        Ok(RequestLazy {
293            buffer: cursor.buffer(),
294            offset,
295            _t: core::marker::PhantomData,
296        })
297    }
298}
299
300impl<'a, T: Owned> TryFrom<RequestLazy<'a, T>> for Request<T> {
301    type Error = DecodeError;
302
303    fn try_from(other: RequestLazy<'a, T>) -> Result<Self, Self::Error> {
304        let cursor = DecodeCursor::at_offset(other.buffer, other.offset);
305        Decode::decode(&cursor)
306    }
307}
308
309impl<'a, T> Copy for RequestLazy<'a, T> { }
310
311impl<'a, T> Clone for RequestLazy<'a, T> {
312    fn clone(&self) -> Self {
313        Self {
314            buffer: self.buffer,
315            offset: self.offset,
316            _t: core::marker::PhantomData,
317        }
318    }
319}
320
321impl<'a, T> core::fmt::Debug for RequestLazy<'a, T> {
322    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
323        f.debug_struct("RequestLazy")
324            .finish()
325    }
326}
327
328impl<'a, T: Owned> PartialEq for RequestLazy<'a, T> {
329    fn eq(&self, other: &Self) -> bool {
330        self.request_id().unwrap() == other.request_id().unwrap()
331            && self.worker().unwrap() == other.worker().unwrap()&& self.payload().unwrap() == other.payload().unwrap()
332    }
333}
334
335#[derive(Copy, Clone, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)]
336pub struct Response<T> {
337    pub request_id: u32,
338    pub requester: u64,
339    pub requester_worker: u16,
340    pub payload: T,
341}
342
343pub struct ResponseLazy<'a, T> {
344    buffer: &'a [u8],
345    offset: usize,
346    _t: core::marker::PhantomData<T>,
347}
348
349pub struct ResponseGen<
350    Payload: Encode,
351> {
352    pub request_id: u32,
353    pub requester: u64,
354    pub requester_worker: u16,
355    pub payload: Payload,
356}
357
358impl<
359    T: Owned,
360    Payload: Encode + Compatible<T>
361> Compatible<Response<T>> for ResponseGen<Payload> { }
362impl<
363    T: Owned,
364    Payload: Encode + Compatible<T>
365> Compatible<ResponseGen<Payload>> for Response<T> { }
366
367impl<
368    Payload: Encode,
369> BaseLen for ResponseGen<Payload> {
370    const BASE_LEN: usize = 14 + Payload::BASE_LEN;
371}
372
373impl<
374    Payload: Encode,
375> Encode for ResponseGen<Payload> {
376    fn scratch_len(&self) -> usize {
377        self.request_id.scratch_len() + self.requester.scratch_len() + self.requester_worker.scratch_len() + self.payload.scratch_len()
378    }
379
380    fn encode(&self, cursor: &mut EncodeCursor) {
381        self.request_id.encode(cursor);
382        self.requester.encode(cursor);
383        self.requester_worker.encode(cursor);
384        self.payload.encode(cursor);
385    }
386}
387
388impl<T: Owned> Owned for Response<T> {
389    type Lazy<'a> = ResponseLazy<'a, T>;
390
391    fn lazy_to_owned(lazy: Self::Lazy<'_>) -> DecodeResult<Self> {
392        TryFrom::try_from(lazy)
393    }
394}
395
396impl<'a, T: Owned> Lazy<'a> for ResponseLazy<'a, T> {
397    type Owned = Response<T>;
398}
399
400impl<'a, T: Owned> Compatible<ResponseLazy<'a, T>> for Response<T> { }
401impl<'a, T: Owned> Compatible<Response<T>> for ResponseLazy<'a, T> { }
402
403impl<'a, T: Owned> ResponseLazy<'a, T> {
404
405    pub fn request_id(&self) -> DecodeResult<u32> {
406        Decode::decode(&DecodeCursor::at_offset(self.buffer, self.offset + 0))
407    }
408
409    pub fn requester(&self) -> DecodeResult<u64> {
410        Decode::decode(&DecodeCursor::at_offset(self.buffer, self.offset + 4))
411    }
412
413    pub fn requester_worker(&self) -> DecodeResult<u16> {
414        Decode::decode(&DecodeCursor::at_offset(self.buffer, self.offset + 12))
415    }
416
417    pub fn payload(&self) -> DecodeResult<T::Lazy<'a>> {
418        Decode::decode(&DecodeCursor::at_offset(self.buffer, self.offset + 14))
419    }
420}
421
422impl<T: BaseLen> BaseLen for Response<T> {
423    const BASE_LEN: usize = 14 + T::BASE_LEN;
424}
425
426impl<T: Encode> Encode for Response<T> {
427    fn scratch_len(&self) -> usize {
428        self.request_id.scratch_len() + self.requester.scratch_len() + self.requester_worker.scratch_len() + self.payload.scratch_len()
429    }
430
431    fn encode(&self, cursor: &mut EncodeCursor) {
432        self.request_id.encode(cursor);
433        self.requester.encode(cursor);
434        self.requester_worker.encode(cursor);
435        self.payload.encode(cursor);
436    }
437}
438
439impl<'a, T: Decode<'a>> Decode<'a> for Response<T> {
440    fn decode(cursor: &DecodeCursor<'a>) -> DecodeResult<Self> {
441        let request_id = Decode::decode(cursor)?;
442        let requester = Decode::decode(cursor)?;
443        let requester_worker = Decode::decode(cursor)?;
444        let payload = Decode::decode(cursor)?;
445
446        Ok(Response {
447            request_id,
448            requester,
449            requester_worker,
450            payload,
451        })
452    }
453}
454
455impl<'a, T: Owned> BaseLen for ResponseLazy<'a, T> {
456    const BASE_LEN: usize = 14 + T::BASE_LEN;
457}
458
459impl<'a, T: Owned> Encode for ResponseLazy<'a, T> {
460    fn scratch_len(&self) -> usize {
461        let request_id: u32 = Decode::decode(&DecodeCursor::at_offset(self.buffer, self.offset + 0)).unwrap();
462        let requester: u64 = Decode::decode(&DecodeCursor::at_offset(self.buffer, self.offset + 4)).unwrap();
463        let requester_worker: u16 = Decode::decode(&DecodeCursor::at_offset(self.buffer, self.offset + 12)).unwrap();
464        let payload: T::Lazy<'a> = Decode::decode(&DecodeCursor::at_offset(self.buffer, self.offset + 14)).unwrap();
465        request_id.scratch_len() + requester.scratch_len() + requester_worker.scratch_len() + payload.scratch_len()
466    }
467
468    fn encode(&self, cursor: &mut EncodeCursor) {
469        let request_id: u32 = Decode::decode(&DecodeCursor::at_offset(self.buffer, self.offset + 0)).unwrap();
470        let requester: u64 = Decode::decode(&DecodeCursor::at_offset(self.buffer, self.offset + 4)).unwrap();
471        let requester_worker: u16 = Decode::decode(&DecodeCursor::at_offset(self.buffer, self.offset + 12)).unwrap();
472        let payload: T::Lazy<'a> = Decode::decode(&DecodeCursor::at_offset(self.buffer, self.offset + 14)).unwrap();
473        request_id.encode(cursor);
474        requester.encode(cursor);
475        requester_worker.encode(cursor);
476        payload.encode(cursor);
477    }
478}
479
480impl<'a, T: Owned> Decode<'a> for ResponseLazy<'a, T> {
481    fn decode(cursor: &DecodeCursor<'a>) -> DecodeResult<Self> {
482        let offset = cursor.offset();
483        cursor.advance(Self::BASE_LEN);
484        Ok(ResponseLazy {
485            buffer: cursor.buffer(),
486            offset,
487            _t: core::marker::PhantomData,
488        })
489    }
490}
491
492impl<'a, T: Owned> TryFrom<ResponseLazy<'a, T>> for Response<T> {
493    type Error = DecodeError;
494
495    fn try_from(other: ResponseLazy<'a, T>) -> Result<Self, Self::Error> {
496        let cursor = DecodeCursor::at_offset(other.buffer, other.offset);
497        Decode::decode(&cursor)
498    }
499}
500
501impl<'a, T> Copy for ResponseLazy<'a, T> { }
502
503impl<'a, T> Clone for ResponseLazy<'a, T> {
504    fn clone(&self) -> Self {
505        Self {
506            buffer: self.buffer,
507            offset: self.offset,
508            _t: core::marker::PhantomData,
509        }
510    }
511}
512
513impl<'a, T> core::fmt::Debug for ResponseLazy<'a, T> {
514    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
515        f.debug_struct("ResponseLazy")
516            .finish()
517    }
518}
519
520impl<'a, T: Owned> PartialEq for ResponseLazy<'a, T> {
521    fn eq(&self, other: &Self) -> bool {
522        self.request_id().unwrap() == other.request_id().unwrap()
523            && self.requester().unwrap() == other.requester().unwrap()&& self.requester_worker().unwrap() == other.requester_worker().unwrap()&& self.payload().unwrap() == other.payload().unwrap()
524    }
525}
526
527#[derive(Copy, Clone, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)]
528pub struct StreamItem<T> {
529    pub seq: u64,
530    pub payload: T,
531}
532
533pub struct StreamItemLazy<'a, T> {
534    buffer: &'a [u8],
535    offset: usize,
536    _t: core::marker::PhantomData<T>,
537}
538
539pub struct StreamItemGen<
540    Payload: Encode,
541> {
542    pub seq: u64,
543    pub payload: Payload,
544}
545
546impl<
547    T: Owned,
548    Payload: Encode + Compatible<T>
549> Compatible<StreamItem<T>> for StreamItemGen<Payload> { }
550impl<
551    T: Owned,
552    Payload: Encode + Compatible<T>
553> Compatible<StreamItemGen<Payload>> for StreamItem<T> { }
554
555impl<
556    Payload: Encode,
557> BaseLen for StreamItemGen<Payload> {
558    const BASE_LEN: usize = 8 + Payload::BASE_LEN;
559}
560
561impl<
562    Payload: Encode,
563> Encode for StreamItemGen<Payload> {
564    fn scratch_len(&self) -> usize {
565        self.seq.scratch_len() + self.payload.scratch_len()
566    }
567
568    fn encode(&self, cursor: &mut EncodeCursor) {
569        self.seq.encode(cursor);
570        self.payload.encode(cursor);
571    }
572}
573
574impl<T: Owned> Owned for StreamItem<T> {
575    type Lazy<'a> = StreamItemLazy<'a, T>;
576
577    fn lazy_to_owned(lazy: Self::Lazy<'_>) -> DecodeResult<Self> {
578        TryFrom::try_from(lazy)
579    }
580}
581
582impl<'a, T: Owned> Lazy<'a> for StreamItemLazy<'a, T> {
583    type Owned = StreamItem<T>;
584}
585
586impl<'a, T: Owned> Compatible<StreamItemLazy<'a, T>> for StreamItem<T> { }
587impl<'a, T: Owned> Compatible<StreamItem<T>> for StreamItemLazy<'a, T> { }
588
589impl<'a, T: Owned> StreamItemLazy<'a, T> {
590
591    pub fn seq(&self) -> DecodeResult<u64> {
592        Decode::decode(&DecodeCursor::at_offset(self.buffer, self.offset + 0))
593    }
594
595    pub fn payload(&self) -> DecodeResult<T::Lazy<'a>> {
596        Decode::decode(&DecodeCursor::at_offset(self.buffer, self.offset + 8))
597    }
598}
599
600impl<T: BaseLen> BaseLen for StreamItem<T> {
601    const BASE_LEN: usize = 8 + T::BASE_LEN;
602}
603
604impl<T: Encode> Encode for StreamItem<T> {
605    fn scratch_len(&self) -> usize {
606        self.seq.scratch_len() + self.payload.scratch_len()
607    }
608
609    fn encode(&self, cursor: &mut EncodeCursor) {
610        self.seq.encode(cursor);
611        self.payload.encode(cursor);
612    }
613}
614
615impl<'a, T: Decode<'a>> Decode<'a> for StreamItem<T> {
616    fn decode(cursor: &DecodeCursor<'a>) -> DecodeResult<Self> {
617        let seq = Decode::decode(cursor)?;
618        let payload = Decode::decode(cursor)?;
619
620        Ok(StreamItem {
621            seq,
622            payload,
623        })
624    }
625}
626
627impl<'a, T: Owned> BaseLen for StreamItemLazy<'a, T> {
628    const BASE_LEN: usize = 8 + T::BASE_LEN;
629}
630
631impl<'a, T: Owned> Encode for StreamItemLazy<'a, T> {
632    fn scratch_len(&self) -> usize {
633        let seq: u64 = Decode::decode(&DecodeCursor::at_offset(self.buffer, self.offset + 0)).unwrap();
634        let payload: T::Lazy<'a> = Decode::decode(&DecodeCursor::at_offset(self.buffer, self.offset + 8)).unwrap();
635        seq.scratch_len() + payload.scratch_len()
636    }
637
638    fn encode(&self, cursor: &mut EncodeCursor) {
639        let seq: u64 = Decode::decode(&DecodeCursor::at_offset(self.buffer, self.offset + 0)).unwrap();
640        let payload: T::Lazy<'a> = Decode::decode(&DecodeCursor::at_offset(self.buffer, self.offset + 8)).unwrap();
641        seq.encode(cursor);
642        payload.encode(cursor);
643    }
644}
645
646impl<'a, T: Owned> Decode<'a> for StreamItemLazy<'a, T> {
647    fn decode(cursor: &DecodeCursor<'a>) -> DecodeResult<Self> {
648        let offset = cursor.offset();
649        cursor.advance(Self::BASE_LEN);
650        Ok(StreamItemLazy {
651            buffer: cursor.buffer(),
652            offset,
653            _t: core::marker::PhantomData,
654        })
655    }
656}
657
658impl<'a, T: Owned> TryFrom<StreamItemLazy<'a, T>> for StreamItem<T> {
659    type Error = DecodeError;
660
661    fn try_from(other: StreamItemLazy<'a, T>) -> Result<Self, Self::Error> {
662        let cursor = DecodeCursor::at_offset(other.buffer, other.offset);
663        Decode::decode(&cursor)
664    }
665}
666
667impl<'a, T> Copy for StreamItemLazy<'a, T> { }
668
669impl<'a, T> Clone for StreamItemLazy<'a, T> {
670    fn clone(&self) -> Self {
671        Self {
672            buffer: self.buffer,
673            offset: self.offset,
674            _t: core::marker::PhantomData,
675        }
676    }
677}
678
679impl<'a, T> core::fmt::Debug for StreamItemLazy<'a, T> {
680    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
681        f.debug_struct("StreamItemLazy")
682            .finish()
683    }
684}
685
686impl<'a, T: Owned> PartialEq for StreamItemLazy<'a, T> {
687    fn eq(&self, other: &Self) -> bool {
688        self.seq().unwrap() == other.seq().unwrap()
689            && self.payload().unwrap() == other.payload().unwrap()
690    }
691}
692
693#[derive(Copy, Clone, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)]
694pub struct MultiStreamId {
695    pub owner: u64,
696    pub id: u32,
697}
698
699pub struct MultiStreamIdLazy<'a> {
700    buffer: &'a [u8],
701    offset: usize,
702}
703
704pub struct MultiStreamIdGen<> {
705    pub owner: u64,
706    pub id: u32,
707}
708
709impl<> Compatible<MultiStreamId> for MultiStreamIdGen<> { }
710impl<> Compatible<MultiStreamIdGen<>> for MultiStreamId { }
711
712impl<> BaseLen for MultiStreamIdGen<> {
713    const BASE_LEN: usize = 12;
714}
715
716impl<> Encode for MultiStreamIdGen<> {
717    fn scratch_len(&self) -> usize {
718        self.owner.scratch_len() + self.id.scratch_len()
719    }
720
721    fn encode(&self, cursor: &mut EncodeCursor) {
722        self.owner.encode(cursor);
723        self.id.encode(cursor);
724    }
725}
726
727impl Owned for MultiStreamId {
728    type Lazy<'a> = MultiStreamIdLazy<'a>;
729
730    fn lazy_to_owned(lazy: Self::Lazy<'_>) -> DecodeResult<Self> {
731        TryFrom::try_from(lazy)
732    }
733}
734
735impl<'a> Lazy<'a> for MultiStreamIdLazy<'a> {
736    type Owned = MultiStreamId;
737}
738
739impl<'a> Compatible<MultiStreamIdLazy<'a>> for MultiStreamId { }
740impl<'a> Compatible<MultiStreamId> for MultiStreamIdLazy<'a> { }
741
742impl<'a> MultiStreamIdLazy<'a> {
743
744    pub fn owner(&self) -> DecodeResult<u64> {
745        Decode::decode(&DecodeCursor::at_offset(self.buffer, self.offset + 0))
746    }
747
748    pub fn id(&self) -> DecodeResult<u32> {
749        Decode::decode(&DecodeCursor::at_offset(self.buffer, self.offset + 8))
750    }
751}
752
753impl BaseLen for MultiStreamId {
754    const BASE_LEN: usize = 12;
755}
756
757impl Encode for MultiStreamId {
758    fn scratch_len(&self) -> usize {
759        self.owner.scratch_len() + self.id.scratch_len()
760    }
761
762    fn encode(&self, cursor: &mut EncodeCursor) {
763        self.owner.encode(cursor);
764        self.id.encode(cursor);
765    }
766}
767
768impl<'a> Decode<'a> for MultiStreamId {
769    fn decode(cursor: &DecodeCursor<'a>) -> DecodeResult<Self> {
770        let owner = Decode::decode(cursor)?;
771        let id = Decode::decode(cursor)?;
772
773        Ok(MultiStreamId {
774            owner,
775            id,
776        })
777    }
778}
779
780impl<'a> BaseLen for MultiStreamIdLazy<'a> {
781    const BASE_LEN: usize = 12;
782}
783
784impl<'a> Encode for MultiStreamIdLazy<'a> {
785    fn scratch_len(&self) -> usize {
786        let owner: u64 = Decode::decode(&DecodeCursor::at_offset(self.buffer, self.offset + 0)).unwrap();
787        let id: u32 = Decode::decode(&DecodeCursor::at_offset(self.buffer, self.offset + 8)).unwrap();
788        owner.scratch_len() + id.scratch_len()
789    }
790
791    fn encode(&self, cursor: &mut EncodeCursor) {
792        let owner: u64 = Decode::decode(&DecodeCursor::at_offset(self.buffer, self.offset + 0)).unwrap();
793        let id: u32 = Decode::decode(&DecodeCursor::at_offset(self.buffer, self.offset + 8)).unwrap();
794        owner.encode(cursor);
795        id.encode(cursor);
796    }
797}
798
799impl<'a> Decode<'a> for MultiStreamIdLazy<'a> {
800    fn decode(cursor: &DecodeCursor<'a>) -> DecodeResult<Self> {
801        let offset = cursor.offset();
802        cursor.advance(Self::BASE_LEN);
803        Ok(MultiStreamIdLazy {
804            buffer: cursor.buffer(),
805            offset,
806        })
807    }
808}
809
810impl<'a> TryFrom<MultiStreamIdLazy<'a>> for MultiStreamId {
811    type Error = DecodeError;
812
813    fn try_from(other: MultiStreamIdLazy<'a>) -> Result<Self, Self::Error> {
814        let cursor = DecodeCursor::at_offset(other.buffer, other.offset);
815        Decode::decode(&cursor)
816    }
817}
818
819impl<'a> Copy for MultiStreamIdLazy<'a> { }
820
821impl<'a> Clone for MultiStreamIdLazy<'a> {
822    fn clone(&self) -> Self {
823        Self {
824            buffer: self.buffer,
825            offset: self.offset,
826        }
827    }
828}
829
830impl<'a> core::fmt::Debug for MultiStreamIdLazy<'a> {
831    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
832        f.debug_struct("MultiStreamIdLazy")
833            .finish()
834    }
835}
836
837impl<'a> PartialEq for MultiStreamIdLazy<'a> {
838    fn eq(&self, other: &Self) -> bool {
839        self.owner().unwrap() == other.owner().unwrap()
840            && self.id().unwrap() == other.id().unwrap()
841    }
842}
843
844#[derive(Copy, Clone, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)]
845pub struct MultiStreamItem<T> {
846    pub stream_id: MultiStreamId,
847    pub seq: u64,
848    pub payload: Option<T>,
849}
850
851pub struct MultiStreamItemLazy<'a, T> {
852    buffer: &'a [u8],
853    offset: usize,
854    _t: core::marker::PhantomData<T>,
855}
856
857pub struct MultiStreamItemGen<
858    StreamId: Encode + Compatible<MultiStreamId>,
859    Payload: Encode,
860> {
861    pub stream_id: StreamId,
862    pub seq: u64,
863    pub payload: Payload,
864}
865
866impl<
867    T: Owned,
868    StreamId: Encode + Compatible<MultiStreamId>,
869    Payload: Encode + Compatible<Option<T>>
870> Compatible<MultiStreamItem<T>> for MultiStreamItemGen<StreamId, Payload> { }
871impl<
872    T: Owned,
873    StreamId: Encode + Compatible<MultiStreamId>,
874    Payload: Encode + Compatible<Option<T>>
875> Compatible<MultiStreamItemGen<StreamId, Payload>> for MultiStreamItem<T> { }
876
877impl<
878    StreamId: Encode + Compatible<MultiStreamId>,
879    Payload: Encode,
880> BaseLen for MultiStreamItemGen<StreamId, Payload> {
881    const BASE_LEN: usize = 8 + StreamId::BASE_LEN + Payload::BASE_LEN;
882}
883
884impl<
885    StreamId: Encode + Compatible<MultiStreamId>,
886    Payload: Encode,
887> Encode for MultiStreamItemGen<StreamId, Payload> {
888    fn scratch_len(&self) -> usize {
889        self.stream_id.scratch_len() + self.seq.scratch_len() + self.payload.scratch_len()
890    }
891
892    fn encode(&self, cursor: &mut EncodeCursor) {
893        self.stream_id.encode(cursor);
894        self.seq.encode(cursor);
895        self.payload.encode(cursor);
896    }
897}
898
899impl<T: Owned> Owned for MultiStreamItem<T> {
900    type Lazy<'a> = MultiStreamItemLazy<'a, T>;
901
902    fn lazy_to_owned(lazy: Self::Lazy<'_>) -> DecodeResult<Self> {
903        TryFrom::try_from(lazy)
904    }
905}
906
907impl<'a, T: Owned> Lazy<'a> for MultiStreamItemLazy<'a, T> {
908    type Owned = MultiStreamItem<T>;
909}
910
911impl<'a, T: Owned> Compatible<MultiStreamItemLazy<'a, T>> for MultiStreamItem<T> { }
912impl<'a, T: Owned> Compatible<MultiStreamItem<T>> for MultiStreamItemLazy<'a, T> { }
913
914impl<'a, T: Owned> MultiStreamItemLazy<'a, T> {
915
916    pub fn stream_id(&self) -> DecodeResult<MultiStreamIdLazy<'a>> {
917        Decode::decode(&DecodeCursor::at_offset(self.buffer, self.offset + 0))
918    }
919
920    pub fn seq(&self) -> DecodeResult<u64> {
921        Decode::decode(&DecodeCursor::at_offset(self.buffer, self.offset + 12))
922    }
923
924    pub fn payload(&self) -> DecodeResult<Option<T::Lazy<'a>>> {
925        Decode::decode(&DecodeCursor::at_offset(self.buffer, self.offset + 20))
926    }
927}
928
929impl<T: BaseLen> BaseLen for MultiStreamItem<T> {
930    const BASE_LEN: usize = 21 + T::BASE_LEN;
931}
932
933impl<T: Encode> Encode for MultiStreamItem<T> {
934    fn scratch_len(&self) -> usize {
935        self.stream_id.scratch_len() + self.seq.scratch_len() + self.payload.scratch_len()
936    }
937
938    fn encode(&self, cursor: &mut EncodeCursor) {
939        self.stream_id.encode(cursor);
940        self.seq.encode(cursor);
941        self.payload.encode(cursor);
942    }
943}
944
945impl<'a, T: Decode<'a>> Decode<'a> for MultiStreamItem<T> {
946    fn decode(cursor: &DecodeCursor<'a>) -> DecodeResult<Self> {
947        let stream_id = Decode::decode(cursor)?;
948        let seq = Decode::decode(cursor)?;
949        let payload = Decode::decode(cursor)?;
950
951        Ok(MultiStreamItem {
952            stream_id,
953            seq,
954            payload,
955        })
956    }
957}
958
959impl<'a, T: Owned> BaseLen for MultiStreamItemLazy<'a, T> {
960    const BASE_LEN: usize = 21 + T::BASE_LEN;
961}
962
963impl<'a, T: Owned> Encode for MultiStreamItemLazy<'a, T> {
964    fn scratch_len(&self) -> usize {
965        let stream_id: MultiStreamIdLazy<'a> = Decode::decode(&DecodeCursor::at_offset(self.buffer, self.offset + 0)).unwrap();
966        let seq: u64 = Decode::decode(&DecodeCursor::at_offset(self.buffer, self.offset + 12)).unwrap();
967        let payload: Option<T::Lazy<'a>> = Decode::decode(&DecodeCursor::at_offset(self.buffer, self.offset + 20)).unwrap();
968        stream_id.scratch_len() + seq.scratch_len() + payload.scratch_len()
969    }
970
971    fn encode(&self, cursor: &mut EncodeCursor) {
972        let stream_id: MultiStreamIdLazy<'a> = Decode::decode(&DecodeCursor::at_offset(self.buffer, self.offset + 0)).unwrap();
973        let seq: u64 = Decode::decode(&DecodeCursor::at_offset(self.buffer, self.offset + 12)).unwrap();
974        let payload: Option<T::Lazy<'a>> = Decode::decode(&DecodeCursor::at_offset(self.buffer, self.offset + 20)).unwrap();
975        stream_id.encode(cursor);
976        seq.encode(cursor);
977        payload.encode(cursor);
978    }
979}
980
981impl<'a, T: Owned> Decode<'a> for MultiStreamItemLazy<'a, T> {
982    fn decode(cursor: &DecodeCursor<'a>) -> DecodeResult<Self> {
983        let offset = cursor.offset();
984        cursor.advance(Self::BASE_LEN);
985        Ok(MultiStreamItemLazy {
986            buffer: cursor.buffer(),
987            offset,
988            _t: core::marker::PhantomData,
989        })
990    }
991}
992
993impl<'a, T: Owned> TryFrom<MultiStreamItemLazy<'a, T>> for MultiStreamItem<T> {
994    type Error = DecodeError;
995
996    fn try_from(other: MultiStreamItemLazy<'a, T>) -> Result<Self, Self::Error> {
997        let cursor = DecodeCursor::at_offset(other.buffer, other.offset);
998        Decode::decode(&cursor)
999    }
1000}
1001
1002impl<'a, T> Copy for MultiStreamItemLazy<'a, T> { }
1003
1004impl<'a, T> Clone for MultiStreamItemLazy<'a, T> {
1005    fn clone(&self) -> Self {
1006        Self {
1007            buffer: self.buffer,
1008            offset: self.offset,
1009            _t: core::marker::PhantomData,
1010        }
1011    }
1012}
1013
1014impl<'a, T> core::fmt::Debug for MultiStreamItemLazy<'a, T> {
1015    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
1016        f.debug_struct("MultiStreamItemLazy")
1017            .finish()
1018    }
1019}
1020
1021impl<'a, T: Owned> PartialEq for MultiStreamItemLazy<'a, T> {
1022    fn eq(&self, other: &Self) -> bool {
1023        self.stream_id().unwrap() == other.stream_id().unwrap()
1024            && self.seq().unwrap() == other.seq().unwrap()&& self.payload().unwrap() == other.payload().unwrap()
1025    }
1026}
1027
1028#[derive(Copy, Clone, Debug, PartialEq, PartialOrd, Eq, Ord, Hash)]
1029pub struct PropertyInitState<T> {
1030    pub value: T,
1031}
1032
1033pub struct PropertyInitStateLazy<'a, T> {
1034    buffer: &'a [u8],
1035    offset: usize,
1036    _t: core::marker::PhantomData<T>,
1037}
1038
1039pub struct PropertyInitStateGen<
1040    Value: Encode,
1041> {
1042    pub value: Value,
1043}
1044
1045impl<
1046    T: Owned,
1047    Value: Encode + Compatible<T>
1048> Compatible<PropertyInitState<T>> for PropertyInitStateGen<Value> { }
1049impl<
1050    T: Owned,
1051    Value: Encode + Compatible<T>
1052> Compatible<PropertyInitStateGen<Value>> for PropertyInitState<T> { }
1053
1054impl<
1055    Value: Encode,
1056> BaseLen for PropertyInitStateGen<Value> {
1057    const BASE_LEN: usize = Value::BASE_LEN;
1058}
1059
1060impl<
1061    Value: Encode,
1062> Encode for PropertyInitStateGen<Value> {
1063    fn scratch_len(&self) -> usize {
1064        self.value.scratch_len()
1065    }
1066
1067    fn encode(&self, cursor: &mut EncodeCursor) {
1068        self.value.encode(cursor);
1069    }
1070}
1071
1072impl<T: Owned> Owned for PropertyInitState<T> {
1073    type Lazy<'a> = PropertyInitStateLazy<'a, T>;
1074
1075    fn lazy_to_owned(lazy: Self::Lazy<'_>) -> DecodeResult<Self> {
1076        TryFrom::try_from(lazy)
1077    }
1078}
1079
1080impl<'a, T: Owned> Lazy<'a> for PropertyInitStateLazy<'a, T> {
1081    type Owned = PropertyInitState<T>;
1082}
1083
1084impl<'a, T: Owned> Compatible<PropertyInitStateLazy<'a, T>> for PropertyInitState<T> { }
1085impl<'a, T: Owned> Compatible<PropertyInitState<T>> for PropertyInitStateLazy<'a, T> { }
1086
1087impl<'a, T: Owned> PropertyInitStateLazy<'a, T> {
1088
1089    pub fn value(&self) -> DecodeResult<T::Lazy<'a>> {
1090        Decode::decode(&DecodeCursor::at_offset(self.buffer, self.offset + 0))
1091    }
1092}
1093
1094impl<T: BaseLen> BaseLen for PropertyInitState<T> {
1095    const BASE_LEN: usize = T::BASE_LEN;
1096}
1097
1098impl<T: Encode> Encode for PropertyInitState<T> {
1099    fn scratch_len(&self) -> usize {
1100        self.value.scratch_len()
1101    }
1102
1103    fn encode(&self, cursor: &mut EncodeCursor) {
1104        self.value.encode(cursor);
1105    }
1106}
1107
1108impl<'a, T: Decode<'a>> Decode<'a> for PropertyInitState<T> {
1109    fn decode(cursor: &DecodeCursor<'a>) -> DecodeResult<Self> {
1110        let value = Decode::decode(cursor)?;
1111
1112        Ok(PropertyInitState {
1113            value,
1114        })
1115    }
1116}
1117
1118impl<'a, T: Owned> BaseLen for PropertyInitStateLazy<'a, T> {
1119    const BASE_LEN: usize = T::BASE_LEN;
1120}
1121
1122impl<'a, T: Owned> Encode for PropertyInitStateLazy<'a, T> {
1123    fn scratch_len(&self) -> usize {
1124        let value: T::Lazy<'a> = Decode::decode(&DecodeCursor::at_offset(self.buffer, self.offset + 0)).unwrap();
1125        value.scratch_len()
1126    }
1127
1128    fn encode(&self, cursor: &mut EncodeCursor) {
1129        let value: T::Lazy<'a> = Decode::decode(&DecodeCursor::at_offset(self.buffer, self.offset + 0)).unwrap();
1130        value.encode(cursor);
1131    }
1132}
1133
1134impl<'a, T: Owned> Decode<'a> for PropertyInitStateLazy<'a, T> {
1135    fn decode(cursor: &DecodeCursor<'a>) -> DecodeResult<Self> {
1136        let offset = cursor.offset();
1137        cursor.advance(Self::BASE_LEN);
1138        Ok(PropertyInitStateLazy {
1139            buffer: cursor.buffer(),
1140            offset,
1141            _t: core::marker::PhantomData,
1142        })
1143    }
1144}
1145
1146impl<'a, T: Owned> TryFrom<PropertyInitStateLazy<'a, T>> for PropertyInitState<T> {
1147    type Error = DecodeError;
1148
1149    fn try_from(other: PropertyInitStateLazy<'a, T>) -> Result<Self, Self::Error> {
1150        let cursor = DecodeCursor::at_offset(other.buffer, other.offset);
1151        Decode::decode(&cursor)
1152    }
1153}
1154
1155impl<'a, T> Copy for PropertyInitStateLazy<'a, T> { }
1156
1157impl<'a, T> Clone for PropertyInitStateLazy<'a, T> {
1158    fn clone(&self) -> Self {
1159        Self {
1160            buffer: self.buffer,
1161            offset: self.offset,
1162            _t: core::marker::PhantomData,
1163        }
1164    }
1165}
1166
1167impl<'a, T> core::fmt::Debug for PropertyInitStateLazy<'a, T> {
1168    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
1169        f.debug_struct("PropertyInitStateLazy")
1170            .finish()
1171    }
1172}
1173
1174impl<'a, T: Owned> PartialEq for PropertyInitStateLazy<'a, T> {
1175    fn eq(&self, other: &Self) -> bool {
1176        self.value().unwrap() == other.value().unwrap()
1177    }
1178}
1179
1180#[derive(Copy, Clone, Debug, PartialEq, PartialOrd, Eq, Ord, Hash, Default)]
1181pub struct PropertyObserverConfig {}
1182
1183pub struct PropertyObserverConfigLazy<'a> {
1184    buffer: &'a [u8],
1185    offset: usize,
1186}
1187
1188pub struct PropertyObserverConfigGen<> {}
1189
1190impl<> Compatible<PropertyObserverConfig> for PropertyObserverConfigGen<> { }
1191impl<> Compatible<PropertyObserverConfigGen<>> for PropertyObserverConfig { }
1192
1193impl<> BaseLen for PropertyObserverConfigGen<> {
1194    const BASE_LEN: usize = 0;
1195}
1196
1197impl<> Encode for PropertyObserverConfigGen<> {
1198    fn scratch_len(&self) -> usize {
1199        0
1200    }
1201
1202    fn encode(&self, _: &mut EncodeCursor) {}
1203}
1204
1205impl Owned for PropertyObserverConfig {
1206    type Lazy<'a> = PropertyObserverConfigLazy<'a>;
1207
1208    fn lazy_to_owned(lazy: Self::Lazy<'_>) -> DecodeResult<Self> {
1209        TryFrom::try_from(lazy)
1210    }
1211}
1212
1213impl<'a> Lazy<'a> for PropertyObserverConfigLazy<'a> {
1214    type Owned = PropertyObserverConfig;
1215}
1216
1217impl<'a> Compatible<PropertyObserverConfigLazy<'a>> for PropertyObserverConfig { }
1218impl<'a> Compatible<PropertyObserverConfig> for PropertyObserverConfigLazy<'a> { }
1219
1220impl<'a> PropertyObserverConfigLazy<'a> {}
1221
1222impl BaseLen for PropertyObserverConfig {
1223    const BASE_LEN: usize = 0;
1224}
1225
1226impl Encode for PropertyObserverConfig {
1227    fn scratch_len(&self) -> usize {
1228        0
1229    }
1230
1231    fn encode(&self, _: &mut EncodeCursor) {}
1232}
1233
1234impl<'a> Decode<'a> for PropertyObserverConfig {
1235    fn decode(_: &DecodeCursor<'a>) -> DecodeResult<Self> {
1236
1237        Ok(PropertyObserverConfig {})
1238    }
1239}
1240
1241impl<'a> BaseLen for PropertyObserverConfigLazy<'a> {
1242    const BASE_LEN: usize = 0;
1243}
1244
1245impl<'a> Encode for PropertyObserverConfigLazy<'a> {
1246    fn scratch_len(&self) -> usize {
1247        0
1248    }
1249
1250    fn encode(&self, _: &mut EncodeCursor) {}
1251}
1252
1253impl<'a> Decode<'a> for PropertyObserverConfigLazy<'a> {
1254    fn decode(cursor: &DecodeCursor<'a>) -> DecodeResult<Self> {
1255        let offset = cursor.offset();
1256        cursor.advance(Self::BASE_LEN);
1257        Ok(PropertyObserverConfigLazy {
1258            buffer: cursor.buffer(),
1259            offset,
1260        })
1261    }
1262}
1263
1264impl<'a> TryFrom<PropertyObserverConfigLazy<'a>> for PropertyObserverConfig {
1265    type Error = DecodeError;
1266
1267    fn try_from(other: PropertyObserverConfigLazy<'a>) -> Result<Self, Self::Error> {
1268        let cursor = DecodeCursor::at_offset(other.buffer, other.offset);
1269        Decode::decode(&cursor)
1270    }
1271}
1272
1273impl<'a> Copy for PropertyObserverConfigLazy<'a> { }
1274
1275impl<'a> Clone for PropertyObserverConfigLazy<'a> {
1276    fn clone(&self) -> Self {
1277        Self {
1278            buffer: self.buffer,
1279            offset: self.offset,
1280        }
1281    }
1282}
1283
1284impl<'a> core::fmt::Debug for PropertyObserverConfigLazy<'a> {
1285    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
1286        f.debug_struct("PropertyObserverConfigLazy")
1287            .finish()
1288    }
1289}
1290
1291impl<'a> PartialEq for PropertyObserverConfigLazy<'a> {
1292    fn eq(&self, _: &Self) -> bool {
1293        true
1294    }
1295}
1296
1297#[derive(Copy, Clone, Debug, PartialEq, PartialOrd, Eq, Ord, Hash, Default)]
1298pub struct PropertyOwnerConfig {}
1299
1300pub struct PropertyOwnerConfigLazy<'a> {
1301    buffer: &'a [u8],
1302    offset: usize,
1303}
1304
1305pub struct PropertyOwnerConfigGen<> {}
1306
1307impl<> Compatible<PropertyOwnerConfig> for PropertyOwnerConfigGen<> { }
1308impl<> Compatible<PropertyOwnerConfigGen<>> for PropertyOwnerConfig { }
1309
1310impl<> BaseLen for PropertyOwnerConfigGen<> {
1311    const BASE_LEN: usize = 0;
1312}
1313
1314impl<> Encode for PropertyOwnerConfigGen<> {
1315    fn scratch_len(&self) -> usize {
1316        0
1317    }
1318
1319    fn encode(&self, _: &mut EncodeCursor) {}
1320}
1321
1322impl Owned for PropertyOwnerConfig {
1323    type Lazy<'a> = PropertyOwnerConfigLazy<'a>;
1324
1325    fn lazy_to_owned(lazy: Self::Lazy<'_>) -> DecodeResult<Self> {
1326        TryFrom::try_from(lazy)
1327    }
1328}
1329
1330impl<'a> Lazy<'a> for PropertyOwnerConfigLazy<'a> {
1331    type Owned = PropertyOwnerConfig;
1332}
1333
1334impl<'a> Compatible<PropertyOwnerConfigLazy<'a>> for PropertyOwnerConfig { }
1335impl<'a> Compatible<PropertyOwnerConfig> for PropertyOwnerConfigLazy<'a> { }
1336
1337impl<'a> PropertyOwnerConfigLazy<'a> {}
1338
1339impl BaseLen for PropertyOwnerConfig {
1340    const BASE_LEN: usize = 0;
1341}
1342
1343impl Encode for PropertyOwnerConfig {
1344    fn scratch_len(&self) -> usize {
1345        0
1346    }
1347
1348    fn encode(&self, _: &mut EncodeCursor) {}
1349}
1350
1351impl<'a> Decode<'a> for PropertyOwnerConfig {
1352    fn decode(_: &DecodeCursor<'a>) -> DecodeResult<Self> {
1353
1354        Ok(PropertyOwnerConfig {})
1355    }
1356}
1357
1358impl<'a> BaseLen for PropertyOwnerConfigLazy<'a> {
1359    const BASE_LEN: usize = 0;
1360}
1361
1362impl<'a> Encode for PropertyOwnerConfigLazy<'a> {
1363    fn scratch_len(&self) -> usize {
1364        0
1365    }
1366
1367    fn encode(&self, _: &mut EncodeCursor) {}
1368}
1369
1370impl<'a> Decode<'a> for PropertyOwnerConfigLazy<'a> {
1371    fn decode(cursor: &DecodeCursor<'a>) -> DecodeResult<Self> {
1372        let offset = cursor.offset();
1373        cursor.advance(Self::BASE_LEN);
1374        Ok(PropertyOwnerConfigLazy {
1375            buffer: cursor.buffer(),
1376            offset,
1377        })
1378    }
1379}
1380
1381impl<'a> TryFrom<PropertyOwnerConfigLazy<'a>> for PropertyOwnerConfig {
1382    type Error = DecodeError;
1383
1384    fn try_from(other: PropertyOwnerConfigLazy<'a>) -> Result<Self, Self::Error> {
1385        let cursor = DecodeCursor::at_offset(other.buffer, other.offset);
1386        Decode::decode(&cursor)
1387    }
1388}
1389
1390impl<'a> Copy for PropertyOwnerConfigLazy<'a> { }
1391
1392impl<'a> Clone for PropertyOwnerConfigLazy<'a> {
1393    fn clone(&self) -> Self {
1394        Self {
1395            buffer: self.buffer,
1396            offset: self.offset,
1397        }
1398    }
1399}
1400
1401impl<'a> core::fmt::Debug for PropertyOwnerConfigLazy<'a> {
1402    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
1403        f.debug_struct("PropertyOwnerConfigLazy")
1404            .finish()
1405    }
1406}
1407
1408impl<'a> PartialEq for PropertyOwnerConfigLazy<'a> {
1409    fn eq(&self, _: &Self) -> bool {
1410        true
1411    }
1412}
1413
1414#[derive(Copy, Clone, Debug, PartialEq, PartialOrd, Eq, Ord, Hash, Default)]
1415pub struct RequestInitState {}
1416
1417pub struct RequestInitStateLazy<'a> {
1418    buffer: &'a [u8],
1419    offset: usize,
1420}
1421
1422pub struct RequestInitStateGen<> {}
1423
1424impl<> Compatible<RequestInitState> for RequestInitStateGen<> { }
1425impl<> Compatible<RequestInitStateGen<>> for RequestInitState { }
1426
1427impl<> BaseLen for RequestInitStateGen<> {
1428    const BASE_LEN: usize = 0;
1429}
1430
1431impl<> Encode for RequestInitStateGen<> {
1432    fn scratch_len(&self) -> usize {
1433        0
1434    }
1435
1436    fn encode(&self, _: &mut EncodeCursor) {}
1437}
1438
1439impl Owned for RequestInitState {
1440    type Lazy<'a> = RequestInitStateLazy<'a>;
1441
1442    fn lazy_to_owned(lazy: Self::Lazy<'_>) -> DecodeResult<Self> {
1443        TryFrom::try_from(lazy)
1444    }
1445}
1446
1447impl<'a> Lazy<'a> for RequestInitStateLazy<'a> {
1448    type Owned = RequestInitState;
1449}
1450
1451impl<'a> Compatible<RequestInitStateLazy<'a>> for RequestInitState { }
1452impl<'a> Compatible<RequestInitState> for RequestInitStateLazy<'a> { }
1453
1454impl<'a> RequestInitStateLazy<'a> {}
1455
1456impl BaseLen for RequestInitState {
1457    const BASE_LEN: usize = 0;
1458}
1459
1460impl Encode for RequestInitState {
1461    fn scratch_len(&self) -> usize {
1462        0
1463    }
1464
1465    fn encode(&self, _: &mut EncodeCursor) {}
1466}
1467
1468impl<'a> Decode<'a> for RequestInitState {
1469    fn decode(_: &DecodeCursor<'a>) -> DecodeResult<Self> {
1470
1471        Ok(RequestInitState {})
1472    }
1473}
1474
1475impl<'a> BaseLen for RequestInitStateLazy<'a> {
1476    const BASE_LEN: usize = 0;
1477}
1478
1479impl<'a> Encode for RequestInitStateLazy<'a> {
1480    fn scratch_len(&self) -> usize {
1481        0
1482    }
1483
1484    fn encode(&self, _: &mut EncodeCursor) {}
1485}
1486
1487impl<'a> Decode<'a> for RequestInitStateLazy<'a> {
1488    fn decode(cursor: &DecodeCursor<'a>) -> DecodeResult<Self> {
1489        let offset = cursor.offset();
1490        cursor.advance(Self::BASE_LEN);
1491        Ok(RequestInitStateLazy {
1492            buffer: cursor.buffer(),
1493            offset,
1494        })
1495    }
1496}
1497
1498impl<'a> TryFrom<RequestInitStateLazy<'a>> for RequestInitState {
1499    type Error = DecodeError;
1500
1501    fn try_from(other: RequestInitStateLazy<'a>) -> Result<Self, Self::Error> {
1502        let cursor = DecodeCursor::at_offset(other.buffer, other.offset);
1503        Decode::decode(&cursor)
1504    }
1505}
1506
1507impl<'a> Copy for RequestInitStateLazy<'a> { }
1508
1509impl<'a> Clone for RequestInitStateLazy<'a> {
1510    fn clone(&self) -> Self {
1511        Self {
1512            buffer: self.buffer,
1513            offset: self.offset,
1514        }
1515    }
1516}
1517
1518impl<'a> core::fmt::Debug for RequestInitStateLazy<'a> {
1519    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
1520        f.debug_struct("RequestInitStateLazy")
1521            .finish()
1522    }
1523}
1524
1525impl<'a> PartialEq for RequestInitStateLazy<'a> {
1526    fn eq(&self, _: &Self) -> bool {
1527        true
1528    }
1529}
1530
1531#[derive(Copy, Clone, Debug, PartialEq, PartialOrd, Eq, Ord, Hash, Default)]
1532pub struct RequestClientConfig {}
1533
1534pub struct RequestClientConfigLazy<'a> {
1535    buffer: &'a [u8],
1536    offset: usize,
1537}
1538
1539pub struct RequestClientConfigGen<> {}
1540
1541impl<> Compatible<RequestClientConfig> for RequestClientConfigGen<> { }
1542impl<> Compatible<RequestClientConfigGen<>> for RequestClientConfig { }
1543
1544impl<> BaseLen for RequestClientConfigGen<> {
1545    const BASE_LEN: usize = 0;
1546}
1547
1548impl<> Encode for RequestClientConfigGen<> {
1549    fn scratch_len(&self) -> usize {
1550        0
1551    }
1552
1553    fn encode(&self, _: &mut EncodeCursor) {}
1554}
1555
1556impl Owned for RequestClientConfig {
1557    type Lazy<'a> = RequestClientConfigLazy<'a>;
1558
1559    fn lazy_to_owned(lazy: Self::Lazy<'_>) -> DecodeResult<Self> {
1560        TryFrom::try_from(lazy)
1561    }
1562}
1563
1564impl<'a> Lazy<'a> for RequestClientConfigLazy<'a> {
1565    type Owned = RequestClientConfig;
1566}
1567
1568impl<'a> Compatible<RequestClientConfigLazy<'a>> for RequestClientConfig { }
1569impl<'a> Compatible<RequestClientConfig> for RequestClientConfigLazy<'a> { }
1570
1571impl<'a> RequestClientConfigLazy<'a> {}
1572
1573impl BaseLen for RequestClientConfig {
1574    const BASE_LEN: usize = 0;
1575}
1576
1577impl Encode for RequestClientConfig {
1578    fn scratch_len(&self) -> usize {
1579        0
1580    }
1581
1582    fn encode(&self, _: &mut EncodeCursor) {}
1583}
1584
1585impl<'a> Decode<'a> for RequestClientConfig {
1586    fn decode(_: &DecodeCursor<'a>) -> DecodeResult<Self> {
1587
1588        Ok(RequestClientConfig {})
1589    }
1590}
1591
1592impl<'a> BaseLen for RequestClientConfigLazy<'a> {
1593    const BASE_LEN: usize = 0;
1594}
1595
1596impl<'a> Encode for RequestClientConfigLazy<'a> {
1597    fn scratch_len(&self) -> usize {
1598        0
1599    }
1600
1601    fn encode(&self, _: &mut EncodeCursor) {}
1602}
1603
1604impl<'a> Decode<'a> for RequestClientConfigLazy<'a> {
1605    fn decode(cursor: &DecodeCursor<'a>) -> DecodeResult<Self> {
1606        let offset = cursor.offset();
1607        cursor.advance(Self::BASE_LEN);
1608        Ok(RequestClientConfigLazy {
1609            buffer: cursor.buffer(),
1610            offset,
1611        })
1612    }
1613}
1614
1615impl<'a> TryFrom<RequestClientConfigLazy<'a>> for RequestClientConfig {
1616    type Error = DecodeError;
1617
1618    fn try_from(other: RequestClientConfigLazy<'a>) -> Result<Self, Self::Error> {
1619        let cursor = DecodeCursor::at_offset(other.buffer, other.offset);
1620        Decode::decode(&cursor)
1621    }
1622}
1623
1624impl<'a> Copy for RequestClientConfigLazy<'a> { }
1625
1626impl<'a> Clone for RequestClientConfigLazy<'a> {
1627    fn clone(&self) -> Self {
1628        Self {
1629            buffer: self.buffer,
1630            offset: self.offset,
1631        }
1632    }
1633}
1634
1635impl<'a> core::fmt::Debug for RequestClientConfigLazy<'a> {
1636    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
1637        f.debug_struct("RequestClientConfigLazy")
1638            .finish()
1639    }
1640}
1641
1642impl<'a> PartialEq for RequestClientConfigLazy<'a> {
1643    fn eq(&self, _: &Self) -> bool {
1644        true
1645    }
1646}
1647
1648#[derive(Copy, Clone, Debug, PartialEq, PartialOrd, Eq, Ord, Hash, Default)]
1649pub struct RequestServerConfig {}
1650
1651pub struct RequestServerConfigLazy<'a> {
1652    buffer: &'a [u8],
1653    offset: usize,
1654}
1655
1656pub struct RequestServerConfigGen<> {}
1657
1658impl<> Compatible<RequestServerConfig> for RequestServerConfigGen<> { }
1659impl<> Compatible<RequestServerConfigGen<>> for RequestServerConfig { }
1660
1661impl<> BaseLen for RequestServerConfigGen<> {
1662    const BASE_LEN: usize = 0;
1663}
1664
1665impl<> Encode for RequestServerConfigGen<> {
1666    fn scratch_len(&self) -> usize {
1667        0
1668    }
1669
1670    fn encode(&self, _: &mut EncodeCursor) {}
1671}
1672
1673impl Owned for RequestServerConfig {
1674    type Lazy<'a> = RequestServerConfigLazy<'a>;
1675
1676    fn lazy_to_owned(lazy: Self::Lazy<'_>) -> DecodeResult<Self> {
1677        TryFrom::try_from(lazy)
1678    }
1679}
1680
1681impl<'a> Lazy<'a> for RequestServerConfigLazy<'a> {
1682    type Owned = RequestServerConfig;
1683}
1684
1685impl<'a> Compatible<RequestServerConfigLazy<'a>> for RequestServerConfig { }
1686impl<'a> Compatible<RequestServerConfig> for RequestServerConfigLazy<'a> { }
1687
1688impl<'a> RequestServerConfigLazy<'a> {}
1689
1690impl BaseLen for RequestServerConfig {
1691    const BASE_LEN: usize = 0;
1692}
1693
1694impl Encode for RequestServerConfig {
1695    fn scratch_len(&self) -> usize {
1696        0
1697    }
1698
1699    fn encode(&self, _: &mut EncodeCursor) {}
1700}
1701
1702impl<'a> Decode<'a> for RequestServerConfig {
1703    fn decode(_: &DecodeCursor<'a>) -> DecodeResult<Self> {
1704
1705        Ok(RequestServerConfig {})
1706    }
1707}
1708
1709impl<'a> BaseLen for RequestServerConfigLazy<'a> {
1710    const BASE_LEN: usize = 0;
1711}
1712
1713impl<'a> Encode for RequestServerConfigLazy<'a> {
1714    fn scratch_len(&self) -> usize {
1715        0
1716    }
1717
1718    fn encode(&self, _: &mut EncodeCursor) {}
1719}
1720
1721impl<'a> Decode<'a> for RequestServerConfigLazy<'a> {
1722    fn decode(cursor: &DecodeCursor<'a>) -> DecodeResult<Self> {
1723        let offset = cursor.offset();
1724        cursor.advance(Self::BASE_LEN);
1725        Ok(RequestServerConfigLazy {
1726            buffer: cursor.buffer(),
1727            offset,
1728        })
1729    }
1730}
1731
1732impl<'a> TryFrom<RequestServerConfigLazy<'a>> for RequestServerConfig {
1733    type Error = DecodeError;
1734
1735    fn try_from(other: RequestServerConfigLazy<'a>) -> Result<Self, Self::Error> {
1736        let cursor = DecodeCursor::at_offset(other.buffer, other.offset);
1737        Decode::decode(&cursor)
1738    }
1739}
1740
1741impl<'a> Copy for RequestServerConfigLazy<'a> { }
1742
1743impl<'a> Clone for RequestServerConfigLazy<'a> {
1744    fn clone(&self) -> Self {
1745        Self {
1746            buffer: self.buffer,
1747            offset: self.offset,
1748        }
1749    }
1750}
1751
1752impl<'a> core::fmt::Debug for RequestServerConfigLazy<'a> {
1753    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
1754        f.debug_struct("RequestServerConfigLazy")
1755            .finish()
1756    }
1757}
1758
1759impl<'a> PartialEq for RequestServerConfigLazy<'a> {
1760    fn eq(&self, _: &Self) -> bool {
1761        true
1762    }
1763}
1764
1765#[derive(Copy, Clone, Debug, PartialEq, PartialOrd, Eq, Ord, Hash, Default)]
1766pub struct StreamInitState {}
1767
1768pub struct StreamInitStateLazy<'a> {
1769    buffer: &'a [u8],
1770    offset: usize,
1771}
1772
1773pub struct StreamInitStateGen<> {}
1774
1775impl<> Compatible<StreamInitState> for StreamInitStateGen<> { }
1776impl<> Compatible<StreamInitStateGen<>> for StreamInitState { }
1777
1778impl<> BaseLen for StreamInitStateGen<> {
1779    const BASE_LEN: usize = 0;
1780}
1781
1782impl<> Encode for StreamInitStateGen<> {
1783    fn scratch_len(&self) -> usize {
1784        0
1785    }
1786
1787    fn encode(&self, _: &mut EncodeCursor) {}
1788}
1789
1790impl Owned for StreamInitState {
1791    type Lazy<'a> = StreamInitStateLazy<'a>;
1792
1793    fn lazy_to_owned(lazy: Self::Lazy<'_>) -> DecodeResult<Self> {
1794        TryFrom::try_from(lazy)
1795    }
1796}
1797
1798impl<'a> Lazy<'a> for StreamInitStateLazy<'a> {
1799    type Owned = StreamInitState;
1800}
1801
1802impl<'a> Compatible<StreamInitStateLazy<'a>> for StreamInitState { }
1803impl<'a> Compatible<StreamInitState> for StreamInitStateLazy<'a> { }
1804
1805impl<'a> StreamInitStateLazy<'a> {}
1806
1807impl BaseLen for StreamInitState {
1808    const BASE_LEN: usize = 0;
1809}
1810
1811impl Encode for StreamInitState {
1812    fn scratch_len(&self) -> usize {
1813        0
1814    }
1815
1816    fn encode(&self, _: &mut EncodeCursor) {}
1817}
1818
1819impl<'a> Decode<'a> for StreamInitState {
1820    fn decode(_: &DecodeCursor<'a>) -> DecodeResult<Self> {
1821
1822        Ok(StreamInitState {})
1823    }
1824}
1825
1826impl<'a> BaseLen for StreamInitStateLazy<'a> {
1827    const BASE_LEN: usize = 0;
1828}
1829
1830impl<'a> Encode for StreamInitStateLazy<'a> {
1831    fn scratch_len(&self) -> usize {
1832        0
1833    }
1834
1835    fn encode(&self, _: &mut EncodeCursor) {}
1836}
1837
1838impl<'a> Decode<'a> for StreamInitStateLazy<'a> {
1839    fn decode(cursor: &DecodeCursor<'a>) -> DecodeResult<Self> {
1840        let offset = cursor.offset();
1841        cursor.advance(Self::BASE_LEN);
1842        Ok(StreamInitStateLazy {
1843            buffer: cursor.buffer(),
1844            offset,
1845        })
1846    }
1847}
1848
1849impl<'a> TryFrom<StreamInitStateLazy<'a>> for StreamInitState {
1850    type Error = DecodeError;
1851
1852    fn try_from(other: StreamInitStateLazy<'a>) -> Result<Self, Self::Error> {
1853        let cursor = DecodeCursor::at_offset(other.buffer, other.offset);
1854        Decode::decode(&cursor)
1855    }
1856}
1857
1858impl<'a> Copy for StreamInitStateLazy<'a> { }
1859
1860impl<'a> Clone for StreamInitStateLazy<'a> {
1861    fn clone(&self) -> Self {
1862        Self {
1863            buffer: self.buffer,
1864            offset: self.offset,
1865        }
1866    }
1867}
1868
1869impl<'a> core::fmt::Debug for StreamInitStateLazy<'a> {
1870    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
1871        f.debug_struct("StreamInitStateLazy")
1872            .finish()
1873    }
1874}
1875
1876impl<'a> PartialEq for StreamInitStateLazy<'a> {
1877    fn eq(&self, _: &Self) -> bool {
1878        true
1879    }
1880}
1881
1882#[derive(Copy, Clone, Debug, PartialEq, PartialOrd, Eq, Ord, Hash, Default)]
1883pub struct StreamReceiverConfig {}
1884
1885pub struct StreamReceiverConfigLazy<'a> {
1886    buffer: &'a [u8],
1887    offset: usize,
1888}
1889
1890pub struct StreamReceiverConfigGen<> {}
1891
1892impl<> Compatible<StreamReceiverConfig> for StreamReceiverConfigGen<> { }
1893impl<> Compatible<StreamReceiverConfigGen<>> for StreamReceiverConfig { }
1894
1895impl<> BaseLen for StreamReceiverConfigGen<> {
1896    const BASE_LEN: usize = 0;
1897}
1898
1899impl<> Encode for StreamReceiverConfigGen<> {
1900    fn scratch_len(&self) -> usize {
1901        0
1902    }
1903
1904    fn encode(&self, _: &mut EncodeCursor) {}
1905}
1906
1907impl Owned for StreamReceiverConfig {
1908    type Lazy<'a> = StreamReceiverConfigLazy<'a>;
1909
1910    fn lazy_to_owned(lazy: Self::Lazy<'_>) -> DecodeResult<Self> {
1911        TryFrom::try_from(lazy)
1912    }
1913}
1914
1915impl<'a> Lazy<'a> for StreamReceiverConfigLazy<'a> {
1916    type Owned = StreamReceiverConfig;
1917}
1918
1919impl<'a> Compatible<StreamReceiverConfigLazy<'a>> for StreamReceiverConfig { }
1920impl<'a> Compatible<StreamReceiverConfig> for StreamReceiverConfigLazy<'a> { }
1921
1922impl<'a> StreamReceiverConfigLazy<'a> {}
1923
1924impl BaseLen for StreamReceiverConfig {
1925    const BASE_LEN: usize = 0;
1926}
1927
1928impl Encode for StreamReceiverConfig {
1929    fn scratch_len(&self) -> usize {
1930        0
1931    }
1932
1933    fn encode(&self, _: &mut EncodeCursor) {}
1934}
1935
1936impl<'a> Decode<'a> for StreamReceiverConfig {
1937    fn decode(_: &DecodeCursor<'a>) -> DecodeResult<Self> {
1938
1939        Ok(StreamReceiverConfig {})
1940    }
1941}
1942
1943impl<'a> BaseLen for StreamReceiverConfigLazy<'a> {
1944    const BASE_LEN: usize = 0;
1945}
1946
1947impl<'a> Encode for StreamReceiverConfigLazy<'a> {
1948    fn scratch_len(&self) -> usize {
1949        0
1950    }
1951
1952    fn encode(&self, _: &mut EncodeCursor) {}
1953}
1954
1955impl<'a> Decode<'a> for StreamReceiverConfigLazy<'a> {
1956    fn decode(cursor: &DecodeCursor<'a>) -> DecodeResult<Self> {
1957        let offset = cursor.offset();
1958        cursor.advance(Self::BASE_LEN);
1959        Ok(StreamReceiverConfigLazy {
1960            buffer: cursor.buffer(),
1961            offset,
1962        })
1963    }
1964}
1965
1966impl<'a> TryFrom<StreamReceiverConfigLazy<'a>> for StreamReceiverConfig {
1967    type Error = DecodeError;
1968
1969    fn try_from(other: StreamReceiverConfigLazy<'a>) -> Result<Self, Self::Error> {
1970        let cursor = DecodeCursor::at_offset(other.buffer, other.offset);
1971        Decode::decode(&cursor)
1972    }
1973}
1974
1975impl<'a> Copy for StreamReceiverConfigLazy<'a> { }
1976
1977impl<'a> Clone for StreamReceiverConfigLazy<'a> {
1978    fn clone(&self) -> Self {
1979        Self {
1980            buffer: self.buffer,
1981            offset: self.offset,
1982        }
1983    }
1984}
1985
1986impl<'a> core::fmt::Debug for StreamReceiverConfigLazy<'a> {
1987    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
1988        f.debug_struct("StreamReceiverConfigLazy")
1989            .finish()
1990    }
1991}
1992
1993impl<'a> PartialEq for StreamReceiverConfigLazy<'a> {
1994    fn eq(&self, _: &Self) -> bool {
1995        true
1996    }
1997}
1998
1999#[derive(Copy, Clone, Debug, PartialEq, PartialOrd, Eq, Ord, Hash, Default)]
2000pub struct StreamSenderConfig {}
2001
2002pub struct StreamSenderConfigLazy<'a> {
2003    buffer: &'a [u8],
2004    offset: usize,
2005}
2006
2007pub struct StreamSenderConfigGen<> {}
2008
2009impl<> Compatible<StreamSenderConfig> for StreamSenderConfigGen<> { }
2010impl<> Compatible<StreamSenderConfigGen<>> for StreamSenderConfig { }
2011
2012impl<> BaseLen for StreamSenderConfigGen<> {
2013    const BASE_LEN: usize = 0;
2014}
2015
2016impl<> Encode for StreamSenderConfigGen<> {
2017    fn scratch_len(&self) -> usize {
2018        0
2019    }
2020
2021    fn encode(&self, _: &mut EncodeCursor) {}
2022}
2023
2024impl Owned for StreamSenderConfig {
2025    type Lazy<'a> = StreamSenderConfigLazy<'a>;
2026
2027    fn lazy_to_owned(lazy: Self::Lazy<'_>) -> DecodeResult<Self> {
2028        TryFrom::try_from(lazy)
2029    }
2030}
2031
2032impl<'a> Lazy<'a> for StreamSenderConfigLazy<'a> {
2033    type Owned = StreamSenderConfig;
2034}
2035
2036impl<'a> Compatible<StreamSenderConfigLazy<'a>> for StreamSenderConfig { }
2037impl<'a> Compatible<StreamSenderConfig> for StreamSenderConfigLazy<'a> { }
2038
2039impl<'a> StreamSenderConfigLazy<'a> {}
2040
2041impl BaseLen for StreamSenderConfig {
2042    const BASE_LEN: usize = 0;
2043}
2044
2045impl Encode for StreamSenderConfig {
2046    fn scratch_len(&self) -> usize {
2047        0
2048    }
2049
2050    fn encode(&self, _: &mut EncodeCursor) {}
2051}
2052
2053impl<'a> Decode<'a> for StreamSenderConfig {
2054    fn decode(_: &DecodeCursor<'a>) -> DecodeResult<Self> {
2055
2056        Ok(StreamSenderConfig {})
2057    }
2058}
2059
2060impl<'a> BaseLen for StreamSenderConfigLazy<'a> {
2061    const BASE_LEN: usize = 0;
2062}
2063
2064impl<'a> Encode for StreamSenderConfigLazy<'a> {
2065    fn scratch_len(&self) -> usize {
2066        0
2067    }
2068
2069    fn encode(&self, _: &mut EncodeCursor) {}
2070}
2071
2072impl<'a> Decode<'a> for StreamSenderConfigLazy<'a> {
2073    fn decode(cursor: &DecodeCursor<'a>) -> DecodeResult<Self> {
2074        let offset = cursor.offset();
2075        cursor.advance(Self::BASE_LEN);
2076        Ok(StreamSenderConfigLazy {
2077            buffer: cursor.buffer(),
2078            offset,
2079        })
2080    }
2081}
2082
2083impl<'a> TryFrom<StreamSenderConfigLazy<'a>> for StreamSenderConfig {
2084    type Error = DecodeError;
2085
2086    fn try_from(other: StreamSenderConfigLazy<'a>) -> Result<Self, Self::Error> {
2087        let cursor = DecodeCursor::at_offset(other.buffer, other.offset);
2088        Decode::decode(&cursor)
2089    }
2090}
2091
2092impl<'a> Copy for StreamSenderConfigLazy<'a> { }
2093
2094impl<'a> Clone for StreamSenderConfigLazy<'a> {
2095    fn clone(&self) -> Self {
2096        Self {
2097            buffer: self.buffer,
2098            offset: self.offset,
2099        }
2100    }
2101}
2102
2103impl<'a> core::fmt::Debug for StreamSenderConfigLazy<'a> {
2104    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
2105        f.debug_struct("StreamSenderConfigLazy")
2106            .finish()
2107    }
2108}
2109
2110impl<'a> PartialEq for StreamSenderConfigLazy<'a> {
2111    fn eq(&self, _: &Self) -> bool {
2112        true
2113    }
2114}
2115
2116#[derive(Copy, Clone, Debug, PartialEq, PartialOrd, Eq, Ord, Hash, Default)]
2117pub struct MultiStreamInitState {}
2118
2119pub struct MultiStreamInitStateLazy<'a> {
2120    buffer: &'a [u8],
2121    offset: usize,
2122}
2123
2124pub struct MultiStreamInitStateGen<> {}
2125
2126impl<> Compatible<MultiStreamInitState> for MultiStreamInitStateGen<> { }
2127impl<> Compatible<MultiStreamInitStateGen<>> for MultiStreamInitState { }
2128
2129impl<> BaseLen for MultiStreamInitStateGen<> {
2130    const BASE_LEN: usize = 0;
2131}
2132
2133impl<> Encode for MultiStreamInitStateGen<> {
2134    fn scratch_len(&self) -> usize {
2135        0
2136    }
2137
2138    fn encode(&self, _: &mut EncodeCursor) {}
2139}
2140
2141impl Owned for MultiStreamInitState {
2142    type Lazy<'a> = MultiStreamInitStateLazy<'a>;
2143
2144    fn lazy_to_owned(lazy: Self::Lazy<'_>) -> DecodeResult<Self> {
2145        TryFrom::try_from(lazy)
2146    }
2147}
2148
2149impl<'a> Lazy<'a> for MultiStreamInitStateLazy<'a> {
2150    type Owned = MultiStreamInitState;
2151}
2152
2153impl<'a> Compatible<MultiStreamInitStateLazy<'a>> for MultiStreamInitState { }
2154impl<'a> Compatible<MultiStreamInitState> for MultiStreamInitStateLazy<'a> { }
2155
2156impl<'a> MultiStreamInitStateLazy<'a> {}
2157
2158impl BaseLen for MultiStreamInitState {
2159    const BASE_LEN: usize = 0;
2160}
2161
2162impl Encode for MultiStreamInitState {
2163    fn scratch_len(&self) -> usize {
2164        0
2165    }
2166
2167    fn encode(&self, _: &mut EncodeCursor) {}
2168}
2169
2170impl<'a> Decode<'a> for MultiStreamInitState {
2171    fn decode(_: &DecodeCursor<'a>) -> DecodeResult<Self> {
2172
2173        Ok(MultiStreamInitState {})
2174    }
2175}
2176
2177impl<'a> BaseLen for MultiStreamInitStateLazy<'a> {
2178    const BASE_LEN: usize = 0;
2179}
2180
2181impl<'a> Encode for MultiStreamInitStateLazy<'a> {
2182    fn scratch_len(&self) -> usize {
2183        0
2184    }
2185
2186    fn encode(&self, _: &mut EncodeCursor) {}
2187}
2188
2189impl<'a> Decode<'a> for MultiStreamInitStateLazy<'a> {
2190    fn decode(cursor: &DecodeCursor<'a>) -> DecodeResult<Self> {
2191        let offset = cursor.offset();
2192        cursor.advance(Self::BASE_LEN);
2193        Ok(MultiStreamInitStateLazy {
2194            buffer: cursor.buffer(),
2195            offset,
2196        })
2197    }
2198}
2199
2200impl<'a> TryFrom<MultiStreamInitStateLazy<'a>> for MultiStreamInitState {
2201    type Error = DecodeError;
2202
2203    fn try_from(other: MultiStreamInitStateLazy<'a>) -> Result<Self, Self::Error> {
2204        let cursor = DecodeCursor::at_offset(other.buffer, other.offset);
2205        Decode::decode(&cursor)
2206    }
2207}
2208
2209impl<'a> Copy for MultiStreamInitStateLazy<'a> { }
2210
2211impl<'a> Clone for MultiStreamInitStateLazy<'a> {
2212    fn clone(&self) -> Self {
2213        Self {
2214            buffer: self.buffer,
2215            offset: self.offset,
2216        }
2217    }
2218}
2219
2220impl<'a> core::fmt::Debug for MultiStreamInitStateLazy<'a> {
2221    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
2222        f.debug_struct("MultiStreamInitStateLazy")
2223            .finish()
2224    }
2225}
2226
2227impl<'a> PartialEq for MultiStreamInitStateLazy<'a> {
2228    fn eq(&self, _: &Self) -> bool {
2229        true
2230    }
2231}
2232
2233#[derive(Copy, Clone, Debug, PartialEq, PartialOrd, Eq, Ord, Hash, Default)]
2234pub struct MultiStreamReceiverConfig {}
2235
2236pub struct MultiStreamReceiverConfigLazy<'a> {
2237    buffer: &'a [u8],
2238    offset: usize,
2239}
2240
2241pub struct MultiStreamReceiverConfigGen<> {}
2242
2243impl<> Compatible<MultiStreamReceiverConfig> for MultiStreamReceiverConfigGen<> { }
2244impl<> Compatible<MultiStreamReceiverConfigGen<>> for MultiStreamReceiverConfig { }
2245
2246impl<> BaseLen for MultiStreamReceiverConfigGen<> {
2247    const BASE_LEN: usize = 0;
2248}
2249
2250impl<> Encode for MultiStreamReceiverConfigGen<> {
2251    fn scratch_len(&self) -> usize {
2252        0
2253    }
2254
2255    fn encode(&self, _: &mut EncodeCursor) {}
2256}
2257
2258impl Owned for MultiStreamReceiverConfig {
2259    type Lazy<'a> = MultiStreamReceiverConfigLazy<'a>;
2260
2261    fn lazy_to_owned(lazy: Self::Lazy<'_>) -> DecodeResult<Self> {
2262        TryFrom::try_from(lazy)
2263    }
2264}
2265
2266impl<'a> Lazy<'a> for MultiStreamReceiverConfigLazy<'a> {
2267    type Owned = MultiStreamReceiverConfig;
2268}
2269
2270impl<'a> Compatible<MultiStreamReceiverConfigLazy<'a>> for MultiStreamReceiverConfig { }
2271impl<'a> Compatible<MultiStreamReceiverConfig> for MultiStreamReceiverConfigLazy<'a> { }
2272
2273impl<'a> MultiStreamReceiverConfigLazy<'a> {}
2274
2275impl BaseLen for MultiStreamReceiverConfig {
2276    const BASE_LEN: usize = 0;
2277}
2278
2279impl Encode for MultiStreamReceiverConfig {
2280    fn scratch_len(&self) -> usize {
2281        0
2282    }
2283
2284    fn encode(&self, _: &mut EncodeCursor) {}
2285}
2286
2287impl<'a> Decode<'a> for MultiStreamReceiverConfig {
2288    fn decode(_: &DecodeCursor<'a>) -> DecodeResult<Self> {
2289
2290        Ok(MultiStreamReceiverConfig {})
2291    }
2292}
2293
2294impl<'a> BaseLen for MultiStreamReceiverConfigLazy<'a> {
2295    const BASE_LEN: usize = 0;
2296}
2297
2298impl<'a> Encode for MultiStreamReceiverConfigLazy<'a> {
2299    fn scratch_len(&self) -> usize {
2300        0
2301    }
2302
2303    fn encode(&self, _: &mut EncodeCursor) {}
2304}
2305
2306impl<'a> Decode<'a> for MultiStreamReceiverConfigLazy<'a> {
2307    fn decode(cursor: &DecodeCursor<'a>) -> DecodeResult<Self> {
2308        let offset = cursor.offset();
2309        cursor.advance(Self::BASE_LEN);
2310        Ok(MultiStreamReceiverConfigLazy {
2311            buffer: cursor.buffer(),
2312            offset,
2313        })
2314    }
2315}
2316
2317impl<'a> TryFrom<MultiStreamReceiverConfigLazy<'a>> for MultiStreamReceiverConfig {
2318    type Error = DecodeError;
2319
2320    fn try_from(other: MultiStreamReceiverConfigLazy<'a>) -> Result<Self, Self::Error> {
2321        let cursor = DecodeCursor::at_offset(other.buffer, other.offset);
2322        Decode::decode(&cursor)
2323    }
2324}
2325
2326impl<'a> Copy for MultiStreamReceiverConfigLazy<'a> { }
2327
2328impl<'a> Clone for MultiStreamReceiverConfigLazy<'a> {
2329    fn clone(&self) -> Self {
2330        Self {
2331            buffer: self.buffer,
2332            offset: self.offset,
2333        }
2334    }
2335}
2336
2337impl<'a> core::fmt::Debug for MultiStreamReceiverConfigLazy<'a> {
2338    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
2339        f.debug_struct("MultiStreamReceiverConfigLazy")
2340            .finish()
2341    }
2342}
2343
2344impl<'a> PartialEq for MultiStreamReceiverConfigLazy<'a> {
2345    fn eq(&self, _: &Self) -> bool {
2346        true
2347    }
2348}
2349
2350#[derive(Copy, Clone, Debug, PartialEq, PartialOrd, Eq, Ord, Hash, Default)]
2351pub struct MultiStreamSenderConfig {}
2352
2353pub struct MultiStreamSenderConfigLazy<'a> {
2354    buffer: &'a [u8],
2355    offset: usize,
2356}
2357
2358pub struct MultiStreamSenderConfigGen<> {}
2359
2360impl<> Compatible<MultiStreamSenderConfig> for MultiStreamSenderConfigGen<> { }
2361impl<> Compatible<MultiStreamSenderConfigGen<>> for MultiStreamSenderConfig { }
2362
2363impl<> BaseLen for MultiStreamSenderConfigGen<> {
2364    const BASE_LEN: usize = 0;
2365}
2366
2367impl<> Encode for MultiStreamSenderConfigGen<> {
2368    fn scratch_len(&self) -> usize {
2369        0
2370    }
2371
2372    fn encode(&self, _: &mut EncodeCursor) {}
2373}
2374
2375impl Owned for MultiStreamSenderConfig {
2376    type Lazy<'a> = MultiStreamSenderConfigLazy<'a>;
2377
2378    fn lazy_to_owned(lazy: Self::Lazy<'_>) -> DecodeResult<Self> {
2379        TryFrom::try_from(lazy)
2380    }
2381}
2382
2383impl<'a> Lazy<'a> for MultiStreamSenderConfigLazy<'a> {
2384    type Owned = MultiStreamSenderConfig;
2385}
2386
2387impl<'a> Compatible<MultiStreamSenderConfigLazy<'a>> for MultiStreamSenderConfig { }
2388impl<'a> Compatible<MultiStreamSenderConfig> for MultiStreamSenderConfigLazy<'a> { }
2389
2390impl<'a> MultiStreamSenderConfigLazy<'a> {}
2391
2392impl BaseLen for MultiStreamSenderConfig {
2393    const BASE_LEN: usize = 0;
2394}
2395
2396impl Encode for MultiStreamSenderConfig {
2397    fn scratch_len(&self) -> usize {
2398        0
2399    }
2400
2401    fn encode(&self, _: &mut EncodeCursor) {}
2402}
2403
2404impl<'a> Decode<'a> for MultiStreamSenderConfig {
2405    fn decode(_: &DecodeCursor<'a>) -> DecodeResult<Self> {
2406
2407        Ok(MultiStreamSenderConfig {})
2408    }
2409}
2410
2411impl<'a> BaseLen for MultiStreamSenderConfigLazy<'a> {
2412    const BASE_LEN: usize = 0;
2413}
2414
2415impl<'a> Encode for MultiStreamSenderConfigLazy<'a> {
2416    fn scratch_len(&self) -> usize {
2417        0
2418    }
2419
2420    fn encode(&self, _: &mut EncodeCursor) {}
2421}
2422
2423impl<'a> Decode<'a> for MultiStreamSenderConfigLazy<'a> {
2424    fn decode(cursor: &DecodeCursor<'a>) -> DecodeResult<Self> {
2425        let offset = cursor.offset();
2426        cursor.advance(Self::BASE_LEN);
2427        Ok(MultiStreamSenderConfigLazy {
2428            buffer: cursor.buffer(),
2429            offset,
2430        })
2431    }
2432}
2433
2434impl<'a> TryFrom<MultiStreamSenderConfigLazy<'a>> for MultiStreamSenderConfig {
2435    type Error = DecodeError;
2436
2437    fn try_from(other: MultiStreamSenderConfigLazy<'a>) -> Result<Self, Self::Error> {
2438        let cursor = DecodeCursor::at_offset(other.buffer, other.offset);
2439        Decode::decode(&cursor)
2440    }
2441}
2442
2443impl<'a> Copy for MultiStreamSenderConfigLazy<'a> { }
2444
2445impl<'a> Clone for MultiStreamSenderConfigLazy<'a> {
2446    fn clone(&self) -> Self {
2447        Self {
2448            buffer: self.buffer,
2449            offset: self.offset,
2450        }
2451    }
2452}
2453
2454impl<'a> core::fmt::Debug for MultiStreamSenderConfigLazy<'a> {
2455    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
2456        f.debug_struct("MultiStreamSenderConfigLazy")
2457            .finish()
2458    }
2459}
2460
2461impl<'a> PartialEq for MultiStreamSenderConfigLazy<'a> {
2462    fn eq(&self, _: &Self) -> bool {
2463        true
2464    }
2465}
2466
2467#[derive(Copy, Clone, Debug, PartialEq, PartialOrd, Eq, Ord, Hash, Default)]
2468pub struct ByteStreamInitState {}
2469
2470pub struct ByteStreamInitStateLazy<'a> {
2471    buffer: &'a [u8],
2472    offset: usize,
2473}
2474
2475pub struct ByteStreamInitStateGen<> {}
2476
2477impl<> Compatible<ByteStreamInitState> for ByteStreamInitStateGen<> { }
2478impl<> Compatible<ByteStreamInitStateGen<>> for ByteStreamInitState { }
2479
2480impl<> BaseLen for ByteStreamInitStateGen<> {
2481    const BASE_LEN: usize = 0;
2482}
2483
2484impl<> Encode for ByteStreamInitStateGen<> {
2485    fn scratch_len(&self) -> usize {
2486        0
2487    }
2488
2489    fn encode(&self, _: &mut EncodeCursor) {}
2490}
2491
2492impl Owned for ByteStreamInitState {
2493    type Lazy<'a> = ByteStreamInitStateLazy<'a>;
2494
2495    fn lazy_to_owned(lazy: Self::Lazy<'_>) -> DecodeResult<Self> {
2496        TryFrom::try_from(lazy)
2497    }
2498}
2499
2500impl<'a> Lazy<'a> for ByteStreamInitStateLazy<'a> {
2501    type Owned = ByteStreamInitState;
2502}
2503
2504impl<'a> Compatible<ByteStreamInitStateLazy<'a>> for ByteStreamInitState { }
2505impl<'a> Compatible<ByteStreamInitState> for ByteStreamInitStateLazy<'a> { }
2506
2507impl<'a> ByteStreamInitStateLazy<'a> {}
2508
2509impl BaseLen for ByteStreamInitState {
2510    const BASE_LEN: usize = 0;
2511}
2512
2513impl Encode for ByteStreamInitState {
2514    fn scratch_len(&self) -> usize {
2515        0
2516    }
2517
2518    fn encode(&self, _: &mut EncodeCursor) {}
2519}
2520
2521impl<'a> Decode<'a> for ByteStreamInitState {
2522    fn decode(_: &DecodeCursor<'a>) -> DecodeResult<Self> {
2523
2524        Ok(ByteStreamInitState {})
2525    }
2526}
2527
2528impl<'a> BaseLen for ByteStreamInitStateLazy<'a> {
2529    const BASE_LEN: usize = 0;
2530}
2531
2532impl<'a> Encode for ByteStreamInitStateLazy<'a> {
2533    fn scratch_len(&self) -> usize {
2534        0
2535    }
2536
2537    fn encode(&self, _: &mut EncodeCursor) {}
2538}
2539
2540impl<'a> Decode<'a> for ByteStreamInitStateLazy<'a> {
2541    fn decode(cursor: &DecodeCursor<'a>) -> DecodeResult<Self> {
2542        let offset = cursor.offset();
2543        cursor.advance(Self::BASE_LEN);
2544        Ok(ByteStreamInitStateLazy {
2545            buffer: cursor.buffer(),
2546            offset,
2547        })
2548    }
2549}
2550
2551impl<'a> TryFrom<ByteStreamInitStateLazy<'a>> for ByteStreamInitState {
2552    type Error = DecodeError;
2553
2554    fn try_from(other: ByteStreamInitStateLazy<'a>) -> Result<Self, Self::Error> {
2555        let cursor = DecodeCursor::at_offset(other.buffer, other.offset);
2556        Decode::decode(&cursor)
2557    }
2558}
2559
2560impl<'a> Copy for ByteStreamInitStateLazy<'a> { }
2561
2562impl<'a> Clone for ByteStreamInitStateLazy<'a> {
2563    fn clone(&self) -> Self {
2564        Self {
2565            buffer: self.buffer,
2566            offset: self.offset,
2567        }
2568    }
2569}
2570
2571impl<'a> core::fmt::Debug for ByteStreamInitStateLazy<'a> {
2572    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
2573        f.debug_struct("ByteStreamInitStateLazy")
2574            .finish()
2575    }
2576}
2577
2578impl<'a> PartialEq for ByteStreamInitStateLazy<'a> {
2579    fn eq(&self, _: &Self) -> bool {
2580        true
2581    }
2582}
2583
2584#[derive(Copy, Clone, Debug, PartialEq, PartialOrd, Eq, Ord, Hash, Default)]
2585pub struct ByteStreamReceiverConfig {}
2586
2587pub struct ByteStreamReceiverConfigLazy<'a> {
2588    buffer: &'a [u8],
2589    offset: usize,
2590}
2591
2592pub struct ByteStreamReceiverConfigGen<> {}
2593
2594impl<> Compatible<ByteStreamReceiverConfig> for ByteStreamReceiverConfigGen<> { }
2595impl<> Compatible<ByteStreamReceiverConfigGen<>> for ByteStreamReceiverConfig { }
2596
2597impl<> BaseLen for ByteStreamReceiverConfigGen<> {
2598    const BASE_LEN: usize = 0;
2599}
2600
2601impl<> Encode for ByteStreamReceiverConfigGen<> {
2602    fn scratch_len(&self) -> usize {
2603        0
2604    }
2605
2606    fn encode(&self, _: &mut EncodeCursor) {}
2607}
2608
2609impl Owned for ByteStreamReceiverConfig {
2610    type Lazy<'a> = ByteStreamReceiverConfigLazy<'a>;
2611
2612    fn lazy_to_owned(lazy: Self::Lazy<'_>) -> DecodeResult<Self> {
2613        TryFrom::try_from(lazy)
2614    }
2615}
2616
2617impl<'a> Lazy<'a> for ByteStreamReceiverConfigLazy<'a> {
2618    type Owned = ByteStreamReceiverConfig;
2619}
2620
2621impl<'a> Compatible<ByteStreamReceiverConfigLazy<'a>> for ByteStreamReceiverConfig { }
2622impl<'a> Compatible<ByteStreamReceiverConfig> for ByteStreamReceiverConfigLazy<'a> { }
2623
2624impl<'a> ByteStreamReceiverConfigLazy<'a> {}
2625
2626impl BaseLen for ByteStreamReceiverConfig {
2627    const BASE_LEN: usize = 0;
2628}
2629
2630impl Encode for ByteStreamReceiverConfig {
2631    fn scratch_len(&self) -> usize {
2632        0
2633    }
2634
2635    fn encode(&self, _: &mut EncodeCursor) {}
2636}
2637
2638impl<'a> Decode<'a> for ByteStreamReceiverConfig {
2639    fn decode(_: &DecodeCursor<'a>) -> DecodeResult<Self> {
2640
2641        Ok(ByteStreamReceiverConfig {})
2642    }
2643}
2644
2645impl<'a> BaseLen for ByteStreamReceiverConfigLazy<'a> {
2646    const BASE_LEN: usize = 0;
2647}
2648
2649impl<'a> Encode for ByteStreamReceiverConfigLazy<'a> {
2650    fn scratch_len(&self) -> usize {
2651        0
2652    }
2653
2654    fn encode(&self, _: &mut EncodeCursor) {}
2655}
2656
2657impl<'a> Decode<'a> for ByteStreamReceiverConfigLazy<'a> {
2658    fn decode(cursor: &DecodeCursor<'a>) -> DecodeResult<Self> {
2659        let offset = cursor.offset();
2660        cursor.advance(Self::BASE_LEN);
2661        Ok(ByteStreamReceiverConfigLazy {
2662            buffer: cursor.buffer(),
2663            offset,
2664        })
2665    }
2666}
2667
2668impl<'a> TryFrom<ByteStreamReceiverConfigLazy<'a>> for ByteStreamReceiverConfig {
2669    type Error = DecodeError;
2670
2671    fn try_from(other: ByteStreamReceiverConfigLazy<'a>) -> Result<Self, Self::Error> {
2672        let cursor = DecodeCursor::at_offset(other.buffer, other.offset);
2673        Decode::decode(&cursor)
2674    }
2675}
2676
2677impl<'a> Copy for ByteStreamReceiverConfigLazy<'a> { }
2678
2679impl<'a> Clone for ByteStreamReceiverConfigLazy<'a> {
2680    fn clone(&self) -> Self {
2681        Self {
2682            buffer: self.buffer,
2683            offset: self.offset,
2684        }
2685    }
2686}
2687
2688impl<'a> core::fmt::Debug for ByteStreamReceiverConfigLazy<'a> {
2689    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
2690        f.debug_struct("ByteStreamReceiverConfigLazy")
2691            .finish()
2692    }
2693}
2694
2695impl<'a> PartialEq for ByteStreamReceiverConfigLazy<'a> {
2696    fn eq(&self, _: &Self) -> bool {
2697        true
2698    }
2699}
2700
2701#[derive(Copy, Clone, Debug, PartialEq, PartialOrd, Eq, Ord, Hash, Default)]
2702pub struct ByteStreamSenderConfig {}
2703
2704pub struct ByteStreamSenderConfigLazy<'a> {
2705    buffer: &'a [u8],
2706    offset: usize,
2707}
2708
2709pub struct ByteStreamSenderConfigGen<> {}
2710
2711impl<> Compatible<ByteStreamSenderConfig> for ByteStreamSenderConfigGen<> { }
2712impl<> Compatible<ByteStreamSenderConfigGen<>> for ByteStreamSenderConfig { }
2713
2714impl<> BaseLen for ByteStreamSenderConfigGen<> {
2715    const BASE_LEN: usize = 0;
2716}
2717
2718impl<> Encode for ByteStreamSenderConfigGen<> {
2719    fn scratch_len(&self) -> usize {
2720        0
2721    }
2722
2723    fn encode(&self, _: &mut EncodeCursor) {}
2724}
2725
2726impl Owned for ByteStreamSenderConfig {
2727    type Lazy<'a> = ByteStreamSenderConfigLazy<'a>;
2728
2729    fn lazy_to_owned(lazy: Self::Lazy<'_>) -> DecodeResult<Self> {
2730        TryFrom::try_from(lazy)
2731    }
2732}
2733
2734impl<'a> Lazy<'a> for ByteStreamSenderConfigLazy<'a> {
2735    type Owned = ByteStreamSenderConfig;
2736}
2737
2738impl<'a> Compatible<ByteStreamSenderConfigLazy<'a>> for ByteStreamSenderConfig { }
2739impl<'a> Compatible<ByteStreamSenderConfig> for ByteStreamSenderConfigLazy<'a> { }
2740
2741impl<'a> ByteStreamSenderConfigLazy<'a> {}
2742
2743impl BaseLen for ByteStreamSenderConfig {
2744    const BASE_LEN: usize = 0;
2745}
2746
2747impl Encode for ByteStreamSenderConfig {
2748    fn scratch_len(&self) -> usize {
2749        0
2750    }
2751
2752    fn encode(&self, _: &mut EncodeCursor) {}
2753}
2754
2755impl<'a> Decode<'a> for ByteStreamSenderConfig {
2756    fn decode(_: &DecodeCursor<'a>) -> DecodeResult<Self> {
2757
2758        Ok(ByteStreamSenderConfig {})
2759    }
2760}
2761
2762impl<'a> BaseLen for ByteStreamSenderConfigLazy<'a> {
2763    const BASE_LEN: usize = 0;
2764}
2765
2766impl<'a> Encode for ByteStreamSenderConfigLazy<'a> {
2767    fn scratch_len(&self) -> usize {
2768        0
2769    }
2770
2771    fn encode(&self, _: &mut EncodeCursor) {}
2772}
2773
2774impl<'a> Decode<'a> for ByteStreamSenderConfigLazy<'a> {
2775    fn decode(cursor: &DecodeCursor<'a>) -> DecodeResult<Self> {
2776        let offset = cursor.offset();
2777        cursor.advance(Self::BASE_LEN);
2778        Ok(ByteStreamSenderConfigLazy {
2779            buffer: cursor.buffer(),
2780            offset,
2781        })
2782    }
2783}
2784
2785impl<'a> TryFrom<ByteStreamSenderConfigLazy<'a>> for ByteStreamSenderConfig {
2786    type Error = DecodeError;
2787
2788    fn try_from(other: ByteStreamSenderConfigLazy<'a>) -> Result<Self, Self::Error> {
2789        let cursor = DecodeCursor::at_offset(other.buffer, other.offset);
2790        Decode::decode(&cursor)
2791    }
2792}
2793
2794impl<'a> Copy for ByteStreamSenderConfigLazy<'a> { }
2795
2796impl<'a> Clone for ByteStreamSenderConfigLazy<'a> {
2797    fn clone(&self) -> Self {
2798        Self {
2799            buffer: self.buffer,
2800            offset: self.offset,
2801        }
2802    }
2803}
2804
2805impl<'a> core::fmt::Debug for ByteStreamSenderConfigLazy<'a> {
2806    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
2807        f.debug_struct("ByteStreamSenderConfigLazy")
2808            .finish()
2809    }
2810}
2811
2812impl<'a> PartialEq for ByteStreamSenderConfigLazy<'a> {
2813    fn eq(&self, _: &Self) -> bool {
2814        true
2815    }
2816}