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