Skip to main content

fidl_fuchsia_hardware_inlineencryption_common/
fidl_fuchsia_hardware_inlineencryption_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
11#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
12#[repr(C)]
13pub struct ControllerProgramKeySlotResponse {
14    pub slot: u8,
15}
16
17impl fidl::Persistable for ControllerProgramKeySlotResponse {}
18
19pub mod controller_ordinals {
20    pub const PROGRAM_KEY_SLOT: u64 = 0xacf9189df7f52e7;
21    pub const DERIVE_RAW_SECRET: u64 = 0x7141b24312e43ca4;
22}
23
24pub mod device_ordinals {
25    pub const PROGRAM_KEY: u64 = 0x30401dc60fc47cd0;
26    pub const DERIVE_RAW_SECRET: u64 = 0x605392dccdef79d4;
27}
28
29mod internal {
30    use super::*;
31
32    impl fidl::encoding::ValueTypeMarker for ControllerProgramKeySlotResponse {
33        type Borrowed<'a> = &'a Self;
34        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
35            value
36        }
37    }
38
39    unsafe impl fidl::encoding::TypeMarker for ControllerProgramKeySlotResponse {
40        type Owned = Self;
41
42        #[inline(always)]
43        fn inline_align(_context: fidl::encoding::Context) -> usize {
44            1
45        }
46
47        #[inline(always)]
48        fn inline_size(_context: fidl::encoding::Context) -> usize {
49            1
50        }
51        #[inline(always)]
52        fn encode_is_copy() -> bool {
53            true
54        }
55
56        #[inline(always)]
57        fn decode_is_copy() -> bool {
58            true
59        }
60    }
61
62    unsafe impl<D: fidl::encoding::ResourceDialect>
63        fidl::encoding::Encode<ControllerProgramKeySlotResponse, D>
64        for &ControllerProgramKeySlotResponse
65    {
66        #[inline]
67        unsafe fn encode(
68            self,
69            encoder: &mut fidl::encoding::Encoder<'_, D>,
70            offset: usize,
71            _depth: fidl::encoding::Depth,
72        ) -> fidl::Result<()> {
73            encoder.debug_check_bounds::<ControllerProgramKeySlotResponse>(offset);
74            unsafe {
75                // Copy the object into the buffer.
76                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
77                (buf_ptr as *mut ControllerProgramKeySlotResponse)
78                    .write_unaligned((self as *const ControllerProgramKeySlotResponse).read());
79                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
80                // done second because the memcpy will write garbage to these bytes.
81            }
82            Ok(())
83        }
84    }
85    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u8, D>>
86        fidl::encoding::Encode<ControllerProgramKeySlotResponse, 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::<ControllerProgramKeySlotResponse>(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 ControllerProgramKeySlotResponse
106    {
107        #[inline(always)]
108        fn new_empty() -> Self {
109            Self { slot: fidl::new_empty!(u8, D) }
110        }
111
112        #[inline]
113        unsafe fn decode(
114            &mut self,
115            decoder: &mut fidl::encoding::Decoder<'_, D>,
116            offset: usize,
117            _depth: fidl::encoding::Depth,
118        ) -> fidl::Result<()> {
119            decoder.debug_check_bounds::<Self>(offset);
120            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
121            // Verify that padding bytes are zero.
122            // Copy from the buffer into the object.
123            unsafe {
124                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 1);
125            }
126            Ok(())
127        }
128    }
129}