std_modrpc/
proto.rs

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