Skip to main content

fidl_fuchsia_driver_token__common/
fidl_fuchsia_driver_token__common.rs

1// WARNING: This file is machine generated by fidlgen.
2
3#![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 const MAX_SEGMENTS: u32 = 20;
12
13#[derive(Clone, Debug, PartialEq)]
14pub struct NodeBusTopologyGetResponse {
15    /// A series of bus fragments descibing the bus topology for this node.
16    /// An example:
17    ///   path[0] = { type: ACPI, address: I2C0, stability: Stable }
18    ///   path[1] = { type: I2C, address: 0x1, stability: Stable }
19    pub path: Vec<fidl_fuchsia_driver_framework__common::BusInfo>,
20}
21
22impl fidl::Persistable for NodeBusTopologyGetResponse {}
23
24pub mod debug_ordinals {
25    pub const LOG_STACK_TRACE: u64 = 0x6c839ab9a2f61de1;
26}
27
28pub mod node_bus_topology_ordinals {
29    pub const GET: u64 = 0x1f35948edf73f5bd;
30}
31
32pub mod node_token_ordinals {
33    pub const GET: u64 = 0x64166e3a6984b1d9;
34}
35
36mod internal {
37    use super::*;
38
39    impl fidl::encoding::ValueTypeMarker for NodeBusTopologyGetResponse {
40        type Borrowed<'a> = &'a Self;
41        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
42            value
43        }
44    }
45
46    unsafe impl fidl::encoding::TypeMarker for NodeBusTopologyGetResponse {
47        type Owned = Self;
48
49        #[inline(always)]
50        fn inline_align(_context: fidl::encoding::Context) -> usize {
51            8
52        }
53
54        #[inline(always)]
55        fn inline_size(_context: fidl::encoding::Context) -> usize {
56            16
57        }
58    }
59
60    unsafe impl<D: fidl::encoding::ResourceDialect>
61        fidl::encoding::Encode<NodeBusTopologyGetResponse, D> for &NodeBusTopologyGetResponse
62    {
63        #[inline]
64        unsafe fn encode(
65            self,
66            encoder: &mut fidl::encoding::Encoder<'_, D>,
67            offset: usize,
68            _depth: fidl::encoding::Depth,
69        ) -> fidl::Result<()> {
70            encoder.debug_check_bounds::<NodeBusTopologyGetResponse>(offset);
71            // Delegate to tuple encoding.
72            fidl::encoding::Encode::<NodeBusTopologyGetResponse, D>::encode(
73                (
74                    <fidl::encoding::Vector<fidl_fuchsia_driver_framework__common::BusInfo, 20> as fidl::encoding::ValueTypeMarker>::borrow(&self.path),
75                ),
76                encoder, offset, _depth
77            )
78        }
79    }
80    unsafe impl<
81        D: fidl::encoding::ResourceDialect,
82        T0: fidl::encoding::Encode<
83                fidl::encoding::Vector<fidl_fuchsia_driver_framework__common::BusInfo, 20>,
84                D,
85            >,
86    > fidl::encoding::Encode<NodeBusTopologyGetResponse, D> for (T0,)
87    {
88        #[inline]
89        unsafe fn encode(
90            self,
91            encoder: &mut fidl::encoding::Encoder<'_, D>,
92            offset: usize,
93            depth: fidl::encoding::Depth,
94        ) -> fidl::Result<()> {
95            encoder.debug_check_bounds::<NodeBusTopologyGetResponse>(offset);
96            // Zero out padding regions. There's no need to apply masks
97            // because the unmasked parts will be overwritten by fields.
98            // Write the fields.
99            self.0.encode(encoder, offset + 0, depth)?;
100            Ok(())
101        }
102    }
103
104    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
105        for NodeBusTopologyGetResponse
106    {
107        #[inline(always)]
108        fn new_empty() -> Self {
109            Self {
110                path: fidl::new_empty!(fidl::encoding::Vector<fidl_fuchsia_driver_framework__common::BusInfo, 20>, D),
111            }
112        }
113
114        #[inline]
115        unsafe fn decode(
116            &mut self,
117            decoder: &mut fidl::encoding::Decoder<'_, D>,
118            offset: usize,
119            _depth: fidl::encoding::Depth,
120        ) -> fidl::Result<()> {
121            decoder.debug_check_bounds::<Self>(offset);
122            // Verify that padding bytes are zero.
123            fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_driver_framework__common::BusInfo, 20>, D, &mut self.path, decoder, offset + 0, _depth)?;
124            Ok(())
125        }
126    }
127}