1#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
8use futures::future::{self, MaybeDone, TryFutureExt};
9use zx_status;
10
11pub type TransferKey = [u8; 16];
15
16pub const MAX_SERVICE_NAME_LENGTH: u64 = fidl_fuchsia_io::MAX_NAME_LENGTH as u64;
17
18pub const TRANSFER_KEY_LENGTH: u32 = 16;
20
21bitflags! {
22 #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
26 pub struct ChannelRights: u32 {
27 const READ = 1;
28 const WRITE = 2;
29 }
30}
31
32impl ChannelRights {
33 #[deprecated = "Strict bits should not use `has_unknown_bits`"]
34 #[inline(always)]
35 pub fn has_unknown_bits(&self) -> bool {
36 false
37 }
38
39 #[deprecated = "Strict bits should not use `get_unknown_bits`"]
40 #[inline(always)]
41 pub fn get_unknown_bits(&self) -> u32 {
42 0
43 }
44}
45
46bitflags! {
47 #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
51 pub struct EventPairRights: u32 {
52 const DO_NOT_USE = 2147483648;
53 }
54}
55
56impl EventPairRights {
57 #[deprecated = "Strict bits should not use `has_unknown_bits`"]
58 #[inline(always)]
59 pub fn has_unknown_bits(&self) -> bool {
60 false
61 }
62
63 #[deprecated = "Strict bits should not use `get_unknown_bits`"]
64 #[inline(always)]
65 pub fn get_unknown_bits(&self) -> u32 {
66 0
67 }
68}
69
70bitflags! {
71 #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
75 pub struct Signals: u32 {
76 const USER_0 = 1;
77 const USER_1 = 2;
78 const USER_2 = 4;
79 const USER_3 = 8;
80 const USER_4 = 16;
81 const USER_5 = 32;
82 const USER_6 = 64;
83 const USER_7 = 128;
84 }
85}
86
87impl Signals {
88 #[deprecated = "Strict bits should not use `has_unknown_bits`"]
89 #[inline(always)]
90 pub fn has_unknown_bits(&self) -> bool {
91 false
92 }
93
94 #[deprecated = "Strict bits should not use `get_unknown_bits`"]
95 #[inline(always)]
96 pub fn get_unknown_bits(&self) -> u32 {
97 0
98 }
99}
100
101bitflags! {
102 #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
106 pub struct SocketRights: u32 {
107 const READ = 1;
108 const WRITE = 2;
109 }
110}
111
112impl SocketRights {
113 #[deprecated = "Strict bits should not use `has_unknown_bits`"]
114 #[inline(always)]
115 pub fn has_unknown_bits(&self) -> bool {
116 false
117 }
118
119 #[deprecated = "Strict bits should not use `get_unknown_bits`"]
120 #[inline(always)]
121 pub fn get_unknown_bits(&self) -> u32 {
122 0
123 }
124}
125
126#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
128#[repr(u32)]
129pub enum SocketType {
130 Datagram = 0,
132 Stream = 1,
134}
135
136impl SocketType {
137 #[inline]
138 pub fn from_primitive(prim: u32) -> Option<Self> {
139 match prim {
140 0 => Some(Self::Datagram),
141 1 => Some(Self::Stream),
142 _ => None,
143 }
144 }
145
146 #[inline]
147 pub const fn into_primitive(self) -> u32 {
148 self as u32
149 }
150
151 #[deprecated = "Strict enums should not use `is_unknown`"]
152 #[inline]
153 pub fn is_unknown(&self) -> bool {
154 false
155 }
156}
157
158#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
160#[repr(C)]
161pub struct BeginTransfer {
162 pub new_destination_node: NodeId,
164 pub transfer_key: [u8; 16],
166}
167
168impl fidl::Persistable for BeginTransfer {}
169
170#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
172pub struct ChannelHandle {
173 pub rights: ChannelRights,
175 pub stream_ref: StreamRef,
178}
179
180impl fidl::Persistable for ChannelHandle {}
181
182#[derive(Clone, Debug, PartialEq)]
185pub struct ConnectToService {
186 pub service_name: String,
188 pub stream_ref: StreamRef,
190 pub rights: ChannelRights,
192 pub options: ConnectToServiceOptions,
194}
195
196impl fidl::Persistable for ConnectToService {}
197
198#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
199pub struct Empty;
200
201impl fidl::Persistable for Empty {}
202
203#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
205pub struct EventPairHandle {
206 pub rights: EventPairRights,
208 pub stream_ref: StreamRef,
212}
213
214impl fidl::Persistable for EventPairHandle {}
215
216#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
218#[repr(C)]
219pub struct NodeId {
220 pub id: u64,
221}
222
223impl fidl::Persistable for NodeId {}
224
225#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
228#[repr(C)]
229pub struct OpenTransfer {
230 pub stream_id: StreamId,
232 pub transfer_key: [u8; 16],
234}
235
236impl fidl::Persistable for OpenTransfer {}
237
238#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
240pub struct SocketHandle {
241 pub rights: SocketRights,
243 pub stream_ref: StreamRef,
246 pub socket_type: SocketType,
248}
249
250impl fidl::Persistable for SocketHandle {}
251
252#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
255#[repr(C)]
256pub struct StreamId {
257 pub id: u64,
258}
259
260impl fidl::Persistable for StreamId {}
261
262#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
264#[repr(C)]
265pub struct TransferInitiator {
266 pub stream_id: StreamId,
270 pub new_destination_node: NodeId,
273 pub transfer_key: [u8; 16],
275}
276
277impl fidl::Persistable for TransferInitiator {}
278
279#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
281#[repr(C)]
282pub struct TransferWaiter {
283 pub stream_id: StreamId,
287 pub transfer_key: [u8; 16],
289}
290
291impl fidl::Persistable for TransferWaiter {}
292
293#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
295pub struct ZirconChannelMessage {
296 pub bytes: Vec<u8>,
298 pub handles: Vec<ZirconHandle>,
300}
301
302impl fidl::Persistable for ZirconChannelMessage {}
303
304#[derive(Clone, Debug, Default, PartialEq)]
306pub struct ConfigRequest {
307 #[doc(hidden)]
308 pub __source_breaking: fidl::marker::SourceBreaking,
309}
310
311impl fidl::Persistable for ConfigRequest {}
312
313#[derive(Clone, Debug, Default, PartialEq)]
316pub struct ConfigResponse {
317 #[doc(hidden)]
318 pub __source_breaking: fidl::marker::SourceBreaking,
319}
320
321impl fidl::Persistable for ConfigResponse {}
322
323#[derive(Clone, Debug, Default, PartialEq)]
325pub struct ConnectToServiceOptions {
326 #[doc(hidden)]
327 pub __source_breaking: fidl::marker::SourceBreaking,
328}
329
330impl fidl::Persistable for ConnectToServiceOptions {}
331
332#[derive(Clone, Debug, Default, PartialEq)]
334pub struct PeerDescription {
335 pub services: Option<Vec<String>>,
337 #[doc(hidden)]
338 pub __source_breaking: fidl::marker::SourceBreaking,
339}
340
341impl fidl::Persistable for PeerDescription {}
342
343#[derive(Clone, Debug, Default, PartialEq)]
346pub struct SignalUpdate {
347 pub assert_signals: Option<Signals>,
349 #[doc(hidden)]
350 pub __source_breaking: fidl::marker::SourceBreaking,
351}
352
353impl fidl::Persistable for SignalUpdate {}
354
355#[derive(Clone, Debug, PartialEq)]
358pub enum PeerMessage {
359 ConnectToService(ConnectToService),
361 UpdateNodeDescription(PeerDescription),
363 OpenTransfer(OpenTransfer),
365}
366
367impl PeerMessage {
368 #[inline]
369 pub fn ordinal(&self) -> u64 {
370 match *self {
371 Self::ConnectToService(_) => 1,
372 Self::UpdateNodeDescription(_) => 2,
373 Self::OpenTransfer(_) => 4,
374 }
375 }
376
377 #[deprecated = "Strict unions should not use `is_unknown`"]
378 #[inline]
379 pub fn is_unknown(&self) -> bool {
380 false
381 }
382}
383
384impl fidl::Persistable for PeerMessage {}
385
386#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
389pub enum PeerReply {
390 UpdateLinkStatusAck(Empty),
392}
393
394impl PeerReply {
395 #[inline]
396 pub fn ordinal(&self) -> u64 {
397 match *self {
398 Self::UpdateLinkStatusAck(_) => 1,
399 }
400 }
401
402 #[deprecated = "Strict unions should not use `is_unknown`"]
403 #[inline]
404 pub fn is_unknown(&self) -> bool {
405 false
406 }
407}
408
409impl fidl::Persistable for PeerReply {}
410
411#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
415pub enum StreamControl {
416 BeginTransfer(BeginTransfer),
419 AckTransfer(Empty),
423 EndTransfer(Empty),
426 Shutdown(i32),
428}
429
430impl StreamControl {
431 #[inline]
432 pub fn ordinal(&self) -> u64 {
433 match *self {
434 Self::BeginTransfer(_) => 1,
435 Self::AckTransfer(_) => 2,
436 Self::EndTransfer(_) => 3,
437 Self::Shutdown(_) => 4,
438 }
439 }
440
441 #[deprecated = "Strict unions should not use `is_unknown`"]
442 #[inline]
443 pub fn is_unknown(&self) -> bool {
444 false
445 }
446}
447
448impl fidl::Persistable for StreamControl {}
449
450#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
453pub enum StreamRef {
454 Creating(StreamId),
458 TransferInitiator(TransferInitiator),
461 TransferWaiter(TransferWaiter),
464}
465
466impl StreamRef {
467 #[inline]
468 pub fn ordinal(&self) -> u64 {
469 match *self {
470 Self::Creating(_) => 1,
471 Self::TransferInitiator(_) => 2,
472 Self::TransferWaiter(_) => 3,
473 }
474 }
475
476 #[deprecated = "Strict unions should not use `is_unknown`"]
477 #[inline]
478 pub fn is_unknown(&self) -> bool {
479 false
480 }
481}
482
483impl fidl::Persistable for StreamRef {}
484
485#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
488pub enum ZirconHandle {
489 Channel(ChannelHandle),
491 Socket(SocketHandle),
493 EventPair(EventPairHandle),
495}
496
497impl ZirconHandle {
498 #[inline]
499 pub fn ordinal(&self) -> u64 {
500 match *self {
501 Self::Channel(_) => 1,
502 Self::Socket(_) => 2,
503 Self::EventPair(_) => 3,
504 }
505 }
506
507 #[deprecated = "Strict unions should not use `is_unknown`"]
508 #[inline]
509 pub fn is_unknown(&self) -> bool {
510 false
511 }
512}
513
514impl fidl::Persistable for ZirconHandle {}
515
516mod internal {
517 use super::*;
518 unsafe impl fidl::encoding::TypeMarker for ChannelRights {
519 type Owned = Self;
520
521 #[inline(always)]
522 fn inline_align(_context: fidl::encoding::Context) -> usize {
523 4
524 }
525
526 #[inline(always)]
527 fn inline_size(_context: fidl::encoding::Context) -> usize {
528 4
529 }
530 }
531
532 impl fidl::encoding::ValueTypeMarker for ChannelRights {
533 type Borrowed<'a> = Self;
534 #[inline(always)]
535 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
536 *value
537 }
538 }
539
540 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for ChannelRights {
541 #[inline]
542 unsafe fn encode(
543 self,
544 encoder: &mut fidl::encoding::Encoder<'_, D>,
545 offset: usize,
546 _depth: fidl::encoding::Depth,
547 ) -> fidl::Result<()> {
548 encoder.debug_check_bounds::<Self>(offset);
549 if self.bits() & Self::all().bits() != self.bits() {
550 return Err(fidl::Error::InvalidBitsValue);
551 }
552 encoder.write_num(self.bits(), offset);
553 Ok(())
554 }
555 }
556
557 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ChannelRights {
558 #[inline(always)]
559 fn new_empty() -> Self {
560 Self::empty()
561 }
562
563 #[inline]
564 unsafe fn decode(
565 &mut self,
566 decoder: &mut fidl::encoding::Decoder<'_, D>,
567 offset: usize,
568 _depth: fidl::encoding::Depth,
569 ) -> fidl::Result<()> {
570 decoder.debug_check_bounds::<Self>(offset);
571 let prim = decoder.read_num::<u32>(offset);
572 *self = Self::from_bits(prim).ok_or(fidl::Error::InvalidBitsValue)?;
573 Ok(())
574 }
575 }
576 unsafe impl fidl::encoding::TypeMarker for EventPairRights {
577 type Owned = Self;
578
579 #[inline(always)]
580 fn inline_align(_context: fidl::encoding::Context) -> usize {
581 4
582 }
583
584 #[inline(always)]
585 fn inline_size(_context: fidl::encoding::Context) -> usize {
586 4
587 }
588 }
589
590 impl fidl::encoding::ValueTypeMarker for EventPairRights {
591 type Borrowed<'a> = Self;
592 #[inline(always)]
593 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
594 *value
595 }
596 }
597
598 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
599 for EventPairRights
600 {
601 #[inline]
602 unsafe fn encode(
603 self,
604 encoder: &mut fidl::encoding::Encoder<'_, D>,
605 offset: usize,
606 _depth: fidl::encoding::Depth,
607 ) -> fidl::Result<()> {
608 encoder.debug_check_bounds::<Self>(offset);
609 if self.bits() & Self::all().bits() != self.bits() {
610 return Err(fidl::Error::InvalidBitsValue);
611 }
612 encoder.write_num(self.bits(), offset);
613 Ok(())
614 }
615 }
616
617 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for EventPairRights {
618 #[inline(always)]
619 fn new_empty() -> Self {
620 Self::empty()
621 }
622
623 #[inline]
624 unsafe fn decode(
625 &mut self,
626 decoder: &mut fidl::encoding::Decoder<'_, D>,
627 offset: usize,
628 _depth: fidl::encoding::Depth,
629 ) -> fidl::Result<()> {
630 decoder.debug_check_bounds::<Self>(offset);
631 let prim = decoder.read_num::<u32>(offset);
632 *self = Self::from_bits(prim).ok_or(fidl::Error::InvalidBitsValue)?;
633 Ok(())
634 }
635 }
636 unsafe impl fidl::encoding::TypeMarker for Signals {
637 type Owned = Self;
638
639 #[inline(always)]
640 fn inline_align(_context: fidl::encoding::Context) -> usize {
641 4
642 }
643
644 #[inline(always)]
645 fn inline_size(_context: fidl::encoding::Context) -> usize {
646 4
647 }
648 }
649
650 impl fidl::encoding::ValueTypeMarker for Signals {
651 type Borrowed<'a> = Self;
652 #[inline(always)]
653 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
654 *value
655 }
656 }
657
658 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for Signals {
659 #[inline]
660 unsafe fn encode(
661 self,
662 encoder: &mut fidl::encoding::Encoder<'_, D>,
663 offset: usize,
664 _depth: fidl::encoding::Depth,
665 ) -> fidl::Result<()> {
666 encoder.debug_check_bounds::<Self>(offset);
667 if self.bits() & Self::all().bits() != self.bits() {
668 return Err(fidl::Error::InvalidBitsValue);
669 }
670 encoder.write_num(self.bits(), offset);
671 Ok(())
672 }
673 }
674
675 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Signals {
676 #[inline(always)]
677 fn new_empty() -> Self {
678 Self::empty()
679 }
680
681 #[inline]
682 unsafe fn decode(
683 &mut self,
684 decoder: &mut fidl::encoding::Decoder<'_, D>,
685 offset: usize,
686 _depth: fidl::encoding::Depth,
687 ) -> fidl::Result<()> {
688 decoder.debug_check_bounds::<Self>(offset);
689 let prim = decoder.read_num::<u32>(offset);
690 *self = Self::from_bits(prim).ok_or(fidl::Error::InvalidBitsValue)?;
691 Ok(())
692 }
693 }
694 unsafe impl fidl::encoding::TypeMarker for SocketRights {
695 type Owned = Self;
696
697 #[inline(always)]
698 fn inline_align(_context: fidl::encoding::Context) -> usize {
699 4
700 }
701
702 #[inline(always)]
703 fn inline_size(_context: fidl::encoding::Context) -> usize {
704 4
705 }
706 }
707
708 impl fidl::encoding::ValueTypeMarker for SocketRights {
709 type Borrowed<'a> = Self;
710 #[inline(always)]
711 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
712 *value
713 }
714 }
715
716 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for SocketRights {
717 #[inline]
718 unsafe fn encode(
719 self,
720 encoder: &mut fidl::encoding::Encoder<'_, D>,
721 offset: usize,
722 _depth: fidl::encoding::Depth,
723 ) -> fidl::Result<()> {
724 encoder.debug_check_bounds::<Self>(offset);
725 if self.bits() & Self::all().bits() != self.bits() {
726 return Err(fidl::Error::InvalidBitsValue);
727 }
728 encoder.write_num(self.bits(), offset);
729 Ok(())
730 }
731 }
732
733 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SocketRights {
734 #[inline(always)]
735 fn new_empty() -> Self {
736 Self::empty()
737 }
738
739 #[inline]
740 unsafe fn decode(
741 &mut self,
742 decoder: &mut fidl::encoding::Decoder<'_, D>,
743 offset: usize,
744 _depth: fidl::encoding::Depth,
745 ) -> fidl::Result<()> {
746 decoder.debug_check_bounds::<Self>(offset);
747 let prim = decoder.read_num::<u32>(offset);
748 *self = Self::from_bits(prim).ok_or(fidl::Error::InvalidBitsValue)?;
749 Ok(())
750 }
751 }
752 unsafe impl fidl::encoding::TypeMarker for SocketType {
753 type Owned = Self;
754
755 #[inline(always)]
756 fn inline_align(_context: fidl::encoding::Context) -> usize {
757 std::mem::align_of::<u32>()
758 }
759
760 #[inline(always)]
761 fn inline_size(_context: fidl::encoding::Context) -> usize {
762 std::mem::size_of::<u32>()
763 }
764
765 #[inline(always)]
766 fn encode_is_copy() -> bool {
767 true
768 }
769
770 #[inline(always)]
771 fn decode_is_copy() -> bool {
772 false
773 }
774 }
775
776 impl fidl::encoding::ValueTypeMarker for SocketType {
777 type Borrowed<'a> = Self;
778 #[inline(always)]
779 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
780 *value
781 }
782 }
783
784 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for SocketType {
785 #[inline]
786 unsafe fn encode(
787 self,
788 encoder: &mut fidl::encoding::Encoder<'_, D>,
789 offset: usize,
790 _depth: fidl::encoding::Depth,
791 ) -> fidl::Result<()> {
792 encoder.debug_check_bounds::<Self>(offset);
793 encoder.write_num(self.into_primitive(), offset);
794 Ok(())
795 }
796 }
797
798 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SocketType {
799 #[inline(always)]
800 fn new_empty() -> Self {
801 Self::Datagram
802 }
803
804 #[inline]
805 unsafe fn decode(
806 &mut self,
807 decoder: &mut fidl::encoding::Decoder<'_, D>,
808 offset: usize,
809 _depth: fidl::encoding::Depth,
810 ) -> fidl::Result<()> {
811 decoder.debug_check_bounds::<Self>(offset);
812 let prim = decoder.read_num::<u32>(offset);
813
814 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
815 Ok(())
816 }
817 }
818
819 impl fidl::encoding::ValueTypeMarker for BeginTransfer {
820 type Borrowed<'a> = &'a Self;
821 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
822 value
823 }
824 }
825
826 unsafe impl fidl::encoding::TypeMarker for BeginTransfer {
827 type Owned = Self;
828
829 #[inline(always)]
830 fn inline_align(_context: fidl::encoding::Context) -> usize {
831 8
832 }
833
834 #[inline(always)]
835 fn inline_size(_context: fidl::encoding::Context) -> usize {
836 24
837 }
838 #[inline(always)]
839 fn encode_is_copy() -> bool {
840 true
841 }
842
843 #[inline(always)]
844 fn decode_is_copy() -> bool {
845 true
846 }
847 }
848
849 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<BeginTransfer, D>
850 for &BeginTransfer
851 {
852 #[inline]
853 unsafe fn encode(
854 self,
855 encoder: &mut fidl::encoding::Encoder<'_, D>,
856 offset: usize,
857 _depth: fidl::encoding::Depth,
858 ) -> fidl::Result<()> {
859 encoder.debug_check_bounds::<BeginTransfer>(offset);
860 unsafe {
861 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
863 (buf_ptr as *mut BeginTransfer)
864 .write_unaligned((self as *const BeginTransfer).read());
865 }
868 Ok(())
869 }
870 }
871 unsafe impl<
872 D: fidl::encoding::ResourceDialect,
873 T0: fidl::encoding::Encode<NodeId, D>,
874 T1: fidl::encoding::Encode<fidl::encoding::Array<u8, 16>, D>,
875 > fidl::encoding::Encode<BeginTransfer, D> for (T0, T1)
876 {
877 #[inline]
878 unsafe fn encode(
879 self,
880 encoder: &mut fidl::encoding::Encoder<'_, D>,
881 offset: usize,
882 depth: fidl::encoding::Depth,
883 ) -> fidl::Result<()> {
884 encoder.debug_check_bounds::<BeginTransfer>(offset);
885 self.0.encode(encoder, offset + 0, depth)?;
889 self.1.encode(encoder, offset + 8, depth)?;
890 Ok(())
891 }
892 }
893
894 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BeginTransfer {
895 #[inline(always)]
896 fn new_empty() -> Self {
897 Self {
898 new_destination_node: fidl::new_empty!(NodeId, D),
899 transfer_key: fidl::new_empty!(fidl::encoding::Array<u8, 16>, D),
900 }
901 }
902
903 #[inline]
904 unsafe fn decode(
905 &mut self,
906 decoder: &mut fidl::encoding::Decoder<'_, D>,
907 offset: usize,
908 _depth: fidl::encoding::Depth,
909 ) -> fidl::Result<()> {
910 decoder.debug_check_bounds::<Self>(offset);
911 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
912 unsafe {
915 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 24);
916 }
917 Ok(())
918 }
919 }
920
921 impl fidl::encoding::ValueTypeMarker for ChannelHandle {
922 type Borrowed<'a> = &'a Self;
923 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
924 value
925 }
926 }
927
928 unsafe impl fidl::encoding::TypeMarker for ChannelHandle {
929 type Owned = Self;
930
931 #[inline(always)]
932 fn inline_align(_context: fidl::encoding::Context) -> usize {
933 8
934 }
935
936 #[inline(always)]
937 fn inline_size(_context: fidl::encoding::Context) -> usize {
938 24
939 }
940 }
941
942 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ChannelHandle, D>
943 for &ChannelHandle
944 {
945 #[inline]
946 unsafe fn encode(
947 self,
948 encoder: &mut fidl::encoding::Encoder<'_, D>,
949 offset: usize,
950 _depth: fidl::encoding::Depth,
951 ) -> fidl::Result<()> {
952 encoder.debug_check_bounds::<ChannelHandle>(offset);
953 fidl::encoding::Encode::<ChannelHandle, D>::encode(
955 (
956 <ChannelRights as fidl::encoding::ValueTypeMarker>::borrow(&self.rights),
957 <StreamRef as fidl::encoding::ValueTypeMarker>::borrow(&self.stream_ref),
958 ),
959 encoder,
960 offset,
961 _depth,
962 )
963 }
964 }
965 unsafe impl<
966 D: fidl::encoding::ResourceDialect,
967 T0: fidl::encoding::Encode<ChannelRights, D>,
968 T1: fidl::encoding::Encode<StreamRef, D>,
969 > fidl::encoding::Encode<ChannelHandle, D> for (T0, T1)
970 {
971 #[inline]
972 unsafe fn encode(
973 self,
974 encoder: &mut fidl::encoding::Encoder<'_, D>,
975 offset: usize,
976 depth: fidl::encoding::Depth,
977 ) -> fidl::Result<()> {
978 encoder.debug_check_bounds::<ChannelHandle>(offset);
979 unsafe {
982 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
983 (ptr as *mut u64).write_unaligned(0);
984 }
985 self.0.encode(encoder, offset + 0, depth)?;
987 self.1.encode(encoder, offset + 8, depth)?;
988 Ok(())
989 }
990 }
991
992 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ChannelHandle {
993 #[inline(always)]
994 fn new_empty() -> Self {
995 Self {
996 rights: fidl::new_empty!(ChannelRights, D),
997 stream_ref: fidl::new_empty!(StreamRef, D),
998 }
999 }
1000
1001 #[inline]
1002 unsafe fn decode(
1003 &mut self,
1004 decoder: &mut fidl::encoding::Decoder<'_, D>,
1005 offset: usize,
1006 _depth: fidl::encoding::Depth,
1007 ) -> fidl::Result<()> {
1008 decoder.debug_check_bounds::<Self>(offset);
1009 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
1011 let padval = unsafe { (ptr as *const u64).read_unaligned() };
1012 let mask = 0xffffffff00000000u64;
1013 let maskedval = padval & mask;
1014 if maskedval != 0 {
1015 return Err(fidl::Error::NonZeroPadding {
1016 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
1017 });
1018 }
1019 fidl::decode!(ChannelRights, D, &mut self.rights, decoder, offset + 0, _depth)?;
1020 fidl::decode!(StreamRef, D, &mut self.stream_ref, decoder, offset + 8, _depth)?;
1021 Ok(())
1022 }
1023 }
1024
1025 impl fidl::encoding::ValueTypeMarker for ConnectToService {
1026 type Borrowed<'a> = &'a Self;
1027 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1028 value
1029 }
1030 }
1031
1032 unsafe impl fidl::encoding::TypeMarker for ConnectToService {
1033 type Owned = Self;
1034
1035 #[inline(always)]
1036 fn inline_align(_context: fidl::encoding::Context) -> usize {
1037 8
1038 }
1039
1040 #[inline(always)]
1041 fn inline_size(_context: fidl::encoding::Context) -> usize {
1042 56
1043 }
1044 }
1045
1046 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ConnectToService, D>
1047 for &ConnectToService
1048 {
1049 #[inline]
1050 unsafe fn encode(
1051 self,
1052 encoder: &mut fidl::encoding::Encoder<'_, D>,
1053 offset: usize,
1054 _depth: fidl::encoding::Depth,
1055 ) -> fidl::Result<()> {
1056 encoder.debug_check_bounds::<ConnectToService>(offset);
1057 fidl::encoding::Encode::<ConnectToService, D>::encode(
1059 (
1060 <fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(
1061 &self.service_name,
1062 ),
1063 <StreamRef as fidl::encoding::ValueTypeMarker>::borrow(&self.stream_ref),
1064 <ChannelRights as fidl::encoding::ValueTypeMarker>::borrow(&self.rights),
1065 <ConnectToServiceOptions as fidl::encoding::ValueTypeMarker>::borrow(
1066 &self.options,
1067 ),
1068 ),
1069 encoder,
1070 offset,
1071 _depth,
1072 )
1073 }
1074 }
1075 unsafe impl<
1076 D: fidl::encoding::ResourceDialect,
1077 T0: fidl::encoding::Encode<fidl::encoding::BoundedString<255>, D>,
1078 T1: fidl::encoding::Encode<StreamRef, D>,
1079 T2: fidl::encoding::Encode<ChannelRights, D>,
1080 T3: fidl::encoding::Encode<ConnectToServiceOptions, D>,
1081 > fidl::encoding::Encode<ConnectToService, D> for (T0, T1, T2, T3)
1082 {
1083 #[inline]
1084 unsafe fn encode(
1085 self,
1086 encoder: &mut fidl::encoding::Encoder<'_, D>,
1087 offset: usize,
1088 depth: fidl::encoding::Depth,
1089 ) -> fidl::Result<()> {
1090 encoder.debug_check_bounds::<ConnectToService>(offset);
1091 unsafe {
1094 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
1095 (ptr as *mut u64).write_unaligned(0);
1096 }
1097 self.0.encode(encoder, offset + 0, depth)?;
1099 self.1.encode(encoder, offset + 16, depth)?;
1100 self.2.encode(encoder, offset + 32, depth)?;
1101 self.3.encode(encoder, offset + 40, depth)?;
1102 Ok(())
1103 }
1104 }
1105
1106 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ConnectToService {
1107 #[inline(always)]
1108 fn new_empty() -> Self {
1109 Self {
1110 service_name: fidl::new_empty!(fidl::encoding::BoundedString<255>, D),
1111 stream_ref: fidl::new_empty!(StreamRef, D),
1112 rights: fidl::new_empty!(ChannelRights, D),
1113 options: fidl::new_empty!(ConnectToServiceOptions, D),
1114 }
1115 }
1116
1117 #[inline]
1118 unsafe fn decode(
1119 &mut self,
1120 decoder: &mut fidl::encoding::Decoder<'_, D>,
1121 offset: usize,
1122 _depth: fidl::encoding::Depth,
1123 ) -> fidl::Result<()> {
1124 decoder.debug_check_bounds::<Self>(offset);
1125 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
1127 let padval = unsafe { (ptr as *const u64).read_unaligned() };
1128 let mask = 0xffffffff00000000u64;
1129 let maskedval = padval & mask;
1130 if maskedval != 0 {
1131 return Err(fidl::Error::NonZeroPadding {
1132 padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
1133 });
1134 }
1135 fidl::decode!(
1136 fidl::encoding::BoundedString<255>,
1137 D,
1138 &mut self.service_name,
1139 decoder,
1140 offset + 0,
1141 _depth
1142 )?;
1143 fidl::decode!(StreamRef, D, &mut self.stream_ref, decoder, offset + 16, _depth)?;
1144 fidl::decode!(ChannelRights, D, &mut self.rights, decoder, offset + 32, _depth)?;
1145 fidl::decode!(
1146 ConnectToServiceOptions,
1147 D,
1148 &mut self.options,
1149 decoder,
1150 offset + 40,
1151 _depth
1152 )?;
1153 Ok(())
1154 }
1155 }
1156
1157 impl fidl::encoding::ValueTypeMarker for Empty {
1158 type Borrowed<'a> = &'a Self;
1159 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1160 value
1161 }
1162 }
1163
1164 unsafe impl fidl::encoding::TypeMarker for Empty {
1165 type Owned = Self;
1166
1167 #[inline(always)]
1168 fn inline_align(_context: fidl::encoding::Context) -> usize {
1169 1
1170 }
1171
1172 #[inline(always)]
1173 fn inline_size(_context: fidl::encoding::Context) -> usize {
1174 1
1175 }
1176 }
1177
1178 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Empty, D> for &Empty {
1179 #[inline]
1180 unsafe fn encode(
1181 self,
1182 encoder: &mut fidl::encoding::Encoder<'_, D>,
1183 offset: usize,
1184 _depth: fidl::encoding::Depth,
1185 ) -> fidl::Result<()> {
1186 encoder.debug_check_bounds::<Empty>(offset);
1187 encoder.write_num(0u8, offset);
1188 Ok(())
1189 }
1190 }
1191
1192 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Empty {
1193 #[inline(always)]
1194 fn new_empty() -> Self {
1195 Self
1196 }
1197
1198 #[inline]
1199 unsafe fn decode(
1200 &mut self,
1201 decoder: &mut fidl::encoding::Decoder<'_, D>,
1202 offset: usize,
1203 _depth: fidl::encoding::Depth,
1204 ) -> fidl::Result<()> {
1205 decoder.debug_check_bounds::<Self>(offset);
1206 match decoder.read_num::<u8>(offset) {
1207 0 => Ok(()),
1208 _ => Err(fidl::Error::Invalid),
1209 }
1210 }
1211 }
1212
1213 impl fidl::encoding::ValueTypeMarker for EventPairHandle {
1214 type Borrowed<'a> = &'a Self;
1215 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1216 value
1217 }
1218 }
1219
1220 unsafe impl fidl::encoding::TypeMarker for EventPairHandle {
1221 type Owned = Self;
1222
1223 #[inline(always)]
1224 fn inline_align(_context: fidl::encoding::Context) -> usize {
1225 8
1226 }
1227
1228 #[inline(always)]
1229 fn inline_size(_context: fidl::encoding::Context) -> usize {
1230 24
1231 }
1232 }
1233
1234 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<EventPairHandle, D>
1235 for &EventPairHandle
1236 {
1237 #[inline]
1238 unsafe fn encode(
1239 self,
1240 encoder: &mut fidl::encoding::Encoder<'_, D>,
1241 offset: usize,
1242 _depth: fidl::encoding::Depth,
1243 ) -> fidl::Result<()> {
1244 encoder.debug_check_bounds::<EventPairHandle>(offset);
1245 fidl::encoding::Encode::<EventPairHandle, D>::encode(
1247 (
1248 <EventPairRights as fidl::encoding::ValueTypeMarker>::borrow(&self.rights),
1249 <StreamRef as fidl::encoding::ValueTypeMarker>::borrow(&self.stream_ref),
1250 ),
1251 encoder,
1252 offset,
1253 _depth,
1254 )
1255 }
1256 }
1257 unsafe impl<
1258 D: fidl::encoding::ResourceDialect,
1259 T0: fidl::encoding::Encode<EventPairRights, D>,
1260 T1: fidl::encoding::Encode<StreamRef, D>,
1261 > fidl::encoding::Encode<EventPairHandle, D> for (T0, T1)
1262 {
1263 #[inline]
1264 unsafe fn encode(
1265 self,
1266 encoder: &mut fidl::encoding::Encoder<'_, D>,
1267 offset: usize,
1268 depth: fidl::encoding::Depth,
1269 ) -> fidl::Result<()> {
1270 encoder.debug_check_bounds::<EventPairHandle>(offset);
1271 unsafe {
1274 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
1275 (ptr as *mut u64).write_unaligned(0);
1276 }
1277 self.0.encode(encoder, offset + 0, depth)?;
1279 self.1.encode(encoder, offset + 8, depth)?;
1280 Ok(())
1281 }
1282 }
1283
1284 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for EventPairHandle {
1285 #[inline(always)]
1286 fn new_empty() -> Self {
1287 Self {
1288 rights: fidl::new_empty!(EventPairRights, D),
1289 stream_ref: fidl::new_empty!(StreamRef, D),
1290 }
1291 }
1292
1293 #[inline]
1294 unsafe fn decode(
1295 &mut self,
1296 decoder: &mut fidl::encoding::Decoder<'_, D>,
1297 offset: usize,
1298 _depth: fidl::encoding::Depth,
1299 ) -> fidl::Result<()> {
1300 decoder.debug_check_bounds::<Self>(offset);
1301 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
1303 let padval = unsafe { (ptr as *const u64).read_unaligned() };
1304 let mask = 0xffffffff00000000u64;
1305 let maskedval = padval & mask;
1306 if maskedval != 0 {
1307 return Err(fidl::Error::NonZeroPadding {
1308 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
1309 });
1310 }
1311 fidl::decode!(EventPairRights, D, &mut self.rights, decoder, offset + 0, _depth)?;
1312 fidl::decode!(StreamRef, D, &mut self.stream_ref, decoder, offset + 8, _depth)?;
1313 Ok(())
1314 }
1315 }
1316
1317 impl fidl::encoding::ValueTypeMarker for NodeId {
1318 type Borrowed<'a> = &'a Self;
1319 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1320 value
1321 }
1322 }
1323
1324 unsafe impl fidl::encoding::TypeMarker for NodeId {
1325 type Owned = Self;
1326
1327 #[inline(always)]
1328 fn inline_align(_context: fidl::encoding::Context) -> usize {
1329 8
1330 }
1331
1332 #[inline(always)]
1333 fn inline_size(_context: fidl::encoding::Context) -> usize {
1334 8
1335 }
1336 #[inline(always)]
1337 fn encode_is_copy() -> bool {
1338 true
1339 }
1340
1341 #[inline(always)]
1342 fn decode_is_copy() -> bool {
1343 true
1344 }
1345 }
1346
1347 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<NodeId, D> for &NodeId {
1348 #[inline]
1349 unsafe fn encode(
1350 self,
1351 encoder: &mut fidl::encoding::Encoder<'_, D>,
1352 offset: usize,
1353 _depth: fidl::encoding::Depth,
1354 ) -> fidl::Result<()> {
1355 encoder.debug_check_bounds::<NodeId>(offset);
1356 unsafe {
1357 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1359 (buf_ptr as *mut NodeId).write_unaligned((self as *const NodeId).read());
1360 }
1363 Ok(())
1364 }
1365 }
1366 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
1367 fidl::encoding::Encode<NodeId, D> for (T0,)
1368 {
1369 #[inline]
1370 unsafe fn encode(
1371 self,
1372 encoder: &mut fidl::encoding::Encoder<'_, D>,
1373 offset: usize,
1374 depth: fidl::encoding::Depth,
1375 ) -> fidl::Result<()> {
1376 encoder.debug_check_bounds::<NodeId>(offset);
1377 self.0.encode(encoder, offset + 0, depth)?;
1381 Ok(())
1382 }
1383 }
1384
1385 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for NodeId {
1386 #[inline(always)]
1387 fn new_empty() -> Self {
1388 Self { id: fidl::new_empty!(u64, D) }
1389 }
1390
1391 #[inline]
1392 unsafe fn decode(
1393 &mut self,
1394 decoder: &mut fidl::encoding::Decoder<'_, D>,
1395 offset: usize,
1396 _depth: fidl::encoding::Depth,
1397 ) -> fidl::Result<()> {
1398 decoder.debug_check_bounds::<Self>(offset);
1399 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1400 unsafe {
1403 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
1404 }
1405 Ok(())
1406 }
1407 }
1408
1409 impl fidl::encoding::ValueTypeMarker for OpenTransfer {
1410 type Borrowed<'a> = &'a Self;
1411 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1412 value
1413 }
1414 }
1415
1416 unsafe impl fidl::encoding::TypeMarker for OpenTransfer {
1417 type Owned = Self;
1418
1419 #[inline(always)]
1420 fn inline_align(_context: fidl::encoding::Context) -> usize {
1421 8
1422 }
1423
1424 #[inline(always)]
1425 fn inline_size(_context: fidl::encoding::Context) -> usize {
1426 24
1427 }
1428 #[inline(always)]
1429 fn encode_is_copy() -> bool {
1430 true
1431 }
1432
1433 #[inline(always)]
1434 fn decode_is_copy() -> bool {
1435 true
1436 }
1437 }
1438
1439 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<OpenTransfer, D>
1440 for &OpenTransfer
1441 {
1442 #[inline]
1443 unsafe fn encode(
1444 self,
1445 encoder: &mut fidl::encoding::Encoder<'_, D>,
1446 offset: usize,
1447 _depth: fidl::encoding::Depth,
1448 ) -> fidl::Result<()> {
1449 encoder.debug_check_bounds::<OpenTransfer>(offset);
1450 unsafe {
1451 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1453 (buf_ptr as *mut OpenTransfer)
1454 .write_unaligned((self as *const OpenTransfer).read());
1455 }
1458 Ok(())
1459 }
1460 }
1461 unsafe impl<
1462 D: fidl::encoding::ResourceDialect,
1463 T0: fidl::encoding::Encode<StreamId, D>,
1464 T1: fidl::encoding::Encode<fidl::encoding::Array<u8, 16>, D>,
1465 > fidl::encoding::Encode<OpenTransfer, D> for (T0, T1)
1466 {
1467 #[inline]
1468 unsafe fn encode(
1469 self,
1470 encoder: &mut fidl::encoding::Encoder<'_, D>,
1471 offset: usize,
1472 depth: fidl::encoding::Depth,
1473 ) -> fidl::Result<()> {
1474 encoder.debug_check_bounds::<OpenTransfer>(offset);
1475 self.0.encode(encoder, offset + 0, depth)?;
1479 self.1.encode(encoder, offset + 8, depth)?;
1480 Ok(())
1481 }
1482 }
1483
1484 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for OpenTransfer {
1485 #[inline(always)]
1486 fn new_empty() -> Self {
1487 Self {
1488 stream_id: fidl::new_empty!(StreamId, D),
1489 transfer_key: fidl::new_empty!(fidl::encoding::Array<u8, 16>, D),
1490 }
1491 }
1492
1493 #[inline]
1494 unsafe fn decode(
1495 &mut self,
1496 decoder: &mut fidl::encoding::Decoder<'_, D>,
1497 offset: usize,
1498 _depth: fidl::encoding::Depth,
1499 ) -> fidl::Result<()> {
1500 decoder.debug_check_bounds::<Self>(offset);
1501 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1502 unsafe {
1505 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 24);
1506 }
1507 Ok(())
1508 }
1509 }
1510
1511 impl fidl::encoding::ValueTypeMarker for SocketHandle {
1512 type Borrowed<'a> = &'a Self;
1513 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1514 value
1515 }
1516 }
1517
1518 unsafe impl fidl::encoding::TypeMarker for SocketHandle {
1519 type Owned = Self;
1520
1521 #[inline(always)]
1522 fn inline_align(_context: fidl::encoding::Context) -> usize {
1523 8
1524 }
1525
1526 #[inline(always)]
1527 fn inline_size(_context: fidl::encoding::Context) -> usize {
1528 32
1529 }
1530 }
1531
1532 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SocketHandle, D>
1533 for &SocketHandle
1534 {
1535 #[inline]
1536 unsafe fn encode(
1537 self,
1538 encoder: &mut fidl::encoding::Encoder<'_, D>,
1539 offset: usize,
1540 _depth: fidl::encoding::Depth,
1541 ) -> fidl::Result<()> {
1542 encoder.debug_check_bounds::<SocketHandle>(offset);
1543 fidl::encoding::Encode::<SocketHandle, D>::encode(
1545 (
1546 <SocketRights as fidl::encoding::ValueTypeMarker>::borrow(&self.rights),
1547 <StreamRef as fidl::encoding::ValueTypeMarker>::borrow(&self.stream_ref),
1548 <SocketType as fidl::encoding::ValueTypeMarker>::borrow(&self.socket_type),
1549 ),
1550 encoder,
1551 offset,
1552 _depth,
1553 )
1554 }
1555 }
1556 unsafe impl<
1557 D: fidl::encoding::ResourceDialect,
1558 T0: fidl::encoding::Encode<SocketRights, D>,
1559 T1: fidl::encoding::Encode<StreamRef, D>,
1560 T2: fidl::encoding::Encode<SocketType, D>,
1561 > fidl::encoding::Encode<SocketHandle, D> for (T0, T1, T2)
1562 {
1563 #[inline]
1564 unsafe fn encode(
1565 self,
1566 encoder: &mut fidl::encoding::Encoder<'_, D>,
1567 offset: usize,
1568 depth: fidl::encoding::Depth,
1569 ) -> fidl::Result<()> {
1570 encoder.debug_check_bounds::<SocketHandle>(offset);
1571 unsafe {
1574 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
1575 (ptr as *mut u64).write_unaligned(0);
1576 }
1577 unsafe {
1578 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(24);
1579 (ptr as *mut u64).write_unaligned(0);
1580 }
1581 self.0.encode(encoder, offset + 0, depth)?;
1583 self.1.encode(encoder, offset + 8, depth)?;
1584 self.2.encode(encoder, offset + 24, depth)?;
1585 Ok(())
1586 }
1587 }
1588
1589 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SocketHandle {
1590 #[inline(always)]
1591 fn new_empty() -> Self {
1592 Self {
1593 rights: fidl::new_empty!(SocketRights, D),
1594 stream_ref: fidl::new_empty!(StreamRef, D),
1595 socket_type: fidl::new_empty!(SocketType, D),
1596 }
1597 }
1598
1599 #[inline]
1600 unsafe fn decode(
1601 &mut self,
1602 decoder: &mut fidl::encoding::Decoder<'_, D>,
1603 offset: usize,
1604 _depth: fidl::encoding::Depth,
1605 ) -> fidl::Result<()> {
1606 decoder.debug_check_bounds::<Self>(offset);
1607 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
1609 let padval = unsafe { (ptr as *const u64).read_unaligned() };
1610 let mask = 0xffffffff00000000u64;
1611 let maskedval = padval & mask;
1612 if maskedval != 0 {
1613 return Err(fidl::Error::NonZeroPadding {
1614 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
1615 });
1616 }
1617 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(24) };
1618 let padval = unsafe { (ptr as *const u64).read_unaligned() };
1619 let mask = 0xffffffff00000000u64;
1620 let maskedval = padval & mask;
1621 if maskedval != 0 {
1622 return Err(fidl::Error::NonZeroPadding {
1623 padding_start: offset + 24 + ((mask as u64).trailing_zeros() / 8) as usize,
1624 });
1625 }
1626 fidl::decode!(SocketRights, D, &mut self.rights, decoder, offset + 0, _depth)?;
1627 fidl::decode!(StreamRef, D, &mut self.stream_ref, decoder, offset + 8, _depth)?;
1628 fidl::decode!(SocketType, D, &mut self.socket_type, decoder, offset + 24, _depth)?;
1629 Ok(())
1630 }
1631 }
1632
1633 impl fidl::encoding::ValueTypeMarker for StreamId {
1634 type Borrowed<'a> = &'a Self;
1635 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1636 value
1637 }
1638 }
1639
1640 unsafe impl fidl::encoding::TypeMarker for StreamId {
1641 type Owned = Self;
1642
1643 #[inline(always)]
1644 fn inline_align(_context: fidl::encoding::Context) -> usize {
1645 8
1646 }
1647
1648 #[inline(always)]
1649 fn inline_size(_context: fidl::encoding::Context) -> usize {
1650 8
1651 }
1652 #[inline(always)]
1653 fn encode_is_copy() -> bool {
1654 true
1655 }
1656
1657 #[inline(always)]
1658 fn decode_is_copy() -> bool {
1659 true
1660 }
1661 }
1662
1663 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<StreamId, D> for &StreamId {
1664 #[inline]
1665 unsafe fn encode(
1666 self,
1667 encoder: &mut fidl::encoding::Encoder<'_, D>,
1668 offset: usize,
1669 _depth: fidl::encoding::Depth,
1670 ) -> fidl::Result<()> {
1671 encoder.debug_check_bounds::<StreamId>(offset);
1672 unsafe {
1673 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1675 (buf_ptr as *mut StreamId).write_unaligned((self as *const StreamId).read());
1676 }
1679 Ok(())
1680 }
1681 }
1682 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
1683 fidl::encoding::Encode<StreamId, D> for (T0,)
1684 {
1685 #[inline]
1686 unsafe fn encode(
1687 self,
1688 encoder: &mut fidl::encoding::Encoder<'_, D>,
1689 offset: usize,
1690 depth: fidl::encoding::Depth,
1691 ) -> fidl::Result<()> {
1692 encoder.debug_check_bounds::<StreamId>(offset);
1693 self.0.encode(encoder, offset + 0, depth)?;
1697 Ok(())
1698 }
1699 }
1700
1701 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for StreamId {
1702 #[inline(always)]
1703 fn new_empty() -> Self {
1704 Self { id: fidl::new_empty!(u64, D) }
1705 }
1706
1707 #[inline]
1708 unsafe fn decode(
1709 &mut self,
1710 decoder: &mut fidl::encoding::Decoder<'_, D>,
1711 offset: usize,
1712 _depth: fidl::encoding::Depth,
1713 ) -> fidl::Result<()> {
1714 decoder.debug_check_bounds::<Self>(offset);
1715 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1716 unsafe {
1719 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
1720 }
1721 Ok(())
1722 }
1723 }
1724
1725 impl fidl::encoding::ValueTypeMarker for TransferInitiator {
1726 type Borrowed<'a> = &'a Self;
1727 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1728 value
1729 }
1730 }
1731
1732 unsafe impl fidl::encoding::TypeMarker for TransferInitiator {
1733 type Owned = Self;
1734
1735 #[inline(always)]
1736 fn inline_align(_context: fidl::encoding::Context) -> usize {
1737 8
1738 }
1739
1740 #[inline(always)]
1741 fn inline_size(_context: fidl::encoding::Context) -> usize {
1742 32
1743 }
1744 #[inline(always)]
1745 fn encode_is_copy() -> bool {
1746 true
1747 }
1748
1749 #[inline(always)]
1750 fn decode_is_copy() -> bool {
1751 true
1752 }
1753 }
1754
1755 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<TransferInitiator, D>
1756 for &TransferInitiator
1757 {
1758 #[inline]
1759 unsafe fn encode(
1760 self,
1761 encoder: &mut fidl::encoding::Encoder<'_, D>,
1762 offset: usize,
1763 _depth: fidl::encoding::Depth,
1764 ) -> fidl::Result<()> {
1765 encoder.debug_check_bounds::<TransferInitiator>(offset);
1766 unsafe {
1767 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1769 (buf_ptr as *mut TransferInitiator)
1770 .write_unaligned((self as *const TransferInitiator).read());
1771 }
1774 Ok(())
1775 }
1776 }
1777 unsafe impl<
1778 D: fidl::encoding::ResourceDialect,
1779 T0: fidl::encoding::Encode<StreamId, D>,
1780 T1: fidl::encoding::Encode<NodeId, D>,
1781 T2: fidl::encoding::Encode<fidl::encoding::Array<u8, 16>, D>,
1782 > fidl::encoding::Encode<TransferInitiator, D> for (T0, T1, T2)
1783 {
1784 #[inline]
1785 unsafe fn encode(
1786 self,
1787 encoder: &mut fidl::encoding::Encoder<'_, D>,
1788 offset: usize,
1789 depth: fidl::encoding::Depth,
1790 ) -> fidl::Result<()> {
1791 encoder.debug_check_bounds::<TransferInitiator>(offset);
1792 self.0.encode(encoder, offset + 0, depth)?;
1796 self.1.encode(encoder, offset + 8, depth)?;
1797 self.2.encode(encoder, offset + 16, depth)?;
1798 Ok(())
1799 }
1800 }
1801
1802 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TransferInitiator {
1803 #[inline(always)]
1804 fn new_empty() -> Self {
1805 Self {
1806 stream_id: fidl::new_empty!(StreamId, D),
1807 new_destination_node: fidl::new_empty!(NodeId, D),
1808 transfer_key: fidl::new_empty!(fidl::encoding::Array<u8, 16>, D),
1809 }
1810 }
1811
1812 #[inline]
1813 unsafe fn decode(
1814 &mut self,
1815 decoder: &mut fidl::encoding::Decoder<'_, D>,
1816 offset: usize,
1817 _depth: fidl::encoding::Depth,
1818 ) -> fidl::Result<()> {
1819 decoder.debug_check_bounds::<Self>(offset);
1820 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1821 unsafe {
1824 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 32);
1825 }
1826 Ok(())
1827 }
1828 }
1829
1830 impl fidl::encoding::ValueTypeMarker for TransferWaiter {
1831 type Borrowed<'a> = &'a Self;
1832 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1833 value
1834 }
1835 }
1836
1837 unsafe impl fidl::encoding::TypeMarker for TransferWaiter {
1838 type Owned = Self;
1839
1840 #[inline(always)]
1841 fn inline_align(_context: fidl::encoding::Context) -> usize {
1842 8
1843 }
1844
1845 #[inline(always)]
1846 fn inline_size(_context: fidl::encoding::Context) -> usize {
1847 24
1848 }
1849 #[inline(always)]
1850 fn encode_is_copy() -> bool {
1851 true
1852 }
1853
1854 #[inline(always)]
1855 fn decode_is_copy() -> bool {
1856 true
1857 }
1858 }
1859
1860 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<TransferWaiter, D>
1861 for &TransferWaiter
1862 {
1863 #[inline]
1864 unsafe fn encode(
1865 self,
1866 encoder: &mut fidl::encoding::Encoder<'_, D>,
1867 offset: usize,
1868 _depth: fidl::encoding::Depth,
1869 ) -> fidl::Result<()> {
1870 encoder.debug_check_bounds::<TransferWaiter>(offset);
1871 unsafe {
1872 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1874 (buf_ptr as *mut TransferWaiter)
1875 .write_unaligned((self as *const TransferWaiter).read());
1876 }
1879 Ok(())
1880 }
1881 }
1882 unsafe impl<
1883 D: fidl::encoding::ResourceDialect,
1884 T0: fidl::encoding::Encode<StreamId, D>,
1885 T1: fidl::encoding::Encode<fidl::encoding::Array<u8, 16>, D>,
1886 > fidl::encoding::Encode<TransferWaiter, D> for (T0, T1)
1887 {
1888 #[inline]
1889 unsafe fn encode(
1890 self,
1891 encoder: &mut fidl::encoding::Encoder<'_, D>,
1892 offset: usize,
1893 depth: fidl::encoding::Depth,
1894 ) -> fidl::Result<()> {
1895 encoder.debug_check_bounds::<TransferWaiter>(offset);
1896 self.0.encode(encoder, offset + 0, depth)?;
1900 self.1.encode(encoder, offset + 8, depth)?;
1901 Ok(())
1902 }
1903 }
1904
1905 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TransferWaiter {
1906 #[inline(always)]
1907 fn new_empty() -> Self {
1908 Self {
1909 stream_id: fidl::new_empty!(StreamId, D),
1910 transfer_key: fidl::new_empty!(fidl::encoding::Array<u8, 16>, D),
1911 }
1912 }
1913
1914 #[inline]
1915 unsafe fn decode(
1916 &mut self,
1917 decoder: &mut fidl::encoding::Decoder<'_, D>,
1918 offset: usize,
1919 _depth: fidl::encoding::Depth,
1920 ) -> fidl::Result<()> {
1921 decoder.debug_check_bounds::<Self>(offset);
1922 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1923 unsafe {
1926 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 24);
1927 }
1928 Ok(())
1929 }
1930 }
1931
1932 impl fidl::encoding::ValueTypeMarker for ZirconChannelMessage {
1933 type Borrowed<'a> = &'a Self;
1934 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1935 value
1936 }
1937 }
1938
1939 unsafe impl fidl::encoding::TypeMarker for ZirconChannelMessage {
1940 type Owned = Self;
1941
1942 #[inline(always)]
1943 fn inline_align(_context: fidl::encoding::Context) -> usize {
1944 8
1945 }
1946
1947 #[inline(always)]
1948 fn inline_size(_context: fidl::encoding::Context) -> usize {
1949 32
1950 }
1951 }
1952
1953 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ZirconChannelMessage, D>
1954 for &ZirconChannelMessage
1955 {
1956 #[inline]
1957 unsafe fn encode(
1958 self,
1959 encoder: &mut fidl::encoding::Encoder<'_, D>,
1960 offset: usize,
1961 _depth: fidl::encoding::Depth,
1962 ) -> fidl::Result<()> {
1963 encoder.debug_check_bounds::<ZirconChannelMessage>(offset);
1964 fidl::encoding::Encode::<ZirconChannelMessage, D>::encode(
1966 (
1967 <fidl::encoding::Vector<u8, 65536> as fidl::encoding::ValueTypeMarker>::borrow(&self.bytes),
1968 <fidl::encoding::Vector<ZirconHandle, 64> as fidl::encoding::ValueTypeMarker>::borrow(&self.handles),
1969 ),
1970 encoder, offset, _depth
1971 )
1972 }
1973 }
1974 unsafe impl<
1975 D: fidl::encoding::ResourceDialect,
1976 T0: fidl::encoding::Encode<fidl::encoding::Vector<u8, 65536>, D>,
1977 T1: fidl::encoding::Encode<fidl::encoding::Vector<ZirconHandle, 64>, D>,
1978 > fidl::encoding::Encode<ZirconChannelMessage, D> for (T0, T1)
1979 {
1980 #[inline]
1981 unsafe fn encode(
1982 self,
1983 encoder: &mut fidl::encoding::Encoder<'_, D>,
1984 offset: usize,
1985 depth: fidl::encoding::Depth,
1986 ) -> fidl::Result<()> {
1987 encoder.debug_check_bounds::<ZirconChannelMessage>(offset);
1988 self.0.encode(encoder, offset + 0, depth)?;
1992 self.1.encode(encoder, offset + 16, depth)?;
1993 Ok(())
1994 }
1995 }
1996
1997 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ZirconChannelMessage {
1998 #[inline(always)]
1999 fn new_empty() -> Self {
2000 Self {
2001 bytes: fidl::new_empty!(fidl::encoding::Vector<u8, 65536>, D),
2002 handles: fidl::new_empty!(fidl::encoding::Vector<ZirconHandle, 64>, D),
2003 }
2004 }
2005
2006 #[inline]
2007 unsafe fn decode(
2008 &mut self,
2009 decoder: &mut fidl::encoding::Decoder<'_, D>,
2010 offset: usize,
2011 _depth: fidl::encoding::Depth,
2012 ) -> fidl::Result<()> {
2013 decoder.debug_check_bounds::<Self>(offset);
2014 fidl::decode!(fidl::encoding::Vector<u8, 65536>, D, &mut self.bytes, decoder, offset + 0, _depth)?;
2016 fidl::decode!(fidl::encoding::Vector<ZirconHandle, 64>, D, &mut self.handles, decoder, offset + 16, _depth)?;
2017 Ok(())
2018 }
2019 }
2020
2021 impl ConfigRequest {
2022 #[inline(always)]
2023 fn max_ordinal_present(&self) -> u64 {
2024 0
2025 }
2026 }
2027
2028 impl fidl::encoding::ValueTypeMarker for ConfigRequest {
2029 type Borrowed<'a> = &'a Self;
2030 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2031 value
2032 }
2033 }
2034
2035 unsafe impl fidl::encoding::TypeMarker for ConfigRequest {
2036 type Owned = Self;
2037
2038 #[inline(always)]
2039 fn inline_align(_context: fidl::encoding::Context) -> usize {
2040 8
2041 }
2042
2043 #[inline(always)]
2044 fn inline_size(_context: fidl::encoding::Context) -> usize {
2045 16
2046 }
2047 }
2048
2049 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ConfigRequest, D>
2050 for &ConfigRequest
2051 {
2052 unsafe fn encode(
2053 self,
2054 encoder: &mut fidl::encoding::Encoder<'_, D>,
2055 offset: usize,
2056 mut depth: fidl::encoding::Depth,
2057 ) -> fidl::Result<()> {
2058 encoder.debug_check_bounds::<ConfigRequest>(offset);
2059 let max_ordinal: u64 = self.max_ordinal_present();
2061 encoder.write_num(max_ordinal, offset);
2062 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2063 if max_ordinal == 0 {
2065 return Ok(());
2066 }
2067 depth.increment()?;
2068 let envelope_size = 8;
2069 let bytes_len = max_ordinal as usize * envelope_size;
2070 #[allow(unused_variables)]
2071 let offset = encoder.out_of_line_offset(bytes_len);
2072 let mut _prev_end_offset: usize = 0;
2073
2074 Ok(())
2075 }
2076 }
2077
2078 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ConfigRequest {
2079 #[inline(always)]
2080 fn new_empty() -> Self {
2081 Self::default()
2082 }
2083
2084 unsafe fn decode(
2085 &mut self,
2086 decoder: &mut fidl::encoding::Decoder<'_, D>,
2087 offset: usize,
2088 mut depth: fidl::encoding::Depth,
2089 ) -> fidl::Result<()> {
2090 decoder.debug_check_bounds::<Self>(offset);
2091 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2092 None => return Err(fidl::Error::NotNullable),
2093 Some(len) => len,
2094 };
2095 if len == 0 {
2097 return Ok(());
2098 };
2099 depth.increment()?;
2100 let envelope_size = 8;
2101 let bytes_len = len * envelope_size;
2102 let offset = decoder.out_of_line_offset(bytes_len)?;
2103 let mut _next_ordinal_to_read = 0;
2105 let mut next_offset = offset;
2106 let end_offset = offset + bytes_len;
2107
2108 while next_offset < end_offset {
2110 _next_ordinal_to_read += 1;
2111 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2112 next_offset += envelope_size;
2113 }
2114
2115 Ok(())
2116 }
2117 }
2118
2119 impl ConfigResponse {
2120 #[inline(always)]
2121 fn max_ordinal_present(&self) -> u64 {
2122 0
2123 }
2124 }
2125
2126 impl fidl::encoding::ValueTypeMarker for ConfigResponse {
2127 type Borrowed<'a> = &'a Self;
2128 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2129 value
2130 }
2131 }
2132
2133 unsafe impl fidl::encoding::TypeMarker for ConfigResponse {
2134 type Owned = Self;
2135
2136 #[inline(always)]
2137 fn inline_align(_context: fidl::encoding::Context) -> usize {
2138 8
2139 }
2140
2141 #[inline(always)]
2142 fn inline_size(_context: fidl::encoding::Context) -> usize {
2143 16
2144 }
2145 }
2146
2147 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ConfigResponse, D>
2148 for &ConfigResponse
2149 {
2150 unsafe fn encode(
2151 self,
2152 encoder: &mut fidl::encoding::Encoder<'_, D>,
2153 offset: usize,
2154 mut depth: fidl::encoding::Depth,
2155 ) -> fidl::Result<()> {
2156 encoder.debug_check_bounds::<ConfigResponse>(offset);
2157 let max_ordinal: u64 = self.max_ordinal_present();
2159 encoder.write_num(max_ordinal, offset);
2160 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2161 if max_ordinal == 0 {
2163 return Ok(());
2164 }
2165 depth.increment()?;
2166 let envelope_size = 8;
2167 let bytes_len = max_ordinal as usize * envelope_size;
2168 #[allow(unused_variables)]
2169 let offset = encoder.out_of_line_offset(bytes_len);
2170 let mut _prev_end_offset: usize = 0;
2171
2172 Ok(())
2173 }
2174 }
2175
2176 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ConfigResponse {
2177 #[inline(always)]
2178 fn new_empty() -> Self {
2179 Self::default()
2180 }
2181
2182 unsafe fn decode(
2183 &mut self,
2184 decoder: &mut fidl::encoding::Decoder<'_, D>,
2185 offset: usize,
2186 mut depth: fidl::encoding::Depth,
2187 ) -> fidl::Result<()> {
2188 decoder.debug_check_bounds::<Self>(offset);
2189 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2190 None => return Err(fidl::Error::NotNullable),
2191 Some(len) => len,
2192 };
2193 if len == 0 {
2195 return Ok(());
2196 };
2197 depth.increment()?;
2198 let envelope_size = 8;
2199 let bytes_len = len * envelope_size;
2200 let offset = decoder.out_of_line_offset(bytes_len)?;
2201 let mut _next_ordinal_to_read = 0;
2203 let mut next_offset = offset;
2204 let end_offset = offset + bytes_len;
2205
2206 while next_offset < end_offset {
2208 _next_ordinal_to_read += 1;
2209 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2210 next_offset += envelope_size;
2211 }
2212
2213 Ok(())
2214 }
2215 }
2216
2217 impl ConnectToServiceOptions {
2218 #[inline(always)]
2219 fn max_ordinal_present(&self) -> u64 {
2220 0
2221 }
2222 }
2223
2224 impl fidl::encoding::ValueTypeMarker for ConnectToServiceOptions {
2225 type Borrowed<'a> = &'a Self;
2226 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2227 value
2228 }
2229 }
2230
2231 unsafe impl fidl::encoding::TypeMarker for ConnectToServiceOptions {
2232 type Owned = Self;
2233
2234 #[inline(always)]
2235 fn inline_align(_context: fidl::encoding::Context) -> usize {
2236 8
2237 }
2238
2239 #[inline(always)]
2240 fn inline_size(_context: fidl::encoding::Context) -> usize {
2241 16
2242 }
2243 }
2244
2245 unsafe impl<D: fidl::encoding::ResourceDialect>
2246 fidl::encoding::Encode<ConnectToServiceOptions, D> for &ConnectToServiceOptions
2247 {
2248 unsafe fn encode(
2249 self,
2250 encoder: &mut fidl::encoding::Encoder<'_, D>,
2251 offset: usize,
2252 mut depth: fidl::encoding::Depth,
2253 ) -> fidl::Result<()> {
2254 encoder.debug_check_bounds::<ConnectToServiceOptions>(offset);
2255 let max_ordinal: u64 = self.max_ordinal_present();
2257 encoder.write_num(max_ordinal, offset);
2258 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2259 if max_ordinal == 0 {
2261 return Ok(());
2262 }
2263 depth.increment()?;
2264 let envelope_size = 8;
2265 let bytes_len = max_ordinal as usize * envelope_size;
2266 #[allow(unused_variables)]
2267 let offset = encoder.out_of_line_offset(bytes_len);
2268 let mut _prev_end_offset: usize = 0;
2269
2270 Ok(())
2271 }
2272 }
2273
2274 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2275 for ConnectToServiceOptions
2276 {
2277 #[inline(always)]
2278 fn new_empty() -> Self {
2279 Self::default()
2280 }
2281
2282 unsafe fn decode(
2283 &mut self,
2284 decoder: &mut fidl::encoding::Decoder<'_, D>,
2285 offset: usize,
2286 mut depth: fidl::encoding::Depth,
2287 ) -> fidl::Result<()> {
2288 decoder.debug_check_bounds::<Self>(offset);
2289 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2290 None => return Err(fidl::Error::NotNullable),
2291 Some(len) => len,
2292 };
2293 if len == 0 {
2295 return Ok(());
2296 };
2297 depth.increment()?;
2298 let envelope_size = 8;
2299 let bytes_len = len * envelope_size;
2300 let offset = decoder.out_of_line_offset(bytes_len)?;
2301 let mut _next_ordinal_to_read = 0;
2303 let mut next_offset = offset;
2304 let end_offset = offset + bytes_len;
2305
2306 while next_offset < end_offset {
2308 _next_ordinal_to_read += 1;
2309 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2310 next_offset += envelope_size;
2311 }
2312
2313 Ok(())
2314 }
2315 }
2316
2317 impl PeerDescription {
2318 #[inline(always)]
2319 fn max_ordinal_present(&self) -> u64 {
2320 if let Some(_) = self.services {
2321 return 1;
2322 }
2323 0
2324 }
2325 }
2326
2327 impl fidl::encoding::ValueTypeMarker for PeerDescription {
2328 type Borrowed<'a> = &'a Self;
2329 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2330 value
2331 }
2332 }
2333
2334 unsafe impl fidl::encoding::TypeMarker for PeerDescription {
2335 type Owned = Self;
2336
2337 #[inline(always)]
2338 fn inline_align(_context: fidl::encoding::Context) -> usize {
2339 8
2340 }
2341
2342 #[inline(always)]
2343 fn inline_size(_context: fidl::encoding::Context) -> usize {
2344 16
2345 }
2346 }
2347
2348 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PeerDescription, D>
2349 for &PeerDescription
2350 {
2351 unsafe fn encode(
2352 self,
2353 encoder: &mut fidl::encoding::Encoder<'_, D>,
2354 offset: usize,
2355 mut depth: fidl::encoding::Depth,
2356 ) -> fidl::Result<()> {
2357 encoder.debug_check_bounds::<PeerDescription>(offset);
2358 let max_ordinal: u64 = self.max_ordinal_present();
2360 encoder.write_num(max_ordinal, offset);
2361 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2362 if max_ordinal == 0 {
2364 return Ok(());
2365 }
2366 depth.increment()?;
2367 let envelope_size = 8;
2368 let bytes_len = max_ordinal as usize * envelope_size;
2369 #[allow(unused_variables)]
2370 let offset = encoder.out_of_line_offset(bytes_len);
2371 let mut _prev_end_offset: usize = 0;
2372 if 1 > max_ordinal {
2373 return Ok(());
2374 }
2375
2376 let cur_offset: usize = (1 - 1) * envelope_size;
2379
2380 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2382
2383 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<255>>, D>(
2388 self.services.as_ref().map(<fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<255>> as fidl::encoding::ValueTypeMarker>::borrow),
2389 encoder, offset + cur_offset, depth
2390 )?;
2391
2392 _prev_end_offset = cur_offset + envelope_size;
2393
2394 Ok(())
2395 }
2396 }
2397
2398 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PeerDescription {
2399 #[inline(always)]
2400 fn new_empty() -> Self {
2401 Self::default()
2402 }
2403
2404 unsafe fn decode(
2405 &mut self,
2406 decoder: &mut fidl::encoding::Decoder<'_, D>,
2407 offset: usize,
2408 mut depth: fidl::encoding::Depth,
2409 ) -> fidl::Result<()> {
2410 decoder.debug_check_bounds::<Self>(offset);
2411 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2412 None => return Err(fidl::Error::NotNullable),
2413 Some(len) => len,
2414 };
2415 if len == 0 {
2417 return Ok(());
2418 };
2419 depth.increment()?;
2420 let envelope_size = 8;
2421 let bytes_len = len * envelope_size;
2422 let offset = decoder.out_of_line_offset(bytes_len)?;
2423 let mut _next_ordinal_to_read = 0;
2425 let mut next_offset = offset;
2426 let end_offset = offset + bytes_len;
2427 _next_ordinal_to_read += 1;
2428 if next_offset >= end_offset {
2429 return Ok(());
2430 }
2431
2432 while _next_ordinal_to_read < 1 {
2434 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2435 _next_ordinal_to_read += 1;
2436 next_offset += envelope_size;
2437 }
2438
2439 let next_out_of_line = decoder.next_out_of_line();
2440 let handles_before = decoder.remaining_handles();
2441 if let Some((inlined, num_bytes, num_handles)) =
2442 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2443 {
2444 let member_inline_size = <fidl::encoding::UnboundedVector<
2445 fidl::encoding::BoundedString<255>,
2446 > as fidl::encoding::TypeMarker>::inline_size(
2447 decoder.context
2448 );
2449 if inlined != (member_inline_size <= 4) {
2450 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2451 }
2452 let inner_offset;
2453 let mut inner_depth = depth.clone();
2454 if inlined {
2455 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2456 inner_offset = next_offset;
2457 } else {
2458 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2459 inner_depth.increment()?;
2460 }
2461 let val_ref = self.services.get_or_insert_with(|| {
2462 fidl::new_empty!(
2463 fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<255>>,
2464 D
2465 )
2466 });
2467 fidl::decode!(
2468 fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<255>>,
2469 D,
2470 val_ref,
2471 decoder,
2472 inner_offset,
2473 inner_depth
2474 )?;
2475 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2476 {
2477 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2478 }
2479 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2480 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2481 }
2482 }
2483
2484 next_offset += envelope_size;
2485
2486 while next_offset < end_offset {
2488 _next_ordinal_to_read += 1;
2489 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2490 next_offset += envelope_size;
2491 }
2492
2493 Ok(())
2494 }
2495 }
2496
2497 impl SignalUpdate {
2498 #[inline(always)]
2499 fn max_ordinal_present(&self) -> u64 {
2500 if let Some(_) = self.assert_signals {
2501 return 1;
2502 }
2503 0
2504 }
2505 }
2506
2507 impl fidl::encoding::ValueTypeMarker for SignalUpdate {
2508 type Borrowed<'a> = &'a Self;
2509 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2510 value
2511 }
2512 }
2513
2514 unsafe impl fidl::encoding::TypeMarker for SignalUpdate {
2515 type Owned = Self;
2516
2517 #[inline(always)]
2518 fn inline_align(_context: fidl::encoding::Context) -> usize {
2519 8
2520 }
2521
2522 #[inline(always)]
2523 fn inline_size(_context: fidl::encoding::Context) -> usize {
2524 16
2525 }
2526 }
2527
2528 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SignalUpdate, D>
2529 for &SignalUpdate
2530 {
2531 unsafe fn encode(
2532 self,
2533 encoder: &mut fidl::encoding::Encoder<'_, D>,
2534 offset: usize,
2535 mut depth: fidl::encoding::Depth,
2536 ) -> fidl::Result<()> {
2537 encoder.debug_check_bounds::<SignalUpdate>(offset);
2538 let max_ordinal: u64 = self.max_ordinal_present();
2540 encoder.write_num(max_ordinal, offset);
2541 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2542 if max_ordinal == 0 {
2544 return Ok(());
2545 }
2546 depth.increment()?;
2547 let envelope_size = 8;
2548 let bytes_len = max_ordinal as usize * envelope_size;
2549 #[allow(unused_variables)]
2550 let offset = encoder.out_of_line_offset(bytes_len);
2551 let mut _prev_end_offset: usize = 0;
2552 if 1 > max_ordinal {
2553 return Ok(());
2554 }
2555
2556 let cur_offset: usize = (1 - 1) * envelope_size;
2559
2560 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2562
2563 fidl::encoding::encode_in_envelope_optional::<Signals, D>(
2568 self.assert_signals
2569 .as_ref()
2570 .map(<Signals as fidl::encoding::ValueTypeMarker>::borrow),
2571 encoder,
2572 offset + cur_offset,
2573 depth,
2574 )?;
2575
2576 _prev_end_offset = cur_offset + envelope_size;
2577
2578 Ok(())
2579 }
2580 }
2581
2582 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SignalUpdate {
2583 #[inline(always)]
2584 fn new_empty() -> Self {
2585 Self::default()
2586 }
2587
2588 unsafe fn decode(
2589 &mut self,
2590 decoder: &mut fidl::encoding::Decoder<'_, D>,
2591 offset: usize,
2592 mut depth: fidl::encoding::Depth,
2593 ) -> fidl::Result<()> {
2594 decoder.debug_check_bounds::<Self>(offset);
2595 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2596 None => return Err(fidl::Error::NotNullable),
2597 Some(len) => len,
2598 };
2599 if len == 0 {
2601 return Ok(());
2602 };
2603 depth.increment()?;
2604 let envelope_size = 8;
2605 let bytes_len = len * envelope_size;
2606 let offset = decoder.out_of_line_offset(bytes_len)?;
2607 let mut _next_ordinal_to_read = 0;
2609 let mut next_offset = offset;
2610 let end_offset = offset + bytes_len;
2611 _next_ordinal_to_read += 1;
2612 if next_offset >= end_offset {
2613 return Ok(());
2614 }
2615
2616 while _next_ordinal_to_read < 1 {
2618 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2619 _next_ordinal_to_read += 1;
2620 next_offset += envelope_size;
2621 }
2622
2623 let next_out_of_line = decoder.next_out_of_line();
2624 let handles_before = decoder.remaining_handles();
2625 if let Some((inlined, num_bytes, num_handles)) =
2626 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2627 {
2628 let member_inline_size =
2629 <Signals as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2630 if inlined != (member_inline_size <= 4) {
2631 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2632 }
2633 let inner_offset;
2634 let mut inner_depth = depth.clone();
2635 if inlined {
2636 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2637 inner_offset = next_offset;
2638 } else {
2639 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2640 inner_depth.increment()?;
2641 }
2642 let val_ref =
2643 self.assert_signals.get_or_insert_with(|| fidl::new_empty!(Signals, D));
2644 fidl::decode!(Signals, D, val_ref, decoder, inner_offset, inner_depth)?;
2645 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2646 {
2647 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2648 }
2649 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2650 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2651 }
2652 }
2653
2654 next_offset += envelope_size;
2655
2656 while next_offset < end_offset {
2658 _next_ordinal_to_read += 1;
2659 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2660 next_offset += envelope_size;
2661 }
2662
2663 Ok(())
2664 }
2665 }
2666
2667 impl fidl::encoding::ValueTypeMarker for PeerMessage {
2668 type Borrowed<'a> = &'a Self;
2669 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2670 value
2671 }
2672 }
2673
2674 unsafe impl fidl::encoding::TypeMarker for PeerMessage {
2675 type Owned = Self;
2676
2677 #[inline(always)]
2678 fn inline_align(_context: fidl::encoding::Context) -> usize {
2679 8
2680 }
2681
2682 #[inline(always)]
2683 fn inline_size(_context: fidl::encoding::Context) -> usize {
2684 16
2685 }
2686 }
2687
2688 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PeerMessage, D>
2689 for &PeerMessage
2690 {
2691 #[inline]
2692 unsafe fn encode(
2693 self,
2694 encoder: &mut fidl::encoding::Encoder<'_, D>,
2695 offset: usize,
2696 _depth: fidl::encoding::Depth,
2697 ) -> fidl::Result<()> {
2698 encoder.debug_check_bounds::<PeerMessage>(offset);
2699 encoder.write_num::<u64>(self.ordinal(), offset);
2700 match self {
2701 PeerMessage::ConnectToService(ref val) => {
2702 fidl::encoding::encode_in_envelope::<ConnectToService, D>(
2703 <ConnectToService as fidl::encoding::ValueTypeMarker>::borrow(val),
2704 encoder,
2705 offset + 8,
2706 _depth,
2707 )
2708 }
2709 PeerMessage::UpdateNodeDescription(ref val) => {
2710 fidl::encoding::encode_in_envelope::<PeerDescription, D>(
2711 <PeerDescription as fidl::encoding::ValueTypeMarker>::borrow(val),
2712 encoder,
2713 offset + 8,
2714 _depth,
2715 )
2716 }
2717 PeerMessage::OpenTransfer(ref val) => {
2718 fidl::encoding::encode_in_envelope::<OpenTransfer, D>(
2719 <OpenTransfer as fidl::encoding::ValueTypeMarker>::borrow(val),
2720 encoder,
2721 offset + 8,
2722 _depth,
2723 )
2724 }
2725 }
2726 }
2727 }
2728
2729 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PeerMessage {
2730 #[inline(always)]
2731 fn new_empty() -> Self {
2732 Self::ConnectToService(fidl::new_empty!(ConnectToService, D))
2733 }
2734
2735 #[inline]
2736 unsafe fn decode(
2737 &mut self,
2738 decoder: &mut fidl::encoding::Decoder<'_, D>,
2739 offset: usize,
2740 mut depth: fidl::encoding::Depth,
2741 ) -> fidl::Result<()> {
2742 decoder.debug_check_bounds::<Self>(offset);
2743 #[allow(unused_variables)]
2744 let next_out_of_line = decoder.next_out_of_line();
2745 let handles_before = decoder.remaining_handles();
2746 let (ordinal, inlined, num_bytes, num_handles) =
2747 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
2748
2749 let member_inline_size = match ordinal {
2750 1 => <ConnectToService as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2751 2 => <PeerDescription as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2752 4 => <OpenTransfer as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2753 _ => return Err(fidl::Error::UnknownUnionTag),
2754 };
2755
2756 if inlined != (member_inline_size <= 4) {
2757 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2758 }
2759 let _inner_offset;
2760 if inlined {
2761 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
2762 _inner_offset = offset + 8;
2763 } else {
2764 depth.increment()?;
2765 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2766 }
2767 match ordinal {
2768 1 => {
2769 #[allow(irrefutable_let_patterns)]
2770 if let PeerMessage::ConnectToService(_) = self {
2771 } else {
2773 *self =
2775 PeerMessage::ConnectToService(fidl::new_empty!(ConnectToService, D));
2776 }
2777 #[allow(irrefutable_let_patterns)]
2778 if let PeerMessage::ConnectToService(ref mut val) = self {
2779 fidl::decode!(ConnectToService, D, val, decoder, _inner_offset, depth)?;
2780 } else {
2781 unreachable!()
2782 }
2783 }
2784 2 => {
2785 #[allow(irrefutable_let_patterns)]
2786 if let PeerMessage::UpdateNodeDescription(_) = self {
2787 } else {
2789 *self = PeerMessage::UpdateNodeDescription(fidl::new_empty!(
2791 PeerDescription,
2792 D
2793 ));
2794 }
2795 #[allow(irrefutable_let_patterns)]
2796 if let PeerMessage::UpdateNodeDescription(ref mut val) = self {
2797 fidl::decode!(PeerDescription, D, val, decoder, _inner_offset, depth)?;
2798 } else {
2799 unreachable!()
2800 }
2801 }
2802 4 => {
2803 #[allow(irrefutable_let_patterns)]
2804 if let PeerMessage::OpenTransfer(_) = self {
2805 } else {
2807 *self = PeerMessage::OpenTransfer(fidl::new_empty!(OpenTransfer, D));
2809 }
2810 #[allow(irrefutable_let_patterns)]
2811 if let PeerMessage::OpenTransfer(ref mut val) = self {
2812 fidl::decode!(OpenTransfer, D, val, decoder, _inner_offset, depth)?;
2813 } else {
2814 unreachable!()
2815 }
2816 }
2817 ordinal => panic!("unexpected ordinal {:?}", ordinal),
2818 }
2819 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
2820 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2821 }
2822 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2823 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2824 }
2825 Ok(())
2826 }
2827 }
2828
2829 impl fidl::encoding::ValueTypeMarker for PeerReply {
2830 type Borrowed<'a> = &'a Self;
2831 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2832 value
2833 }
2834 }
2835
2836 unsafe impl fidl::encoding::TypeMarker for PeerReply {
2837 type Owned = Self;
2838
2839 #[inline(always)]
2840 fn inline_align(_context: fidl::encoding::Context) -> usize {
2841 8
2842 }
2843
2844 #[inline(always)]
2845 fn inline_size(_context: fidl::encoding::Context) -> usize {
2846 16
2847 }
2848 }
2849
2850 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PeerReply, D>
2851 for &PeerReply
2852 {
2853 #[inline]
2854 unsafe fn encode(
2855 self,
2856 encoder: &mut fidl::encoding::Encoder<'_, D>,
2857 offset: usize,
2858 _depth: fidl::encoding::Depth,
2859 ) -> fidl::Result<()> {
2860 encoder.debug_check_bounds::<PeerReply>(offset);
2861 encoder.write_num::<u64>(self.ordinal(), offset);
2862 match self {
2863 PeerReply::UpdateLinkStatusAck(ref val) => {
2864 fidl::encoding::encode_in_envelope::<Empty, D>(
2865 <Empty as fidl::encoding::ValueTypeMarker>::borrow(val),
2866 encoder,
2867 offset + 8,
2868 _depth,
2869 )
2870 }
2871 }
2872 }
2873 }
2874
2875 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PeerReply {
2876 #[inline(always)]
2877 fn new_empty() -> Self {
2878 Self::UpdateLinkStatusAck(fidl::new_empty!(Empty, D))
2879 }
2880
2881 #[inline]
2882 unsafe fn decode(
2883 &mut self,
2884 decoder: &mut fidl::encoding::Decoder<'_, D>,
2885 offset: usize,
2886 mut depth: fidl::encoding::Depth,
2887 ) -> fidl::Result<()> {
2888 decoder.debug_check_bounds::<Self>(offset);
2889 #[allow(unused_variables)]
2890 let next_out_of_line = decoder.next_out_of_line();
2891 let handles_before = decoder.remaining_handles();
2892 let (ordinal, inlined, num_bytes, num_handles) =
2893 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
2894
2895 let member_inline_size = match ordinal {
2896 1 => <Empty as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2897 _ => return Err(fidl::Error::UnknownUnionTag),
2898 };
2899
2900 if inlined != (member_inline_size <= 4) {
2901 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2902 }
2903 let _inner_offset;
2904 if inlined {
2905 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
2906 _inner_offset = offset + 8;
2907 } else {
2908 depth.increment()?;
2909 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2910 }
2911 match ordinal {
2912 1 => {
2913 #[allow(irrefutable_let_patterns)]
2914 if let PeerReply::UpdateLinkStatusAck(_) = self {
2915 } else {
2917 *self = PeerReply::UpdateLinkStatusAck(fidl::new_empty!(Empty, D));
2919 }
2920 #[allow(irrefutable_let_patterns)]
2921 if let PeerReply::UpdateLinkStatusAck(ref mut val) = self {
2922 fidl::decode!(Empty, D, val, decoder, _inner_offset, depth)?;
2923 } else {
2924 unreachable!()
2925 }
2926 }
2927 ordinal => panic!("unexpected ordinal {:?}", ordinal),
2928 }
2929 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
2930 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2931 }
2932 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2933 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2934 }
2935 Ok(())
2936 }
2937 }
2938
2939 impl fidl::encoding::ValueTypeMarker for StreamControl {
2940 type Borrowed<'a> = &'a Self;
2941 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2942 value
2943 }
2944 }
2945
2946 unsafe impl fidl::encoding::TypeMarker for StreamControl {
2947 type Owned = Self;
2948
2949 #[inline(always)]
2950 fn inline_align(_context: fidl::encoding::Context) -> usize {
2951 8
2952 }
2953
2954 #[inline(always)]
2955 fn inline_size(_context: fidl::encoding::Context) -> usize {
2956 16
2957 }
2958 }
2959
2960 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<StreamControl, D>
2961 for &StreamControl
2962 {
2963 #[inline]
2964 unsafe fn encode(
2965 self,
2966 encoder: &mut fidl::encoding::Encoder<'_, D>,
2967 offset: usize,
2968 _depth: fidl::encoding::Depth,
2969 ) -> fidl::Result<()> {
2970 encoder.debug_check_bounds::<StreamControl>(offset);
2971 encoder.write_num::<u64>(self.ordinal(), offset);
2972 match self {
2973 StreamControl::BeginTransfer(ref val) => {
2974 fidl::encoding::encode_in_envelope::<BeginTransfer, D>(
2975 <BeginTransfer as fidl::encoding::ValueTypeMarker>::borrow(val),
2976 encoder,
2977 offset + 8,
2978 _depth,
2979 )
2980 }
2981 StreamControl::AckTransfer(ref val) => {
2982 fidl::encoding::encode_in_envelope::<Empty, D>(
2983 <Empty as fidl::encoding::ValueTypeMarker>::borrow(val),
2984 encoder,
2985 offset + 8,
2986 _depth,
2987 )
2988 }
2989 StreamControl::EndTransfer(ref val) => {
2990 fidl::encoding::encode_in_envelope::<Empty, D>(
2991 <Empty as fidl::encoding::ValueTypeMarker>::borrow(val),
2992 encoder,
2993 offset + 8,
2994 _depth,
2995 )
2996 }
2997 StreamControl::Shutdown(ref val) => fidl::encoding::encode_in_envelope::<i32, D>(
2998 <i32 as fidl::encoding::ValueTypeMarker>::borrow(val),
2999 encoder,
3000 offset + 8,
3001 _depth,
3002 ),
3003 }
3004 }
3005 }
3006
3007 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for StreamControl {
3008 #[inline(always)]
3009 fn new_empty() -> Self {
3010 Self::BeginTransfer(fidl::new_empty!(BeginTransfer, D))
3011 }
3012
3013 #[inline]
3014 unsafe fn decode(
3015 &mut self,
3016 decoder: &mut fidl::encoding::Decoder<'_, D>,
3017 offset: usize,
3018 mut depth: fidl::encoding::Depth,
3019 ) -> fidl::Result<()> {
3020 decoder.debug_check_bounds::<Self>(offset);
3021 #[allow(unused_variables)]
3022 let next_out_of_line = decoder.next_out_of_line();
3023 let handles_before = decoder.remaining_handles();
3024 let (ordinal, inlined, num_bytes, num_handles) =
3025 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
3026
3027 let member_inline_size = match ordinal {
3028 1 => <BeginTransfer as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3029 2 => <Empty as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3030 3 => <Empty as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3031 4 => <i32 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3032 _ => return Err(fidl::Error::UnknownUnionTag),
3033 };
3034
3035 if inlined != (member_inline_size <= 4) {
3036 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3037 }
3038 let _inner_offset;
3039 if inlined {
3040 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
3041 _inner_offset = offset + 8;
3042 } else {
3043 depth.increment()?;
3044 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3045 }
3046 match ordinal {
3047 1 => {
3048 #[allow(irrefutable_let_patterns)]
3049 if let StreamControl::BeginTransfer(_) = self {
3050 } else {
3052 *self = StreamControl::BeginTransfer(fidl::new_empty!(BeginTransfer, D));
3054 }
3055 #[allow(irrefutable_let_patterns)]
3056 if let StreamControl::BeginTransfer(ref mut val) = self {
3057 fidl::decode!(BeginTransfer, D, val, decoder, _inner_offset, depth)?;
3058 } else {
3059 unreachable!()
3060 }
3061 }
3062 2 => {
3063 #[allow(irrefutable_let_patterns)]
3064 if let StreamControl::AckTransfer(_) = self {
3065 } else {
3067 *self = StreamControl::AckTransfer(fidl::new_empty!(Empty, D));
3069 }
3070 #[allow(irrefutable_let_patterns)]
3071 if let StreamControl::AckTransfer(ref mut val) = self {
3072 fidl::decode!(Empty, D, val, decoder, _inner_offset, depth)?;
3073 } else {
3074 unreachable!()
3075 }
3076 }
3077 3 => {
3078 #[allow(irrefutable_let_patterns)]
3079 if let StreamControl::EndTransfer(_) = self {
3080 } else {
3082 *self = StreamControl::EndTransfer(fidl::new_empty!(Empty, D));
3084 }
3085 #[allow(irrefutable_let_patterns)]
3086 if let StreamControl::EndTransfer(ref mut val) = self {
3087 fidl::decode!(Empty, D, val, decoder, _inner_offset, depth)?;
3088 } else {
3089 unreachable!()
3090 }
3091 }
3092 4 => {
3093 #[allow(irrefutable_let_patterns)]
3094 if let StreamControl::Shutdown(_) = self {
3095 } else {
3097 *self = StreamControl::Shutdown(fidl::new_empty!(i32, D));
3099 }
3100 #[allow(irrefutable_let_patterns)]
3101 if let StreamControl::Shutdown(ref mut val) = self {
3102 fidl::decode!(i32, D, val, decoder, _inner_offset, depth)?;
3103 } else {
3104 unreachable!()
3105 }
3106 }
3107 ordinal => panic!("unexpected ordinal {:?}", ordinal),
3108 }
3109 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
3110 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3111 }
3112 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3113 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3114 }
3115 Ok(())
3116 }
3117 }
3118
3119 impl fidl::encoding::ValueTypeMarker for StreamRef {
3120 type Borrowed<'a> = &'a Self;
3121 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3122 value
3123 }
3124 }
3125
3126 unsafe impl fidl::encoding::TypeMarker for StreamRef {
3127 type Owned = Self;
3128
3129 #[inline(always)]
3130 fn inline_align(_context: fidl::encoding::Context) -> usize {
3131 8
3132 }
3133
3134 #[inline(always)]
3135 fn inline_size(_context: fidl::encoding::Context) -> usize {
3136 16
3137 }
3138 }
3139
3140 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<StreamRef, D>
3141 for &StreamRef
3142 {
3143 #[inline]
3144 unsafe fn encode(
3145 self,
3146 encoder: &mut fidl::encoding::Encoder<'_, D>,
3147 offset: usize,
3148 _depth: fidl::encoding::Depth,
3149 ) -> fidl::Result<()> {
3150 encoder.debug_check_bounds::<StreamRef>(offset);
3151 encoder.write_num::<u64>(self.ordinal(), offset);
3152 match self {
3153 StreamRef::Creating(ref val) => fidl::encoding::encode_in_envelope::<StreamId, D>(
3154 <StreamId as fidl::encoding::ValueTypeMarker>::borrow(val),
3155 encoder,
3156 offset + 8,
3157 _depth,
3158 ),
3159 StreamRef::TransferInitiator(ref val) => {
3160 fidl::encoding::encode_in_envelope::<TransferInitiator, D>(
3161 <TransferInitiator as fidl::encoding::ValueTypeMarker>::borrow(val),
3162 encoder,
3163 offset + 8,
3164 _depth,
3165 )
3166 }
3167 StreamRef::TransferWaiter(ref val) => {
3168 fidl::encoding::encode_in_envelope::<TransferWaiter, D>(
3169 <TransferWaiter as fidl::encoding::ValueTypeMarker>::borrow(val),
3170 encoder,
3171 offset + 8,
3172 _depth,
3173 )
3174 }
3175 }
3176 }
3177 }
3178
3179 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for StreamRef {
3180 #[inline(always)]
3181 fn new_empty() -> Self {
3182 Self::Creating(fidl::new_empty!(StreamId, D))
3183 }
3184
3185 #[inline]
3186 unsafe fn decode(
3187 &mut self,
3188 decoder: &mut fidl::encoding::Decoder<'_, D>,
3189 offset: usize,
3190 mut depth: fidl::encoding::Depth,
3191 ) -> fidl::Result<()> {
3192 decoder.debug_check_bounds::<Self>(offset);
3193 #[allow(unused_variables)]
3194 let next_out_of_line = decoder.next_out_of_line();
3195 let handles_before = decoder.remaining_handles();
3196 let (ordinal, inlined, num_bytes, num_handles) =
3197 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
3198
3199 let member_inline_size = match ordinal {
3200 1 => <StreamId as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3201 2 => {
3202 <TransferInitiator as fidl::encoding::TypeMarker>::inline_size(decoder.context)
3203 }
3204 3 => <TransferWaiter as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3205 _ => return Err(fidl::Error::UnknownUnionTag),
3206 };
3207
3208 if inlined != (member_inline_size <= 4) {
3209 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3210 }
3211 let _inner_offset;
3212 if inlined {
3213 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
3214 _inner_offset = offset + 8;
3215 } else {
3216 depth.increment()?;
3217 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3218 }
3219 match ordinal {
3220 1 => {
3221 #[allow(irrefutable_let_patterns)]
3222 if let StreamRef::Creating(_) = self {
3223 } else {
3225 *self = StreamRef::Creating(fidl::new_empty!(StreamId, D));
3227 }
3228 #[allow(irrefutable_let_patterns)]
3229 if let StreamRef::Creating(ref mut val) = self {
3230 fidl::decode!(StreamId, D, val, decoder, _inner_offset, depth)?;
3231 } else {
3232 unreachable!()
3233 }
3234 }
3235 2 => {
3236 #[allow(irrefutable_let_patterns)]
3237 if let StreamRef::TransferInitiator(_) = self {
3238 } else {
3240 *self =
3242 StreamRef::TransferInitiator(fidl::new_empty!(TransferInitiator, D));
3243 }
3244 #[allow(irrefutable_let_patterns)]
3245 if let StreamRef::TransferInitiator(ref mut val) = self {
3246 fidl::decode!(TransferInitiator, D, val, decoder, _inner_offset, depth)?;
3247 } else {
3248 unreachable!()
3249 }
3250 }
3251 3 => {
3252 #[allow(irrefutable_let_patterns)]
3253 if let StreamRef::TransferWaiter(_) = self {
3254 } else {
3256 *self = StreamRef::TransferWaiter(fidl::new_empty!(TransferWaiter, D));
3258 }
3259 #[allow(irrefutable_let_patterns)]
3260 if let StreamRef::TransferWaiter(ref mut val) = self {
3261 fidl::decode!(TransferWaiter, D, val, decoder, _inner_offset, depth)?;
3262 } else {
3263 unreachable!()
3264 }
3265 }
3266 ordinal => panic!("unexpected ordinal {:?}", ordinal),
3267 }
3268 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
3269 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3270 }
3271 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3272 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3273 }
3274 Ok(())
3275 }
3276 }
3277
3278 impl fidl::encoding::ValueTypeMarker for ZirconHandle {
3279 type Borrowed<'a> = &'a Self;
3280 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3281 value
3282 }
3283 }
3284
3285 unsafe impl fidl::encoding::TypeMarker for ZirconHandle {
3286 type Owned = Self;
3287
3288 #[inline(always)]
3289 fn inline_align(_context: fidl::encoding::Context) -> usize {
3290 8
3291 }
3292
3293 #[inline(always)]
3294 fn inline_size(_context: fidl::encoding::Context) -> usize {
3295 16
3296 }
3297 }
3298
3299 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ZirconHandle, D>
3300 for &ZirconHandle
3301 {
3302 #[inline]
3303 unsafe fn encode(
3304 self,
3305 encoder: &mut fidl::encoding::Encoder<'_, D>,
3306 offset: usize,
3307 _depth: fidl::encoding::Depth,
3308 ) -> fidl::Result<()> {
3309 encoder.debug_check_bounds::<ZirconHandle>(offset);
3310 encoder.write_num::<u64>(self.ordinal(), offset);
3311 match self {
3312 ZirconHandle::Channel(ref val) => {
3313 fidl::encoding::encode_in_envelope::<ChannelHandle, D>(
3314 <ChannelHandle as fidl::encoding::ValueTypeMarker>::borrow(val),
3315 encoder,
3316 offset + 8,
3317 _depth,
3318 )
3319 }
3320 ZirconHandle::Socket(ref val) => {
3321 fidl::encoding::encode_in_envelope::<SocketHandle, D>(
3322 <SocketHandle as fidl::encoding::ValueTypeMarker>::borrow(val),
3323 encoder,
3324 offset + 8,
3325 _depth,
3326 )
3327 }
3328 ZirconHandle::EventPair(ref val) => {
3329 fidl::encoding::encode_in_envelope::<EventPairHandle, D>(
3330 <EventPairHandle as fidl::encoding::ValueTypeMarker>::borrow(val),
3331 encoder,
3332 offset + 8,
3333 _depth,
3334 )
3335 }
3336 }
3337 }
3338 }
3339
3340 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ZirconHandle {
3341 #[inline(always)]
3342 fn new_empty() -> Self {
3343 Self::Channel(fidl::new_empty!(ChannelHandle, D))
3344 }
3345
3346 #[inline]
3347 unsafe fn decode(
3348 &mut self,
3349 decoder: &mut fidl::encoding::Decoder<'_, D>,
3350 offset: usize,
3351 mut depth: fidl::encoding::Depth,
3352 ) -> fidl::Result<()> {
3353 decoder.debug_check_bounds::<Self>(offset);
3354 #[allow(unused_variables)]
3355 let next_out_of_line = decoder.next_out_of_line();
3356 let handles_before = decoder.remaining_handles();
3357 let (ordinal, inlined, num_bytes, num_handles) =
3358 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
3359
3360 let member_inline_size = match ordinal {
3361 1 => <ChannelHandle as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3362 2 => <SocketHandle as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3363 3 => <EventPairHandle as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3364 _ => return Err(fidl::Error::UnknownUnionTag),
3365 };
3366
3367 if inlined != (member_inline_size <= 4) {
3368 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3369 }
3370 let _inner_offset;
3371 if inlined {
3372 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
3373 _inner_offset = offset + 8;
3374 } else {
3375 depth.increment()?;
3376 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3377 }
3378 match ordinal {
3379 1 => {
3380 #[allow(irrefutable_let_patterns)]
3381 if let ZirconHandle::Channel(_) = self {
3382 } else {
3384 *self = ZirconHandle::Channel(fidl::new_empty!(ChannelHandle, D));
3386 }
3387 #[allow(irrefutable_let_patterns)]
3388 if let ZirconHandle::Channel(ref mut val) = self {
3389 fidl::decode!(ChannelHandle, D, val, decoder, _inner_offset, depth)?;
3390 } else {
3391 unreachable!()
3392 }
3393 }
3394 2 => {
3395 #[allow(irrefutable_let_patterns)]
3396 if let ZirconHandle::Socket(_) = self {
3397 } else {
3399 *self = ZirconHandle::Socket(fidl::new_empty!(SocketHandle, D));
3401 }
3402 #[allow(irrefutable_let_patterns)]
3403 if let ZirconHandle::Socket(ref mut val) = self {
3404 fidl::decode!(SocketHandle, D, val, decoder, _inner_offset, depth)?;
3405 } else {
3406 unreachable!()
3407 }
3408 }
3409 3 => {
3410 #[allow(irrefutable_let_patterns)]
3411 if let ZirconHandle::EventPair(_) = self {
3412 } else {
3414 *self = ZirconHandle::EventPair(fidl::new_empty!(EventPairHandle, D));
3416 }
3417 #[allow(irrefutable_let_patterns)]
3418 if let ZirconHandle::EventPair(ref mut val) = self {
3419 fidl::decode!(EventPairHandle, D, val, decoder, _inner_offset, depth)?;
3420 } else {
3421 unreachable!()
3422 }
3423 }
3424 ordinal => panic!("unexpected ordinal {:?}", ordinal),
3425 }
3426 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
3427 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3428 }
3429 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3430 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3431 }
3432 Ok(())
3433 }
3434 }
3435}