Skip to main content

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