fidl_fuchsia_net_power/
fidl_fuchsia_net_power.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_net_power__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, PartialEq)]
15pub struct CreateWakeGroupRequest {
16    pub options: WakeGroupOptions,
17    pub request: fidl::endpoints::ServerEnd<WakeGroupMarker>,
18}
19
20impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for CreateWakeGroupRequest {}
21
22#[derive(Debug, Default, PartialEq)]
23pub struct CreateWakeGroupResponse {
24    /// A token that can be used to identify this wake group when adding
25    /// networking resources (such as sockets) to the group.
26    ///
27    /// Always present.
28    pub token: Option<fidl_fuchsia_net_resources::WakeGroupToken>,
29    #[doc(hidden)]
30    pub __source_breaking: fidl::marker::SourceBreaking,
31}
32
33impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for CreateWakeGroupResponse {}
34
35#[derive(Debug, Default, PartialEq)]
36pub struct WakeGroupWaitForDataResponse {
37    /// The source of the wakeup.
38    ///
39    /// Always present.
40    pub source: Option<WakeSource>,
41    #[doc(hidden)]
42    pub __source_breaking: fidl::marker::SourceBreaking,
43}
44
45impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
46    for WakeGroupWaitForDataResponse
47{
48}
49
50#[derive(Debug)]
51pub enum WakeSource {
52    /// The caller is being notified of data to be processed.
53    Data(Empty),
54    /// The caller is being notified of a lease delegated from the
55    /// network driver.
56    ///
57    /// The caller should retain the lease until it is ready to allow
58    /// the system to suspend.
59    Lease(fidl::EventPair),
60    #[doc(hidden)]
61    __SourceBreaking { unknown_ordinal: u64 },
62}
63
64/// Pattern that matches an unknown `WakeSource` member.
65#[macro_export]
66macro_rules! WakeSourceUnknown {
67    () => {
68        _
69    };
70}
71
72// Custom PartialEq so that unknown variants are not equal to themselves.
73impl PartialEq for WakeSource {
74    fn eq(&self, other: &Self) -> bool {
75        match (self, other) {
76            (Self::Data(x), Self::Data(y)) => *x == *y,
77            (Self::Lease(x), Self::Lease(y)) => *x == *y,
78            _ => false,
79        }
80    }
81}
82
83impl WakeSource {
84    #[inline]
85    pub fn ordinal(&self) -> u64 {
86        match *self {
87            Self::Data(_) => 1,
88            Self::Lease(_) => 2,
89            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
90        }
91    }
92
93    #[inline]
94    pub fn unknown_variant_for_testing() -> Self {
95        Self::__SourceBreaking { unknown_ordinal: 0 }
96    }
97
98    #[inline]
99    pub fn is_unknown(&self) -> bool {
100        match self {
101            Self::__SourceBreaking { .. } => true,
102            _ => false,
103        }
104    }
105}
106
107impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for WakeSource {}
108
109#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
110pub struct WakeGroupMarker;
111
112impl fidl::endpoints::ProtocolMarker for WakeGroupMarker {
113    type Proxy = WakeGroupProxy;
114    type RequestStream = WakeGroupRequestStream;
115    #[cfg(target_os = "fuchsia")]
116    type SynchronousProxy = WakeGroupSynchronousProxy;
117
118    const DEBUG_NAME: &'static str = "(anonymous) WakeGroup";
119}
120
121pub trait WakeGroupProxyInterface: Send + Sync {
122    type WaitForDataResponseFut: std::future::Future<Output = Result<WakeGroupWaitForDataResponse, fidl::Error>>
123        + Send;
124    fn r#wait_for_data(&self) -> Self::WaitForDataResponseFut;
125    type ArmResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
126    fn r#arm(&self) -> Self::ArmResponseFut;
127}
128#[derive(Debug)]
129#[cfg(target_os = "fuchsia")]
130pub struct WakeGroupSynchronousProxy {
131    client: fidl::client::sync::Client,
132}
133
134#[cfg(target_os = "fuchsia")]
135impl fidl::endpoints::SynchronousProxy for WakeGroupSynchronousProxy {
136    type Proxy = WakeGroupProxy;
137    type Protocol = WakeGroupMarker;
138
139    fn from_channel(inner: fidl::Channel) -> Self {
140        Self::new(inner)
141    }
142
143    fn into_channel(self) -> fidl::Channel {
144        self.client.into_channel()
145    }
146
147    fn as_channel(&self) -> &fidl::Channel {
148        self.client.as_channel()
149    }
150}
151
152#[cfg(target_os = "fuchsia")]
153impl WakeGroupSynchronousProxy {
154    pub fn new(channel: fidl::Channel) -> Self {
155        let protocol_name = <WakeGroupMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
156        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
157    }
158
159    pub fn into_channel(self) -> fidl::Channel {
160        self.client.into_channel()
161    }
162
163    /// Waits until an event arrives and returns it. It is safe for other
164    /// threads to make concurrent requests while waiting for an event.
165    pub fn wait_for_event(
166        &self,
167        deadline: zx::MonotonicInstant,
168    ) -> Result<WakeGroupEvent, fidl::Error> {
169        WakeGroupEvent::decode(self.client.wait_for_event(deadline)?)
170    }
171
172    /// Registers the client to be woken up (in the form of a response) when
173    /// there is incoming data available for any of the resources registered
174    /// with this wake group.
175    ///
176    /// Note that the client is required to "arm" this hanging get by calling
177    /// `Arm` in order to ensure a response. Once the `WaitForData` call has
178    /// returned, the next call to the method will hang until `Arm` has been
179    /// called again *and* new data has arrived. In other words, `Arm` re-arms
180    /// the hanging get and should be called when a response is required in
181    /// order to be woken up.
182    ///
183    /// If the caller is responsible for keeping the system awake while handling
184    /// the incoming data, the netstack will delegate (baton-pass) a lease to
185    /// the caller that it can retain until it is ready to allow the system to
186    /// suspend.
187    pub fn r#wait_for_data(
188        &self,
189        ___deadline: zx::MonotonicInstant,
190    ) -> Result<WakeGroupWaitForDataResponse, fidl::Error> {
191        let _response =
192            self.client.send_query::<fidl::encoding::EmptyPayload, WakeGroupWaitForDataResponse>(
193                (),
194                0x1b9ea0f8e92c2e79,
195                fidl::encoding::DynamicFlags::empty(),
196                ___deadline,
197            )?;
198        Ok(_response)
199    }
200
201    /// Notifies the netstack that the client has handled any previous
202    /// `WaitForData` response that has arrived on the channel, and expects to
203    /// be woken up again when data arrives, in the form of a response to the
204    /// pending `WaitForData` call.
205    ///
206    /// In other words, calling this method "re-arms" the hanging get.
207    pub fn r#arm(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
208        let _response =
209            self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::EmptyPayload>(
210                (),
211                0x4339c3052501e712,
212                fidl::encoding::DynamicFlags::empty(),
213                ___deadline,
214            )?;
215        Ok(_response)
216    }
217}
218
219#[cfg(target_os = "fuchsia")]
220impl From<WakeGroupSynchronousProxy> for zx::Handle {
221    fn from(value: WakeGroupSynchronousProxy) -> Self {
222        value.into_channel().into()
223    }
224}
225
226#[cfg(target_os = "fuchsia")]
227impl From<fidl::Channel> for WakeGroupSynchronousProxy {
228    fn from(value: fidl::Channel) -> Self {
229        Self::new(value)
230    }
231}
232
233#[cfg(target_os = "fuchsia")]
234impl fidl::endpoints::FromClient for WakeGroupSynchronousProxy {
235    type Protocol = WakeGroupMarker;
236
237    fn from_client(value: fidl::endpoints::ClientEnd<WakeGroupMarker>) -> Self {
238        Self::new(value.into_channel())
239    }
240}
241
242#[derive(Debug, Clone)]
243pub struct WakeGroupProxy {
244    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
245}
246
247impl fidl::endpoints::Proxy for WakeGroupProxy {
248    type Protocol = WakeGroupMarker;
249
250    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
251        Self::new(inner)
252    }
253
254    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
255        self.client.into_channel().map_err(|client| Self { client })
256    }
257
258    fn as_channel(&self) -> &::fidl::AsyncChannel {
259        self.client.as_channel()
260    }
261}
262
263impl WakeGroupProxy {
264    /// Create a new Proxy for fuchsia.net.power/WakeGroup.
265    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
266        let protocol_name = <WakeGroupMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
267        Self { client: fidl::client::Client::new(channel, protocol_name) }
268    }
269
270    /// Get a Stream of events from the remote end of the protocol.
271    ///
272    /// # Panics
273    ///
274    /// Panics if the event stream was already taken.
275    pub fn take_event_stream(&self) -> WakeGroupEventStream {
276        WakeGroupEventStream { event_receiver: self.client.take_event_receiver() }
277    }
278
279    /// Registers the client to be woken up (in the form of a response) when
280    /// there is incoming data available for any of the resources registered
281    /// with this wake group.
282    ///
283    /// Note that the client is required to "arm" this hanging get by calling
284    /// `Arm` in order to ensure a response. Once the `WaitForData` call has
285    /// returned, the next call to the method will hang until `Arm` has been
286    /// called again *and* new data has arrived. In other words, `Arm` re-arms
287    /// the hanging get and should be called when a response is required in
288    /// order to be woken up.
289    ///
290    /// If the caller is responsible for keeping the system awake while handling
291    /// the incoming data, the netstack will delegate (baton-pass) a lease to
292    /// the caller that it can retain until it is ready to allow the system to
293    /// suspend.
294    pub fn r#wait_for_data(
295        &self,
296    ) -> fidl::client::QueryResponseFut<
297        WakeGroupWaitForDataResponse,
298        fidl::encoding::DefaultFuchsiaResourceDialect,
299    > {
300        WakeGroupProxyInterface::r#wait_for_data(self)
301    }
302
303    /// Notifies the netstack that the client has handled any previous
304    /// `WaitForData` response that has arrived on the channel, and expects to
305    /// be woken up again when data arrives, in the form of a response to the
306    /// pending `WaitForData` call.
307    ///
308    /// In other words, calling this method "re-arms" the hanging get.
309    pub fn r#arm(
310        &self,
311    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
312        WakeGroupProxyInterface::r#arm(self)
313    }
314}
315
316impl WakeGroupProxyInterface for WakeGroupProxy {
317    type WaitForDataResponseFut = fidl::client::QueryResponseFut<
318        WakeGroupWaitForDataResponse,
319        fidl::encoding::DefaultFuchsiaResourceDialect,
320    >;
321    fn r#wait_for_data(&self) -> Self::WaitForDataResponseFut {
322        fn _decode(
323            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
324        ) -> Result<WakeGroupWaitForDataResponse, fidl::Error> {
325            let _response = fidl::client::decode_transaction_body::<
326                WakeGroupWaitForDataResponse,
327                fidl::encoding::DefaultFuchsiaResourceDialect,
328                0x1b9ea0f8e92c2e79,
329            >(_buf?)?;
330            Ok(_response)
331        }
332        self.client
333            .send_query_and_decode::<fidl::encoding::EmptyPayload, WakeGroupWaitForDataResponse>(
334                (),
335                0x1b9ea0f8e92c2e79,
336                fidl::encoding::DynamicFlags::empty(),
337                _decode,
338            )
339    }
340
341    type ArmResponseFut =
342        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
343    fn r#arm(&self) -> Self::ArmResponseFut {
344        fn _decode(
345            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
346        ) -> Result<(), fidl::Error> {
347            let _response = fidl::client::decode_transaction_body::<
348                fidl::encoding::EmptyPayload,
349                fidl::encoding::DefaultFuchsiaResourceDialect,
350                0x4339c3052501e712,
351            >(_buf?)?;
352            Ok(_response)
353        }
354        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
355            (),
356            0x4339c3052501e712,
357            fidl::encoding::DynamicFlags::empty(),
358            _decode,
359        )
360    }
361}
362
363pub struct WakeGroupEventStream {
364    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
365}
366
367impl std::marker::Unpin for WakeGroupEventStream {}
368
369impl futures::stream::FusedStream for WakeGroupEventStream {
370    fn is_terminated(&self) -> bool {
371        self.event_receiver.is_terminated()
372    }
373}
374
375impl futures::Stream for WakeGroupEventStream {
376    type Item = Result<WakeGroupEvent, fidl::Error>;
377
378    fn poll_next(
379        mut self: std::pin::Pin<&mut Self>,
380        cx: &mut std::task::Context<'_>,
381    ) -> std::task::Poll<Option<Self::Item>> {
382        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
383            &mut self.event_receiver,
384            cx
385        )?) {
386            Some(buf) => std::task::Poll::Ready(Some(WakeGroupEvent::decode(buf))),
387            None => std::task::Poll::Ready(None),
388        }
389    }
390}
391
392#[derive(Debug)]
393pub enum WakeGroupEvent {}
394
395impl WakeGroupEvent {
396    /// Decodes a message buffer as a [`WakeGroupEvent`].
397    fn decode(
398        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
399    ) -> Result<WakeGroupEvent, fidl::Error> {
400        let (bytes, _handles) = buf.split_mut();
401        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
402        debug_assert_eq!(tx_header.tx_id, 0);
403        match tx_header.ordinal {
404            _ => Err(fidl::Error::UnknownOrdinal {
405                ordinal: tx_header.ordinal,
406                protocol_name: <WakeGroupMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
407            }),
408        }
409    }
410}
411
412/// A Stream of incoming requests for fuchsia.net.power/WakeGroup.
413pub struct WakeGroupRequestStream {
414    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
415    is_terminated: bool,
416}
417
418impl std::marker::Unpin for WakeGroupRequestStream {}
419
420impl futures::stream::FusedStream for WakeGroupRequestStream {
421    fn is_terminated(&self) -> bool {
422        self.is_terminated
423    }
424}
425
426impl fidl::endpoints::RequestStream for WakeGroupRequestStream {
427    type Protocol = WakeGroupMarker;
428    type ControlHandle = WakeGroupControlHandle;
429
430    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
431        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
432    }
433
434    fn control_handle(&self) -> Self::ControlHandle {
435        WakeGroupControlHandle { inner: self.inner.clone() }
436    }
437
438    fn into_inner(
439        self,
440    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
441    {
442        (self.inner, self.is_terminated)
443    }
444
445    fn from_inner(
446        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
447        is_terminated: bool,
448    ) -> Self {
449        Self { inner, is_terminated }
450    }
451}
452
453impl futures::Stream for WakeGroupRequestStream {
454    type Item = Result<WakeGroupRequest, fidl::Error>;
455
456    fn poll_next(
457        mut self: std::pin::Pin<&mut Self>,
458        cx: &mut std::task::Context<'_>,
459    ) -> std::task::Poll<Option<Self::Item>> {
460        let this = &mut *self;
461        if this.inner.check_shutdown(cx) {
462            this.is_terminated = true;
463            return std::task::Poll::Ready(None);
464        }
465        if this.is_terminated {
466            panic!("polled WakeGroupRequestStream after completion");
467        }
468        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
469            |bytes, handles| {
470                match this.inner.channel().read_etc(cx, bytes, handles) {
471                    std::task::Poll::Ready(Ok(())) => {}
472                    std::task::Poll::Pending => return std::task::Poll::Pending,
473                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
474                        this.is_terminated = true;
475                        return std::task::Poll::Ready(None);
476                    }
477                    std::task::Poll::Ready(Err(e)) => {
478                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
479                            e.into(),
480                        ))));
481                    }
482                }
483
484                // A message has been received from the channel
485                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
486
487                std::task::Poll::Ready(Some(match header.ordinal {
488                    0x1b9ea0f8e92c2e79 => {
489                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
490                        let mut req = fidl::new_empty!(
491                            fidl::encoding::EmptyPayload,
492                            fidl::encoding::DefaultFuchsiaResourceDialect
493                        );
494                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
495                        let control_handle = WakeGroupControlHandle { inner: this.inner.clone() };
496                        Ok(WakeGroupRequest::WaitForData {
497                            responder: WakeGroupWaitForDataResponder {
498                                control_handle: std::mem::ManuallyDrop::new(control_handle),
499                                tx_id: header.tx_id,
500                            },
501                        })
502                    }
503                    0x4339c3052501e712 => {
504                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
505                        let mut req = fidl::new_empty!(
506                            fidl::encoding::EmptyPayload,
507                            fidl::encoding::DefaultFuchsiaResourceDialect
508                        );
509                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
510                        let control_handle = WakeGroupControlHandle { inner: this.inner.clone() };
511                        Ok(WakeGroupRequest::Arm {
512                            responder: WakeGroupArmResponder {
513                                control_handle: std::mem::ManuallyDrop::new(control_handle),
514                                tx_id: header.tx_id,
515                            },
516                        })
517                    }
518                    _ => Err(fidl::Error::UnknownOrdinal {
519                        ordinal: header.ordinal,
520                        protocol_name:
521                            <WakeGroupMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
522                    }),
523                }))
524            },
525        )
526    }
527}
528
529/// A group of networking resources, such as sockets, for which the client
530/// wishes to receive a notification when data is available.
531///
532/// This may be useful to, for example, allow a client to suspend execution
533/// until it is notified that some data is available to be processed.
534///
535/// Each connection to this protocol represents a distinct wake group.
536#[derive(Debug)]
537pub enum WakeGroupRequest {
538    /// Registers the client to be woken up (in the form of a response) when
539    /// there is incoming data available for any of the resources registered
540    /// with this wake group.
541    ///
542    /// Note that the client is required to "arm" this hanging get by calling
543    /// `Arm` in order to ensure a response. Once the `WaitForData` call has
544    /// returned, the next call to the method will hang until `Arm` has been
545    /// called again *and* new data has arrived. In other words, `Arm` re-arms
546    /// the hanging get and should be called when a response is required in
547    /// order to be woken up.
548    ///
549    /// If the caller is responsible for keeping the system awake while handling
550    /// the incoming data, the netstack will delegate (baton-pass) a lease to
551    /// the caller that it can retain until it is ready to allow the system to
552    /// suspend.
553    WaitForData { responder: WakeGroupWaitForDataResponder },
554    /// Notifies the netstack that the client has handled any previous
555    /// `WaitForData` response that has arrived on the channel, and expects to
556    /// be woken up again when data arrives, in the form of a response to the
557    /// pending `WaitForData` call.
558    ///
559    /// In other words, calling this method "re-arms" the hanging get.
560    Arm { responder: WakeGroupArmResponder },
561}
562
563impl WakeGroupRequest {
564    #[allow(irrefutable_let_patterns)]
565    pub fn into_wait_for_data(self) -> Option<(WakeGroupWaitForDataResponder)> {
566        if let WakeGroupRequest::WaitForData { responder } = self {
567            Some((responder))
568        } else {
569            None
570        }
571    }
572
573    #[allow(irrefutable_let_patterns)]
574    pub fn into_arm(self) -> Option<(WakeGroupArmResponder)> {
575        if let WakeGroupRequest::Arm { responder } = self { Some((responder)) } else { None }
576    }
577
578    /// Name of the method defined in FIDL
579    pub fn method_name(&self) -> &'static str {
580        match *self {
581            WakeGroupRequest::WaitForData { .. } => "wait_for_data",
582            WakeGroupRequest::Arm { .. } => "arm",
583        }
584    }
585}
586
587#[derive(Debug, Clone)]
588pub struct WakeGroupControlHandle {
589    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
590}
591
592impl fidl::endpoints::ControlHandle for WakeGroupControlHandle {
593    fn shutdown(&self) {
594        self.inner.shutdown()
595    }
596    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
597        self.inner.shutdown_with_epitaph(status)
598    }
599
600    fn is_closed(&self) -> bool {
601        self.inner.channel().is_closed()
602    }
603    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
604        self.inner.channel().on_closed()
605    }
606
607    #[cfg(target_os = "fuchsia")]
608    fn signal_peer(
609        &self,
610        clear_mask: zx::Signals,
611        set_mask: zx::Signals,
612    ) -> Result<(), zx_status::Status> {
613        use fidl::Peered;
614        self.inner.channel().signal_peer(clear_mask, set_mask)
615    }
616}
617
618impl WakeGroupControlHandle {}
619
620#[must_use = "FIDL methods require a response to be sent"]
621#[derive(Debug)]
622pub struct WakeGroupWaitForDataResponder {
623    control_handle: std::mem::ManuallyDrop<WakeGroupControlHandle>,
624    tx_id: u32,
625}
626
627/// Set the the channel to be shutdown (see [`WakeGroupControlHandle::shutdown`])
628/// if the responder is dropped without sending a response, so that the client
629/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
630impl std::ops::Drop for WakeGroupWaitForDataResponder {
631    fn drop(&mut self) {
632        self.control_handle.shutdown();
633        // Safety: drops once, never accessed again
634        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
635    }
636}
637
638impl fidl::endpoints::Responder for WakeGroupWaitForDataResponder {
639    type ControlHandle = WakeGroupControlHandle;
640
641    fn control_handle(&self) -> &WakeGroupControlHandle {
642        &self.control_handle
643    }
644
645    fn drop_without_shutdown(mut self) {
646        // Safety: drops once, never accessed again due to mem::forget
647        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
648        // Prevent Drop from running (which would shut down the channel)
649        std::mem::forget(self);
650    }
651}
652
653impl WakeGroupWaitForDataResponder {
654    /// Sends a response to the FIDL transaction.
655    ///
656    /// Sets the channel to shutdown if an error occurs.
657    pub fn send(self, mut payload: WakeGroupWaitForDataResponse) -> Result<(), fidl::Error> {
658        let _result = self.send_raw(payload);
659        if _result.is_err() {
660            self.control_handle.shutdown();
661        }
662        self.drop_without_shutdown();
663        _result
664    }
665
666    /// Similar to "send" but does not shutdown the channel if an error occurs.
667    pub fn send_no_shutdown_on_err(
668        self,
669        mut payload: WakeGroupWaitForDataResponse,
670    ) -> Result<(), fidl::Error> {
671        let _result = self.send_raw(payload);
672        self.drop_without_shutdown();
673        _result
674    }
675
676    fn send_raw(&self, mut payload: WakeGroupWaitForDataResponse) -> Result<(), fidl::Error> {
677        self.control_handle.inner.send::<WakeGroupWaitForDataResponse>(
678            &mut payload,
679            self.tx_id,
680            0x1b9ea0f8e92c2e79,
681            fidl::encoding::DynamicFlags::empty(),
682        )
683    }
684}
685
686#[must_use = "FIDL methods require a response to be sent"]
687#[derive(Debug)]
688pub struct WakeGroupArmResponder {
689    control_handle: std::mem::ManuallyDrop<WakeGroupControlHandle>,
690    tx_id: u32,
691}
692
693/// Set the the channel to be shutdown (see [`WakeGroupControlHandle::shutdown`])
694/// if the responder is dropped without sending a response, so that the client
695/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
696impl std::ops::Drop for WakeGroupArmResponder {
697    fn drop(&mut self) {
698        self.control_handle.shutdown();
699        // Safety: drops once, never accessed again
700        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
701    }
702}
703
704impl fidl::endpoints::Responder for WakeGroupArmResponder {
705    type ControlHandle = WakeGroupControlHandle;
706
707    fn control_handle(&self) -> &WakeGroupControlHandle {
708        &self.control_handle
709    }
710
711    fn drop_without_shutdown(mut self) {
712        // Safety: drops once, never accessed again due to mem::forget
713        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
714        // Prevent Drop from running (which would shut down the channel)
715        std::mem::forget(self);
716    }
717}
718
719impl WakeGroupArmResponder {
720    /// Sends a response to the FIDL transaction.
721    ///
722    /// Sets the channel to shutdown if an error occurs.
723    pub fn send(self) -> Result<(), fidl::Error> {
724        let _result = self.send_raw();
725        if _result.is_err() {
726            self.control_handle.shutdown();
727        }
728        self.drop_without_shutdown();
729        _result
730    }
731
732    /// Similar to "send" but does not shutdown the channel if an error occurs.
733    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
734        let _result = self.send_raw();
735        self.drop_without_shutdown();
736        _result
737    }
738
739    fn send_raw(&self) -> Result<(), fidl::Error> {
740        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
741            (),
742            self.tx_id,
743            0x4339c3052501e712,
744            fidl::encoding::DynamicFlags::empty(),
745        )
746    }
747}
748
749#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
750pub struct WakeGroupProviderMarker;
751
752impl fidl::endpoints::ProtocolMarker for WakeGroupProviderMarker {
753    type Proxy = WakeGroupProviderProxy;
754    type RequestStream = WakeGroupProviderRequestStream;
755    #[cfg(target_os = "fuchsia")]
756    type SynchronousProxy = WakeGroupProviderSynchronousProxy;
757
758    const DEBUG_NAME: &'static str = "fuchsia.net.power.WakeGroupProvider";
759}
760impl fidl::endpoints::DiscoverableProtocolMarker for WakeGroupProviderMarker {}
761
762pub trait WakeGroupProviderProxyInterface: Send + Sync {
763    type CreateWakeGroupResponseFut: std::future::Future<Output = Result<CreateWakeGroupResponse, fidl::Error>>
764        + Send;
765    fn r#create_wake_group(
766        &self,
767        options: &WakeGroupOptions,
768        request: fidl::endpoints::ServerEnd<WakeGroupMarker>,
769    ) -> Self::CreateWakeGroupResponseFut;
770}
771#[derive(Debug)]
772#[cfg(target_os = "fuchsia")]
773pub struct WakeGroupProviderSynchronousProxy {
774    client: fidl::client::sync::Client,
775}
776
777#[cfg(target_os = "fuchsia")]
778impl fidl::endpoints::SynchronousProxy for WakeGroupProviderSynchronousProxy {
779    type Proxy = WakeGroupProviderProxy;
780    type Protocol = WakeGroupProviderMarker;
781
782    fn from_channel(inner: fidl::Channel) -> Self {
783        Self::new(inner)
784    }
785
786    fn into_channel(self) -> fidl::Channel {
787        self.client.into_channel()
788    }
789
790    fn as_channel(&self) -> &fidl::Channel {
791        self.client.as_channel()
792    }
793}
794
795#[cfg(target_os = "fuchsia")]
796impl WakeGroupProviderSynchronousProxy {
797    pub fn new(channel: fidl::Channel) -> Self {
798        let protocol_name =
799            <WakeGroupProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
800        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
801    }
802
803    pub fn into_channel(self) -> fidl::Channel {
804        self.client.into_channel()
805    }
806
807    /// Waits until an event arrives and returns it. It is safe for other
808    /// threads to make concurrent requests while waiting for an event.
809    pub fn wait_for_event(
810        &self,
811        deadline: zx::MonotonicInstant,
812    ) -> Result<WakeGroupProviderEvent, fidl::Error> {
813        WakeGroupProviderEvent::decode(self.client.wait_for_event(deadline)?)
814    }
815
816    /// Creates a new wake group with the provided options.
817    pub fn r#create_wake_group(
818        &self,
819        mut options: &WakeGroupOptions,
820        mut request: fidl::endpoints::ServerEnd<WakeGroupMarker>,
821        ___deadline: zx::MonotonicInstant,
822    ) -> Result<CreateWakeGroupResponse, fidl::Error> {
823        let _response = self.client.send_query::<CreateWakeGroupRequest, CreateWakeGroupResponse>(
824            (options, request),
825            0x3c6a15f6c6b1447f,
826            fidl::encoding::DynamicFlags::empty(),
827            ___deadline,
828        )?;
829        Ok(_response)
830    }
831}
832
833#[cfg(target_os = "fuchsia")]
834impl From<WakeGroupProviderSynchronousProxy> for zx::Handle {
835    fn from(value: WakeGroupProviderSynchronousProxy) -> Self {
836        value.into_channel().into()
837    }
838}
839
840#[cfg(target_os = "fuchsia")]
841impl From<fidl::Channel> for WakeGroupProviderSynchronousProxy {
842    fn from(value: fidl::Channel) -> Self {
843        Self::new(value)
844    }
845}
846
847#[cfg(target_os = "fuchsia")]
848impl fidl::endpoints::FromClient for WakeGroupProviderSynchronousProxy {
849    type Protocol = WakeGroupProviderMarker;
850
851    fn from_client(value: fidl::endpoints::ClientEnd<WakeGroupProviderMarker>) -> Self {
852        Self::new(value.into_channel())
853    }
854}
855
856#[derive(Debug, Clone)]
857pub struct WakeGroupProviderProxy {
858    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
859}
860
861impl fidl::endpoints::Proxy for WakeGroupProviderProxy {
862    type Protocol = WakeGroupProviderMarker;
863
864    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
865        Self::new(inner)
866    }
867
868    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
869        self.client.into_channel().map_err(|client| Self { client })
870    }
871
872    fn as_channel(&self) -> &::fidl::AsyncChannel {
873        self.client.as_channel()
874    }
875}
876
877impl WakeGroupProviderProxy {
878    /// Create a new Proxy for fuchsia.net.power/WakeGroupProvider.
879    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
880        let protocol_name =
881            <WakeGroupProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
882        Self { client: fidl::client::Client::new(channel, protocol_name) }
883    }
884
885    /// Get a Stream of events from the remote end of the protocol.
886    ///
887    /// # Panics
888    ///
889    /// Panics if the event stream was already taken.
890    pub fn take_event_stream(&self) -> WakeGroupProviderEventStream {
891        WakeGroupProviderEventStream { event_receiver: self.client.take_event_receiver() }
892    }
893
894    /// Creates a new wake group with the provided options.
895    pub fn r#create_wake_group(
896        &self,
897        mut options: &WakeGroupOptions,
898        mut request: fidl::endpoints::ServerEnd<WakeGroupMarker>,
899    ) -> fidl::client::QueryResponseFut<
900        CreateWakeGroupResponse,
901        fidl::encoding::DefaultFuchsiaResourceDialect,
902    > {
903        WakeGroupProviderProxyInterface::r#create_wake_group(self, options, request)
904    }
905}
906
907impl WakeGroupProviderProxyInterface for WakeGroupProviderProxy {
908    type CreateWakeGroupResponseFut = fidl::client::QueryResponseFut<
909        CreateWakeGroupResponse,
910        fidl::encoding::DefaultFuchsiaResourceDialect,
911    >;
912    fn r#create_wake_group(
913        &self,
914        mut options: &WakeGroupOptions,
915        mut request: fidl::endpoints::ServerEnd<WakeGroupMarker>,
916    ) -> Self::CreateWakeGroupResponseFut {
917        fn _decode(
918            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
919        ) -> Result<CreateWakeGroupResponse, fidl::Error> {
920            let _response = fidl::client::decode_transaction_body::<
921                CreateWakeGroupResponse,
922                fidl::encoding::DefaultFuchsiaResourceDialect,
923                0x3c6a15f6c6b1447f,
924            >(_buf?)?;
925            Ok(_response)
926        }
927        self.client.send_query_and_decode::<CreateWakeGroupRequest, CreateWakeGroupResponse>(
928            (options, request),
929            0x3c6a15f6c6b1447f,
930            fidl::encoding::DynamicFlags::empty(),
931            _decode,
932        )
933    }
934}
935
936pub struct WakeGroupProviderEventStream {
937    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
938}
939
940impl std::marker::Unpin for WakeGroupProviderEventStream {}
941
942impl futures::stream::FusedStream for WakeGroupProviderEventStream {
943    fn is_terminated(&self) -> bool {
944        self.event_receiver.is_terminated()
945    }
946}
947
948impl futures::Stream for WakeGroupProviderEventStream {
949    type Item = Result<WakeGroupProviderEvent, fidl::Error>;
950
951    fn poll_next(
952        mut self: std::pin::Pin<&mut Self>,
953        cx: &mut std::task::Context<'_>,
954    ) -> std::task::Poll<Option<Self::Item>> {
955        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
956            &mut self.event_receiver,
957            cx
958        )?) {
959            Some(buf) => std::task::Poll::Ready(Some(WakeGroupProviderEvent::decode(buf))),
960            None => std::task::Poll::Ready(None),
961        }
962    }
963}
964
965#[derive(Debug)]
966pub enum WakeGroupProviderEvent {}
967
968impl WakeGroupProviderEvent {
969    /// Decodes a message buffer as a [`WakeGroupProviderEvent`].
970    fn decode(
971        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
972    ) -> Result<WakeGroupProviderEvent, fidl::Error> {
973        let (bytes, _handles) = buf.split_mut();
974        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
975        debug_assert_eq!(tx_header.tx_id, 0);
976        match tx_header.ordinal {
977            _ => Err(fidl::Error::UnknownOrdinal {
978                ordinal: tx_header.ordinal,
979                protocol_name:
980                    <WakeGroupProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
981            }),
982        }
983    }
984}
985
986/// A Stream of incoming requests for fuchsia.net.power/WakeGroupProvider.
987pub struct WakeGroupProviderRequestStream {
988    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
989    is_terminated: bool,
990}
991
992impl std::marker::Unpin for WakeGroupProviderRequestStream {}
993
994impl futures::stream::FusedStream for WakeGroupProviderRequestStream {
995    fn is_terminated(&self) -> bool {
996        self.is_terminated
997    }
998}
999
1000impl fidl::endpoints::RequestStream for WakeGroupProviderRequestStream {
1001    type Protocol = WakeGroupProviderMarker;
1002    type ControlHandle = WakeGroupProviderControlHandle;
1003
1004    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1005        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1006    }
1007
1008    fn control_handle(&self) -> Self::ControlHandle {
1009        WakeGroupProviderControlHandle { inner: self.inner.clone() }
1010    }
1011
1012    fn into_inner(
1013        self,
1014    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1015    {
1016        (self.inner, self.is_terminated)
1017    }
1018
1019    fn from_inner(
1020        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1021        is_terminated: bool,
1022    ) -> Self {
1023        Self { inner, is_terminated }
1024    }
1025}
1026
1027impl futures::Stream for WakeGroupProviderRequestStream {
1028    type Item = Result<WakeGroupProviderRequest, fidl::Error>;
1029
1030    fn poll_next(
1031        mut self: std::pin::Pin<&mut Self>,
1032        cx: &mut std::task::Context<'_>,
1033    ) -> std::task::Poll<Option<Self::Item>> {
1034        let this = &mut *self;
1035        if this.inner.check_shutdown(cx) {
1036            this.is_terminated = true;
1037            return std::task::Poll::Ready(None);
1038        }
1039        if this.is_terminated {
1040            panic!("polled WakeGroupProviderRequestStream after completion");
1041        }
1042        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1043            |bytes, handles| {
1044                match this.inner.channel().read_etc(cx, bytes, handles) {
1045                    std::task::Poll::Ready(Ok(())) => {}
1046                    std::task::Poll::Pending => return std::task::Poll::Pending,
1047                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1048                        this.is_terminated = true;
1049                        return std::task::Poll::Ready(None);
1050                    }
1051                    std::task::Poll::Ready(Err(e)) => {
1052                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1053                            e.into(),
1054                        ))));
1055                    }
1056                }
1057
1058                // A message has been received from the channel
1059                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1060
1061                std::task::Poll::Ready(Some(match header.ordinal {
1062                    0x3c6a15f6c6b1447f => {
1063                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1064                        let mut req = fidl::new_empty!(
1065                            CreateWakeGroupRequest,
1066                            fidl::encoding::DefaultFuchsiaResourceDialect
1067                        );
1068                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CreateWakeGroupRequest>(&header, _body_bytes, handles, &mut req)?;
1069                        let control_handle =
1070                            WakeGroupProviderControlHandle { inner: this.inner.clone() };
1071                        Ok(WakeGroupProviderRequest::CreateWakeGroup {
1072                            options: req.options,
1073                            request: req.request,
1074
1075                            responder: WakeGroupProviderCreateWakeGroupResponder {
1076                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1077                                tx_id: header.tx_id,
1078                            },
1079                        })
1080                    }
1081                    _ => Err(fidl::Error::UnknownOrdinal {
1082                        ordinal: header.ordinal,
1083                        protocol_name:
1084                            <WakeGroupProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1085                    }),
1086                }))
1087            },
1088        )
1089    }
1090}
1091
1092/// A provider of `WakeGroup`s.
1093#[derive(Debug)]
1094pub enum WakeGroupProviderRequest {
1095    /// Creates a new wake group with the provided options.
1096    CreateWakeGroup {
1097        options: WakeGroupOptions,
1098        request: fidl::endpoints::ServerEnd<WakeGroupMarker>,
1099        responder: WakeGroupProviderCreateWakeGroupResponder,
1100    },
1101}
1102
1103impl WakeGroupProviderRequest {
1104    #[allow(irrefutable_let_patterns)]
1105    pub fn into_create_wake_group(
1106        self,
1107    ) -> Option<(
1108        WakeGroupOptions,
1109        fidl::endpoints::ServerEnd<WakeGroupMarker>,
1110        WakeGroupProviderCreateWakeGroupResponder,
1111    )> {
1112        if let WakeGroupProviderRequest::CreateWakeGroup { options, request, responder } = self {
1113            Some((options, request, responder))
1114        } else {
1115            None
1116        }
1117    }
1118
1119    /// Name of the method defined in FIDL
1120    pub fn method_name(&self) -> &'static str {
1121        match *self {
1122            WakeGroupProviderRequest::CreateWakeGroup { .. } => "create_wake_group",
1123        }
1124    }
1125}
1126
1127#[derive(Debug, Clone)]
1128pub struct WakeGroupProviderControlHandle {
1129    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1130}
1131
1132impl fidl::endpoints::ControlHandle for WakeGroupProviderControlHandle {
1133    fn shutdown(&self) {
1134        self.inner.shutdown()
1135    }
1136    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1137        self.inner.shutdown_with_epitaph(status)
1138    }
1139
1140    fn is_closed(&self) -> bool {
1141        self.inner.channel().is_closed()
1142    }
1143    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1144        self.inner.channel().on_closed()
1145    }
1146
1147    #[cfg(target_os = "fuchsia")]
1148    fn signal_peer(
1149        &self,
1150        clear_mask: zx::Signals,
1151        set_mask: zx::Signals,
1152    ) -> Result<(), zx_status::Status> {
1153        use fidl::Peered;
1154        self.inner.channel().signal_peer(clear_mask, set_mask)
1155    }
1156}
1157
1158impl WakeGroupProviderControlHandle {}
1159
1160#[must_use = "FIDL methods require a response to be sent"]
1161#[derive(Debug)]
1162pub struct WakeGroupProviderCreateWakeGroupResponder {
1163    control_handle: std::mem::ManuallyDrop<WakeGroupProviderControlHandle>,
1164    tx_id: u32,
1165}
1166
1167/// Set the the channel to be shutdown (see [`WakeGroupProviderControlHandle::shutdown`])
1168/// if the responder is dropped without sending a response, so that the client
1169/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1170impl std::ops::Drop for WakeGroupProviderCreateWakeGroupResponder {
1171    fn drop(&mut self) {
1172        self.control_handle.shutdown();
1173        // Safety: drops once, never accessed again
1174        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1175    }
1176}
1177
1178impl fidl::endpoints::Responder for WakeGroupProviderCreateWakeGroupResponder {
1179    type ControlHandle = WakeGroupProviderControlHandle;
1180
1181    fn control_handle(&self) -> &WakeGroupProviderControlHandle {
1182        &self.control_handle
1183    }
1184
1185    fn drop_without_shutdown(mut self) {
1186        // Safety: drops once, never accessed again due to mem::forget
1187        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1188        // Prevent Drop from running (which would shut down the channel)
1189        std::mem::forget(self);
1190    }
1191}
1192
1193impl WakeGroupProviderCreateWakeGroupResponder {
1194    /// Sends a response to the FIDL transaction.
1195    ///
1196    /// Sets the channel to shutdown if an error occurs.
1197    pub fn send(self, mut payload: CreateWakeGroupResponse) -> Result<(), fidl::Error> {
1198        let _result = self.send_raw(payload);
1199        if _result.is_err() {
1200            self.control_handle.shutdown();
1201        }
1202        self.drop_without_shutdown();
1203        _result
1204    }
1205
1206    /// Similar to "send" but does not shutdown the channel if an error occurs.
1207    pub fn send_no_shutdown_on_err(
1208        self,
1209        mut payload: CreateWakeGroupResponse,
1210    ) -> Result<(), fidl::Error> {
1211        let _result = self.send_raw(payload);
1212        self.drop_without_shutdown();
1213        _result
1214    }
1215
1216    fn send_raw(&self, mut payload: CreateWakeGroupResponse) -> Result<(), fidl::Error> {
1217        self.control_handle.inner.send::<CreateWakeGroupResponse>(
1218            &mut payload,
1219            self.tx_id,
1220            0x3c6a15f6c6b1447f,
1221            fidl::encoding::DynamicFlags::empty(),
1222        )
1223    }
1224}
1225
1226mod internal {
1227    use super::*;
1228
1229    impl fidl::encoding::ResourceTypeMarker for CreateWakeGroupRequest {
1230        type Borrowed<'a> = &'a mut Self;
1231        fn take_or_borrow<'a>(
1232            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1233        ) -> Self::Borrowed<'a> {
1234            value
1235        }
1236    }
1237
1238    unsafe impl fidl::encoding::TypeMarker for CreateWakeGroupRequest {
1239        type Owned = Self;
1240
1241        #[inline(always)]
1242        fn inline_align(_context: fidl::encoding::Context) -> usize {
1243            8
1244        }
1245
1246        #[inline(always)]
1247        fn inline_size(_context: fidl::encoding::Context) -> usize {
1248            24
1249        }
1250    }
1251
1252    unsafe impl
1253        fidl::encoding::Encode<
1254            CreateWakeGroupRequest,
1255            fidl::encoding::DefaultFuchsiaResourceDialect,
1256        > for &mut CreateWakeGroupRequest
1257    {
1258        #[inline]
1259        unsafe fn encode(
1260            self,
1261            encoder: &mut fidl::encoding::Encoder<
1262                '_,
1263                fidl::encoding::DefaultFuchsiaResourceDialect,
1264            >,
1265            offset: usize,
1266            _depth: fidl::encoding::Depth,
1267        ) -> fidl::Result<()> {
1268            encoder.debug_check_bounds::<CreateWakeGroupRequest>(offset);
1269            // Delegate to tuple encoding.
1270            fidl::encoding::Encode::<CreateWakeGroupRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
1271                (
1272                    <WakeGroupOptions as fidl::encoding::ValueTypeMarker>::borrow(&self.options),
1273                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<WakeGroupMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.request),
1274                ),
1275                encoder, offset, _depth
1276            )
1277        }
1278    }
1279    unsafe impl<
1280        T0: fidl::encoding::Encode<WakeGroupOptions, fidl::encoding::DefaultFuchsiaResourceDialect>,
1281        T1: fidl::encoding::Encode<
1282                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<WakeGroupMarker>>,
1283                fidl::encoding::DefaultFuchsiaResourceDialect,
1284            >,
1285    >
1286        fidl::encoding::Encode<
1287            CreateWakeGroupRequest,
1288            fidl::encoding::DefaultFuchsiaResourceDialect,
1289        > for (T0, T1)
1290    {
1291        #[inline]
1292        unsafe fn encode(
1293            self,
1294            encoder: &mut fidl::encoding::Encoder<
1295                '_,
1296                fidl::encoding::DefaultFuchsiaResourceDialect,
1297            >,
1298            offset: usize,
1299            depth: fidl::encoding::Depth,
1300        ) -> fidl::Result<()> {
1301            encoder.debug_check_bounds::<CreateWakeGroupRequest>(offset);
1302            // Zero out padding regions. There's no need to apply masks
1303            // because the unmasked parts will be overwritten by fields.
1304            unsafe {
1305                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
1306                (ptr as *mut u64).write_unaligned(0);
1307            }
1308            // Write the fields.
1309            self.0.encode(encoder, offset + 0, depth)?;
1310            self.1.encode(encoder, offset + 16, depth)?;
1311            Ok(())
1312        }
1313    }
1314
1315    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1316        for CreateWakeGroupRequest
1317    {
1318        #[inline(always)]
1319        fn new_empty() -> Self {
1320            Self {
1321                options: fidl::new_empty!(
1322                    WakeGroupOptions,
1323                    fidl::encoding::DefaultFuchsiaResourceDialect
1324                ),
1325                request: fidl::new_empty!(
1326                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<WakeGroupMarker>>,
1327                    fidl::encoding::DefaultFuchsiaResourceDialect
1328                ),
1329            }
1330        }
1331
1332        #[inline]
1333        unsafe fn decode(
1334            &mut self,
1335            decoder: &mut fidl::encoding::Decoder<
1336                '_,
1337                fidl::encoding::DefaultFuchsiaResourceDialect,
1338            >,
1339            offset: usize,
1340            _depth: fidl::encoding::Depth,
1341        ) -> fidl::Result<()> {
1342            decoder.debug_check_bounds::<Self>(offset);
1343            // Verify that padding bytes are zero.
1344            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
1345            let padval = unsafe { (ptr as *const u64).read_unaligned() };
1346            let mask = 0xffffffff00000000u64;
1347            let maskedval = padval & mask;
1348            if maskedval != 0 {
1349                return Err(fidl::Error::NonZeroPadding {
1350                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
1351                });
1352            }
1353            fidl::decode!(
1354                WakeGroupOptions,
1355                fidl::encoding::DefaultFuchsiaResourceDialect,
1356                &mut self.options,
1357                decoder,
1358                offset + 0,
1359                _depth
1360            )?;
1361            fidl::decode!(
1362                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<WakeGroupMarker>>,
1363                fidl::encoding::DefaultFuchsiaResourceDialect,
1364                &mut self.request,
1365                decoder,
1366                offset + 16,
1367                _depth
1368            )?;
1369            Ok(())
1370        }
1371    }
1372
1373    impl CreateWakeGroupResponse {
1374        #[inline(always)]
1375        fn max_ordinal_present(&self) -> u64 {
1376            if let Some(_) = self.token {
1377                return 1;
1378            }
1379            0
1380        }
1381    }
1382
1383    impl fidl::encoding::ResourceTypeMarker for CreateWakeGroupResponse {
1384        type Borrowed<'a> = &'a mut Self;
1385        fn take_or_borrow<'a>(
1386            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1387        ) -> Self::Borrowed<'a> {
1388            value
1389        }
1390    }
1391
1392    unsafe impl fidl::encoding::TypeMarker for CreateWakeGroupResponse {
1393        type Owned = Self;
1394
1395        #[inline(always)]
1396        fn inline_align(_context: fidl::encoding::Context) -> usize {
1397            8
1398        }
1399
1400        #[inline(always)]
1401        fn inline_size(_context: fidl::encoding::Context) -> usize {
1402            16
1403        }
1404    }
1405
1406    unsafe impl
1407        fidl::encoding::Encode<
1408            CreateWakeGroupResponse,
1409            fidl::encoding::DefaultFuchsiaResourceDialect,
1410        > for &mut CreateWakeGroupResponse
1411    {
1412        unsafe fn encode(
1413            self,
1414            encoder: &mut fidl::encoding::Encoder<
1415                '_,
1416                fidl::encoding::DefaultFuchsiaResourceDialect,
1417            >,
1418            offset: usize,
1419            mut depth: fidl::encoding::Depth,
1420        ) -> fidl::Result<()> {
1421            encoder.debug_check_bounds::<CreateWakeGroupResponse>(offset);
1422            // Vector header
1423            let max_ordinal: u64 = self.max_ordinal_present();
1424            encoder.write_num(max_ordinal, offset);
1425            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1426            // Calling encoder.out_of_line_offset(0) is not allowed.
1427            if max_ordinal == 0 {
1428                return Ok(());
1429            }
1430            depth.increment()?;
1431            let envelope_size = 8;
1432            let bytes_len = max_ordinal as usize * envelope_size;
1433            #[allow(unused_variables)]
1434            let offset = encoder.out_of_line_offset(bytes_len);
1435            let mut _prev_end_offset: usize = 0;
1436            if 1 > max_ordinal {
1437                return Ok(());
1438            }
1439
1440            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1441            // are envelope_size bytes.
1442            let cur_offset: usize = (1 - 1) * envelope_size;
1443
1444            // Zero reserved fields.
1445            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1446
1447            // Safety:
1448            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1449            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1450            //   envelope_size bytes, there is always sufficient room.
1451            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_net_resources::WakeGroupToken, fidl::encoding::DefaultFuchsiaResourceDialect>(
1452            self.token.as_mut().map(<fidl_fuchsia_net_resources::WakeGroupToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
1453            encoder, offset + cur_offset, depth
1454        )?;
1455
1456            _prev_end_offset = cur_offset + envelope_size;
1457
1458            Ok(())
1459        }
1460    }
1461
1462    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1463        for CreateWakeGroupResponse
1464    {
1465        #[inline(always)]
1466        fn new_empty() -> Self {
1467            Self::default()
1468        }
1469
1470        unsafe fn decode(
1471            &mut self,
1472            decoder: &mut fidl::encoding::Decoder<
1473                '_,
1474                fidl::encoding::DefaultFuchsiaResourceDialect,
1475            >,
1476            offset: usize,
1477            mut depth: fidl::encoding::Depth,
1478        ) -> fidl::Result<()> {
1479            decoder.debug_check_bounds::<Self>(offset);
1480            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1481                None => return Err(fidl::Error::NotNullable),
1482                Some(len) => len,
1483            };
1484            // Calling decoder.out_of_line_offset(0) is not allowed.
1485            if len == 0 {
1486                return Ok(());
1487            };
1488            depth.increment()?;
1489            let envelope_size = 8;
1490            let bytes_len = len * envelope_size;
1491            let offset = decoder.out_of_line_offset(bytes_len)?;
1492            // Decode the envelope for each type.
1493            let mut _next_ordinal_to_read = 0;
1494            let mut next_offset = offset;
1495            let end_offset = offset + bytes_len;
1496            _next_ordinal_to_read += 1;
1497            if next_offset >= end_offset {
1498                return Ok(());
1499            }
1500
1501            // Decode unknown envelopes for gaps in ordinals.
1502            while _next_ordinal_to_read < 1 {
1503                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1504                _next_ordinal_to_read += 1;
1505                next_offset += envelope_size;
1506            }
1507
1508            let next_out_of_line = decoder.next_out_of_line();
1509            let handles_before = decoder.remaining_handles();
1510            if let Some((inlined, num_bytes, num_handles)) =
1511                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1512            {
1513                let member_inline_size = <fidl_fuchsia_net_resources::WakeGroupToken as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1514                if inlined != (member_inline_size <= 4) {
1515                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1516                }
1517                let inner_offset;
1518                let mut inner_depth = depth.clone();
1519                if inlined {
1520                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1521                    inner_offset = next_offset;
1522                } else {
1523                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1524                    inner_depth.increment()?;
1525                }
1526                let val_ref = self.token.get_or_insert_with(|| {
1527                    fidl::new_empty!(
1528                        fidl_fuchsia_net_resources::WakeGroupToken,
1529                        fidl::encoding::DefaultFuchsiaResourceDialect
1530                    )
1531                });
1532                fidl::decode!(
1533                    fidl_fuchsia_net_resources::WakeGroupToken,
1534                    fidl::encoding::DefaultFuchsiaResourceDialect,
1535                    val_ref,
1536                    decoder,
1537                    inner_offset,
1538                    inner_depth
1539                )?;
1540                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1541                {
1542                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1543                }
1544                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1545                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1546                }
1547            }
1548
1549            next_offset += envelope_size;
1550
1551            // Decode the remaining unknown envelopes.
1552            while next_offset < end_offset {
1553                _next_ordinal_to_read += 1;
1554                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1555                next_offset += envelope_size;
1556            }
1557
1558            Ok(())
1559        }
1560    }
1561
1562    impl WakeGroupWaitForDataResponse {
1563        #[inline(always)]
1564        fn max_ordinal_present(&self) -> u64 {
1565            if let Some(_) = self.source {
1566                return 1;
1567            }
1568            0
1569        }
1570    }
1571
1572    impl fidl::encoding::ResourceTypeMarker for WakeGroupWaitForDataResponse {
1573        type Borrowed<'a> = &'a mut Self;
1574        fn take_or_borrow<'a>(
1575            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1576        ) -> Self::Borrowed<'a> {
1577            value
1578        }
1579    }
1580
1581    unsafe impl fidl::encoding::TypeMarker for WakeGroupWaitForDataResponse {
1582        type Owned = Self;
1583
1584        #[inline(always)]
1585        fn inline_align(_context: fidl::encoding::Context) -> usize {
1586            8
1587        }
1588
1589        #[inline(always)]
1590        fn inline_size(_context: fidl::encoding::Context) -> usize {
1591            16
1592        }
1593    }
1594
1595    unsafe impl
1596        fidl::encoding::Encode<
1597            WakeGroupWaitForDataResponse,
1598            fidl::encoding::DefaultFuchsiaResourceDialect,
1599        > for &mut WakeGroupWaitForDataResponse
1600    {
1601        unsafe fn encode(
1602            self,
1603            encoder: &mut fidl::encoding::Encoder<
1604                '_,
1605                fidl::encoding::DefaultFuchsiaResourceDialect,
1606            >,
1607            offset: usize,
1608            mut depth: fidl::encoding::Depth,
1609        ) -> fidl::Result<()> {
1610            encoder.debug_check_bounds::<WakeGroupWaitForDataResponse>(offset);
1611            // Vector header
1612            let max_ordinal: u64 = self.max_ordinal_present();
1613            encoder.write_num(max_ordinal, offset);
1614            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1615            // Calling encoder.out_of_line_offset(0) is not allowed.
1616            if max_ordinal == 0 {
1617                return Ok(());
1618            }
1619            depth.increment()?;
1620            let envelope_size = 8;
1621            let bytes_len = max_ordinal as usize * envelope_size;
1622            #[allow(unused_variables)]
1623            let offset = encoder.out_of_line_offset(bytes_len);
1624            let mut _prev_end_offset: usize = 0;
1625            if 1 > max_ordinal {
1626                return Ok(());
1627            }
1628
1629            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1630            // are envelope_size bytes.
1631            let cur_offset: usize = (1 - 1) * envelope_size;
1632
1633            // Zero reserved fields.
1634            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1635
1636            // Safety:
1637            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1638            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1639            //   envelope_size bytes, there is always sufficient room.
1640            fidl::encoding::encode_in_envelope_optional::<
1641                WakeSource,
1642                fidl::encoding::DefaultFuchsiaResourceDialect,
1643            >(
1644                self.source
1645                    .as_mut()
1646                    .map(<WakeSource as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
1647                encoder,
1648                offset + cur_offset,
1649                depth,
1650            )?;
1651
1652            _prev_end_offset = cur_offset + envelope_size;
1653
1654            Ok(())
1655        }
1656    }
1657
1658    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1659        for WakeGroupWaitForDataResponse
1660    {
1661        #[inline(always)]
1662        fn new_empty() -> Self {
1663            Self::default()
1664        }
1665
1666        unsafe fn decode(
1667            &mut self,
1668            decoder: &mut fidl::encoding::Decoder<
1669                '_,
1670                fidl::encoding::DefaultFuchsiaResourceDialect,
1671            >,
1672            offset: usize,
1673            mut depth: fidl::encoding::Depth,
1674        ) -> fidl::Result<()> {
1675            decoder.debug_check_bounds::<Self>(offset);
1676            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1677                None => return Err(fidl::Error::NotNullable),
1678                Some(len) => len,
1679            };
1680            // Calling decoder.out_of_line_offset(0) is not allowed.
1681            if len == 0 {
1682                return Ok(());
1683            };
1684            depth.increment()?;
1685            let envelope_size = 8;
1686            let bytes_len = len * envelope_size;
1687            let offset = decoder.out_of_line_offset(bytes_len)?;
1688            // Decode the envelope for each type.
1689            let mut _next_ordinal_to_read = 0;
1690            let mut next_offset = offset;
1691            let end_offset = offset + bytes_len;
1692            _next_ordinal_to_read += 1;
1693            if next_offset >= end_offset {
1694                return Ok(());
1695            }
1696
1697            // Decode unknown envelopes for gaps in ordinals.
1698            while _next_ordinal_to_read < 1 {
1699                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1700                _next_ordinal_to_read += 1;
1701                next_offset += envelope_size;
1702            }
1703
1704            let next_out_of_line = decoder.next_out_of_line();
1705            let handles_before = decoder.remaining_handles();
1706            if let Some((inlined, num_bytes, num_handles)) =
1707                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1708            {
1709                let member_inline_size =
1710                    <WakeSource as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1711                if inlined != (member_inline_size <= 4) {
1712                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1713                }
1714                let inner_offset;
1715                let mut inner_depth = depth.clone();
1716                if inlined {
1717                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1718                    inner_offset = next_offset;
1719                } else {
1720                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1721                    inner_depth.increment()?;
1722                }
1723                let val_ref = self.source.get_or_insert_with(|| {
1724                    fidl::new_empty!(WakeSource, fidl::encoding::DefaultFuchsiaResourceDialect)
1725                });
1726                fidl::decode!(
1727                    WakeSource,
1728                    fidl::encoding::DefaultFuchsiaResourceDialect,
1729                    val_ref,
1730                    decoder,
1731                    inner_offset,
1732                    inner_depth
1733                )?;
1734                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1735                {
1736                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1737                }
1738                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1739                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1740                }
1741            }
1742
1743            next_offset += envelope_size;
1744
1745            // Decode the remaining unknown envelopes.
1746            while next_offset < end_offset {
1747                _next_ordinal_to_read += 1;
1748                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1749                next_offset += envelope_size;
1750            }
1751
1752            Ok(())
1753        }
1754    }
1755
1756    impl fidl::encoding::ResourceTypeMarker for WakeSource {
1757        type Borrowed<'a> = &'a mut Self;
1758        fn take_or_borrow<'a>(
1759            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1760        ) -> Self::Borrowed<'a> {
1761            value
1762        }
1763    }
1764
1765    unsafe impl fidl::encoding::TypeMarker for WakeSource {
1766        type Owned = Self;
1767
1768        #[inline(always)]
1769        fn inline_align(_context: fidl::encoding::Context) -> usize {
1770            8
1771        }
1772
1773        #[inline(always)]
1774        fn inline_size(_context: fidl::encoding::Context) -> usize {
1775            16
1776        }
1777    }
1778
1779    unsafe impl fidl::encoding::Encode<WakeSource, fidl::encoding::DefaultFuchsiaResourceDialect>
1780        for &mut WakeSource
1781    {
1782        #[inline]
1783        unsafe fn encode(
1784            self,
1785            encoder: &mut fidl::encoding::Encoder<
1786                '_,
1787                fidl::encoding::DefaultFuchsiaResourceDialect,
1788            >,
1789            offset: usize,
1790            _depth: fidl::encoding::Depth,
1791        ) -> fidl::Result<()> {
1792            encoder.debug_check_bounds::<WakeSource>(offset);
1793            encoder.write_num::<u64>(self.ordinal(), offset);
1794            match self {
1795                WakeSource::Data(ref val) => fidl::encoding::encode_in_envelope::<
1796                    Empty,
1797                    fidl::encoding::DefaultFuchsiaResourceDialect,
1798                >(
1799                    <Empty as fidl::encoding::ValueTypeMarker>::borrow(val),
1800                    encoder,
1801                    offset + 8,
1802                    _depth,
1803                ),
1804                WakeSource::Lease(ref mut val) => fidl::encoding::encode_in_envelope::<
1805                    fidl::encoding::HandleType<
1806                        fidl::EventPair,
1807                        { fidl::ObjectType::EVENTPAIR.into_raw() },
1808                        16387,
1809                    >,
1810                    fidl::encoding::DefaultFuchsiaResourceDialect,
1811                >(
1812                    <fidl::encoding::HandleType<
1813                        fidl::EventPair,
1814                        { fidl::ObjectType::EVENTPAIR.into_raw() },
1815                        16387,
1816                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1817                        val
1818                    ),
1819                    encoder,
1820                    offset + 8,
1821                    _depth,
1822                ),
1823                WakeSource::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
1824            }
1825        }
1826    }
1827
1828    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for WakeSource {
1829        #[inline(always)]
1830        fn new_empty() -> Self {
1831            Self::__SourceBreaking { unknown_ordinal: 0 }
1832        }
1833
1834        #[inline]
1835        unsafe fn decode(
1836            &mut self,
1837            decoder: &mut fidl::encoding::Decoder<
1838                '_,
1839                fidl::encoding::DefaultFuchsiaResourceDialect,
1840            >,
1841            offset: usize,
1842            mut depth: fidl::encoding::Depth,
1843        ) -> fidl::Result<()> {
1844            decoder.debug_check_bounds::<Self>(offset);
1845            #[allow(unused_variables)]
1846            let next_out_of_line = decoder.next_out_of_line();
1847            let handles_before = decoder.remaining_handles();
1848            let (ordinal, inlined, num_bytes, num_handles) =
1849                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
1850
1851            let member_inline_size = match ordinal {
1852                1 => <Empty as fidl::encoding::TypeMarker>::inline_size(decoder.context),
1853                2 => <fidl::encoding::HandleType<
1854                    fidl::EventPair,
1855                    { fidl::ObjectType::EVENTPAIR.into_raw() },
1856                    16387,
1857                > as fidl::encoding::TypeMarker>::inline_size(decoder.context),
1858                0 => return Err(fidl::Error::UnknownUnionTag),
1859                _ => num_bytes as usize,
1860            };
1861
1862            if inlined != (member_inline_size <= 4) {
1863                return Err(fidl::Error::InvalidInlineBitInEnvelope);
1864            }
1865            let _inner_offset;
1866            if inlined {
1867                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
1868                _inner_offset = offset + 8;
1869            } else {
1870                depth.increment()?;
1871                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1872            }
1873            match ordinal {
1874                1 => {
1875                    #[allow(irrefutable_let_patterns)]
1876                    if let WakeSource::Data(_) = self {
1877                        // Do nothing, read the value into the object
1878                    } else {
1879                        // Initialize `self` to the right variant
1880                        *self = WakeSource::Data(fidl::new_empty!(
1881                            Empty,
1882                            fidl::encoding::DefaultFuchsiaResourceDialect
1883                        ));
1884                    }
1885                    #[allow(irrefutable_let_patterns)]
1886                    if let WakeSource::Data(ref mut val) = self {
1887                        fidl::decode!(
1888                            Empty,
1889                            fidl::encoding::DefaultFuchsiaResourceDialect,
1890                            val,
1891                            decoder,
1892                            _inner_offset,
1893                            depth
1894                        )?;
1895                    } else {
1896                        unreachable!()
1897                    }
1898                }
1899                2 => {
1900                    #[allow(irrefutable_let_patterns)]
1901                    if let WakeSource::Lease(_) = self {
1902                        // Do nothing, read the value into the object
1903                    } else {
1904                        // Initialize `self` to the right variant
1905                        *self = WakeSource::Lease(
1906                            fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 16387>, fidl::encoding::DefaultFuchsiaResourceDialect),
1907                        );
1908                    }
1909                    #[allow(irrefutable_let_patterns)]
1910                    if let WakeSource::Lease(ref mut val) = self {
1911                        fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 16387>, fidl::encoding::DefaultFuchsiaResourceDialect, val, decoder, _inner_offset, depth)?;
1912                    } else {
1913                        unreachable!()
1914                    }
1915                }
1916                #[allow(deprecated)]
1917                ordinal => {
1918                    for _ in 0..num_handles {
1919                        decoder.drop_next_handle()?;
1920                    }
1921                    *self = WakeSource::__SourceBreaking { unknown_ordinal: ordinal };
1922                }
1923            }
1924            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
1925                return Err(fidl::Error::InvalidNumBytesInEnvelope);
1926            }
1927            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1928                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1929            }
1930            Ok(())
1931        }
1932    }
1933}