Skip to main content

fidl_fuchsia_time_alarms/
fidl_fuchsia_time_alarms.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::client::QueryResponseFut;
8use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
9use fidl::endpoints::{ControlHandle as _, Responder as _};
10pub use fidl_fuchsia_time_alarms_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct NotifierNotifyErrorRequest {
16    /// Identifier of the alarm that fired.
17    pub alarm_id: String,
18    /// Error preventing the alarm from firing.
19    pub error: WakeAlarmsError,
20}
21
22impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
23    for NotifierNotifyErrorRequest
24{
25}
26
27#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
28pub struct NotifierNotifyRequest {
29    /// Identifier of the alarm that fired.
30    pub alarm_id: String,
31    /// Used to ensure a minimum time slice for useful work, before the
32    /// system may suspend again.
33    pub keep_alive: fidl::EventPair,
34}
35
36impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for NotifierNotifyRequest {}
37
38#[derive(Debug, PartialEq)]
39pub struct SetAndWaitArgs {
40    /// The deadline at which the timer is supposed to fire. This
41    /// corresponds to a time instant on the boot timeline.
42    pub deadline: fidl::BootInstant,
43    /// Optional mode that allows the API to support a number of use cases.
44    pub mode: SetMode,
45    /// A unique identifier for the alarm.
46    ///
47    /// A unique value of `AlarmId` must be picked for each unique alarm
48    /// within a single FIDL connection's scope.
49    ///
50    /// Supplying an `alarm_id` for an already scheduled alarm reschedules
51    /// that alarm.
52    pub alarm_id: String,
53}
54
55impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for SetAndWaitArgs {}
56
57#[derive(Debug, PartialEq)]
58pub struct SetAndWaitUtcArgs {
59    /// The deadline at which the timer is supposed to fire. This
60    /// corresponds to a time instant on the UTC timeline.
61    pub deadline: InstantUtc,
62    /// Optional mode that allows the API to support a number of use cases.
63    pub mode: SetMode,
64    /// A unique identifier for the alarm.
65    ///
66    /// A unique value of `AlarmId` must be picked for each unique alarm
67    /// within a single FIDL connection's scope.
68    ///
69    /// Supplying an `alarm_id` for an already scheduled alarm reschedules
70    /// that alarm.
71    pub alarm_id: String,
72}
73
74impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for SetAndWaitUtcArgs {}
75
76#[derive(Debug, PartialEq)]
77pub struct SetArgs {
78    /// Notifier to call when the alarm fires. When the server_end to
79    /// this channel is dropped, the alarm will be canceled.
80    pub notifier: fidl::endpoints::ClientEnd<NotifierMarker>,
81    /// The deadline at which the timer is supposed to fire. This
82    /// corresponds to a time instant on the boot timeline.
83    pub deadline: fidl::BootInstant,
84    /// Optional mode that allows the API to support a number of use cases.
85    pub mode: SetMode,
86    /// Set to a nonempty value to identify the alarm. A unique value
87    /// of [AlarmId] must be picked per each unique alarm within a
88    /// single FIDL connection's scope.
89    ///
90    /// Supplying an alarm_id for an already scheduled alarm reschedules
91    /// that alarm.
92    pub alarm_id: String,
93}
94
95impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for SetArgs {}
96
97#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
98pub struct WakeAlarmsSetAndWaitUtcResponse {
99    /// Used by the caller to ensure a minimum time slice for useful work,
100    /// before the system may suspend again.
101    pub keep_alive: fidl::EventPair,
102}
103
104impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
105    for WakeAlarmsSetAndWaitUtcResponse
106{
107}
108
109#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
110pub struct WakeAlarmsSetAndWaitResponse {
111    /// Used by the caller to ensure a minimum time slice for useful work,
112    /// before the system may suspend again.
113    pub keep_alive: fidl::EventPair,
114}
115
116impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
117    for WakeAlarmsSetAndWaitResponse
118{
119}
120
121/// A mode of notification for when an alarm has been scheduled.
122#[derive(Debug)]
123pub enum SetMode {
124    /// This lease is dropped as immediately after the alarm is scheduled
125    /// (or an error occurs during scheduling), thus guaranteeing that the
126    /// alarm is scheduled before the system is suspended.
127    KeepAlive(fidl::EventPair),
128    /// The callee signals this event (with ZX_EVENT_SIGNALED) once the alarm
129    /// is scheduled. This indicates that the caller can drop any pending wake
130    /// leases related to this call.
131    NotifySetupDone(fidl::Event),
132    #[doc(hidden)]
133    __SourceBreaking { unknown_ordinal: u64 },
134}
135
136/// Pattern that matches an unknown `SetMode` member.
137#[macro_export]
138macro_rules! SetModeUnknown {
139    () => {
140        _
141    };
142}
143
144// Custom PartialEq so that unknown variants are not equal to themselves.
145impl PartialEq for SetMode {
146    fn eq(&self, other: &Self) -> bool {
147        match (self, other) {
148            (Self::KeepAlive(x), Self::KeepAlive(y)) => *x == *y,
149            (Self::NotifySetupDone(x), Self::NotifySetupDone(y)) => *x == *y,
150            _ => false,
151        }
152    }
153}
154
155impl SetMode {
156    #[inline]
157    pub fn ordinal(&self) -> u64 {
158        match *self {
159            Self::KeepAlive(_) => 1,
160            Self::NotifySetupDone(_) => 2,
161            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
162        }
163    }
164
165    #[inline]
166    pub fn unknown_variant_for_testing() -> Self {
167        Self::__SourceBreaking { unknown_ordinal: 0 }
168    }
169
170    #[inline]
171    pub fn is_unknown(&self) -> bool {
172        match self {
173            Self::__SourceBreaking { .. } => true,
174            _ => false,
175        }
176    }
177}
178
179impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for SetMode {}
180
181#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
182pub struct NotifierMarker;
183
184impl fidl::endpoints::ProtocolMarker for NotifierMarker {
185    type Proxy = NotifierProxy;
186    type RequestStream = NotifierRequestStream;
187    #[cfg(target_os = "fuchsia")]
188    type SynchronousProxy = NotifierSynchronousProxy;
189
190    const DEBUG_NAME: &'static str = "fuchsia.time.alarms.Notifier";
191}
192impl fidl::endpoints::DiscoverableProtocolMarker for NotifierMarker {}
193
194pub trait NotifierProxyInterface: Send + Sync {
195    fn r#notify(&self, alarm_id: &str, keep_alive: fidl::EventPair) -> Result<(), fidl::Error>;
196    fn r#notify_error(&self, alarm_id: &str, error: WakeAlarmsError) -> Result<(), fidl::Error>;
197}
198#[derive(Debug)]
199#[cfg(target_os = "fuchsia")]
200pub struct NotifierSynchronousProxy {
201    client: fidl::client::sync::Client,
202}
203
204#[cfg(target_os = "fuchsia")]
205impl fidl::endpoints::SynchronousProxy for NotifierSynchronousProxy {
206    type Proxy = NotifierProxy;
207    type Protocol = NotifierMarker;
208
209    fn from_channel(inner: fidl::Channel) -> Self {
210        Self::new(inner)
211    }
212
213    fn into_channel(self) -> fidl::Channel {
214        self.client.into_channel()
215    }
216
217    fn as_channel(&self) -> &fidl::Channel {
218        self.client.as_channel()
219    }
220}
221
222#[cfg(target_os = "fuchsia")]
223impl NotifierSynchronousProxy {
224    pub fn new(channel: fidl::Channel) -> Self {
225        Self { client: fidl::client::sync::Client::new(channel) }
226    }
227
228    pub fn into_channel(self) -> fidl::Channel {
229        self.client.into_channel()
230    }
231
232    /// Waits until an event arrives and returns it. It is safe for other
233    /// threads to make concurrent requests while waiting for an event.
234    pub fn wait_for_event(
235        &self,
236        deadline: zx::MonotonicInstant,
237    ) -> Result<NotifierEvent, fidl::Error> {
238        NotifierEvent::decode(self.client.wait_for_event::<NotifierMarker>(deadline)?)
239    }
240
241    /// Notifies when an alarm previously set by [WakeAlarms.Set] fires.
242    pub fn r#notify(
243        &self,
244        mut alarm_id: &str,
245        mut keep_alive: fidl::EventPair,
246    ) -> Result<(), fidl::Error> {
247        self.client.send::<NotifierNotifyRequest>(
248            (alarm_id, keep_alive),
249            0x23d11b31ba0d67d4,
250            fidl::encoding::DynamicFlags::FLEXIBLE,
251        )
252    }
253
254    /// Notifies when an alarm previously set by [WakeAlarms.Set] is unable to
255    /// fire due to an error.
256    pub fn r#notify_error(
257        &self,
258        mut alarm_id: &str,
259        mut error: WakeAlarmsError,
260    ) -> Result<(), fidl::Error> {
261        self.client.send::<NotifierNotifyErrorRequest>(
262            (alarm_id, error),
263            0x62e915191b0113e9,
264            fidl::encoding::DynamicFlags::FLEXIBLE,
265        )
266    }
267}
268
269#[cfg(target_os = "fuchsia")]
270impl From<NotifierSynchronousProxy> for zx::NullableHandle {
271    fn from(value: NotifierSynchronousProxy) -> Self {
272        value.into_channel().into()
273    }
274}
275
276#[cfg(target_os = "fuchsia")]
277impl From<fidl::Channel> for NotifierSynchronousProxy {
278    fn from(value: fidl::Channel) -> Self {
279        Self::new(value)
280    }
281}
282
283#[cfg(target_os = "fuchsia")]
284impl fidl::endpoints::FromClient for NotifierSynchronousProxy {
285    type Protocol = NotifierMarker;
286
287    fn from_client(value: fidl::endpoints::ClientEnd<NotifierMarker>) -> Self {
288        Self::new(value.into_channel())
289    }
290}
291
292#[derive(Debug, Clone)]
293pub struct NotifierProxy {
294    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
295}
296
297impl fidl::endpoints::Proxy for NotifierProxy {
298    type Protocol = NotifierMarker;
299
300    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
301        Self::new(inner)
302    }
303
304    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
305        self.client.into_channel().map_err(|client| Self { client })
306    }
307
308    fn as_channel(&self) -> &::fidl::AsyncChannel {
309        self.client.as_channel()
310    }
311}
312
313impl NotifierProxy {
314    /// Create a new Proxy for fuchsia.time.alarms/Notifier.
315    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
316        let protocol_name = <NotifierMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
317        Self { client: fidl::client::Client::new(channel, protocol_name) }
318    }
319
320    /// Get a Stream of events from the remote end of the protocol.
321    ///
322    /// # Panics
323    ///
324    /// Panics if the event stream was already taken.
325    pub fn take_event_stream(&self) -> NotifierEventStream {
326        NotifierEventStream { event_receiver: self.client.take_event_receiver() }
327    }
328
329    /// Notifies when an alarm previously set by [WakeAlarms.Set] fires.
330    pub fn r#notify(
331        &self,
332        mut alarm_id: &str,
333        mut keep_alive: fidl::EventPair,
334    ) -> Result<(), fidl::Error> {
335        NotifierProxyInterface::r#notify(self, alarm_id, keep_alive)
336    }
337
338    /// Notifies when an alarm previously set by [WakeAlarms.Set] is unable to
339    /// fire due to an error.
340    pub fn r#notify_error(
341        &self,
342        mut alarm_id: &str,
343        mut error: WakeAlarmsError,
344    ) -> Result<(), fidl::Error> {
345        NotifierProxyInterface::r#notify_error(self, alarm_id, error)
346    }
347}
348
349impl NotifierProxyInterface for NotifierProxy {
350    fn r#notify(
351        &self,
352        mut alarm_id: &str,
353        mut keep_alive: fidl::EventPair,
354    ) -> Result<(), fidl::Error> {
355        self.client.send::<NotifierNotifyRequest>(
356            (alarm_id, keep_alive),
357            0x23d11b31ba0d67d4,
358            fidl::encoding::DynamicFlags::FLEXIBLE,
359        )
360    }
361
362    fn r#notify_error(
363        &self,
364        mut alarm_id: &str,
365        mut error: WakeAlarmsError,
366    ) -> Result<(), fidl::Error> {
367        self.client.send::<NotifierNotifyErrorRequest>(
368            (alarm_id, error),
369            0x62e915191b0113e9,
370            fidl::encoding::DynamicFlags::FLEXIBLE,
371        )
372    }
373}
374
375pub struct NotifierEventStream {
376    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
377}
378
379impl std::marker::Unpin for NotifierEventStream {}
380
381impl futures::stream::FusedStream for NotifierEventStream {
382    fn is_terminated(&self) -> bool {
383        self.event_receiver.is_terminated()
384    }
385}
386
387impl futures::Stream for NotifierEventStream {
388    type Item = Result<NotifierEvent, fidl::Error>;
389
390    fn poll_next(
391        mut self: std::pin::Pin<&mut Self>,
392        cx: &mut std::task::Context<'_>,
393    ) -> std::task::Poll<Option<Self::Item>> {
394        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
395            &mut self.event_receiver,
396            cx
397        )?) {
398            Some(buf) => std::task::Poll::Ready(Some(NotifierEvent::decode(buf))),
399            None => std::task::Poll::Ready(None),
400        }
401    }
402}
403
404#[derive(Debug)]
405pub enum NotifierEvent {
406    #[non_exhaustive]
407    _UnknownEvent {
408        /// Ordinal of the event that was sent.
409        ordinal: u64,
410    },
411}
412
413impl NotifierEvent {
414    /// Decodes a message buffer as a [`NotifierEvent`].
415    fn decode(
416        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
417    ) -> Result<NotifierEvent, fidl::Error> {
418        let (bytes, _handles) = buf.split_mut();
419        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
420        debug_assert_eq!(tx_header.tx_id, 0);
421        match tx_header.ordinal {
422            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
423                Ok(NotifierEvent::_UnknownEvent { ordinal: tx_header.ordinal })
424            }
425            _ => Err(fidl::Error::UnknownOrdinal {
426                ordinal: tx_header.ordinal,
427                protocol_name: <NotifierMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
428            }),
429        }
430    }
431}
432
433/// A Stream of incoming requests for fuchsia.time.alarms/Notifier.
434pub struct NotifierRequestStream {
435    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
436    is_terminated: bool,
437}
438
439impl std::marker::Unpin for NotifierRequestStream {}
440
441impl futures::stream::FusedStream for NotifierRequestStream {
442    fn is_terminated(&self) -> bool {
443        self.is_terminated
444    }
445}
446
447impl fidl::endpoints::RequestStream for NotifierRequestStream {
448    type Protocol = NotifierMarker;
449    type ControlHandle = NotifierControlHandle;
450
451    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
452        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
453    }
454
455    fn control_handle(&self) -> Self::ControlHandle {
456        NotifierControlHandle { inner: self.inner.clone() }
457    }
458
459    fn into_inner(
460        self,
461    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
462    {
463        (self.inner, self.is_terminated)
464    }
465
466    fn from_inner(
467        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
468        is_terminated: bool,
469    ) -> Self {
470        Self { inner, is_terminated }
471    }
472}
473
474impl futures::Stream for NotifierRequestStream {
475    type Item = Result<NotifierRequest, fidl::Error>;
476
477    fn poll_next(
478        mut self: std::pin::Pin<&mut Self>,
479        cx: &mut std::task::Context<'_>,
480    ) -> std::task::Poll<Option<Self::Item>> {
481        let this = &mut *self;
482        if this.inner.check_shutdown(cx) {
483            this.is_terminated = true;
484            return std::task::Poll::Ready(None);
485        }
486        if this.is_terminated {
487            panic!("polled NotifierRequestStream after completion");
488        }
489        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
490            |bytes, handles| {
491                match this.inner.channel().read_etc(cx, bytes, handles) {
492                    std::task::Poll::Ready(Ok(())) => {}
493                    std::task::Poll::Pending => return std::task::Poll::Pending,
494                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
495                        this.is_terminated = true;
496                        return std::task::Poll::Ready(None);
497                    }
498                    std::task::Poll::Ready(Err(e)) => {
499                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
500                            e.into(),
501                        ))));
502                    }
503                }
504
505                // A message has been received from the channel
506                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
507
508                std::task::Poll::Ready(Some(match header.ordinal {
509                    0x23d11b31ba0d67d4 => {
510                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
511                        let mut req = fidl::new_empty!(
512                            NotifierNotifyRequest,
513                            fidl::encoding::DefaultFuchsiaResourceDialect
514                        );
515                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<NotifierNotifyRequest>(&header, _body_bytes, handles, &mut req)?;
516                        let control_handle = NotifierControlHandle { inner: this.inner.clone() };
517                        Ok(NotifierRequest::Notify {
518                            alarm_id: req.alarm_id,
519                            keep_alive: req.keep_alive,
520
521                            control_handle,
522                        })
523                    }
524                    0x62e915191b0113e9 => {
525                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
526                        let mut req = fidl::new_empty!(
527                            NotifierNotifyErrorRequest,
528                            fidl::encoding::DefaultFuchsiaResourceDialect
529                        );
530                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<NotifierNotifyErrorRequest>(&header, _body_bytes, handles, &mut req)?;
531                        let control_handle = NotifierControlHandle { inner: this.inner.clone() };
532                        Ok(NotifierRequest::NotifyError {
533                            alarm_id: req.alarm_id,
534                            error: req.error,
535
536                            control_handle,
537                        })
538                    }
539                    _ if header.tx_id == 0
540                        && header
541                            .dynamic_flags()
542                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
543                    {
544                        Ok(NotifierRequest::_UnknownMethod {
545                            ordinal: header.ordinal,
546                            control_handle: NotifierControlHandle { inner: this.inner.clone() },
547                            method_type: fidl::MethodType::OneWay,
548                        })
549                    }
550                    _ if header
551                        .dynamic_flags()
552                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
553                    {
554                        this.inner.send_framework_err(
555                            fidl::encoding::FrameworkErr::UnknownMethod,
556                            header.tx_id,
557                            header.ordinal,
558                            header.dynamic_flags(),
559                            (bytes, handles),
560                        )?;
561                        Ok(NotifierRequest::_UnknownMethod {
562                            ordinal: header.ordinal,
563                            control_handle: NotifierControlHandle { inner: this.inner.clone() },
564                            method_type: fidl::MethodType::TwoWay,
565                        })
566                    }
567                    _ => Err(fidl::Error::UnknownOrdinal {
568                        ordinal: header.ordinal,
569                        protocol_name:
570                            <NotifierMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
571                    }),
572                }))
573            },
574        )
575    }
576}
577
578/// [Notifier] is used to notify when a wake alarm fires.
579///
580/// A client-end channel of this protocol will be provided to the implementor of
581/// [WakeAlarms.Set].
582///
583/// Dropping the server-end will cancel all alarms scheduled with [WakeAlarms.Set]
584/// associated with this server instance.
585#[derive(Debug)]
586pub enum NotifierRequest {
587    /// Notifies when an alarm previously set by [WakeAlarms.Set] fires.
588    Notify { alarm_id: String, keep_alive: fidl::EventPair, control_handle: NotifierControlHandle },
589    /// Notifies when an alarm previously set by [WakeAlarms.Set] is unable to
590    /// fire due to an error.
591    NotifyError { alarm_id: String, error: WakeAlarmsError, control_handle: NotifierControlHandle },
592    /// An interaction was received which does not match any known method.
593    #[non_exhaustive]
594    _UnknownMethod {
595        /// Ordinal of the method that was called.
596        ordinal: u64,
597        control_handle: NotifierControlHandle,
598        method_type: fidl::MethodType,
599    },
600}
601
602impl NotifierRequest {
603    #[allow(irrefutable_let_patterns)]
604    pub fn into_notify(self) -> Option<(String, fidl::EventPair, NotifierControlHandle)> {
605        if let NotifierRequest::Notify { alarm_id, keep_alive, control_handle } = self {
606            Some((alarm_id, keep_alive, control_handle))
607        } else {
608            None
609        }
610    }
611
612    #[allow(irrefutable_let_patterns)]
613    pub fn into_notify_error(self) -> Option<(String, WakeAlarmsError, NotifierControlHandle)> {
614        if let NotifierRequest::NotifyError { alarm_id, error, control_handle } = self {
615            Some((alarm_id, error, control_handle))
616        } else {
617            None
618        }
619    }
620
621    /// Name of the method defined in FIDL
622    pub fn method_name(&self) -> &'static str {
623        match *self {
624            NotifierRequest::Notify { .. } => "notify",
625            NotifierRequest::NotifyError { .. } => "notify_error",
626            NotifierRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
627                "unknown one-way method"
628            }
629            NotifierRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
630                "unknown two-way method"
631            }
632        }
633    }
634}
635
636#[derive(Debug, Clone)]
637pub struct NotifierControlHandle {
638    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
639}
640
641impl NotifierControlHandle {
642    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
643        self.inner.shutdown_with_epitaph(status.into())
644    }
645}
646
647impl fidl::endpoints::ControlHandle for NotifierControlHandle {
648    fn shutdown(&self) {
649        self.inner.shutdown()
650    }
651
652    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
653        self.inner.shutdown_with_epitaph(status)
654    }
655
656    fn is_closed(&self) -> bool {
657        self.inner.channel().is_closed()
658    }
659    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
660        self.inner.channel().on_closed()
661    }
662
663    #[cfg(target_os = "fuchsia")]
664    fn signal_peer(
665        &self,
666        clear_mask: zx::Signals,
667        set_mask: zx::Signals,
668    ) -> Result<(), zx_status::Status> {
669        use fidl::Peered;
670        self.inner.channel().signal_peer(clear_mask, set_mask)
671    }
672}
673
674impl NotifierControlHandle {}
675
676#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
677pub struct WakeAlarmsMarker;
678
679impl fidl::endpoints::ProtocolMarker for WakeAlarmsMarker {
680    type Proxy = WakeAlarmsProxy;
681    type RequestStream = WakeAlarmsRequestStream;
682    #[cfg(target_os = "fuchsia")]
683    type SynchronousProxy = WakeAlarmsSynchronousProxy;
684
685    const DEBUG_NAME: &'static str = "fuchsia.time.alarms.WakeAlarms";
686}
687impl fidl::endpoints::DiscoverableProtocolMarker for WakeAlarmsMarker {}
688pub type WakeAlarmsSetAndWaitResult = Result<fidl::EventPair, WakeAlarmsError>;
689pub type WakeAlarmsSetResult = Result<(), WakeAlarmsError>;
690pub type WakeAlarmsSetAndWaitUtcResult = Result<fidl::EventPair, WakeAlarmsError>;
691
692pub trait WakeAlarmsProxyInterface: Send + Sync {
693    type SetAndWaitResponseFut: std::future::Future<Output = Result<WakeAlarmsSetAndWaitResult, fidl::Error>>
694        + Send;
695    fn r#set_and_wait(
696        &self,
697        deadline: fidl::BootInstant,
698        mode: SetMode,
699        alarm_id: &str,
700    ) -> Self::SetAndWaitResponseFut;
701    fn r#cancel(&self, alarm_id: &str) -> Result<(), fidl::Error>;
702    type SetResponseFut: std::future::Future<Output = Result<WakeAlarmsSetResult, fidl::Error>>
703        + Send;
704    fn r#set(
705        &self,
706        notifier: fidl::endpoints::ClientEnd<NotifierMarker>,
707        deadline: fidl::BootInstant,
708        mode: SetMode,
709        alarm_id: &str,
710    ) -> Self::SetResponseFut;
711    type SetAndWaitUtcResponseFut: std::future::Future<Output = Result<WakeAlarmsSetAndWaitUtcResult, fidl::Error>>
712        + Send;
713    fn r#set_and_wait_utc(
714        &self,
715        deadline: &InstantUtc,
716        mode: SetMode,
717        alarm_id: &str,
718    ) -> Self::SetAndWaitUtcResponseFut;
719}
720#[derive(Debug)]
721#[cfg(target_os = "fuchsia")]
722pub struct WakeAlarmsSynchronousProxy {
723    client: fidl::client::sync::Client,
724}
725
726#[cfg(target_os = "fuchsia")]
727impl fidl::endpoints::SynchronousProxy for WakeAlarmsSynchronousProxy {
728    type Proxy = WakeAlarmsProxy;
729    type Protocol = WakeAlarmsMarker;
730
731    fn from_channel(inner: fidl::Channel) -> Self {
732        Self::new(inner)
733    }
734
735    fn into_channel(self) -> fidl::Channel {
736        self.client.into_channel()
737    }
738
739    fn as_channel(&self) -> &fidl::Channel {
740        self.client.as_channel()
741    }
742}
743
744#[cfg(target_os = "fuchsia")]
745impl WakeAlarmsSynchronousProxy {
746    pub fn new(channel: fidl::Channel) -> Self {
747        Self { client: fidl::client::sync::Client::new(channel) }
748    }
749
750    pub fn into_channel(self) -> fidl::Channel {
751        self.client.into_channel()
752    }
753
754    /// Waits until an event arrives and returns it. It is safe for other
755    /// threads to make concurrent requests while waiting for an event.
756    pub fn wait_for_event(
757        &self,
758        deadline: zx::MonotonicInstant,
759    ) -> Result<WakeAlarmsEvent, fidl::Error> {
760        WakeAlarmsEvent::decode(self.client.wait_for_event::<WakeAlarmsMarker>(deadline)?)
761    }
762
763    /// Sets a wake alarm with the provided parameters, and waits for the alarm
764    /// to fire.
765    ///
766    /// The caller may request multiple alarms concurrently. Re-requesting
767    /// an alarm that has the same `alarm_id` as an already scheduled alarm
768    /// causes that scheduled alarm to be canceled before the new alarm is
769    /// scheduled.
770    ///
771    /// ## Return value
772    ///
773    /// * `keep_alive`: A handle that prevents the system from suspending as
774    ///   long as it is held.
775    ///
776    /// The call to `SetAndWait` returns when the alarm fires, an error occurs,
777    /// or the alarm is canceled. This return style is required for some
778    /// clients, such as Starnix, which rely on FIDL response tallying to guide
779    /// their power management strategy.
780    ///
781    /// As an example, under Starnix, a response to this request will cause a
782    /// Starnix container to be unsuspended ("woken up"). This is a critical
783    /// behavior for suspend correctness under Starnix. Using the [Notifier]
784    /// approach would side-step this mechanism and result in incorrect wake
785    /// behavior under Starnix.
786    ///
787    /// ## Protocol Errors
788    ///
789    /// * `DROPPED`: The alarm was canceled by a call to `Cancel`.
790    /// * `UNSPECIFIED`: A new failure mode has been observed that has not
791    ///   yet been assigned an error code. This indicates that the API
792    ///   version may need to be updated.
793    /// * `INTERNAL` is a server-side bug: an internal fallible call (which is
794    ///   expected to be unlikely to fail) has failed somehow. Please report this
795    ///   for investigation.
796    /// * [INVALID_ARGS]: a parameter provided by the user is not valid, such
797    ///   as an empty `alarm_id`.
798    pub fn r#set_and_wait(
799        &self,
800        mut deadline: fidl::BootInstant,
801        mut mode: SetMode,
802        mut alarm_id: &str,
803        ___deadline: zx::MonotonicInstant,
804    ) -> Result<WakeAlarmsSetAndWaitResult, fidl::Error> {
805        let _response = self.client.send_query::<
806            SetAndWaitArgs,
807            fidl::encoding::FlexibleResultType<WakeAlarmsSetAndWaitResponse, WakeAlarmsError>,
808            WakeAlarmsMarker,
809        >(
810            (deadline, &mut mode, alarm_id,),
811            0x57ebd075ce4beba,
812            fidl::encoding::DynamicFlags::FLEXIBLE,
813            ___deadline,
814        )?
815        .into_result::<WakeAlarmsMarker>("set_and_wait")?;
816        Ok(_response.map(|x| x.keep_alive))
817    }
818
819    /// Cancels the alarm specified by `alarm_id`.
820    ///
821    /// Providing an `alarm_id` for an alarm that is not scheduled is a no-op.
822    pub fn r#cancel(&self, mut alarm_id: &str) -> Result<(), fidl::Error> {
823        self.client.send::<WakeAlarmsCancelRequest>(
824            (alarm_id,),
825            0x7b23a9760115e55c,
826            fidl::encoding::DynamicFlags::FLEXIBLE,
827        )
828    }
829
830    /// Sets a wake alarm with the provided parameters.
831    ///
832    /// The caller may request multiple alarms concurrently. Re-requesting
833    /// an alarm that has the same `alarm_id` as an already scheduled alarm
834    /// causes that scheduled alarm to be canceled before the same alarm
835    /// is scheduled again.
836    ///
837    /// ## Return value
838    ///
839    /// This method will return when the alarm is scheduled.
840    ///
841    /// ## Protocol Errors
842    ///
843    /// * [UNSPECIFIED] you are observing a new failure mode which has not
844    ///   been assigned an error code yet. Expect this failure mode to be
845    ///   assigned a more specific error code in future versions of this API.
846    ///   This is not a bug, but an indication that you may need to update the
847    ///   API version.
848    /// * [INTERNAL] is a bug: an internal fallible call (which is expected
849    ///   to be unlikely to fail) has failed somehow. Please report this for
850    ///   investigation.
851    /// * [INVALID_ARGS]: a parameter provided by the user is not valid, such
852    ///   as an empty `alarm_id`.
853    pub fn r#set(
854        &self,
855        mut notifier: fidl::endpoints::ClientEnd<NotifierMarker>,
856        mut deadline: fidl::BootInstant,
857        mut mode: SetMode,
858        mut alarm_id: &str,
859        ___deadline: zx::MonotonicInstant,
860    ) -> Result<WakeAlarmsSetResult, fidl::Error> {
861        let _response = self.client.send_query::<
862            SetArgs,
863            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, WakeAlarmsError>,
864            WakeAlarmsMarker,
865        >(
866            (notifier, deadline, &mut mode, alarm_id,),
867            0x1f110857e48fd72c,
868            fidl::encoding::DynamicFlags::FLEXIBLE,
869            ___deadline,
870        )?
871        .into_result::<WakeAlarmsMarker>("set")?;
872        Ok(_response.map(|x| x))
873    }
874
875    /// Similar to [SetAndWait], except the alarm is scheduled on the UTC
876    /// timeline.
877    ///
878    /// Refer to [SetAndWait] documentation for the functionality details, and
879    /// especially see the section "Return value" for the return value
880    /// subtleties.
881    pub fn r#set_and_wait_utc(
882        &self,
883        mut deadline: &InstantUtc,
884        mut mode: SetMode,
885        mut alarm_id: &str,
886        ___deadline: zx::MonotonicInstant,
887    ) -> Result<WakeAlarmsSetAndWaitUtcResult, fidl::Error> {
888        let _response =
889            self.client
890                .send_query::<SetAndWaitUtcArgs, fidl::encoding::FlexibleResultType<
891                    WakeAlarmsSetAndWaitUtcResponse,
892                    WakeAlarmsError,
893                >, WakeAlarmsMarker>(
894                    (deadline, &mut mode, alarm_id),
895                    0x4ea69d33af584219,
896                    fidl::encoding::DynamicFlags::FLEXIBLE,
897                    ___deadline,
898                )?
899                .into_result::<WakeAlarmsMarker>("set_and_wait_utc")?;
900        Ok(_response.map(|x| x.keep_alive))
901    }
902}
903
904#[cfg(target_os = "fuchsia")]
905impl From<WakeAlarmsSynchronousProxy> for zx::NullableHandle {
906    fn from(value: WakeAlarmsSynchronousProxy) -> Self {
907        value.into_channel().into()
908    }
909}
910
911#[cfg(target_os = "fuchsia")]
912impl From<fidl::Channel> for WakeAlarmsSynchronousProxy {
913    fn from(value: fidl::Channel) -> Self {
914        Self::new(value)
915    }
916}
917
918#[cfg(target_os = "fuchsia")]
919impl fidl::endpoints::FromClient for WakeAlarmsSynchronousProxy {
920    type Protocol = WakeAlarmsMarker;
921
922    fn from_client(value: fidl::endpoints::ClientEnd<WakeAlarmsMarker>) -> Self {
923        Self::new(value.into_channel())
924    }
925}
926
927#[derive(Debug, Clone)]
928pub struct WakeAlarmsProxy {
929    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
930}
931
932impl fidl::endpoints::Proxy for WakeAlarmsProxy {
933    type Protocol = WakeAlarmsMarker;
934
935    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
936        Self::new(inner)
937    }
938
939    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
940        self.client.into_channel().map_err(|client| Self { client })
941    }
942
943    fn as_channel(&self) -> &::fidl::AsyncChannel {
944        self.client.as_channel()
945    }
946}
947
948impl WakeAlarmsProxy {
949    /// Create a new Proxy for fuchsia.time.alarms/WakeAlarms.
950    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
951        let protocol_name = <WakeAlarmsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
952        Self { client: fidl::client::Client::new(channel, protocol_name) }
953    }
954
955    /// Get a Stream of events from the remote end of the protocol.
956    ///
957    /// # Panics
958    ///
959    /// Panics if the event stream was already taken.
960    pub fn take_event_stream(&self) -> WakeAlarmsEventStream {
961        WakeAlarmsEventStream { event_receiver: self.client.take_event_receiver() }
962    }
963
964    /// Sets a wake alarm with the provided parameters, and waits for the alarm
965    /// to fire.
966    ///
967    /// The caller may request multiple alarms concurrently. Re-requesting
968    /// an alarm that has the same `alarm_id` as an already scheduled alarm
969    /// causes that scheduled alarm to be canceled before the new alarm is
970    /// scheduled.
971    ///
972    /// ## Return value
973    ///
974    /// * `keep_alive`: A handle that prevents the system from suspending as
975    ///   long as it is held.
976    ///
977    /// The call to `SetAndWait` returns when the alarm fires, an error occurs,
978    /// or the alarm is canceled. This return style is required for some
979    /// clients, such as Starnix, which rely on FIDL response tallying to guide
980    /// their power management strategy.
981    ///
982    /// As an example, under Starnix, a response to this request will cause a
983    /// Starnix container to be unsuspended ("woken up"). This is a critical
984    /// behavior for suspend correctness under Starnix. Using the [Notifier]
985    /// approach would side-step this mechanism and result in incorrect wake
986    /// behavior under Starnix.
987    ///
988    /// ## Protocol Errors
989    ///
990    /// * `DROPPED`: The alarm was canceled by a call to `Cancel`.
991    /// * `UNSPECIFIED`: A new failure mode has been observed that has not
992    ///   yet been assigned an error code. This indicates that the API
993    ///   version may need to be updated.
994    /// * `INTERNAL` is a server-side bug: an internal fallible call (which is
995    ///   expected to be unlikely to fail) has failed somehow. Please report this
996    ///   for investigation.
997    /// * [INVALID_ARGS]: a parameter provided by the user is not valid, such
998    ///   as an empty `alarm_id`.
999    pub fn r#set_and_wait(
1000        &self,
1001        mut deadline: fidl::BootInstant,
1002        mut mode: SetMode,
1003        mut alarm_id: &str,
1004    ) -> fidl::client::QueryResponseFut<
1005        WakeAlarmsSetAndWaitResult,
1006        fidl::encoding::DefaultFuchsiaResourceDialect,
1007    > {
1008        WakeAlarmsProxyInterface::r#set_and_wait(self, deadline, mode, alarm_id)
1009    }
1010
1011    /// Cancels the alarm specified by `alarm_id`.
1012    ///
1013    /// Providing an `alarm_id` for an alarm that is not scheduled is a no-op.
1014    pub fn r#cancel(&self, mut alarm_id: &str) -> Result<(), fidl::Error> {
1015        WakeAlarmsProxyInterface::r#cancel(self, alarm_id)
1016    }
1017
1018    /// Sets a wake alarm with the provided parameters.
1019    ///
1020    /// The caller may request multiple alarms concurrently. Re-requesting
1021    /// an alarm that has the same `alarm_id` as an already scheduled alarm
1022    /// causes that scheduled alarm to be canceled before the same alarm
1023    /// is scheduled again.
1024    ///
1025    /// ## Return value
1026    ///
1027    /// This method will return when the alarm is scheduled.
1028    ///
1029    /// ## Protocol Errors
1030    ///
1031    /// * [UNSPECIFIED] you are observing a new failure mode which has not
1032    ///   been assigned an error code yet. Expect this failure mode to be
1033    ///   assigned a more specific error code in future versions of this API.
1034    ///   This is not a bug, but an indication that you may need to update the
1035    ///   API version.
1036    /// * [INTERNAL] is a bug: an internal fallible call (which is expected
1037    ///   to be unlikely to fail) has failed somehow. Please report this for
1038    ///   investigation.
1039    /// * [INVALID_ARGS]: a parameter provided by the user is not valid, such
1040    ///   as an empty `alarm_id`.
1041    pub fn r#set(
1042        &self,
1043        mut notifier: fidl::endpoints::ClientEnd<NotifierMarker>,
1044        mut deadline: fidl::BootInstant,
1045        mut mode: SetMode,
1046        mut alarm_id: &str,
1047    ) -> fidl::client::QueryResponseFut<
1048        WakeAlarmsSetResult,
1049        fidl::encoding::DefaultFuchsiaResourceDialect,
1050    > {
1051        WakeAlarmsProxyInterface::r#set(self, notifier, deadline, mode, alarm_id)
1052    }
1053
1054    /// Similar to [SetAndWait], except the alarm is scheduled on the UTC
1055    /// timeline.
1056    ///
1057    /// Refer to [SetAndWait] documentation for the functionality details, and
1058    /// especially see the section "Return value" for the return value
1059    /// subtleties.
1060    pub fn r#set_and_wait_utc(
1061        &self,
1062        mut deadline: &InstantUtc,
1063        mut mode: SetMode,
1064        mut alarm_id: &str,
1065    ) -> fidl::client::QueryResponseFut<
1066        WakeAlarmsSetAndWaitUtcResult,
1067        fidl::encoding::DefaultFuchsiaResourceDialect,
1068    > {
1069        WakeAlarmsProxyInterface::r#set_and_wait_utc(self, deadline, mode, alarm_id)
1070    }
1071}
1072
1073impl WakeAlarmsProxyInterface for WakeAlarmsProxy {
1074    type SetAndWaitResponseFut = fidl::client::QueryResponseFut<
1075        WakeAlarmsSetAndWaitResult,
1076        fidl::encoding::DefaultFuchsiaResourceDialect,
1077    >;
1078    fn r#set_and_wait(
1079        &self,
1080        mut deadline: fidl::BootInstant,
1081        mut mode: SetMode,
1082        mut alarm_id: &str,
1083    ) -> Self::SetAndWaitResponseFut {
1084        fn _decode(
1085            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1086        ) -> Result<WakeAlarmsSetAndWaitResult, fidl::Error> {
1087            let _response = fidl::client::decode_transaction_body::<
1088                fidl::encoding::FlexibleResultType<WakeAlarmsSetAndWaitResponse, WakeAlarmsError>,
1089                fidl::encoding::DefaultFuchsiaResourceDialect,
1090                0x57ebd075ce4beba,
1091            >(_buf?)?
1092            .into_result::<WakeAlarmsMarker>("set_and_wait")?;
1093            Ok(_response.map(|x| x.keep_alive))
1094        }
1095        self.client.send_query_and_decode::<SetAndWaitArgs, WakeAlarmsSetAndWaitResult>(
1096            (deadline, &mut mode, alarm_id),
1097            0x57ebd075ce4beba,
1098            fidl::encoding::DynamicFlags::FLEXIBLE,
1099            _decode,
1100        )
1101    }
1102
1103    fn r#cancel(&self, mut alarm_id: &str) -> Result<(), fidl::Error> {
1104        self.client.send::<WakeAlarmsCancelRequest>(
1105            (alarm_id,),
1106            0x7b23a9760115e55c,
1107            fidl::encoding::DynamicFlags::FLEXIBLE,
1108        )
1109    }
1110
1111    type SetResponseFut = fidl::client::QueryResponseFut<
1112        WakeAlarmsSetResult,
1113        fidl::encoding::DefaultFuchsiaResourceDialect,
1114    >;
1115    fn r#set(
1116        &self,
1117        mut notifier: fidl::endpoints::ClientEnd<NotifierMarker>,
1118        mut deadline: fidl::BootInstant,
1119        mut mode: SetMode,
1120        mut alarm_id: &str,
1121    ) -> Self::SetResponseFut {
1122        fn _decode(
1123            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1124        ) -> Result<WakeAlarmsSetResult, fidl::Error> {
1125            let _response = fidl::client::decode_transaction_body::<
1126                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, WakeAlarmsError>,
1127                fidl::encoding::DefaultFuchsiaResourceDialect,
1128                0x1f110857e48fd72c,
1129            >(_buf?)?
1130            .into_result::<WakeAlarmsMarker>("set")?;
1131            Ok(_response.map(|x| x))
1132        }
1133        self.client.send_query_and_decode::<SetArgs, WakeAlarmsSetResult>(
1134            (notifier, deadline, &mut mode, alarm_id),
1135            0x1f110857e48fd72c,
1136            fidl::encoding::DynamicFlags::FLEXIBLE,
1137            _decode,
1138        )
1139    }
1140
1141    type SetAndWaitUtcResponseFut = fidl::client::QueryResponseFut<
1142        WakeAlarmsSetAndWaitUtcResult,
1143        fidl::encoding::DefaultFuchsiaResourceDialect,
1144    >;
1145    fn r#set_and_wait_utc(
1146        &self,
1147        mut deadline: &InstantUtc,
1148        mut mode: SetMode,
1149        mut alarm_id: &str,
1150    ) -> Self::SetAndWaitUtcResponseFut {
1151        fn _decode(
1152            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1153        ) -> Result<WakeAlarmsSetAndWaitUtcResult, fidl::Error> {
1154            let _response = fidl::client::decode_transaction_body::<
1155                fidl::encoding::FlexibleResultType<
1156                    WakeAlarmsSetAndWaitUtcResponse,
1157                    WakeAlarmsError,
1158                >,
1159                fidl::encoding::DefaultFuchsiaResourceDialect,
1160                0x4ea69d33af584219,
1161            >(_buf?)?
1162            .into_result::<WakeAlarmsMarker>("set_and_wait_utc")?;
1163            Ok(_response.map(|x| x.keep_alive))
1164        }
1165        self.client.send_query_and_decode::<SetAndWaitUtcArgs, WakeAlarmsSetAndWaitUtcResult>(
1166            (deadline, &mut mode, alarm_id),
1167            0x4ea69d33af584219,
1168            fidl::encoding::DynamicFlags::FLEXIBLE,
1169            _decode,
1170        )
1171    }
1172}
1173
1174pub struct WakeAlarmsEventStream {
1175    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1176}
1177
1178impl std::marker::Unpin for WakeAlarmsEventStream {}
1179
1180impl futures::stream::FusedStream for WakeAlarmsEventStream {
1181    fn is_terminated(&self) -> bool {
1182        self.event_receiver.is_terminated()
1183    }
1184}
1185
1186impl futures::Stream for WakeAlarmsEventStream {
1187    type Item = Result<WakeAlarmsEvent, fidl::Error>;
1188
1189    fn poll_next(
1190        mut self: std::pin::Pin<&mut Self>,
1191        cx: &mut std::task::Context<'_>,
1192    ) -> std::task::Poll<Option<Self::Item>> {
1193        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1194            &mut self.event_receiver,
1195            cx
1196        )?) {
1197            Some(buf) => std::task::Poll::Ready(Some(WakeAlarmsEvent::decode(buf))),
1198            None => std::task::Poll::Ready(None),
1199        }
1200    }
1201}
1202
1203#[derive(Debug)]
1204pub enum WakeAlarmsEvent {
1205    #[non_exhaustive]
1206    _UnknownEvent {
1207        /// Ordinal of the event that was sent.
1208        ordinal: u64,
1209    },
1210}
1211
1212impl WakeAlarmsEvent {
1213    /// Decodes a message buffer as a [`WakeAlarmsEvent`].
1214    fn decode(
1215        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1216    ) -> Result<WakeAlarmsEvent, fidl::Error> {
1217        let (bytes, _handles) = buf.split_mut();
1218        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1219        debug_assert_eq!(tx_header.tx_id, 0);
1220        match tx_header.ordinal {
1221            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1222                Ok(WakeAlarmsEvent::_UnknownEvent { ordinal: tx_header.ordinal })
1223            }
1224            _ => Err(fidl::Error::UnknownOrdinal {
1225                ordinal: tx_header.ordinal,
1226                protocol_name: <WakeAlarmsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1227            }),
1228        }
1229    }
1230}
1231
1232/// A Stream of incoming requests for fuchsia.time.alarms/WakeAlarms.
1233pub struct WakeAlarmsRequestStream {
1234    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1235    is_terminated: bool,
1236}
1237
1238impl std::marker::Unpin for WakeAlarmsRequestStream {}
1239
1240impl futures::stream::FusedStream for WakeAlarmsRequestStream {
1241    fn is_terminated(&self) -> bool {
1242        self.is_terminated
1243    }
1244}
1245
1246impl fidl::endpoints::RequestStream for WakeAlarmsRequestStream {
1247    type Protocol = WakeAlarmsMarker;
1248    type ControlHandle = WakeAlarmsControlHandle;
1249
1250    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1251        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1252    }
1253
1254    fn control_handle(&self) -> Self::ControlHandle {
1255        WakeAlarmsControlHandle { inner: self.inner.clone() }
1256    }
1257
1258    fn into_inner(
1259        self,
1260    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1261    {
1262        (self.inner, self.is_terminated)
1263    }
1264
1265    fn from_inner(
1266        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1267        is_terminated: bool,
1268    ) -> Self {
1269        Self { inner, is_terminated }
1270    }
1271}
1272
1273impl futures::Stream for WakeAlarmsRequestStream {
1274    type Item = Result<WakeAlarmsRequest, fidl::Error>;
1275
1276    fn poll_next(
1277        mut self: std::pin::Pin<&mut Self>,
1278        cx: &mut std::task::Context<'_>,
1279    ) -> std::task::Poll<Option<Self::Item>> {
1280        let this = &mut *self;
1281        if this.inner.check_shutdown(cx) {
1282            this.is_terminated = true;
1283            return std::task::Poll::Ready(None);
1284        }
1285        if this.is_terminated {
1286            panic!("polled WakeAlarmsRequestStream after completion");
1287        }
1288        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1289            |bytes, handles| {
1290                match this.inner.channel().read_etc(cx, bytes, handles) {
1291                    std::task::Poll::Ready(Ok(())) => {}
1292                    std::task::Poll::Pending => return std::task::Poll::Pending,
1293                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1294                        this.is_terminated = true;
1295                        return std::task::Poll::Ready(None);
1296                    }
1297                    std::task::Poll::Ready(Err(e)) => {
1298                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1299                            e.into(),
1300                        ))));
1301                    }
1302                }
1303
1304                // A message has been received from the channel
1305                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1306
1307                std::task::Poll::Ready(Some(match header.ordinal {
1308                    0x57ebd075ce4beba => {
1309                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1310                        let mut req = fidl::new_empty!(
1311                            SetAndWaitArgs,
1312                            fidl::encoding::DefaultFuchsiaResourceDialect
1313                        );
1314                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SetAndWaitArgs>(&header, _body_bytes, handles, &mut req)?;
1315                        let control_handle = WakeAlarmsControlHandle { inner: this.inner.clone() };
1316                        Ok(WakeAlarmsRequest::SetAndWait {
1317                            deadline: req.deadline,
1318                            mode: req.mode,
1319                            alarm_id: req.alarm_id,
1320
1321                            responder: WakeAlarmsSetAndWaitResponder {
1322                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1323                                tx_id: header.tx_id,
1324                            },
1325                        })
1326                    }
1327                    0x7b23a9760115e55c => {
1328                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1329                        let mut req = fidl::new_empty!(
1330                            WakeAlarmsCancelRequest,
1331                            fidl::encoding::DefaultFuchsiaResourceDialect
1332                        );
1333                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<WakeAlarmsCancelRequest>(&header, _body_bytes, handles, &mut req)?;
1334                        let control_handle = WakeAlarmsControlHandle { inner: this.inner.clone() };
1335                        Ok(WakeAlarmsRequest::Cancel { alarm_id: req.alarm_id, control_handle })
1336                    }
1337                    0x1f110857e48fd72c => {
1338                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1339                        let mut req = fidl::new_empty!(
1340                            SetArgs,
1341                            fidl::encoding::DefaultFuchsiaResourceDialect
1342                        );
1343                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SetArgs>(&header, _body_bytes, handles, &mut req)?;
1344                        let control_handle = WakeAlarmsControlHandle { inner: this.inner.clone() };
1345                        Ok(WakeAlarmsRequest::Set {
1346                            notifier: req.notifier,
1347                            deadline: req.deadline,
1348                            mode: req.mode,
1349                            alarm_id: req.alarm_id,
1350
1351                            responder: WakeAlarmsSetResponder {
1352                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1353                                tx_id: header.tx_id,
1354                            },
1355                        })
1356                    }
1357                    0x4ea69d33af584219 => {
1358                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1359                        let mut req = fidl::new_empty!(
1360                            SetAndWaitUtcArgs,
1361                            fidl::encoding::DefaultFuchsiaResourceDialect
1362                        );
1363                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SetAndWaitUtcArgs>(&header, _body_bytes, handles, &mut req)?;
1364                        let control_handle = WakeAlarmsControlHandle { inner: this.inner.clone() };
1365                        Ok(WakeAlarmsRequest::SetAndWaitUtc {
1366                            deadline: req.deadline,
1367                            mode: req.mode,
1368                            alarm_id: req.alarm_id,
1369
1370                            responder: WakeAlarmsSetAndWaitUtcResponder {
1371                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1372                                tx_id: header.tx_id,
1373                            },
1374                        })
1375                    }
1376                    _ if header.tx_id == 0
1377                        && header
1378                            .dynamic_flags()
1379                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1380                    {
1381                        Ok(WakeAlarmsRequest::_UnknownMethod {
1382                            ordinal: header.ordinal,
1383                            control_handle: WakeAlarmsControlHandle { inner: this.inner.clone() },
1384                            method_type: fidl::MethodType::OneWay,
1385                        })
1386                    }
1387                    _ if header
1388                        .dynamic_flags()
1389                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1390                    {
1391                        this.inner.send_framework_err(
1392                            fidl::encoding::FrameworkErr::UnknownMethod,
1393                            header.tx_id,
1394                            header.ordinal,
1395                            header.dynamic_flags(),
1396                            (bytes, handles),
1397                        )?;
1398                        Ok(WakeAlarmsRequest::_UnknownMethod {
1399                            ordinal: header.ordinal,
1400                            control_handle: WakeAlarmsControlHandle { inner: this.inner.clone() },
1401                            method_type: fidl::MethodType::TwoWay,
1402                        })
1403                    }
1404                    _ => Err(fidl::Error::UnknownOrdinal {
1405                        ordinal: header.ordinal,
1406                        protocol_name:
1407                            <WakeAlarmsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1408                    }),
1409                }))
1410            },
1411        )
1412    }
1413}
1414
1415/// Provides a mechanism for scheduling platform-wide wake alarms.
1416///
1417/// An alarm is a promise made by the system to the caller of the API to notify
1418/// the caller that *at least* the requested amount of time has expired. The
1419/// alarm may fire later than the requested amount of time at the discretion of
1420/// the server implementing this API.
1421///
1422/// When this notification happens, we say that the wake alarm has "fired".
1423///
1424/// A "wake" alarm firing also ensures that the system comes back from a reduced
1425/// power state if needed, so that it can notify the caller.
1426///
1427/// The general shape of a wake alarm API has three parts:
1428/// * A specification of when a wake alarm is supposed to fire,
1429/// * A way to notify the caller of an alarm that fired, and
1430/// * A way to keep the system awake until both the caller and the callee have
1431///   completed work associated with the alarm.
1432#[derive(Debug)]
1433pub enum WakeAlarmsRequest {
1434    /// Sets a wake alarm with the provided parameters, and waits for the alarm
1435    /// to fire.
1436    ///
1437    /// The caller may request multiple alarms concurrently. Re-requesting
1438    /// an alarm that has the same `alarm_id` as an already scheduled alarm
1439    /// causes that scheduled alarm to be canceled before the new alarm is
1440    /// scheduled.
1441    ///
1442    /// ## Return value
1443    ///
1444    /// * `keep_alive`: A handle that prevents the system from suspending as
1445    ///   long as it is held.
1446    ///
1447    /// The call to `SetAndWait` returns when the alarm fires, an error occurs,
1448    /// or the alarm is canceled. This return style is required for some
1449    /// clients, such as Starnix, which rely on FIDL response tallying to guide
1450    /// their power management strategy.
1451    ///
1452    /// As an example, under Starnix, a response to this request will cause a
1453    /// Starnix container to be unsuspended ("woken up"). This is a critical
1454    /// behavior for suspend correctness under Starnix. Using the [Notifier]
1455    /// approach would side-step this mechanism and result in incorrect wake
1456    /// behavior under Starnix.
1457    ///
1458    /// ## Protocol Errors
1459    ///
1460    /// * `DROPPED`: The alarm was canceled by a call to `Cancel`.
1461    /// * `UNSPECIFIED`: A new failure mode has been observed that has not
1462    ///   yet been assigned an error code. This indicates that the API
1463    ///   version may need to be updated.
1464    /// * `INTERNAL` is a server-side bug: an internal fallible call (which is
1465    ///   expected to be unlikely to fail) has failed somehow. Please report this
1466    ///   for investigation.
1467    /// * [INVALID_ARGS]: a parameter provided by the user is not valid, such
1468    ///   as an empty `alarm_id`.
1469    SetAndWait {
1470        deadline: fidl::BootInstant,
1471        mode: SetMode,
1472        alarm_id: String,
1473        responder: WakeAlarmsSetAndWaitResponder,
1474    },
1475    /// Cancels the alarm specified by `alarm_id`.
1476    ///
1477    /// Providing an `alarm_id` for an alarm that is not scheduled is a no-op.
1478    Cancel { alarm_id: String, control_handle: WakeAlarmsControlHandle },
1479    /// Sets a wake alarm with the provided parameters.
1480    ///
1481    /// The caller may request multiple alarms concurrently. Re-requesting
1482    /// an alarm that has the same `alarm_id` as an already scheduled alarm
1483    /// causes that scheduled alarm to be canceled before the same alarm
1484    /// is scheduled again.
1485    ///
1486    /// ## Return value
1487    ///
1488    /// This method will return when the alarm is scheduled.
1489    ///
1490    /// ## Protocol Errors
1491    ///
1492    /// * [UNSPECIFIED] you are observing a new failure mode which has not
1493    ///   been assigned an error code yet. Expect this failure mode to be
1494    ///   assigned a more specific error code in future versions of this API.
1495    ///   This is not a bug, but an indication that you may need to update the
1496    ///   API version.
1497    /// * [INTERNAL] is a bug: an internal fallible call (which is expected
1498    ///   to be unlikely to fail) has failed somehow. Please report this for
1499    ///   investigation.
1500    /// * [INVALID_ARGS]: a parameter provided by the user is not valid, such
1501    ///   as an empty `alarm_id`.
1502    Set {
1503        notifier: fidl::endpoints::ClientEnd<NotifierMarker>,
1504        deadline: fidl::BootInstant,
1505        mode: SetMode,
1506        alarm_id: String,
1507        responder: WakeAlarmsSetResponder,
1508    },
1509    /// Similar to [SetAndWait], except the alarm is scheduled on the UTC
1510    /// timeline.
1511    ///
1512    /// Refer to [SetAndWait] documentation for the functionality details, and
1513    /// especially see the section "Return value" for the return value
1514    /// subtleties.
1515    SetAndWaitUtc {
1516        deadline: InstantUtc,
1517        mode: SetMode,
1518        alarm_id: String,
1519        responder: WakeAlarmsSetAndWaitUtcResponder,
1520    },
1521    /// An interaction was received which does not match any known method.
1522    #[non_exhaustive]
1523    _UnknownMethod {
1524        /// Ordinal of the method that was called.
1525        ordinal: u64,
1526        control_handle: WakeAlarmsControlHandle,
1527        method_type: fidl::MethodType,
1528    },
1529}
1530
1531impl WakeAlarmsRequest {
1532    #[allow(irrefutable_let_patterns)]
1533    pub fn into_set_and_wait(
1534        self,
1535    ) -> Option<(fidl::BootInstant, SetMode, String, WakeAlarmsSetAndWaitResponder)> {
1536        if let WakeAlarmsRequest::SetAndWait { deadline, mode, alarm_id, responder } = self {
1537            Some((deadline, mode, alarm_id, responder))
1538        } else {
1539            None
1540        }
1541    }
1542
1543    #[allow(irrefutable_let_patterns)]
1544    pub fn into_cancel(self) -> Option<(String, WakeAlarmsControlHandle)> {
1545        if let WakeAlarmsRequest::Cancel { alarm_id, control_handle } = self {
1546            Some((alarm_id, control_handle))
1547        } else {
1548            None
1549        }
1550    }
1551
1552    #[allow(irrefutable_let_patterns)]
1553    pub fn into_set(
1554        self,
1555    ) -> Option<(
1556        fidl::endpoints::ClientEnd<NotifierMarker>,
1557        fidl::BootInstant,
1558        SetMode,
1559        String,
1560        WakeAlarmsSetResponder,
1561    )> {
1562        if let WakeAlarmsRequest::Set { notifier, deadline, mode, alarm_id, responder } = self {
1563            Some((notifier, deadline, mode, alarm_id, responder))
1564        } else {
1565            None
1566        }
1567    }
1568
1569    #[allow(irrefutable_let_patterns)]
1570    pub fn into_set_and_wait_utc(
1571        self,
1572    ) -> Option<(InstantUtc, SetMode, String, WakeAlarmsSetAndWaitUtcResponder)> {
1573        if let WakeAlarmsRequest::SetAndWaitUtc { deadline, mode, alarm_id, responder } = self {
1574            Some((deadline, mode, alarm_id, responder))
1575        } else {
1576            None
1577        }
1578    }
1579
1580    /// Name of the method defined in FIDL
1581    pub fn method_name(&self) -> &'static str {
1582        match *self {
1583            WakeAlarmsRequest::SetAndWait { .. } => "set_and_wait",
1584            WakeAlarmsRequest::Cancel { .. } => "cancel",
1585            WakeAlarmsRequest::Set { .. } => "set",
1586            WakeAlarmsRequest::SetAndWaitUtc { .. } => "set_and_wait_utc",
1587            WakeAlarmsRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
1588                "unknown one-way method"
1589            }
1590            WakeAlarmsRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
1591                "unknown two-way method"
1592            }
1593        }
1594    }
1595}
1596
1597#[derive(Debug, Clone)]
1598pub struct WakeAlarmsControlHandle {
1599    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1600}
1601
1602impl WakeAlarmsControlHandle {
1603    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
1604        self.inner.shutdown_with_epitaph(status.into())
1605    }
1606}
1607
1608impl fidl::endpoints::ControlHandle for WakeAlarmsControlHandle {
1609    fn shutdown(&self) {
1610        self.inner.shutdown()
1611    }
1612
1613    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
1614        self.inner.shutdown_with_epitaph(status)
1615    }
1616
1617    fn is_closed(&self) -> bool {
1618        self.inner.channel().is_closed()
1619    }
1620    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1621        self.inner.channel().on_closed()
1622    }
1623
1624    #[cfg(target_os = "fuchsia")]
1625    fn signal_peer(
1626        &self,
1627        clear_mask: zx::Signals,
1628        set_mask: zx::Signals,
1629    ) -> Result<(), zx_status::Status> {
1630        use fidl::Peered;
1631        self.inner.channel().signal_peer(clear_mask, set_mask)
1632    }
1633}
1634
1635impl WakeAlarmsControlHandle {}
1636
1637#[must_use = "FIDL methods require a response to be sent"]
1638#[derive(Debug)]
1639pub struct WakeAlarmsSetAndWaitResponder {
1640    control_handle: std::mem::ManuallyDrop<WakeAlarmsControlHandle>,
1641    tx_id: u32,
1642}
1643
1644/// Set the the channel to be shutdown (see [`WakeAlarmsControlHandle::shutdown`])
1645/// if the responder is dropped without sending a response, so that the client
1646/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1647impl std::ops::Drop for WakeAlarmsSetAndWaitResponder {
1648    fn drop(&mut self) {
1649        self.control_handle.shutdown();
1650        // Safety: drops once, never accessed again
1651        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1652    }
1653}
1654
1655impl fidl::endpoints::Responder for WakeAlarmsSetAndWaitResponder {
1656    type ControlHandle = WakeAlarmsControlHandle;
1657
1658    fn control_handle(&self) -> &WakeAlarmsControlHandle {
1659        &self.control_handle
1660    }
1661
1662    fn drop_without_shutdown(mut self) {
1663        // Safety: drops once, never accessed again due to mem::forget
1664        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1665        // Prevent Drop from running (which would shut down the channel)
1666        std::mem::forget(self);
1667    }
1668}
1669
1670impl WakeAlarmsSetAndWaitResponder {
1671    /// Sends a response to the FIDL transaction.
1672    ///
1673    /// Sets the channel to shutdown if an error occurs.
1674    pub fn send(
1675        self,
1676        mut result: Result<fidl::EventPair, WakeAlarmsError>,
1677    ) -> Result<(), fidl::Error> {
1678        let _result = self.send_raw(result);
1679        if _result.is_err() {
1680            self.control_handle.shutdown();
1681        }
1682        self.drop_without_shutdown();
1683        _result
1684    }
1685
1686    /// Similar to "send" but does not shutdown the channel if an error occurs.
1687    pub fn send_no_shutdown_on_err(
1688        self,
1689        mut result: Result<fidl::EventPair, WakeAlarmsError>,
1690    ) -> Result<(), fidl::Error> {
1691        let _result = self.send_raw(result);
1692        self.drop_without_shutdown();
1693        _result
1694    }
1695
1696    fn send_raw(
1697        &self,
1698        mut result: Result<fidl::EventPair, WakeAlarmsError>,
1699    ) -> Result<(), fidl::Error> {
1700        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1701            WakeAlarmsSetAndWaitResponse,
1702            WakeAlarmsError,
1703        >>(
1704            fidl::encoding::FlexibleResult::new(result.map(|keep_alive| (keep_alive,))),
1705            self.tx_id,
1706            0x57ebd075ce4beba,
1707            fidl::encoding::DynamicFlags::FLEXIBLE,
1708        )
1709    }
1710}
1711
1712#[must_use = "FIDL methods require a response to be sent"]
1713#[derive(Debug)]
1714pub struct WakeAlarmsSetResponder {
1715    control_handle: std::mem::ManuallyDrop<WakeAlarmsControlHandle>,
1716    tx_id: u32,
1717}
1718
1719/// Set the the channel to be shutdown (see [`WakeAlarmsControlHandle::shutdown`])
1720/// if the responder is dropped without sending a response, so that the client
1721/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1722impl std::ops::Drop for WakeAlarmsSetResponder {
1723    fn drop(&mut self) {
1724        self.control_handle.shutdown();
1725        // Safety: drops once, never accessed again
1726        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1727    }
1728}
1729
1730impl fidl::endpoints::Responder for WakeAlarmsSetResponder {
1731    type ControlHandle = WakeAlarmsControlHandle;
1732
1733    fn control_handle(&self) -> &WakeAlarmsControlHandle {
1734        &self.control_handle
1735    }
1736
1737    fn drop_without_shutdown(mut self) {
1738        // Safety: drops once, never accessed again due to mem::forget
1739        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1740        // Prevent Drop from running (which would shut down the channel)
1741        std::mem::forget(self);
1742    }
1743}
1744
1745impl WakeAlarmsSetResponder {
1746    /// Sends a response to the FIDL transaction.
1747    ///
1748    /// Sets the channel to shutdown if an error occurs.
1749    pub fn send(self, mut result: Result<(), WakeAlarmsError>) -> Result<(), fidl::Error> {
1750        let _result = self.send_raw(result);
1751        if _result.is_err() {
1752            self.control_handle.shutdown();
1753        }
1754        self.drop_without_shutdown();
1755        _result
1756    }
1757
1758    /// Similar to "send" but does not shutdown the channel if an error occurs.
1759    pub fn send_no_shutdown_on_err(
1760        self,
1761        mut result: Result<(), WakeAlarmsError>,
1762    ) -> Result<(), fidl::Error> {
1763        let _result = self.send_raw(result);
1764        self.drop_without_shutdown();
1765        _result
1766    }
1767
1768    fn send_raw(&self, mut result: Result<(), WakeAlarmsError>) -> Result<(), fidl::Error> {
1769        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1770            fidl::encoding::EmptyStruct,
1771            WakeAlarmsError,
1772        >>(
1773            fidl::encoding::FlexibleResult::new(result),
1774            self.tx_id,
1775            0x1f110857e48fd72c,
1776            fidl::encoding::DynamicFlags::FLEXIBLE,
1777        )
1778    }
1779}
1780
1781#[must_use = "FIDL methods require a response to be sent"]
1782#[derive(Debug)]
1783pub struct WakeAlarmsSetAndWaitUtcResponder {
1784    control_handle: std::mem::ManuallyDrop<WakeAlarmsControlHandle>,
1785    tx_id: u32,
1786}
1787
1788/// Set the the channel to be shutdown (see [`WakeAlarmsControlHandle::shutdown`])
1789/// if the responder is dropped without sending a response, so that the client
1790/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1791impl std::ops::Drop for WakeAlarmsSetAndWaitUtcResponder {
1792    fn drop(&mut self) {
1793        self.control_handle.shutdown();
1794        // Safety: drops once, never accessed again
1795        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1796    }
1797}
1798
1799impl fidl::endpoints::Responder for WakeAlarmsSetAndWaitUtcResponder {
1800    type ControlHandle = WakeAlarmsControlHandle;
1801
1802    fn control_handle(&self) -> &WakeAlarmsControlHandle {
1803        &self.control_handle
1804    }
1805
1806    fn drop_without_shutdown(mut self) {
1807        // Safety: drops once, never accessed again due to mem::forget
1808        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1809        // Prevent Drop from running (which would shut down the channel)
1810        std::mem::forget(self);
1811    }
1812}
1813
1814impl WakeAlarmsSetAndWaitUtcResponder {
1815    /// Sends a response to the FIDL transaction.
1816    ///
1817    /// Sets the channel to shutdown if an error occurs.
1818    pub fn send(
1819        self,
1820        mut result: Result<fidl::EventPair, WakeAlarmsError>,
1821    ) -> Result<(), fidl::Error> {
1822        let _result = self.send_raw(result);
1823        if _result.is_err() {
1824            self.control_handle.shutdown();
1825        }
1826        self.drop_without_shutdown();
1827        _result
1828    }
1829
1830    /// Similar to "send" but does not shutdown the channel if an error occurs.
1831    pub fn send_no_shutdown_on_err(
1832        self,
1833        mut result: Result<fidl::EventPair, WakeAlarmsError>,
1834    ) -> Result<(), fidl::Error> {
1835        let _result = self.send_raw(result);
1836        self.drop_without_shutdown();
1837        _result
1838    }
1839
1840    fn send_raw(
1841        &self,
1842        mut result: Result<fidl::EventPair, WakeAlarmsError>,
1843    ) -> Result<(), fidl::Error> {
1844        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1845            WakeAlarmsSetAndWaitUtcResponse,
1846            WakeAlarmsError,
1847        >>(
1848            fidl::encoding::FlexibleResult::new(result.map(|keep_alive| (keep_alive,))),
1849            self.tx_id,
1850            0x4ea69d33af584219,
1851            fidl::encoding::DynamicFlags::FLEXIBLE,
1852        )
1853    }
1854}
1855
1856mod internal {
1857    use super::*;
1858
1859    impl fidl::encoding::ResourceTypeMarker for NotifierNotifyErrorRequest {
1860        type Borrowed<'a> = &'a mut Self;
1861        fn take_or_borrow<'a>(
1862            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1863        ) -> Self::Borrowed<'a> {
1864            value
1865        }
1866    }
1867
1868    unsafe impl fidl::encoding::TypeMarker for NotifierNotifyErrorRequest {
1869        type Owned = Self;
1870
1871        #[inline(always)]
1872        fn inline_align(_context: fidl::encoding::Context) -> usize {
1873            8
1874        }
1875
1876        #[inline(always)]
1877        fn inline_size(_context: fidl::encoding::Context) -> usize {
1878            24
1879        }
1880    }
1881
1882    unsafe impl
1883        fidl::encoding::Encode<
1884            NotifierNotifyErrorRequest,
1885            fidl::encoding::DefaultFuchsiaResourceDialect,
1886        > for &mut NotifierNotifyErrorRequest
1887    {
1888        #[inline]
1889        unsafe fn encode(
1890            self,
1891            encoder: &mut fidl::encoding::Encoder<
1892                '_,
1893                fidl::encoding::DefaultFuchsiaResourceDialect,
1894            >,
1895            offset: usize,
1896            _depth: fidl::encoding::Depth,
1897        ) -> fidl::Result<()> {
1898            encoder.debug_check_bounds::<NotifierNotifyErrorRequest>(offset);
1899            // Delegate to tuple encoding.
1900            fidl::encoding::Encode::<
1901                NotifierNotifyErrorRequest,
1902                fidl::encoding::DefaultFuchsiaResourceDialect,
1903            >::encode(
1904                (
1905                    <fidl::encoding::BoundedString<128> as fidl::encoding::ValueTypeMarker>::borrow(
1906                        &self.alarm_id,
1907                    ),
1908                    <WakeAlarmsError as fidl::encoding::ValueTypeMarker>::borrow(&self.error),
1909                ),
1910                encoder,
1911                offset,
1912                _depth,
1913            )
1914        }
1915    }
1916    unsafe impl<
1917        T0: fidl::encoding::Encode<
1918                fidl::encoding::BoundedString<128>,
1919                fidl::encoding::DefaultFuchsiaResourceDialect,
1920            >,
1921        T1: fidl::encoding::Encode<WakeAlarmsError, fidl::encoding::DefaultFuchsiaResourceDialect>,
1922    >
1923        fidl::encoding::Encode<
1924            NotifierNotifyErrorRequest,
1925            fidl::encoding::DefaultFuchsiaResourceDialect,
1926        > for (T0, T1)
1927    {
1928        #[inline]
1929        unsafe fn encode(
1930            self,
1931            encoder: &mut fidl::encoding::Encoder<
1932                '_,
1933                fidl::encoding::DefaultFuchsiaResourceDialect,
1934            >,
1935            offset: usize,
1936            depth: fidl::encoding::Depth,
1937        ) -> fidl::Result<()> {
1938            encoder.debug_check_bounds::<NotifierNotifyErrorRequest>(offset);
1939            // Zero out padding regions. There's no need to apply masks
1940            // because the unmasked parts will be overwritten by fields.
1941            unsafe {
1942                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
1943                (ptr as *mut u64).write_unaligned(0);
1944            }
1945            // Write the fields.
1946            self.0.encode(encoder, offset + 0, depth)?;
1947            self.1.encode(encoder, offset + 16, depth)?;
1948            Ok(())
1949        }
1950    }
1951
1952    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1953        for NotifierNotifyErrorRequest
1954    {
1955        #[inline(always)]
1956        fn new_empty() -> Self {
1957            Self {
1958                alarm_id: fidl::new_empty!(
1959                    fidl::encoding::BoundedString<128>,
1960                    fidl::encoding::DefaultFuchsiaResourceDialect
1961                ),
1962                error: fidl::new_empty!(
1963                    WakeAlarmsError,
1964                    fidl::encoding::DefaultFuchsiaResourceDialect
1965                ),
1966            }
1967        }
1968
1969        #[inline]
1970        unsafe fn decode(
1971            &mut self,
1972            decoder: &mut fidl::encoding::Decoder<
1973                '_,
1974                fidl::encoding::DefaultFuchsiaResourceDialect,
1975            >,
1976            offset: usize,
1977            _depth: fidl::encoding::Depth,
1978        ) -> fidl::Result<()> {
1979            decoder.debug_check_bounds::<Self>(offset);
1980            // Verify that padding bytes are zero.
1981            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
1982            let padval = unsafe { (ptr as *const u64).read_unaligned() };
1983            let mask = 0xffffffff00000000u64;
1984            let maskedval = padval & mask;
1985            if maskedval != 0 {
1986                return Err(fidl::Error::NonZeroPadding {
1987                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
1988                });
1989            }
1990            fidl::decode!(
1991                fidl::encoding::BoundedString<128>,
1992                fidl::encoding::DefaultFuchsiaResourceDialect,
1993                &mut self.alarm_id,
1994                decoder,
1995                offset + 0,
1996                _depth
1997            )?;
1998            fidl::decode!(
1999                WakeAlarmsError,
2000                fidl::encoding::DefaultFuchsiaResourceDialect,
2001                &mut self.error,
2002                decoder,
2003                offset + 16,
2004                _depth
2005            )?;
2006            Ok(())
2007        }
2008    }
2009
2010    impl fidl::encoding::ResourceTypeMarker for NotifierNotifyRequest {
2011        type Borrowed<'a> = &'a mut Self;
2012        fn take_or_borrow<'a>(
2013            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2014        ) -> Self::Borrowed<'a> {
2015            value
2016        }
2017    }
2018
2019    unsafe impl fidl::encoding::TypeMarker for NotifierNotifyRequest {
2020        type Owned = Self;
2021
2022        #[inline(always)]
2023        fn inline_align(_context: fidl::encoding::Context) -> usize {
2024            8
2025        }
2026
2027        #[inline(always)]
2028        fn inline_size(_context: fidl::encoding::Context) -> usize {
2029            24
2030        }
2031    }
2032
2033    unsafe impl
2034        fidl::encoding::Encode<NotifierNotifyRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
2035        for &mut NotifierNotifyRequest
2036    {
2037        #[inline]
2038        unsafe fn encode(
2039            self,
2040            encoder: &mut fidl::encoding::Encoder<
2041                '_,
2042                fidl::encoding::DefaultFuchsiaResourceDialect,
2043            >,
2044            offset: usize,
2045            _depth: fidl::encoding::Depth,
2046        ) -> fidl::Result<()> {
2047            encoder.debug_check_bounds::<NotifierNotifyRequest>(offset);
2048            // Delegate to tuple encoding.
2049            fidl::encoding::Encode::<
2050                NotifierNotifyRequest,
2051                fidl::encoding::DefaultFuchsiaResourceDialect,
2052            >::encode(
2053                (
2054                    <fidl::encoding::BoundedString<128> as fidl::encoding::ValueTypeMarker>::borrow(
2055                        &self.alarm_id,
2056                    ),
2057                    <fidl::encoding::HandleType<
2058                        fidl::EventPair,
2059                        { fidl::ObjectType::EVENTPAIR.into_raw() },
2060                        16387,
2061                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2062                        &mut self.keep_alive
2063                    ),
2064                ),
2065                encoder,
2066                offset,
2067                _depth,
2068            )
2069        }
2070    }
2071    unsafe impl<
2072        T0: fidl::encoding::Encode<
2073                fidl::encoding::BoundedString<128>,
2074                fidl::encoding::DefaultFuchsiaResourceDialect,
2075            >,
2076        T1: fidl::encoding::Encode<
2077                fidl::encoding::HandleType<
2078                    fidl::EventPair,
2079                    { fidl::ObjectType::EVENTPAIR.into_raw() },
2080                    16387,
2081                >,
2082                fidl::encoding::DefaultFuchsiaResourceDialect,
2083            >,
2084    >
2085        fidl::encoding::Encode<NotifierNotifyRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
2086        for (T0, T1)
2087    {
2088        #[inline]
2089        unsafe fn encode(
2090            self,
2091            encoder: &mut fidl::encoding::Encoder<
2092                '_,
2093                fidl::encoding::DefaultFuchsiaResourceDialect,
2094            >,
2095            offset: usize,
2096            depth: fidl::encoding::Depth,
2097        ) -> fidl::Result<()> {
2098            encoder.debug_check_bounds::<NotifierNotifyRequest>(offset);
2099            // Zero out padding regions. There's no need to apply masks
2100            // because the unmasked parts will be overwritten by fields.
2101            unsafe {
2102                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
2103                (ptr as *mut u64).write_unaligned(0);
2104            }
2105            // Write the fields.
2106            self.0.encode(encoder, offset + 0, depth)?;
2107            self.1.encode(encoder, offset + 16, depth)?;
2108            Ok(())
2109        }
2110    }
2111
2112    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2113        for NotifierNotifyRequest
2114    {
2115        #[inline(always)]
2116        fn new_empty() -> Self {
2117            Self {
2118                alarm_id: fidl::new_empty!(
2119                    fidl::encoding::BoundedString<128>,
2120                    fidl::encoding::DefaultFuchsiaResourceDialect
2121                ),
2122                keep_alive: fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 16387>, fidl::encoding::DefaultFuchsiaResourceDialect),
2123            }
2124        }
2125
2126        #[inline]
2127        unsafe fn decode(
2128            &mut self,
2129            decoder: &mut fidl::encoding::Decoder<
2130                '_,
2131                fidl::encoding::DefaultFuchsiaResourceDialect,
2132            >,
2133            offset: usize,
2134            _depth: fidl::encoding::Depth,
2135        ) -> fidl::Result<()> {
2136            decoder.debug_check_bounds::<Self>(offset);
2137            // Verify that padding bytes are zero.
2138            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
2139            let padval = unsafe { (ptr as *const u64).read_unaligned() };
2140            let mask = 0xffffffff00000000u64;
2141            let maskedval = padval & mask;
2142            if maskedval != 0 {
2143                return Err(fidl::Error::NonZeroPadding {
2144                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
2145                });
2146            }
2147            fidl::decode!(
2148                fidl::encoding::BoundedString<128>,
2149                fidl::encoding::DefaultFuchsiaResourceDialect,
2150                &mut self.alarm_id,
2151                decoder,
2152                offset + 0,
2153                _depth
2154            )?;
2155            fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 16387>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.keep_alive, decoder, offset + 16, _depth)?;
2156            Ok(())
2157        }
2158    }
2159
2160    impl fidl::encoding::ResourceTypeMarker for SetAndWaitArgs {
2161        type Borrowed<'a> = &'a mut Self;
2162        fn take_or_borrow<'a>(
2163            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2164        ) -> Self::Borrowed<'a> {
2165            value
2166        }
2167    }
2168
2169    unsafe impl fidl::encoding::TypeMarker for SetAndWaitArgs {
2170        type Owned = Self;
2171
2172        #[inline(always)]
2173        fn inline_align(_context: fidl::encoding::Context) -> usize {
2174            8
2175        }
2176
2177        #[inline(always)]
2178        fn inline_size(_context: fidl::encoding::Context) -> usize {
2179            40
2180        }
2181    }
2182
2183    unsafe impl
2184        fidl::encoding::Encode<SetAndWaitArgs, fidl::encoding::DefaultFuchsiaResourceDialect>
2185        for &mut SetAndWaitArgs
2186    {
2187        #[inline]
2188        unsafe fn encode(
2189            self,
2190            encoder: &mut fidl::encoding::Encoder<
2191                '_,
2192                fidl::encoding::DefaultFuchsiaResourceDialect,
2193            >,
2194            offset: usize,
2195            _depth: fidl::encoding::Depth,
2196        ) -> fidl::Result<()> {
2197            encoder.debug_check_bounds::<SetAndWaitArgs>(offset);
2198            // Delegate to tuple encoding.
2199            fidl::encoding::Encode::<SetAndWaitArgs, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2200                (
2201                    <fidl::BootInstant as fidl::encoding::ValueTypeMarker>::borrow(&self.deadline),
2202                    <SetMode as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.mode),
2203                    <fidl::encoding::BoundedString<128> as fidl::encoding::ValueTypeMarker>::borrow(&self.alarm_id),
2204                ),
2205                encoder, offset, _depth
2206            )
2207        }
2208    }
2209    unsafe impl<
2210        T0: fidl::encoding::Encode<fidl::BootInstant, fidl::encoding::DefaultFuchsiaResourceDialect>,
2211        T1: fidl::encoding::Encode<SetMode, fidl::encoding::DefaultFuchsiaResourceDialect>,
2212        T2: fidl::encoding::Encode<
2213                fidl::encoding::BoundedString<128>,
2214                fidl::encoding::DefaultFuchsiaResourceDialect,
2215            >,
2216    > fidl::encoding::Encode<SetAndWaitArgs, fidl::encoding::DefaultFuchsiaResourceDialect>
2217        for (T0, T1, T2)
2218    {
2219        #[inline]
2220        unsafe fn encode(
2221            self,
2222            encoder: &mut fidl::encoding::Encoder<
2223                '_,
2224                fidl::encoding::DefaultFuchsiaResourceDialect,
2225            >,
2226            offset: usize,
2227            depth: fidl::encoding::Depth,
2228        ) -> fidl::Result<()> {
2229            encoder.debug_check_bounds::<SetAndWaitArgs>(offset);
2230            // Zero out padding regions. There's no need to apply masks
2231            // because the unmasked parts will be overwritten by fields.
2232            // Write the fields.
2233            self.0.encode(encoder, offset + 0, depth)?;
2234            self.1.encode(encoder, offset + 8, depth)?;
2235            self.2.encode(encoder, offset + 24, depth)?;
2236            Ok(())
2237        }
2238    }
2239
2240    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2241        for SetAndWaitArgs
2242    {
2243        #[inline(always)]
2244        fn new_empty() -> Self {
2245            Self {
2246                deadline: fidl::new_empty!(
2247                    fidl::BootInstant,
2248                    fidl::encoding::DefaultFuchsiaResourceDialect
2249                ),
2250                mode: fidl::new_empty!(SetMode, fidl::encoding::DefaultFuchsiaResourceDialect),
2251                alarm_id: fidl::new_empty!(
2252                    fidl::encoding::BoundedString<128>,
2253                    fidl::encoding::DefaultFuchsiaResourceDialect
2254                ),
2255            }
2256        }
2257
2258        #[inline]
2259        unsafe fn decode(
2260            &mut self,
2261            decoder: &mut fidl::encoding::Decoder<
2262                '_,
2263                fidl::encoding::DefaultFuchsiaResourceDialect,
2264            >,
2265            offset: usize,
2266            _depth: fidl::encoding::Depth,
2267        ) -> fidl::Result<()> {
2268            decoder.debug_check_bounds::<Self>(offset);
2269            // Verify that padding bytes are zero.
2270            fidl::decode!(
2271                fidl::BootInstant,
2272                fidl::encoding::DefaultFuchsiaResourceDialect,
2273                &mut self.deadline,
2274                decoder,
2275                offset + 0,
2276                _depth
2277            )?;
2278            fidl::decode!(
2279                SetMode,
2280                fidl::encoding::DefaultFuchsiaResourceDialect,
2281                &mut self.mode,
2282                decoder,
2283                offset + 8,
2284                _depth
2285            )?;
2286            fidl::decode!(
2287                fidl::encoding::BoundedString<128>,
2288                fidl::encoding::DefaultFuchsiaResourceDialect,
2289                &mut self.alarm_id,
2290                decoder,
2291                offset + 24,
2292                _depth
2293            )?;
2294            Ok(())
2295        }
2296    }
2297
2298    impl fidl::encoding::ResourceTypeMarker for SetAndWaitUtcArgs {
2299        type Borrowed<'a> = &'a mut Self;
2300        fn take_or_borrow<'a>(
2301            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2302        ) -> Self::Borrowed<'a> {
2303            value
2304        }
2305    }
2306
2307    unsafe impl fidl::encoding::TypeMarker for SetAndWaitUtcArgs {
2308        type Owned = Self;
2309
2310        #[inline(always)]
2311        fn inline_align(_context: fidl::encoding::Context) -> usize {
2312            8
2313        }
2314
2315        #[inline(always)]
2316        fn inline_size(_context: fidl::encoding::Context) -> usize {
2317            40
2318        }
2319    }
2320
2321    unsafe impl
2322        fidl::encoding::Encode<SetAndWaitUtcArgs, fidl::encoding::DefaultFuchsiaResourceDialect>
2323        for &mut SetAndWaitUtcArgs
2324    {
2325        #[inline]
2326        unsafe fn encode(
2327            self,
2328            encoder: &mut fidl::encoding::Encoder<
2329                '_,
2330                fidl::encoding::DefaultFuchsiaResourceDialect,
2331            >,
2332            offset: usize,
2333            _depth: fidl::encoding::Depth,
2334        ) -> fidl::Result<()> {
2335            encoder.debug_check_bounds::<SetAndWaitUtcArgs>(offset);
2336            // Delegate to tuple encoding.
2337            fidl::encoding::Encode::<SetAndWaitUtcArgs, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2338                (
2339                    <InstantUtc as fidl::encoding::ValueTypeMarker>::borrow(&self.deadline),
2340                    <SetMode as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.mode),
2341                    <fidl::encoding::BoundedString<128> as fidl::encoding::ValueTypeMarker>::borrow(&self.alarm_id),
2342                ),
2343                encoder, offset, _depth
2344            )
2345        }
2346    }
2347    unsafe impl<
2348        T0: fidl::encoding::Encode<InstantUtc, fidl::encoding::DefaultFuchsiaResourceDialect>,
2349        T1: fidl::encoding::Encode<SetMode, fidl::encoding::DefaultFuchsiaResourceDialect>,
2350        T2: fidl::encoding::Encode<
2351                fidl::encoding::BoundedString<128>,
2352                fidl::encoding::DefaultFuchsiaResourceDialect,
2353            >,
2354    > fidl::encoding::Encode<SetAndWaitUtcArgs, fidl::encoding::DefaultFuchsiaResourceDialect>
2355        for (T0, T1, T2)
2356    {
2357        #[inline]
2358        unsafe fn encode(
2359            self,
2360            encoder: &mut fidl::encoding::Encoder<
2361                '_,
2362                fidl::encoding::DefaultFuchsiaResourceDialect,
2363            >,
2364            offset: usize,
2365            depth: fidl::encoding::Depth,
2366        ) -> fidl::Result<()> {
2367            encoder.debug_check_bounds::<SetAndWaitUtcArgs>(offset);
2368            // Zero out padding regions. There's no need to apply masks
2369            // because the unmasked parts will be overwritten by fields.
2370            // Write the fields.
2371            self.0.encode(encoder, offset + 0, depth)?;
2372            self.1.encode(encoder, offset + 8, depth)?;
2373            self.2.encode(encoder, offset + 24, depth)?;
2374            Ok(())
2375        }
2376    }
2377
2378    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2379        for SetAndWaitUtcArgs
2380    {
2381        #[inline(always)]
2382        fn new_empty() -> Self {
2383            Self {
2384                deadline: fidl::new_empty!(
2385                    InstantUtc,
2386                    fidl::encoding::DefaultFuchsiaResourceDialect
2387                ),
2388                mode: fidl::new_empty!(SetMode, fidl::encoding::DefaultFuchsiaResourceDialect),
2389                alarm_id: fidl::new_empty!(
2390                    fidl::encoding::BoundedString<128>,
2391                    fidl::encoding::DefaultFuchsiaResourceDialect
2392                ),
2393            }
2394        }
2395
2396        #[inline]
2397        unsafe fn decode(
2398            &mut self,
2399            decoder: &mut fidl::encoding::Decoder<
2400                '_,
2401                fidl::encoding::DefaultFuchsiaResourceDialect,
2402            >,
2403            offset: usize,
2404            _depth: fidl::encoding::Depth,
2405        ) -> fidl::Result<()> {
2406            decoder.debug_check_bounds::<Self>(offset);
2407            // Verify that padding bytes are zero.
2408            fidl::decode!(
2409                InstantUtc,
2410                fidl::encoding::DefaultFuchsiaResourceDialect,
2411                &mut self.deadline,
2412                decoder,
2413                offset + 0,
2414                _depth
2415            )?;
2416            fidl::decode!(
2417                SetMode,
2418                fidl::encoding::DefaultFuchsiaResourceDialect,
2419                &mut self.mode,
2420                decoder,
2421                offset + 8,
2422                _depth
2423            )?;
2424            fidl::decode!(
2425                fidl::encoding::BoundedString<128>,
2426                fidl::encoding::DefaultFuchsiaResourceDialect,
2427                &mut self.alarm_id,
2428                decoder,
2429                offset + 24,
2430                _depth
2431            )?;
2432            Ok(())
2433        }
2434    }
2435
2436    impl fidl::encoding::ResourceTypeMarker for SetArgs {
2437        type Borrowed<'a> = &'a mut Self;
2438        fn take_or_borrow<'a>(
2439            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2440        ) -> Self::Borrowed<'a> {
2441            value
2442        }
2443    }
2444
2445    unsafe impl fidl::encoding::TypeMarker for SetArgs {
2446        type Owned = Self;
2447
2448        #[inline(always)]
2449        fn inline_align(_context: fidl::encoding::Context) -> usize {
2450            8
2451        }
2452
2453        #[inline(always)]
2454        fn inline_size(_context: fidl::encoding::Context) -> usize {
2455            48
2456        }
2457    }
2458
2459    unsafe impl fidl::encoding::Encode<SetArgs, fidl::encoding::DefaultFuchsiaResourceDialect>
2460        for &mut SetArgs
2461    {
2462        #[inline]
2463        unsafe fn encode(
2464            self,
2465            encoder: &mut fidl::encoding::Encoder<
2466                '_,
2467                fidl::encoding::DefaultFuchsiaResourceDialect,
2468            >,
2469            offset: usize,
2470            _depth: fidl::encoding::Depth,
2471        ) -> fidl::Result<()> {
2472            encoder.debug_check_bounds::<SetArgs>(offset);
2473            // Delegate to tuple encoding.
2474            fidl::encoding::Encode::<SetArgs, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2475                (
2476                    <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<NotifierMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.notifier),
2477                    <fidl::BootInstant as fidl::encoding::ValueTypeMarker>::borrow(&self.deadline),
2478                    <SetMode as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.mode),
2479                    <fidl::encoding::BoundedString<128> as fidl::encoding::ValueTypeMarker>::borrow(&self.alarm_id),
2480                ),
2481                encoder, offset, _depth
2482            )
2483        }
2484    }
2485    unsafe impl<
2486        T0: fidl::encoding::Encode<
2487                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<NotifierMarker>>,
2488                fidl::encoding::DefaultFuchsiaResourceDialect,
2489            >,
2490        T1: fidl::encoding::Encode<fidl::BootInstant, fidl::encoding::DefaultFuchsiaResourceDialect>,
2491        T2: fidl::encoding::Encode<SetMode, fidl::encoding::DefaultFuchsiaResourceDialect>,
2492        T3: fidl::encoding::Encode<
2493                fidl::encoding::BoundedString<128>,
2494                fidl::encoding::DefaultFuchsiaResourceDialect,
2495            >,
2496    > fidl::encoding::Encode<SetArgs, fidl::encoding::DefaultFuchsiaResourceDialect>
2497        for (T0, T1, T2, T3)
2498    {
2499        #[inline]
2500        unsafe fn encode(
2501            self,
2502            encoder: &mut fidl::encoding::Encoder<
2503                '_,
2504                fidl::encoding::DefaultFuchsiaResourceDialect,
2505            >,
2506            offset: usize,
2507            depth: fidl::encoding::Depth,
2508        ) -> fidl::Result<()> {
2509            encoder.debug_check_bounds::<SetArgs>(offset);
2510            // Zero out padding regions. There's no need to apply masks
2511            // because the unmasked parts will be overwritten by fields.
2512            unsafe {
2513                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
2514                (ptr as *mut u64).write_unaligned(0);
2515            }
2516            // Write the fields.
2517            self.0.encode(encoder, offset + 0, depth)?;
2518            self.1.encode(encoder, offset + 8, depth)?;
2519            self.2.encode(encoder, offset + 16, depth)?;
2520            self.3.encode(encoder, offset + 32, depth)?;
2521            Ok(())
2522        }
2523    }
2524
2525    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for SetArgs {
2526        #[inline(always)]
2527        fn new_empty() -> Self {
2528            Self {
2529                notifier: fidl::new_empty!(
2530                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<NotifierMarker>>,
2531                    fidl::encoding::DefaultFuchsiaResourceDialect
2532                ),
2533                deadline: fidl::new_empty!(
2534                    fidl::BootInstant,
2535                    fidl::encoding::DefaultFuchsiaResourceDialect
2536                ),
2537                mode: fidl::new_empty!(SetMode, fidl::encoding::DefaultFuchsiaResourceDialect),
2538                alarm_id: fidl::new_empty!(
2539                    fidl::encoding::BoundedString<128>,
2540                    fidl::encoding::DefaultFuchsiaResourceDialect
2541                ),
2542            }
2543        }
2544
2545        #[inline]
2546        unsafe fn decode(
2547            &mut self,
2548            decoder: &mut fidl::encoding::Decoder<
2549                '_,
2550                fidl::encoding::DefaultFuchsiaResourceDialect,
2551            >,
2552            offset: usize,
2553            _depth: fidl::encoding::Depth,
2554        ) -> fidl::Result<()> {
2555            decoder.debug_check_bounds::<Self>(offset);
2556            // Verify that padding bytes are zero.
2557            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
2558            let padval = unsafe { (ptr as *const u64).read_unaligned() };
2559            let mask = 0xffffffff00000000u64;
2560            let maskedval = padval & mask;
2561            if maskedval != 0 {
2562                return Err(fidl::Error::NonZeroPadding {
2563                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
2564                });
2565            }
2566            fidl::decode!(
2567                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<NotifierMarker>>,
2568                fidl::encoding::DefaultFuchsiaResourceDialect,
2569                &mut self.notifier,
2570                decoder,
2571                offset + 0,
2572                _depth
2573            )?;
2574            fidl::decode!(
2575                fidl::BootInstant,
2576                fidl::encoding::DefaultFuchsiaResourceDialect,
2577                &mut self.deadline,
2578                decoder,
2579                offset + 8,
2580                _depth
2581            )?;
2582            fidl::decode!(
2583                SetMode,
2584                fidl::encoding::DefaultFuchsiaResourceDialect,
2585                &mut self.mode,
2586                decoder,
2587                offset + 16,
2588                _depth
2589            )?;
2590            fidl::decode!(
2591                fidl::encoding::BoundedString<128>,
2592                fidl::encoding::DefaultFuchsiaResourceDialect,
2593                &mut self.alarm_id,
2594                decoder,
2595                offset + 32,
2596                _depth
2597            )?;
2598            Ok(())
2599        }
2600    }
2601
2602    impl fidl::encoding::ResourceTypeMarker for WakeAlarmsSetAndWaitUtcResponse {
2603        type Borrowed<'a> = &'a mut Self;
2604        fn take_or_borrow<'a>(
2605            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2606        ) -> Self::Borrowed<'a> {
2607            value
2608        }
2609    }
2610
2611    unsafe impl fidl::encoding::TypeMarker for WakeAlarmsSetAndWaitUtcResponse {
2612        type Owned = Self;
2613
2614        #[inline(always)]
2615        fn inline_align(_context: fidl::encoding::Context) -> usize {
2616            4
2617        }
2618
2619        #[inline(always)]
2620        fn inline_size(_context: fidl::encoding::Context) -> usize {
2621            4
2622        }
2623    }
2624
2625    unsafe impl
2626        fidl::encoding::Encode<
2627            WakeAlarmsSetAndWaitUtcResponse,
2628            fidl::encoding::DefaultFuchsiaResourceDialect,
2629        > for &mut WakeAlarmsSetAndWaitUtcResponse
2630    {
2631        #[inline]
2632        unsafe fn encode(
2633            self,
2634            encoder: &mut fidl::encoding::Encoder<
2635                '_,
2636                fidl::encoding::DefaultFuchsiaResourceDialect,
2637            >,
2638            offset: usize,
2639            _depth: fidl::encoding::Depth,
2640        ) -> fidl::Result<()> {
2641            encoder.debug_check_bounds::<WakeAlarmsSetAndWaitUtcResponse>(offset);
2642            // Delegate to tuple encoding.
2643            fidl::encoding::Encode::<
2644                WakeAlarmsSetAndWaitUtcResponse,
2645                fidl::encoding::DefaultFuchsiaResourceDialect,
2646            >::encode(
2647                (<fidl::encoding::HandleType<
2648                    fidl::EventPair,
2649                    { fidl::ObjectType::EVENTPAIR.into_raw() },
2650                    16387,
2651                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2652                    &mut self.keep_alive
2653                ),),
2654                encoder,
2655                offset,
2656                _depth,
2657            )
2658        }
2659    }
2660    unsafe impl<
2661        T0: fidl::encoding::Encode<
2662                fidl::encoding::HandleType<
2663                    fidl::EventPair,
2664                    { fidl::ObjectType::EVENTPAIR.into_raw() },
2665                    16387,
2666                >,
2667                fidl::encoding::DefaultFuchsiaResourceDialect,
2668            >,
2669    >
2670        fidl::encoding::Encode<
2671            WakeAlarmsSetAndWaitUtcResponse,
2672            fidl::encoding::DefaultFuchsiaResourceDialect,
2673        > for (T0,)
2674    {
2675        #[inline]
2676        unsafe fn encode(
2677            self,
2678            encoder: &mut fidl::encoding::Encoder<
2679                '_,
2680                fidl::encoding::DefaultFuchsiaResourceDialect,
2681            >,
2682            offset: usize,
2683            depth: fidl::encoding::Depth,
2684        ) -> fidl::Result<()> {
2685            encoder.debug_check_bounds::<WakeAlarmsSetAndWaitUtcResponse>(offset);
2686            // Zero out padding regions. There's no need to apply masks
2687            // because the unmasked parts will be overwritten by fields.
2688            // Write the fields.
2689            self.0.encode(encoder, offset + 0, depth)?;
2690            Ok(())
2691        }
2692    }
2693
2694    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2695        for WakeAlarmsSetAndWaitUtcResponse
2696    {
2697        #[inline(always)]
2698        fn new_empty() -> Self {
2699            Self {
2700                keep_alive: fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 16387>, fidl::encoding::DefaultFuchsiaResourceDialect),
2701            }
2702        }
2703
2704        #[inline]
2705        unsafe fn decode(
2706            &mut self,
2707            decoder: &mut fidl::encoding::Decoder<
2708                '_,
2709                fidl::encoding::DefaultFuchsiaResourceDialect,
2710            >,
2711            offset: usize,
2712            _depth: fidl::encoding::Depth,
2713        ) -> fidl::Result<()> {
2714            decoder.debug_check_bounds::<Self>(offset);
2715            // Verify that padding bytes are zero.
2716            fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 16387>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.keep_alive, decoder, offset + 0, _depth)?;
2717            Ok(())
2718        }
2719    }
2720
2721    impl fidl::encoding::ResourceTypeMarker for WakeAlarmsSetAndWaitResponse {
2722        type Borrowed<'a> = &'a mut Self;
2723        fn take_or_borrow<'a>(
2724            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2725        ) -> Self::Borrowed<'a> {
2726            value
2727        }
2728    }
2729
2730    unsafe impl fidl::encoding::TypeMarker for WakeAlarmsSetAndWaitResponse {
2731        type Owned = Self;
2732
2733        #[inline(always)]
2734        fn inline_align(_context: fidl::encoding::Context) -> usize {
2735            4
2736        }
2737
2738        #[inline(always)]
2739        fn inline_size(_context: fidl::encoding::Context) -> usize {
2740            4
2741        }
2742    }
2743
2744    unsafe impl
2745        fidl::encoding::Encode<
2746            WakeAlarmsSetAndWaitResponse,
2747            fidl::encoding::DefaultFuchsiaResourceDialect,
2748        > for &mut WakeAlarmsSetAndWaitResponse
2749    {
2750        #[inline]
2751        unsafe fn encode(
2752            self,
2753            encoder: &mut fidl::encoding::Encoder<
2754                '_,
2755                fidl::encoding::DefaultFuchsiaResourceDialect,
2756            >,
2757            offset: usize,
2758            _depth: fidl::encoding::Depth,
2759        ) -> fidl::Result<()> {
2760            encoder.debug_check_bounds::<WakeAlarmsSetAndWaitResponse>(offset);
2761            // Delegate to tuple encoding.
2762            fidl::encoding::Encode::<
2763                WakeAlarmsSetAndWaitResponse,
2764                fidl::encoding::DefaultFuchsiaResourceDialect,
2765            >::encode(
2766                (<fidl::encoding::HandleType<
2767                    fidl::EventPair,
2768                    { fidl::ObjectType::EVENTPAIR.into_raw() },
2769                    16387,
2770                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2771                    &mut self.keep_alive
2772                ),),
2773                encoder,
2774                offset,
2775                _depth,
2776            )
2777        }
2778    }
2779    unsafe impl<
2780        T0: fidl::encoding::Encode<
2781                fidl::encoding::HandleType<
2782                    fidl::EventPair,
2783                    { fidl::ObjectType::EVENTPAIR.into_raw() },
2784                    16387,
2785                >,
2786                fidl::encoding::DefaultFuchsiaResourceDialect,
2787            >,
2788    >
2789        fidl::encoding::Encode<
2790            WakeAlarmsSetAndWaitResponse,
2791            fidl::encoding::DefaultFuchsiaResourceDialect,
2792        > for (T0,)
2793    {
2794        #[inline]
2795        unsafe fn encode(
2796            self,
2797            encoder: &mut fidl::encoding::Encoder<
2798                '_,
2799                fidl::encoding::DefaultFuchsiaResourceDialect,
2800            >,
2801            offset: usize,
2802            depth: fidl::encoding::Depth,
2803        ) -> fidl::Result<()> {
2804            encoder.debug_check_bounds::<WakeAlarmsSetAndWaitResponse>(offset);
2805            // Zero out padding regions. There's no need to apply masks
2806            // because the unmasked parts will be overwritten by fields.
2807            // Write the fields.
2808            self.0.encode(encoder, offset + 0, depth)?;
2809            Ok(())
2810        }
2811    }
2812
2813    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2814        for WakeAlarmsSetAndWaitResponse
2815    {
2816        #[inline(always)]
2817        fn new_empty() -> Self {
2818            Self {
2819                keep_alive: fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 16387>, fidl::encoding::DefaultFuchsiaResourceDialect),
2820            }
2821        }
2822
2823        #[inline]
2824        unsafe fn decode(
2825            &mut self,
2826            decoder: &mut fidl::encoding::Decoder<
2827                '_,
2828                fidl::encoding::DefaultFuchsiaResourceDialect,
2829            >,
2830            offset: usize,
2831            _depth: fidl::encoding::Depth,
2832        ) -> fidl::Result<()> {
2833            decoder.debug_check_bounds::<Self>(offset);
2834            // Verify that padding bytes are zero.
2835            fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 16387>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.keep_alive, decoder, offset + 0, _depth)?;
2836            Ok(())
2837        }
2838    }
2839
2840    impl fidl::encoding::ResourceTypeMarker for SetMode {
2841        type Borrowed<'a> = &'a mut Self;
2842        fn take_or_borrow<'a>(
2843            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2844        ) -> Self::Borrowed<'a> {
2845            value
2846        }
2847    }
2848
2849    unsafe impl fidl::encoding::TypeMarker for SetMode {
2850        type Owned = Self;
2851
2852        #[inline(always)]
2853        fn inline_align(_context: fidl::encoding::Context) -> usize {
2854            8
2855        }
2856
2857        #[inline(always)]
2858        fn inline_size(_context: fidl::encoding::Context) -> usize {
2859            16
2860        }
2861    }
2862
2863    unsafe impl fidl::encoding::Encode<SetMode, fidl::encoding::DefaultFuchsiaResourceDialect>
2864        for &mut SetMode
2865    {
2866        #[inline]
2867        unsafe fn encode(
2868            self,
2869            encoder: &mut fidl::encoding::Encoder<
2870                '_,
2871                fidl::encoding::DefaultFuchsiaResourceDialect,
2872            >,
2873            offset: usize,
2874            _depth: fidl::encoding::Depth,
2875        ) -> fidl::Result<()> {
2876            encoder.debug_check_bounds::<SetMode>(offset);
2877            encoder.write_num::<u64>(self.ordinal(), offset);
2878            match self {
2879                SetMode::KeepAlive(ref mut val) => fidl::encoding::encode_in_envelope::<
2880                    fidl::encoding::HandleType<
2881                        fidl::EventPair,
2882                        { fidl::ObjectType::EVENTPAIR.into_raw() },
2883                        16387,
2884                    >,
2885                    fidl::encoding::DefaultFuchsiaResourceDialect,
2886                >(
2887                    <fidl::encoding::HandleType<
2888                        fidl::EventPair,
2889                        { fidl::ObjectType::EVENTPAIR.into_raw() },
2890                        16387,
2891                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2892                        val
2893                    ),
2894                    encoder,
2895                    offset + 8,
2896                    _depth,
2897                ),
2898                SetMode::NotifySetupDone(ref mut val) => fidl::encoding::encode_in_envelope::<
2899                    fidl::encoding::HandleType<
2900                        fidl::Event,
2901                        { fidl::ObjectType::EVENT.into_raw() },
2902                        2147483648,
2903                    >,
2904                    fidl::encoding::DefaultFuchsiaResourceDialect,
2905                >(
2906                    <fidl::encoding::HandleType<
2907                        fidl::Event,
2908                        { fidl::ObjectType::EVENT.into_raw() },
2909                        2147483648,
2910                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2911                        val
2912                    ),
2913                    encoder,
2914                    offset + 8,
2915                    _depth,
2916                ),
2917                SetMode::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
2918            }
2919        }
2920    }
2921
2922    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for SetMode {
2923        #[inline(always)]
2924        fn new_empty() -> Self {
2925            Self::__SourceBreaking { unknown_ordinal: 0 }
2926        }
2927
2928        #[inline]
2929        unsafe fn decode(
2930            &mut self,
2931            decoder: &mut fidl::encoding::Decoder<
2932                '_,
2933                fidl::encoding::DefaultFuchsiaResourceDialect,
2934            >,
2935            offset: usize,
2936            mut depth: fidl::encoding::Depth,
2937        ) -> fidl::Result<()> {
2938            decoder.debug_check_bounds::<Self>(offset);
2939            #[allow(unused_variables)]
2940            let next_out_of_line = decoder.next_out_of_line();
2941            let handles_before = decoder.remaining_handles();
2942            let (ordinal, inlined, num_bytes, num_handles) =
2943                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
2944
2945            let member_inline_size = match ordinal {
2946                1 => <fidl::encoding::HandleType<
2947                    fidl::EventPair,
2948                    { fidl::ObjectType::EVENTPAIR.into_raw() },
2949                    16387,
2950                > as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2951                2 => <fidl::encoding::HandleType<
2952                    fidl::Event,
2953                    { fidl::ObjectType::EVENT.into_raw() },
2954                    2147483648,
2955                > as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2956                0 => return Err(fidl::Error::UnknownUnionTag),
2957                _ => num_bytes as usize,
2958            };
2959
2960            if inlined != (member_inline_size <= 4) {
2961                return Err(fidl::Error::InvalidInlineBitInEnvelope);
2962            }
2963            let _inner_offset;
2964            if inlined {
2965                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
2966                _inner_offset = offset + 8;
2967            } else {
2968                depth.increment()?;
2969                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2970            }
2971            match ordinal {
2972                1 => {
2973                    #[allow(irrefutable_let_patterns)]
2974                    if let SetMode::KeepAlive(_) = self {
2975                        // Do nothing, read the value into the object
2976                    } else {
2977                        // Initialize `self` to the right variant
2978                        *self = SetMode::KeepAlive(
2979                            fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 16387>, fidl::encoding::DefaultFuchsiaResourceDialect),
2980                        );
2981                    }
2982                    #[allow(irrefutable_let_patterns)]
2983                    if let SetMode::KeepAlive(ref mut val) = self {
2984                        fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 16387>, fidl::encoding::DefaultFuchsiaResourceDialect, val, decoder, _inner_offset, depth)?;
2985                    } else {
2986                        unreachable!()
2987                    }
2988                }
2989                2 => {
2990                    #[allow(irrefutable_let_patterns)]
2991                    if let SetMode::NotifySetupDone(_) = self {
2992                        // Do nothing, read the value into the object
2993                    } else {
2994                        // Initialize `self` to the right variant
2995                        *self = SetMode::NotifySetupDone(
2996                            fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
2997                        );
2998                    }
2999                    #[allow(irrefutable_let_patterns)]
3000                    if let SetMode::NotifySetupDone(ref mut val) = self {
3001                        fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val, decoder, _inner_offset, depth)?;
3002                    } else {
3003                        unreachable!()
3004                    }
3005                }
3006                #[allow(deprecated)]
3007                ordinal => {
3008                    for _ in 0..num_handles {
3009                        decoder.drop_next_handle()?;
3010                    }
3011                    *self = SetMode::__SourceBreaking { unknown_ordinal: ordinal };
3012                }
3013            }
3014            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
3015                return Err(fidl::Error::InvalidNumBytesInEnvelope);
3016            }
3017            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3018                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3019            }
3020            Ok(())
3021        }
3022    }
3023}