fidl_cf_sc_internal_elementconfig__common/
fidl_cf_sc_internal_elementconfig__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 default_collection: String,
14    pub url_to_collection: Vec<String>,
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            32
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<512> as fidl::encoding::ValueTypeMarker>::borrow(&self.default_collection),
56                    <fidl::encoding::Vector<fidl::encoding::BoundedString<512>, 100> as fidl::encoding::ValueTypeMarker>::borrow(&self.url_to_collection),
57                ),
58                encoder, offset, _depth
59            )
60        }
61    }
62    unsafe impl<
63        D: fidl::encoding::ResourceDialect,
64        T0: fidl::encoding::Encode<fidl::encoding::BoundedString<512>, D>,
65        T1: fidl::encoding::Encode<fidl::encoding::Vector<fidl::encoding::BoundedString<512>, 100>, D>,
66    > fidl::encoding::Encode<Config, D> for (T0, T1)
67    {
68        #[inline]
69        unsafe fn encode(
70            self,
71            encoder: &mut fidl::encoding::Encoder<'_, D>,
72            offset: usize,
73            depth: fidl::encoding::Depth,
74        ) -> fidl::Result<()> {
75            encoder.debug_check_bounds::<Config>(offset);
76            // Zero out padding regions. There's no need to apply masks
77            // because the unmasked parts will be overwritten by fields.
78            // Write the fields.
79            self.0.encode(encoder, offset + 0, depth)?;
80            self.1.encode(encoder, offset + 16, depth)?;
81            Ok(())
82        }
83    }
84
85    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Config {
86        #[inline(always)]
87        fn new_empty() -> Self {
88            Self {
89                default_collection: fidl::new_empty!(fidl::encoding::BoundedString<512>, D),
90                url_to_collection: fidl::new_empty!(
91                    fidl::encoding::Vector<fidl::encoding::BoundedString<512>, 100>,
92                    D
93                ),
94            }
95        }
96
97        #[inline]
98        unsafe fn decode(
99            &mut self,
100            decoder: &mut fidl::encoding::Decoder<'_, D>,
101            offset: usize,
102            _depth: fidl::encoding::Depth,
103        ) -> fidl::Result<()> {
104            decoder.debug_check_bounds::<Self>(offset);
105            // Verify that padding bytes are zero.
106            fidl::decode!(
107                fidl::encoding::BoundedString<512>,
108                D,
109                &mut self.default_collection,
110                decoder,
111                offset + 0,
112                _depth
113            )?;
114            fidl::decode!(
115                fidl::encoding::Vector<fidl::encoding::BoundedString<512>, 100>,
116                D,
117                &mut self.url_to_collection,
118                decoder,
119                offset + 16,
120                _depth
121            )?;
122            Ok(())
123        }
124    }
125}