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, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
14#[repr(C)]
15pub struct DebugGetHostKoidResponse {
16    pub host_koid: u64,
17}
18
19impl fidl::Persistable for DebugGetHostKoidResponse {}
20
21#[derive(Clone, Debug, PartialEq)]
22pub struct NodeBusTopologyGetResponse {
23    /// A series of bus fragments descibing the bus topology for this node.
24    /// An example:
25    ///   path[0] = { type: ACPI, address: I2C0, stability: Stable }
26    ///   path[1] = { type: I2C, address: 0x1, stability: Stable }
27    pub path: Vec<fidl_fuchsia_driver_framework__common::BusInfo>,
28}
29
30impl fidl::Persistable for NodeBusTopologyGetResponse {}
31
32pub mod debug_ordinals {
33    pub const LOG_STACK_TRACE: u64 = 0x6c839ab9a2f61de1;
34    pub const GET_HOST_KOID: u64 = 0x250b90689178cf1c;
35}
36
37pub mod node_bus_topology_ordinals {
38    pub const GET: u64 = 0x1f35948edf73f5bd;
39}
40
41pub mod node_token_ordinals {
42    pub const GET: u64 = 0x64166e3a6984b1d9;
43}
44
45mod internal {
46    use super::*;
47
48    impl fidl::encoding::ValueTypeMarker for DebugGetHostKoidResponse {
49        type Borrowed<'a> = &'a Self;
50        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
51            value
52        }
53    }
54
55    unsafe impl fidl::encoding::TypeMarker for DebugGetHostKoidResponse {
56        type Owned = Self;
57
58        #[inline(always)]
59        fn inline_align(_context: fidl::encoding::Context) -> usize {
60            8
61        }
62
63        #[inline(always)]
64        fn inline_size(_context: fidl::encoding::Context) -> usize {
65            8
66        }
67        #[inline(always)]
68        fn encode_is_copy() -> bool {
69            true
70        }
71
72        #[inline(always)]
73        fn decode_is_copy() -> bool {
74            true
75        }
76    }
77
78    unsafe impl<D: fidl::encoding::ResourceDialect>
79        fidl::encoding::Encode<DebugGetHostKoidResponse, D> for &DebugGetHostKoidResponse
80    {
81        #[inline]
82        unsafe fn encode(
83            self,
84            encoder: &mut fidl::encoding::Encoder<'_, D>,
85            offset: usize,
86            _depth: fidl::encoding::Depth,
87        ) -> fidl::Result<()> {
88            encoder.debug_check_bounds::<DebugGetHostKoidResponse>(offset);
89            unsafe {
90                // Copy the object into the buffer.
91                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
92                (buf_ptr as *mut DebugGetHostKoidResponse)
93                    .write_unaligned((self as *const DebugGetHostKoidResponse).read());
94                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
95                // done second because the memcpy will write garbage to these bytes.
96            }
97            Ok(())
98        }
99    }
100    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
101        fidl::encoding::Encode<DebugGetHostKoidResponse, D> for (T0,)
102    {
103        #[inline]
104        unsafe fn encode(
105            self,
106            encoder: &mut fidl::encoding::Encoder<'_, D>,
107            offset: usize,
108            depth: fidl::encoding::Depth,
109        ) -> fidl::Result<()> {
110            encoder.debug_check_bounds::<DebugGetHostKoidResponse>(offset);
111            // Zero out padding regions. There's no need to apply masks
112            // because the unmasked parts will be overwritten by fields.
113            // Write the fields.
114            self.0.encode(encoder, offset + 0, depth)?;
115            Ok(())
116        }
117    }
118
119    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
120        for DebugGetHostKoidResponse
121    {
122        #[inline(always)]
123        fn new_empty() -> Self {
124            Self { host_koid: fidl::new_empty!(u64, D) }
125        }
126
127        #[inline]
128        unsafe fn decode(
129            &mut self,
130            decoder: &mut fidl::encoding::Decoder<'_, D>,
131            offset: usize,
132            _depth: fidl::encoding::Depth,
133        ) -> fidl::Result<()> {
134            decoder.debug_check_bounds::<Self>(offset);
135            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
136            // Verify that padding bytes are zero.
137            // Copy from the buffer into the object.
138            unsafe {
139                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
140            }
141            Ok(())
142        }
143    }
144
145    impl fidl::encoding::ValueTypeMarker for NodeBusTopologyGetResponse {
146        type Borrowed<'a> = &'a Self;
147        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
148            value
149        }
150    }
151
152    unsafe impl fidl::encoding::TypeMarker for NodeBusTopologyGetResponse {
153        type Owned = Self;
154
155        #[inline(always)]
156        fn inline_align(_context: fidl::encoding::Context) -> usize {
157            8
158        }
159
160        #[inline(always)]
161        fn inline_size(_context: fidl::encoding::Context) -> usize {
162            16
163        }
164    }
165
166    unsafe impl<D: fidl::encoding::ResourceDialect>
167        fidl::encoding::Encode<NodeBusTopologyGetResponse, D> for &NodeBusTopologyGetResponse
168    {
169        #[inline]
170        unsafe fn encode(
171            self,
172            encoder: &mut fidl::encoding::Encoder<'_, D>,
173            offset: usize,
174            _depth: fidl::encoding::Depth,
175        ) -> fidl::Result<()> {
176            encoder.debug_check_bounds::<NodeBusTopologyGetResponse>(offset);
177            // Delegate to tuple encoding.
178            fidl::encoding::Encode::<NodeBusTopologyGetResponse, D>::encode(
179                (
180                    <fidl::encoding::Vector<fidl_fuchsia_driver_framework__common::BusInfo, 20> as fidl::encoding::ValueTypeMarker>::borrow(&self.path),
181                ),
182                encoder, offset, _depth
183            )
184        }
185    }
186    unsafe impl<
187        D: fidl::encoding::ResourceDialect,
188        T0: fidl::encoding::Encode<
189                fidl::encoding::Vector<fidl_fuchsia_driver_framework__common::BusInfo, 20>,
190                D,
191            >,
192    > fidl::encoding::Encode<NodeBusTopologyGetResponse, D> for (T0,)
193    {
194        #[inline]
195        unsafe fn encode(
196            self,
197            encoder: &mut fidl::encoding::Encoder<'_, D>,
198            offset: usize,
199            depth: fidl::encoding::Depth,
200        ) -> fidl::Result<()> {
201            encoder.debug_check_bounds::<NodeBusTopologyGetResponse>(offset);
202            // Zero out padding regions. There's no need to apply masks
203            // because the unmasked parts will be overwritten by fields.
204            // Write the fields.
205            self.0.encode(encoder, offset + 0, depth)?;
206            Ok(())
207        }
208    }
209
210    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
211        for NodeBusTopologyGetResponse
212    {
213        #[inline(always)]
214        fn new_empty() -> Self {
215            Self {
216                path: fidl::new_empty!(fidl::encoding::Vector<fidl_fuchsia_driver_framework__common::BusInfo, 20>, D),
217            }
218        }
219
220        #[inline]
221        unsafe fn decode(
222            &mut self,
223            decoder: &mut fidl::encoding::Decoder<'_, D>,
224            offset: usize,
225            _depth: fidl::encoding::Depth,
226        ) -> fidl::Result<()> {
227            decoder.debug_check_bounds::<Self>(offset);
228            // Verify that padding bytes are zero.
229            fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_driver_framework__common::BusInfo, 20>, D, &mut self.path, decoder, offset + 0, _depth)?;
230            Ok(())
231        }
232    }
233}