fidl_test_configexample__common/
fidl_test_configexample__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)]
12pub struct ConfigUserIsManagingPowerResponse {
13    pub is_managing_power: bool,
14}
15
16impl fidl::Persistable for ConfigUserIsManagingPowerResponse {}
17
18pub mod config_user_ordinals {
19    pub const IS_MANAGING_POWER: u64 = 0x3ed8a6f9f9f9fae7;
20}
21
22mod internal {
23    use super::*;
24
25    impl fidl::encoding::ValueTypeMarker for ConfigUserIsManagingPowerResponse {
26        type Borrowed<'a> = &'a Self;
27        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
28            value
29        }
30    }
31
32    unsafe impl fidl::encoding::TypeMarker for ConfigUserIsManagingPowerResponse {
33        type Owned = Self;
34
35        #[inline(always)]
36        fn inline_align(_context: fidl::encoding::Context) -> usize {
37            1
38        }
39
40        #[inline(always)]
41        fn inline_size(_context: fidl::encoding::Context) -> usize {
42            1
43        }
44    }
45
46    unsafe impl<D: fidl::encoding::ResourceDialect>
47        fidl::encoding::Encode<ConfigUserIsManagingPowerResponse, D>
48        for &ConfigUserIsManagingPowerResponse
49    {
50        #[inline]
51        unsafe fn encode(
52            self,
53            encoder: &mut fidl::encoding::Encoder<'_, D>,
54            offset: usize,
55            _depth: fidl::encoding::Depth,
56        ) -> fidl::Result<()> {
57            encoder.debug_check_bounds::<ConfigUserIsManagingPowerResponse>(offset);
58            // Delegate to tuple encoding.
59            fidl::encoding::Encode::<ConfigUserIsManagingPowerResponse, D>::encode(
60                (<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.is_managing_power),),
61                encoder,
62                offset,
63                _depth,
64            )
65        }
66    }
67    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
68        fidl::encoding::Encode<ConfigUserIsManagingPowerResponse, D> for (T0,)
69    {
70        #[inline]
71        unsafe fn encode(
72            self,
73            encoder: &mut fidl::encoding::Encoder<'_, D>,
74            offset: usize,
75            depth: fidl::encoding::Depth,
76        ) -> fidl::Result<()> {
77            encoder.debug_check_bounds::<ConfigUserIsManagingPowerResponse>(offset);
78            // Zero out padding regions. There's no need to apply masks
79            // because the unmasked parts will be overwritten by fields.
80            // Write the fields.
81            self.0.encode(encoder, offset + 0, depth)?;
82            Ok(())
83        }
84    }
85
86    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
87        for ConfigUserIsManagingPowerResponse
88    {
89        #[inline(always)]
90        fn new_empty() -> Self {
91            Self { is_managing_power: fidl::new_empty!(bool, D) }
92        }
93
94        #[inline]
95        unsafe fn decode(
96            &mut self,
97            decoder: &mut fidl::encoding::Decoder<'_, D>,
98            offset: usize,
99            _depth: fidl::encoding::Depth,
100        ) -> fidl::Result<()> {
101            decoder.debug_check_bounds::<Self>(offset);
102            // Verify that padding bytes are zero.
103            fidl::decode!(bool, D, &mut self.is_managing_power, decoder, offset + 0, _depth)?;
104            Ok(())
105        }
106    }
107}