fidl_fuchsia_time_alarms__common/
fidl_fuchsia_time_alarms__common.rs1#![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 type AlarmId = String;
12
13#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
16pub enum WakeError {
17 Unspecified,
21 Dropped,
24 Internal,
28 #[doc(hidden)]
29 __SourceBreaking { unknown_ordinal: u32 },
30}
31
32#[macro_export]
34macro_rules! WakeErrorUnknown {
35 () => {
36 _
37 };
38}
39
40impl WakeError {
41 #[inline]
42 pub fn from_primitive(prim: u32) -> Option<Self> {
43 match prim {
44 1 => Some(Self::Unspecified),
45 2 => Some(Self::Dropped),
46 3 => Some(Self::Internal),
47 _ => None,
48 }
49 }
50
51 #[inline]
52 pub fn from_primitive_allow_unknown(prim: u32) -> Self {
53 match prim {
54 1 => Self::Unspecified,
55 2 => Self::Dropped,
56 3 => Self::Internal,
57 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
58 }
59 }
60
61 #[inline]
62 pub fn unknown() -> Self {
63 Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
64 }
65
66 #[inline]
67 pub const fn into_primitive(self) -> u32 {
68 match self {
69 Self::Unspecified => 1,
70 Self::Dropped => 2,
71 Self::Internal => 3,
72 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
73 }
74 }
75
76 #[inline]
77 pub fn is_unknown(&self) -> bool {
78 match self {
79 Self::__SourceBreaking { unknown_ordinal: _ } => true,
80 _ => false,
81 }
82 }
83}
84
85#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
86pub struct ClientSideBatonManagementCancelRequest {
87 pub alarm_id: String,
97}
98
99impl fidl::Persistable for ClientSideBatonManagementCancelRequest {}
100
101pub mod client_side_baton_management_ordinals {
102 pub const SET_AND_WAIT: u64 = 0x46ea462fcd0246c0;
103 pub const CANCEL: u64 = 0x2d59ccae0bda24e3;
104}
105
106pub mod wake_ordinals {
107 pub const SET_AND_WAIT: u64 = 0x46ea462fcd0246c0;
108 pub const CANCEL: u64 = 0x2d59ccae0bda24e3;
109}
110
111mod internal {
112 use super::*;
113 unsafe impl fidl::encoding::TypeMarker for WakeError {
114 type Owned = Self;
115
116 #[inline(always)]
117 fn inline_align(_context: fidl::encoding::Context) -> usize {
118 std::mem::align_of::<u32>()
119 }
120
121 #[inline(always)]
122 fn inline_size(_context: fidl::encoding::Context) -> usize {
123 std::mem::size_of::<u32>()
124 }
125
126 #[inline(always)]
127 fn encode_is_copy() -> bool {
128 false
129 }
130
131 #[inline(always)]
132 fn decode_is_copy() -> bool {
133 false
134 }
135 }
136
137 impl fidl::encoding::ValueTypeMarker for WakeError {
138 type Borrowed<'a> = Self;
139 #[inline(always)]
140 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
141 *value
142 }
143 }
144
145 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for WakeError {
146 #[inline]
147 unsafe fn encode(
148 self,
149 encoder: &mut fidl::encoding::Encoder<'_, D>,
150 offset: usize,
151 _depth: fidl::encoding::Depth,
152 ) -> fidl::Result<()> {
153 encoder.debug_check_bounds::<Self>(offset);
154 encoder.write_num(self.into_primitive(), offset);
155 Ok(())
156 }
157 }
158
159 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for WakeError {
160 #[inline(always)]
161 fn new_empty() -> Self {
162 Self::unknown()
163 }
164
165 #[inline]
166 unsafe fn decode(
167 &mut self,
168 decoder: &mut fidl::encoding::Decoder<'_, D>,
169 offset: usize,
170 _depth: fidl::encoding::Depth,
171 ) -> fidl::Result<()> {
172 decoder.debug_check_bounds::<Self>(offset);
173 let prim = decoder.read_num::<u32>(offset);
174
175 *self = Self::from_primitive_allow_unknown(prim);
176 Ok(())
177 }
178 }
179
180 impl fidl::encoding::ValueTypeMarker for ClientSideBatonManagementCancelRequest {
181 type Borrowed<'a> = &'a Self;
182 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
183 value
184 }
185 }
186
187 unsafe impl fidl::encoding::TypeMarker for ClientSideBatonManagementCancelRequest {
188 type Owned = Self;
189
190 #[inline(always)]
191 fn inline_align(_context: fidl::encoding::Context) -> usize {
192 8
193 }
194
195 #[inline(always)]
196 fn inline_size(_context: fidl::encoding::Context) -> usize {
197 16
198 }
199 }
200
201 unsafe impl<D: fidl::encoding::ResourceDialect>
202 fidl::encoding::Encode<ClientSideBatonManagementCancelRequest, D>
203 for &ClientSideBatonManagementCancelRequest
204 {
205 #[inline]
206 unsafe fn encode(
207 self,
208 encoder: &mut fidl::encoding::Encoder<'_, D>,
209 offset: usize,
210 _depth: fidl::encoding::Depth,
211 ) -> fidl::Result<()> {
212 encoder.debug_check_bounds::<ClientSideBatonManagementCancelRequest>(offset);
213 fidl::encoding::Encode::<ClientSideBatonManagementCancelRequest, D>::encode(
215 (<fidl::encoding::BoundedString<128> as fidl::encoding::ValueTypeMarker>::borrow(
216 &self.alarm_id,
217 ),),
218 encoder,
219 offset,
220 _depth,
221 )
222 }
223 }
224 unsafe impl<
225 D: fidl::encoding::ResourceDialect,
226 T0: fidl::encoding::Encode<fidl::encoding::BoundedString<128>, D>,
227 > fidl::encoding::Encode<ClientSideBatonManagementCancelRequest, D> for (T0,)
228 {
229 #[inline]
230 unsafe fn encode(
231 self,
232 encoder: &mut fidl::encoding::Encoder<'_, D>,
233 offset: usize,
234 depth: fidl::encoding::Depth,
235 ) -> fidl::Result<()> {
236 encoder.debug_check_bounds::<ClientSideBatonManagementCancelRequest>(offset);
237 self.0.encode(encoder, offset + 0, depth)?;
241 Ok(())
242 }
243 }
244
245 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
246 for ClientSideBatonManagementCancelRequest
247 {
248 #[inline(always)]
249 fn new_empty() -> Self {
250 Self { alarm_id: fidl::new_empty!(fidl::encoding::BoundedString<128>, D) }
251 }
252
253 #[inline]
254 unsafe fn decode(
255 &mut self,
256 decoder: &mut fidl::encoding::Decoder<'_, D>,
257 offset: usize,
258 _depth: fidl::encoding::Depth,
259 ) -> fidl::Result<()> {
260 decoder.debug_check_bounds::<Self>(offset);
261 fidl::decode!(
263 fidl::encoding::BoundedString<128>,
264 D,
265 &mut self.alarm_id,
266 decoder,
267 offset + 0,
268 _depth
269 )?;
270 Ok(())
271 }
272 }
273}