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