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