fidl_fuchsia_ui_policy__common/
fidl_fuchsia_ui_policy__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 DisplayBacklightSetMinimumRgbRequest {
14    pub minimum_rgb: u8,
15}
16
17impl fidl::Persistable for DisplayBacklightSetMinimumRgbRequest {}
18
19pub mod device_listener_registry_ordinals {
20    pub const REGISTER_MEDIA_BUTTONS_LISTENER: u64 = 0x3826318765c72e70;
21    pub const REGISTER_LISTENER: u64 = 0x2f9e7eea89485a7b;
22    pub const REGISTER_TOUCH_BUTTONS_LISTENER: u64 = 0x1625430c46f9b84b;
23}
24
25pub mod display_backlight_ordinals {
26    pub const SET_MINIMUM_RGB: u64 = 0x25604347bb8a1ca3;
27}
28
29pub mod media_buttons_listener_ordinals {
30    pub const ON_MEDIA_BUTTONS_EVENT: u64 = 0x2c2068c386964e00;
31    pub const ON_EVENT: u64 = 0x16e7130ddcaf877c;
32}
33
34pub mod touch_buttons_listener_ordinals {
35    pub const ON_EVENT: u64 = 0x476b549161542f92;
36}
37
38mod internal {
39    use super::*;
40
41    impl fidl::encoding::ValueTypeMarker for DisplayBacklightSetMinimumRgbRequest {
42        type Borrowed<'a> = &'a Self;
43        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
44            value
45        }
46    }
47
48    unsafe impl fidl::encoding::TypeMarker for DisplayBacklightSetMinimumRgbRequest {
49        type Owned = Self;
50
51        #[inline(always)]
52        fn inline_align(_context: fidl::encoding::Context) -> usize {
53            1
54        }
55
56        #[inline(always)]
57        fn inline_size(_context: fidl::encoding::Context) -> usize {
58            1
59        }
60        #[inline(always)]
61        fn encode_is_copy() -> bool {
62            true
63        }
64
65        #[inline(always)]
66        fn decode_is_copy() -> bool {
67            true
68        }
69    }
70
71    unsafe impl<D: fidl::encoding::ResourceDialect>
72        fidl::encoding::Encode<DisplayBacklightSetMinimumRgbRequest, D>
73        for &DisplayBacklightSetMinimumRgbRequest
74    {
75        #[inline]
76        unsafe fn encode(
77            self,
78            encoder: &mut fidl::encoding::Encoder<'_, D>,
79            offset: usize,
80            _depth: fidl::encoding::Depth,
81        ) -> fidl::Result<()> {
82            encoder.debug_check_bounds::<DisplayBacklightSetMinimumRgbRequest>(offset);
83            unsafe {
84                // Copy the object into the buffer.
85                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
86                (buf_ptr as *mut DisplayBacklightSetMinimumRgbRequest)
87                    .write_unaligned((self as *const DisplayBacklightSetMinimumRgbRequest).read());
88                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
89                // done second because the memcpy will write garbage to these bytes.
90            }
91            Ok(())
92        }
93    }
94    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u8, D>>
95        fidl::encoding::Encode<DisplayBacklightSetMinimumRgbRequest, D> for (T0,)
96    {
97        #[inline]
98        unsafe fn encode(
99            self,
100            encoder: &mut fidl::encoding::Encoder<'_, D>,
101            offset: usize,
102            depth: fidl::encoding::Depth,
103        ) -> fidl::Result<()> {
104            encoder.debug_check_bounds::<DisplayBacklightSetMinimumRgbRequest>(offset);
105            // Zero out padding regions. There's no need to apply masks
106            // because the unmasked parts will be overwritten by fields.
107            // Write the fields.
108            self.0.encode(encoder, offset + 0, depth)?;
109            Ok(())
110        }
111    }
112
113    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
114        for DisplayBacklightSetMinimumRgbRequest
115    {
116        #[inline(always)]
117        fn new_empty() -> Self {
118            Self { minimum_rgb: fidl::new_empty!(u8, D) }
119        }
120
121        #[inline]
122        unsafe fn decode(
123            &mut self,
124            decoder: &mut fidl::encoding::Decoder<'_, D>,
125            offset: usize,
126            _depth: fidl::encoding::Depth,
127        ) -> fidl::Result<()> {
128            decoder.debug_check_bounds::<Self>(offset);
129            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
130            // Verify that padding bytes are zero.
131            // Copy from the buffer into the object.
132            unsafe {
133                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 1);
134            }
135            Ok(())
136        }
137    }
138}