fidl_fuchsia_validate_logs/
fidl_fuchsia_validate_logs.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_validate_logs__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, PartialEq)]
15pub struct EncodingPuppetEncodeResponse {
16    pub result: fidl_fuchsia_mem::Buffer,
17}
18
19impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
20    for EncodingPuppetEncodeResponse
21{
22}
23
24#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
25pub struct EncodingValidatorValidateRequest {
26    pub results: fidl::endpoints::ServerEnd<ValidateResultsIteratorMarker>,
27}
28
29impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
30    for EncodingValidatorValidateRequest
31{
32}
33
34#[derive(Debug, Default, PartialEq)]
35pub struct ValidateResultsIteratorGetNextResponse {
36    pub result: Option<ValidateResult>,
37    #[doc(hidden)]
38    pub __source_breaking: fidl::marker::SourceBreaking,
39}
40
41impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
42    for ValidateResultsIteratorGetNextResponse
43{
44}
45
46#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
47pub struct EncodingPuppetMarker;
48
49impl fidl::endpoints::ProtocolMarker for EncodingPuppetMarker {
50    type Proxy = EncodingPuppetProxy;
51    type RequestStream = EncodingPuppetRequestStream;
52    #[cfg(target_os = "fuchsia")]
53    type SynchronousProxy = EncodingPuppetSynchronousProxy;
54
55    const DEBUG_NAME: &'static str = "fuchsia.validate.logs.EncodingPuppet";
56}
57impl fidl::endpoints::DiscoverableProtocolMarker for EncodingPuppetMarker {}
58pub type EncodingPuppetEncodeResult = Result<fidl_fuchsia_mem::Buffer, PuppetError>;
59
60pub trait EncodingPuppetProxyInterface: Send + Sync {
61    type EncodeResponseFut: std::future::Future<Output = Result<EncodingPuppetEncodeResult, fidl::Error>>
62        + Send;
63    fn r#encode(&self, record: &Record) -> Self::EncodeResponseFut;
64}
65#[derive(Debug)]
66#[cfg(target_os = "fuchsia")]
67pub struct EncodingPuppetSynchronousProxy {
68    client: fidl::client::sync::Client,
69}
70
71#[cfg(target_os = "fuchsia")]
72impl fidl::endpoints::SynchronousProxy for EncodingPuppetSynchronousProxy {
73    type Proxy = EncodingPuppetProxy;
74    type Protocol = EncodingPuppetMarker;
75
76    fn from_channel(inner: fidl::Channel) -> Self {
77        Self::new(inner)
78    }
79
80    fn into_channel(self) -> fidl::Channel {
81        self.client.into_channel()
82    }
83
84    fn as_channel(&self) -> &fidl::Channel {
85        self.client.as_channel()
86    }
87}
88
89#[cfg(target_os = "fuchsia")]
90impl EncodingPuppetSynchronousProxy {
91    pub fn new(channel: fidl::Channel) -> Self {
92        let protocol_name = <EncodingPuppetMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
93        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
94    }
95
96    pub fn into_channel(self) -> fidl::Channel {
97        self.client.into_channel()
98    }
99
100    /// Waits until an event arrives and returns it. It is safe for other
101    /// threads to make concurrent requests while waiting for an event.
102    pub fn wait_for_event(
103        &self,
104        deadline: zx::MonotonicInstant,
105    ) -> Result<EncodingPuppetEvent, fidl::Error> {
106        EncodingPuppetEvent::decode(self.client.wait_for_event(deadline)?)
107    }
108
109    /// Log takes a record and converts it into a buffer.
110    /// Returns an error if record contains unsupported type
111    pub fn r#encode(
112        &self,
113        mut record: &Record,
114        ___deadline: zx::MonotonicInstant,
115    ) -> Result<EncodingPuppetEncodeResult, fidl::Error> {
116        let _response = self.client.send_query::<
117            EncodingPuppetEncodeRequest,
118            fidl::encoding::ResultType<EncodingPuppetEncodeResponse, PuppetError>,
119        >(
120            (record,),
121            0x4486ab9d1bb462f8,
122            fidl::encoding::DynamicFlags::empty(),
123            ___deadline,
124        )?;
125        Ok(_response.map(|x| x.result))
126    }
127}
128
129#[cfg(target_os = "fuchsia")]
130impl From<EncodingPuppetSynchronousProxy> for zx::Handle {
131    fn from(value: EncodingPuppetSynchronousProxy) -> Self {
132        value.into_channel().into()
133    }
134}
135
136#[cfg(target_os = "fuchsia")]
137impl From<fidl::Channel> for EncodingPuppetSynchronousProxy {
138    fn from(value: fidl::Channel) -> Self {
139        Self::new(value)
140    }
141}
142
143#[cfg(target_os = "fuchsia")]
144impl fidl::endpoints::FromClient for EncodingPuppetSynchronousProxy {
145    type Protocol = EncodingPuppetMarker;
146
147    fn from_client(value: fidl::endpoints::ClientEnd<EncodingPuppetMarker>) -> Self {
148        Self::new(value.into_channel())
149    }
150}
151
152#[derive(Debug, Clone)]
153pub struct EncodingPuppetProxy {
154    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
155}
156
157impl fidl::endpoints::Proxy for EncodingPuppetProxy {
158    type Protocol = EncodingPuppetMarker;
159
160    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
161        Self::new(inner)
162    }
163
164    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
165        self.client.into_channel().map_err(|client| Self { client })
166    }
167
168    fn as_channel(&self) -> &::fidl::AsyncChannel {
169        self.client.as_channel()
170    }
171}
172
173impl EncodingPuppetProxy {
174    /// Create a new Proxy for fuchsia.validate.logs/EncodingPuppet.
175    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
176        let protocol_name = <EncodingPuppetMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
177        Self { client: fidl::client::Client::new(channel, protocol_name) }
178    }
179
180    /// Get a Stream of events from the remote end of the protocol.
181    ///
182    /// # Panics
183    ///
184    /// Panics if the event stream was already taken.
185    pub fn take_event_stream(&self) -> EncodingPuppetEventStream {
186        EncodingPuppetEventStream { event_receiver: self.client.take_event_receiver() }
187    }
188
189    /// Log takes a record and converts it into a buffer.
190    /// Returns an error if record contains unsupported type
191    pub fn r#encode(
192        &self,
193        mut record: &Record,
194    ) -> fidl::client::QueryResponseFut<
195        EncodingPuppetEncodeResult,
196        fidl::encoding::DefaultFuchsiaResourceDialect,
197    > {
198        EncodingPuppetProxyInterface::r#encode(self, record)
199    }
200}
201
202impl EncodingPuppetProxyInterface for EncodingPuppetProxy {
203    type EncodeResponseFut = fidl::client::QueryResponseFut<
204        EncodingPuppetEncodeResult,
205        fidl::encoding::DefaultFuchsiaResourceDialect,
206    >;
207    fn r#encode(&self, mut record: &Record) -> Self::EncodeResponseFut {
208        fn _decode(
209            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
210        ) -> Result<EncodingPuppetEncodeResult, fidl::Error> {
211            let _response = fidl::client::decode_transaction_body::<
212                fidl::encoding::ResultType<EncodingPuppetEncodeResponse, PuppetError>,
213                fidl::encoding::DefaultFuchsiaResourceDialect,
214                0x4486ab9d1bb462f8,
215            >(_buf?)?;
216            Ok(_response.map(|x| x.result))
217        }
218        self.client
219            .send_query_and_decode::<EncodingPuppetEncodeRequest, EncodingPuppetEncodeResult>(
220                (record,),
221                0x4486ab9d1bb462f8,
222                fidl::encoding::DynamicFlags::empty(),
223                _decode,
224            )
225    }
226}
227
228pub struct EncodingPuppetEventStream {
229    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
230}
231
232impl std::marker::Unpin for EncodingPuppetEventStream {}
233
234impl futures::stream::FusedStream for EncodingPuppetEventStream {
235    fn is_terminated(&self) -> bool {
236        self.event_receiver.is_terminated()
237    }
238}
239
240impl futures::Stream for EncodingPuppetEventStream {
241    type Item = Result<EncodingPuppetEvent, fidl::Error>;
242
243    fn poll_next(
244        mut self: std::pin::Pin<&mut Self>,
245        cx: &mut std::task::Context<'_>,
246    ) -> std::task::Poll<Option<Self::Item>> {
247        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
248            &mut self.event_receiver,
249            cx
250        )?) {
251            Some(buf) => std::task::Poll::Ready(Some(EncodingPuppetEvent::decode(buf))),
252            None => std::task::Poll::Ready(None),
253        }
254    }
255}
256
257#[derive(Debug)]
258pub enum EncodingPuppetEvent {}
259
260impl EncodingPuppetEvent {
261    /// Decodes a message buffer as a [`EncodingPuppetEvent`].
262    fn decode(
263        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
264    ) -> Result<EncodingPuppetEvent, fidl::Error> {
265        let (bytes, _handles) = buf.split_mut();
266        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
267        debug_assert_eq!(tx_header.tx_id, 0);
268        match tx_header.ordinal {
269            _ => Err(fidl::Error::UnknownOrdinal {
270                ordinal: tx_header.ordinal,
271                protocol_name:
272                    <EncodingPuppetMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
273            }),
274        }
275    }
276}
277
278/// A Stream of incoming requests for fuchsia.validate.logs/EncodingPuppet.
279pub struct EncodingPuppetRequestStream {
280    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
281    is_terminated: bool,
282}
283
284impl std::marker::Unpin for EncodingPuppetRequestStream {}
285
286impl futures::stream::FusedStream for EncodingPuppetRequestStream {
287    fn is_terminated(&self) -> bool {
288        self.is_terminated
289    }
290}
291
292impl fidl::endpoints::RequestStream for EncodingPuppetRequestStream {
293    type Protocol = EncodingPuppetMarker;
294    type ControlHandle = EncodingPuppetControlHandle;
295
296    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
297        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
298    }
299
300    fn control_handle(&self) -> Self::ControlHandle {
301        EncodingPuppetControlHandle { inner: self.inner.clone() }
302    }
303
304    fn into_inner(
305        self,
306    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
307    {
308        (self.inner, self.is_terminated)
309    }
310
311    fn from_inner(
312        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
313        is_terminated: bool,
314    ) -> Self {
315        Self { inner, is_terminated }
316    }
317}
318
319impl futures::Stream for EncodingPuppetRequestStream {
320    type Item = Result<EncodingPuppetRequest, fidl::Error>;
321
322    fn poll_next(
323        mut self: std::pin::Pin<&mut Self>,
324        cx: &mut std::task::Context<'_>,
325    ) -> std::task::Poll<Option<Self::Item>> {
326        let this = &mut *self;
327        if this.inner.check_shutdown(cx) {
328            this.is_terminated = true;
329            return std::task::Poll::Ready(None);
330        }
331        if this.is_terminated {
332            panic!("polled EncodingPuppetRequestStream after completion");
333        }
334        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
335            |bytes, handles| {
336                match this.inner.channel().read_etc(cx, bytes, handles) {
337                    std::task::Poll::Ready(Ok(())) => {}
338                    std::task::Poll::Pending => return std::task::Poll::Pending,
339                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
340                        this.is_terminated = true;
341                        return std::task::Poll::Ready(None);
342                    }
343                    std::task::Poll::Ready(Err(e)) => {
344                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
345                            e.into(),
346                        ))))
347                    }
348                }
349
350                // A message has been received from the channel
351                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
352
353                std::task::Poll::Ready(Some(match header.ordinal {
354                    0x4486ab9d1bb462f8 => {
355                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
356                        let mut req = fidl::new_empty!(
357                            EncodingPuppetEncodeRequest,
358                            fidl::encoding::DefaultFuchsiaResourceDialect
359                        );
360                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<EncodingPuppetEncodeRequest>(&header, _body_bytes, handles, &mut req)?;
361                        let control_handle =
362                            EncodingPuppetControlHandle { inner: this.inner.clone() };
363                        Ok(EncodingPuppetRequest::Encode {
364                            record: req.record,
365
366                            responder: EncodingPuppetEncodeResponder {
367                                control_handle: std::mem::ManuallyDrop::new(control_handle),
368                                tx_id: header.tx_id,
369                            },
370                        })
371                    }
372                    _ => Err(fidl::Error::UnknownOrdinal {
373                        ordinal: header.ordinal,
374                        protocol_name:
375                            <EncodingPuppetMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
376                    }),
377                }))
378            },
379        )
380    }
381}
382
383#[derive(Debug)]
384pub enum EncodingPuppetRequest {
385    /// Log takes a record and converts it into a buffer.
386    /// Returns an error if record contains unsupported type
387    Encode { record: Record, responder: EncodingPuppetEncodeResponder },
388}
389
390impl EncodingPuppetRequest {
391    #[allow(irrefutable_let_patterns)]
392    pub fn into_encode(self) -> Option<(Record, EncodingPuppetEncodeResponder)> {
393        if let EncodingPuppetRequest::Encode { record, responder } = self {
394            Some((record, responder))
395        } else {
396            None
397        }
398    }
399
400    /// Name of the method defined in FIDL
401    pub fn method_name(&self) -> &'static str {
402        match *self {
403            EncodingPuppetRequest::Encode { .. } => "encode",
404        }
405    }
406}
407
408#[derive(Debug, Clone)]
409pub struct EncodingPuppetControlHandle {
410    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
411}
412
413impl fidl::endpoints::ControlHandle for EncodingPuppetControlHandle {
414    fn shutdown(&self) {
415        self.inner.shutdown()
416    }
417    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
418        self.inner.shutdown_with_epitaph(status)
419    }
420
421    fn is_closed(&self) -> bool {
422        self.inner.channel().is_closed()
423    }
424    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
425        self.inner.channel().on_closed()
426    }
427
428    #[cfg(target_os = "fuchsia")]
429    fn signal_peer(
430        &self,
431        clear_mask: zx::Signals,
432        set_mask: zx::Signals,
433    ) -> Result<(), zx_status::Status> {
434        use fidl::Peered;
435        self.inner.channel().signal_peer(clear_mask, set_mask)
436    }
437}
438
439impl EncodingPuppetControlHandle {}
440
441#[must_use = "FIDL methods require a response to be sent"]
442#[derive(Debug)]
443pub struct EncodingPuppetEncodeResponder {
444    control_handle: std::mem::ManuallyDrop<EncodingPuppetControlHandle>,
445    tx_id: u32,
446}
447
448/// Set the the channel to be shutdown (see [`EncodingPuppetControlHandle::shutdown`])
449/// if the responder is dropped without sending a response, so that the client
450/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
451impl std::ops::Drop for EncodingPuppetEncodeResponder {
452    fn drop(&mut self) {
453        self.control_handle.shutdown();
454        // Safety: drops once, never accessed again
455        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
456    }
457}
458
459impl fidl::endpoints::Responder for EncodingPuppetEncodeResponder {
460    type ControlHandle = EncodingPuppetControlHandle;
461
462    fn control_handle(&self) -> &EncodingPuppetControlHandle {
463        &self.control_handle
464    }
465
466    fn drop_without_shutdown(mut self) {
467        // Safety: drops once, never accessed again due to mem::forget
468        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
469        // Prevent Drop from running (which would shut down the channel)
470        std::mem::forget(self);
471    }
472}
473
474impl EncodingPuppetEncodeResponder {
475    /// Sends a response to the FIDL transaction.
476    ///
477    /// Sets the channel to shutdown if an error occurs.
478    pub fn send(
479        self,
480        mut result: Result<fidl_fuchsia_mem::Buffer, PuppetError>,
481    ) -> Result<(), fidl::Error> {
482        let _result = self.send_raw(result);
483        if _result.is_err() {
484            self.control_handle.shutdown();
485        }
486        self.drop_without_shutdown();
487        _result
488    }
489
490    /// Similar to "send" but does not shutdown the channel if an error occurs.
491    pub fn send_no_shutdown_on_err(
492        self,
493        mut result: Result<fidl_fuchsia_mem::Buffer, PuppetError>,
494    ) -> Result<(), fidl::Error> {
495        let _result = self.send_raw(result);
496        self.drop_without_shutdown();
497        _result
498    }
499
500    fn send_raw(
501        &self,
502        mut result: Result<fidl_fuchsia_mem::Buffer, PuppetError>,
503    ) -> Result<(), fidl::Error> {
504        self.control_handle.inner.send::<fidl::encoding::ResultType<
505            EncodingPuppetEncodeResponse,
506            PuppetError,
507        >>(
508            result.as_mut().map_err(|e| *e).map(|result| (result,)),
509            self.tx_id,
510            0x4486ab9d1bb462f8,
511            fidl::encoding::DynamicFlags::empty(),
512        )
513    }
514}
515
516#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
517pub struct EncodingValidatorMarker;
518
519impl fidl::endpoints::ProtocolMarker for EncodingValidatorMarker {
520    type Proxy = EncodingValidatorProxy;
521    type RequestStream = EncodingValidatorRequestStream;
522    #[cfg(target_os = "fuchsia")]
523    type SynchronousProxy = EncodingValidatorSynchronousProxy;
524
525    const DEBUG_NAME: &'static str = "fuchsia.validate.logs.EncodingValidator";
526}
527impl fidl::endpoints::DiscoverableProtocolMarker for EncodingValidatorMarker {}
528
529pub trait EncodingValidatorProxyInterface: Send + Sync {
530    fn r#validate(
531        &self,
532        results: fidl::endpoints::ServerEnd<ValidateResultsIteratorMarker>,
533    ) -> Result<(), fidl::Error>;
534}
535#[derive(Debug)]
536#[cfg(target_os = "fuchsia")]
537pub struct EncodingValidatorSynchronousProxy {
538    client: fidl::client::sync::Client,
539}
540
541#[cfg(target_os = "fuchsia")]
542impl fidl::endpoints::SynchronousProxy for EncodingValidatorSynchronousProxy {
543    type Proxy = EncodingValidatorProxy;
544    type Protocol = EncodingValidatorMarker;
545
546    fn from_channel(inner: fidl::Channel) -> Self {
547        Self::new(inner)
548    }
549
550    fn into_channel(self) -> fidl::Channel {
551        self.client.into_channel()
552    }
553
554    fn as_channel(&self) -> &fidl::Channel {
555        self.client.as_channel()
556    }
557}
558
559#[cfg(target_os = "fuchsia")]
560impl EncodingValidatorSynchronousProxy {
561    pub fn new(channel: fidl::Channel) -> Self {
562        let protocol_name =
563            <EncodingValidatorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
564        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
565    }
566
567    pub fn into_channel(self) -> fidl::Channel {
568        self.client.into_channel()
569    }
570
571    /// Waits until an event arrives and returns it. It is safe for other
572    /// threads to make concurrent requests while waiting for an event.
573    pub fn wait_for_event(
574        &self,
575        deadline: zx::MonotonicInstant,
576    ) -> Result<EncodingValidatorEvent, fidl::Error> {
577        EncodingValidatorEvent::decode(self.client.wait_for_event(deadline)?)
578    }
579
580    /// Runs the encoding validation test suite and reports the results on the
581    /// given channel.
582    pub fn r#validate(
583        &self,
584        mut results: fidl::endpoints::ServerEnd<ValidateResultsIteratorMarker>,
585    ) -> Result<(), fidl::Error> {
586        self.client.send::<EncodingValidatorValidateRequest>(
587            (results,),
588            0x1ac204a62465f23c,
589            fidl::encoding::DynamicFlags::empty(),
590        )
591    }
592}
593
594#[cfg(target_os = "fuchsia")]
595impl From<EncodingValidatorSynchronousProxy> for zx::Handle {
596    fn from(value: EncodingValidatorSynchronousProxy) -> Self {
597        value.into_channel().into()
598    }
599}
600
601#[cfg(target_os = "fuchsia")]
602impl From<fidl::Channel> for EncodingValidatorSynchronousProxy {
603    fn from(value: fidl::Channel) -> Self {
604        Self::new(value)
605    }
606}
607
608#[cfg(target_os = "fuchsia")]
609impl fidl::endpoints::FromClient for EncodingValidatorSynchronousProxy {
610    type Protocol = EncodingValidatorMarker;
611
612    fn from_client(value: fidl::endpoints::ClientEnd<EncodingValidatorMarker>) -> Self {
613        Self::new(value.into_channel())
614    }
615}
616
617#[derive(Debug, Clone)]
618pub struct EncodingValidatorProxy {
619    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
620}
621
622impl fidl::endpoints::Proxy for EncodingValidatorProxy {
623    type Protocol = EncodingValidatorMarker;
624
625    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
626        Self::new(inner)
627    }
628
629    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
630        self.client.into_channel().map_err(|client| Self { client })
631    }
632
633    fn as_channel(&self) -> &::fidl::AsyncChannel {
634        self.client.as_channel()
635    }
636}
637
638impl EncodingValidatorProxy {
639    /// Create a new Proxy for fuchsia.validate.logs/EncodingValidator.
640    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
641        let protocol_name =
642            <EncodingValidatorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
643        Self { client: fidl::client::Client::new(channel, protocol_name) }
644    }
645
646    /// Get a Stream of events from the remote end of the protocol.
647    ///
648    /// # Panics
649    ///
650    /// Panics if the event stream was already taken.
651    pub fn take_event_stream(&self) -> EncodingValidatorEventStream {
652        EncodingValidatorEventStream { event_receiver: self.client.take_event_receiver() }
653    }
654
655    /// Runs the encoding validation test suite and reports the results on the
656    /// given channel.
657    pub fn r#validate(
658        &self,
659        mut results: fidl::endpoints::ServerEnd<ValidateResultsIteratorMarker>,
660    ) -> Result<(), fidl::Error> {
661        EncodingValidatorProxyInterface::r#validate(self, results)
662    }
663}
664
665impl EncodingValidatorProxyInterface for EncodingValidatorProxy {
666    fn r#validate(
667        &self,
668        mut results: fidl::endpoints::ServerEnd<ValidateResultsIteratorMarker>,
669    ) -> Result<(), fidl::Error> {
670        self.client.send::<EncodingValidatorValidateRequest>(
671            (results,),
672            0x1ac204a62465f23c,
673            fidl::encoding::DynamicFlags::empty(),
674        )
675    }
676}
677
678pub struct EncodingValidatorEventStream {
679    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
680}
681
682impl std::marker::Unpin for EncodingValidatorEventStream {}
683
684impl futures::stream::FusedStream for EncodingValidatorEventStream {
685    fn is_terminated(&self) -> bool {
686        self.event_receiver.is_terminated()
687    }
688}
689
690impl futures::Stream for EncodingValidatorEventStream {
691    type Item = Result<EncodingValidatorEvent, fidl::Error>;
692
693    fn poll_next(
694        mut self: std::pin::Pin<&mut Self>,
695        cx: &mut std::task::Context<'_>,
696    ) -> std::task::Poll<Option<Self::Item>> {
697        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
698            &mut self.event_receiver,
699            cx
700        )?) {
701            Some(buf) => std::task::Poll::Ready(Some(EncodingValidatorEvent::decode(buf))),
702            None => std::task::Poll::Ready(None),
703        }
704    }
705}
706
707#[derive(Debug)]
708pub enum EncodingValidatorEvent {}
709
710impl EncodingValidatorEvent {
711    /// Decodes a message buffer as a [`EncodingValidatorEvent`].
712    fn decode(
713        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
714    ) -> Result<EncodingValidatorEvent, fidl::Error> {
715        let (bytes, _handles) = buf.split_mut();
716        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
717        debug_assert_eq!(tx_header.tx_id, 0);
718        match tx_header.ordinal {
719            _ => Err(fidl::Error::UnknownOrdinal {
720                ordinal: tx_header.ordinal,
721                protocol_name:
722                    <EncodingValidatorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
723            }),
724        }
725    }
726}
727
728/// A Stream of incoming requests for fuchsia.validate.logs/EncodingValidator.
729pub struct EncodingValidatorRequestStream {
730    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
731    is_terminated: bool,
732}
733
734impl std::marker::Unpin for EncodingValidatorRequestStream {}
735
736impl futures::stream::FusedStream for EncodingValidatorRequestStream {
737    fn is_terminated(&self) -> bool {
738        self.is_terminated
739    }
740}
741
742impl fidl::endpoints::RequestStream for EncodingValidatorRequestStream {
743    type Protocol = EncodingValidatorMarker;
744    type ControlHandle = EncodingValidatorControlHandle;
745
746    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
747        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
748    }
749
750    fn control_handle(&self) -> Self::ControlHandle {
751        EncodingValidatorControlHandle { inner: self.inner.clone() }
752    }
753
754    fn into_inner(
755        self,
756    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
757    {
758        (self.inner, self.is_terminated)
759    }
760
761    fn from_inner(
762        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
763        is_terminated: bool,
764    ) -> Self {
765        Self { inner, is_terminated }
766    }
767}
768
769impl futures::Stream for EncodingValidatorRequestStream {
770    type Item = Result<EncodingValidatorRequest, fidl::Error>;
771
772    fn poll_next(
773        mut self: std::pin::Pin<&mut Self>,
774        cx: &mut std::task::Context<'_>,
775    ) -> std::task::Poll<Option<Self::Item>> {
776        let this = &mut *self;
777        if this.inner.check_shutdown(cx) {
778            this.is_terminated = true;
779            return std::task::Poll::Ready(None);
780        }
781        if this.is_terminated {
782            panic!("polled EncodingValidatorRequestStream after completion");
783        }
784        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
785            |bytes, handles| {
786                match this.inner.channel().read_etc(cx, bytes, handles) {
787                    std::task::Poll::Ready(Ok(())) => {}
788                    std::task::Poll::Pending => return std::task::Poll::Pending,
789                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
790                        this.is_terminated = true;
791                        return std::task::Poll::Ready(None);
792                    }
793                    std::task::Poll::Ready(Err(e)) => {
794                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
795                            e.into(),
796                        ))))
797                    }
798                }
799
800                // A message has been received from the channel
801                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
802
803                std::task::Poll::Ready(Some(match header.ordinal {
804                    0x1ac204a62465f23c => {
805                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
806                        let mut req = fidl::new_empty!(
807                            EncodingValidatorValidateRequest,
808                            fidl::encoding::DefaultFuchsiaResourceDialect
809                        );
810                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<EncodingValidatorValidateRequest>(&header, _body_bytes, handles, &mut req)?;
811                        let control_handle =
812                            EncodingValidatorControlHandle { inner: this.inner.clone() };
813                        Ok(EncodingValidatorRequest::Validate {
814                            results: req.results,
815
816                            control_handle,
817                        })
818                    }
819                    _ => Err(fidl::Error::UnknownOrdinal {
820                        ordinal: header.ordinal,
821                        protocol_name:
822                            <EncodingValidatorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
823                    }),
824                }))
825            },
826        )
827    }
828}
829
830#[derive(Debug)]
831pub enum EncodingValidatorRequest {
832    /// Runs the encoding validation test suite and reports the results on the
833    /// given channel.
834    Validate {
835        results: fidl::endpoints::ServerEnd<ValidateResultsIteratorMarker>,
836        control_handle: EncodingValidatorControlHandle,
837    },
838}
839
840impl EncodingValidatorRequest {
841    #[allow(irrefutable_let_patterns)]
842    pub fn into_validate(
843        self,
844    ) -> Option<(
845        fidl::endpoints::ServerEnd<ValidateResultsIteratorMarker>,
846        EncodingValidatorControlHandle,
847    )> {
848        if let EncodingValidatorRequest::Validate { results, control_handle } = self {
849            Some((results, control_handle))
850        } else {
851            None
852        }
853    }
854
855    /// Name of the method defined in FIDL
856    pub fn method_name(&self) -> &'static str {
857        match *self {
858            EncodingValidatorRequest::Validate { .. } => "validate",
859        }
860    }
861}
862
863#[derive(Debug, Clone)]
864pub struct EncodingValidatorControlHandle {
865    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
866}
867
868impl fidl::endpoints::ControlHandle for EncodingValidatorControlHandle {
869    fn shutdown(&self) {
870        self.inner.shutdown()
871    }
872    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
873        self.inner.shutdown_with_epitaph(status)
874    }
875
876    fn is_closed(&self) -> bool {
877        self.inner.channel().is_closed()
878    }
879    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
880        self.inner.channel().on_closed()
881    }
882
883    #[cfg(target_os = "fuchsia")]
884    fn signal_peer(
885        &self,
886        clear_mask: zx::Signals,
887        set_mask: zx::Signals,
888    ) -> Result<(), zx_status::Status> {
889        use fidl::Peered;
890        self.inner.channel().signal_peer(clear_mask, set_mask)
891    }
892}
893
894impl EncodingValidatorControlHandle {}
895
896#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
897pub struct LogSinkPuppetMarker;
898
899impl fidl::endpoints::ProtocolMarker for LogSinkPuppetMarker {
900    type Proxy = LogSinkPuppetProxy;
901    type RequestStream = LogSinkPuppetRequestStream;
902    #[cfg(target_os = "fuchsia")]
903    type SynchronousProxy = LogSinkPuppetSynchronousProxy;
904
905    const DEBUG_NAME: &'static str = "fuchsia.validate.logs.LogSinkPuppet";
906}
907impl fidl::endpoints::DiscoverableProtocolMarker for LogSinkPuppetMarker {}
908
909pub trait LogSinkPuppetProxyInterface: Send + Sync {
910    type GetInfoResponseFut: std::future::Future<Output = Result<PuppetInfo, fidl::Error>> + Send;
911    fn r#get_info(&self) -> Self::GetInfoResponseFut;
912    type EmitLogResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
913    fn r#emit_log(&self, spec: &RecordSpec) -> Self::EmitLogResponseFut;
914    type StopInterestListenerResponseFut: std::future::Future<Output = Result<(), fidl::Error>>
915        + Send;
916    fn r#stop_interest_listener(&self) -> Self::StopInterestListenerResponseFut;
917}
918#[derive(Debug)]
919#[cfg(target_os = "fuchsia")]
920pub struct LogSinkPuppetSynchronousProxy {
921    client: fidl::client::sync::Client,
922}
923
924#[cfg(target_os = "fuchsia")]
925impl fidl::endpoints::SynchronousProxy for LogSinkPuppetSynchronousProxy {
926    type Proxy = LogSinkPuppetProxy;
927    type Protocol = LogSinkPuppetMarker;
928
929    fn from_channel(inner: fidl::Channel) -> Self {
930        Self::new(inner)
931    }
932
933    fn into_channel(self) -> fidl::Channel {
934        self.client.into_channel()
935    }
936
937    fn as_channel(&self) -> &fidl::Channel {
938        self.client.as_channel()
939    }
940}
941
942#[cfg(target_os = "fuchsia")]
943impl LogSinkPuppetSynchronousProxy {
944    pub fn new(channel: fidl::Channel) -> Self {
945        let protocol_name = <LogSinkPuppetMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
946        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
947    }
948
949    pub fn into_channel(self) -> fidl::Channel {
950        self.client.into_channel()
951    }
952
953    /// Waits until an event arrives and returns it. It is safe for other
954    /// threads to make concurrent requests while waiting for an event.
955    pub fn wait_for_event(
956        &self,
957        deadline: zx::MonotonicInstant,
958    ) -> Result<LogSinkPuppetEvent, fidl::Error> {
959        LogSinkPuppetEvent::decode(self.client.wait_for_event(deadline)?)
960    }
961
962    /// Returns the information the puppet knows about itself.
963    pub fn r#get_info(&self, ___deadline: zx::MonotonicInstant) -> Result<PuppetInfo, fidl::Error> {
964        let _response =
965            self.client.send_query::<fidl::encoding::EmptyPayload, LogSinkPuppetGetInfoResponse>(
966                (),
967                0x5b1c3dac76c26425,
968                fidl::encoding::DynamicFlags::empty(),
969                ___deadline,
970            )?;
971        Ok(_response.info)
972    }
973
974    /// Logs a record.
975    pub fn r#emit_log(
976        &self,
977        mut spec: &RecordSpec,
978        ___deadline: zx::MonotonicInstant,
979    ) -> Result<(), fidl::Error> {
980        let _response =
981            self.client.send_query::<LogSinkPuppetEmitLogRequest, fidl::encoding::EmptyPayload>(
982                (spec,),
983                0x58b64b6672ed66de,
984                fidl::encoding::DynamicFlags::empty(),
985                ___deadline,
986            )?;
987        Ok(_response)
988    }
989
990    /// Disables the interest listener
991    pub fn r#stop_interest_listener(
992        &self,
993        ___deadline: zx::MonotonicInstant,
994    ) -> Result<(), fidl::Error> {
995        let _response =
996            self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::EmptyPayload>(
997                (),
998                0x4c69520a50828cbd,
999                fidl::encoding::DynamicFlags::empty(),
1000                ___deadline,
1001            )?;
1002        Ok(_response)
1003    }
1004}
1005
1006#[cfg(target_os = "fuchsia")]
1007impl From<LogSinkPuppetSynchronousProxy> for zx::Handle {
1008    fn from(value: LogSinkPuppetSynchronousProxy) -> Self {
1009        value.into_channel().into()
1010    }
1011}
1012
1013#[cfg(target_os = "fuchsia")]
1014impl From<fidl::Channel> for LogSinkPuppetSynchronousProxy {
1015    fn from(value: fidl::Channel) -> Self {
1016        Self::new(value)
1017    }
1018}
1019
1020#[cfg(target_os = "fuchsia")]
1021impl fidl::endpoints::FromClient for LogSinkPuppetSynchronousProxy {
1022    type Protocol = LogSinkPuppetMarker;
1023
1024    fn from_client(value: fidl::endpoints::ClientEnd<LogSinkPuppetMarker>) -> Self {
1025        Self::new(value.into_channel())
1026    }
1027}
1028
1029#[derive(Debug, Clone)]
1030pub struct LogSinkPuppetProxy {
1031    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1032}
1033
1034impl fidl::endpoints::Proxy for LogSinkPuppetProxy {
1035    type Protocol = LogSinkPuppetMarker;
1036
1037    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1038        Self::new(inner)
1039    }
1040
1041    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1042        self.client.into_channel().map_err(|client| Self { client })
1043    }
1044
1045    fn as_channel(&self) -> &::fidl::AsyncChannel {
1046        self.client.as_channel()
1047    }
1048}
1049
1050impl LogSinkPuppetProxy {
1051    /// Create a new Proxy for fuchsia.validate.logs/LogSinkPuppet.
1052    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1053        let protocol_name = <LogSinkPuppetMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1054        Self { client: fidl::client::Client::new(channel, protocol_name) }
1055    }
1056
1057    /// Get a Stream of events from the remote end of the protocol.
1058    ///
1059    /// # Panics
1060    ///
1061    /// Panics if the event stream was already taken.
1062    pub fn take_event_stream(&self) -> LogSinkPuppetEventStream {
1063        LogSinkPuppetEventStream { event_receiver: self.client.take_event_receiver() }
1064    }
1065
1066    /// Returns the information the puppet knows about itself.
1067    pub fn r#get_info(
1068        &self,
1069    ) -> fidl::client::QueryResponseFut<PuppetInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
1070    {
1071        LogSinkPuppetProxyInterface::r#get_info(self)
1072    }
1073
1074    /// Logs a record.
1075    pub fn r#emit_log(
1076        &self,
1077        mut spec: &RecordSpec,
1078    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
1079        LogSinkPuppetProxyInterface::r#emit_log(self, spec)
1080    }
1081
1082    /// Disables the interest listener
1083    pub fn r#stop_interest_listener(
1084        &self,
1085    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
1086        LogSinkPuppetProxyInterface::r#stop_interest_listener(self)
1087    }
1088}
1089
1090impl LogSinkPuppetProxyInterface for LogSinkPuppetProxy {
1091    type GetInfoResponseFut =
1092        fidl::client::QueryResponseFut<PuppetInfo, fidl::encoding::DefaultFuchsiaResourceDialect>;
1093    fn r#get_info(&self) -> Self::GetInfoResponseFut {
1094        fn _decode(
1095            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1096        ) -> Result<PuppetInfo, fidl::Error> {
1097            let _response = fidl::client::decode_transaction_body::<
1098                LogSinkPuppetGetInfoResponse,
1099                fidl::encoding::DefaultFuchsiaResourceDialect,
1100                0x5b1c3dac76c26425,
1101            >(_buf?)?;
1102            Ok(_response.info)
1103        }
1104        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, PuppetInfo>(
1105            (),
1106            0x5b1c3dac76c26425,
1107            fidl::encoding::DynamicFlags::empty(),
1108            _decode,
1109        )
1110    }
1111
1112    type EmitLogResponseFut =
1113        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
1114    fn r#emit_log(&self, mut spec: &RecordSpec) -> Self::EmitLogResponseFut {
1115        fn _decode(
1116            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1117        ) -> Result<(), fidl::Error> {
1118            let _response = fidl::client::decode_transaction_body::<
1119                fidl::encoding::EmptyPayload,
1120                fidl::encoding::DefaultFuchsiaResourceDialect,
1121                0x58b64b6672ed66de,
1122            >(_buf?)?;
1123            Ok(_response)
1124        }
1125        self.client.send_query_and_decode::<LogSinkPuppetEmitLogRequest, ()>(
1126            (spec,),
1127            0x58b64b6672ed66de,
1128            fidl::encoding::DynamicFlags::empty(),
1129            _decode,
1130        )
1131    }
1132
1133    type StopInterestListenerResponseFut =
1134        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
1135    fn r#stop_interest_listener(&self) -> Self::StopInterestListenerResponseFut {
1136        fn _decode(
1137            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1138        ) -> Result<(), fidl::Error> {
1139            let _response = fidl::client::decode_transaction_body::<
1140                fidl::encoding::EmptyPayload,
1141                fidl::encoding::DefaultFuchsiaResourceDialect,
1142                0x4c69520a50828cbd,
1143            >(_buf?)?;
1144            Ok(_response)
1145        }
1146        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
1147            (),
1148            0x4c69520a50828cbd,
1149            fidl::encoding::DynamicFlags::empty(),
1150            _decode,
1151        )
1152    }
1153}
1154
1155pub struct LogSinkPuppetEventStream {
1156    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1157}
1158
1159impl std::marker::Unpin for LogSinkPuppetEventStream {}
1160
1161impl futures::stream::FusedStream for LogSinkPuppetEventStream {
1162    fn is_terminated(&self) -> bool {
1163        self.event_receiver.is_terminated()
1164    }
1165}
1166
1167impl futures::Stream for LogSinkPuppetEventStream {
1168    type Item = Result<LogSinkPuppetEvent, fidl::Error>;
1169
1170    fn poll_next(
1171        mut self: std::pin::Pin<&mut Self>,
1172        cx: &mut std::task::Context<'_>,
1173    ) -> std::task::Poll<Option<Self::Item>> {
1174        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1175            &mut self.event_receiver,
1176            cx
1177        )?) {
1178            Some(buf) => std::task::Poll::Ready(Some(LogSinkPuppetEvent::decode(buf))),
1179            None => std::task::Poll::Ready(None),
1180        }
1181    }
1182}
1183
1184#[derive(Debug)]
1185pub enum LogSinkPuppetEvent {}
1186
1187impl LogSinkPuppetEvent {
1188    /// Decodes a message buffer as a [`LogSinkPuppetEvent`].
1189    fn decode(
1190        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1191    ) -> Result<LogSinkPuppetEvent, fidl::Error> {
1192        let (bytes, _handles) = buf.split_mut();
1193        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1194        debug_assert_eq!(tx_header.tx_id, 0);
1195        match tx_header.ordinal {
1196            _ => Err(fidl::Error::UnknownOrdinal {
1197                ordinal: tx_header.ordinal,
1198                protocol_name: <LogSinkPuppetMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1199            }),
1200        }
1201    }
1202}
1203
1204/// A Stream of incoming requests for fuchsia.validate.logs/LogSinkPuppet.
1205pub struct LogSinkPuppetRequestStream {
1206    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1207    is_terminated: bool,
1208}
1209
1210impl std::marker::Unpin for LogSinkPuppetRequestStream {}
1211
1212impl futures::stream::FusedStream for LogSinkPuppetRequestStream {
1213    fn is_terminated(&self) -> bool {
1214        self.is_terminated
1215    }
1216}
1217
1218impl fidl::endpoints::RequestStream for LogSinkPuppetRequestStream {
1219    type Protocol = LogSinkPuppetMarker;
1220    type ControlHandle = LogSinkPuppetControlHandle;
1221
1222    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1223        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1224    }
1225
1226    fn control_handle(&self) -> Self::ControlHandle {
1227        LogSinkPuppetControlHandle { inner: self.inner.clone() }
1228    }
1229
1230    fn into_inner(
1231        self,
1232    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1233    {
1234        (self.inner, self.is_terminated)
1235    }
1236
1237    fn from_inner(
1238        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1239        is_terminated: bool,
1240    ) -> Self {
1241        Self { inner, is_terminated }
1242    }
1243}
1244
1245impl futures::Stream for LogSinkPuppetRequestStream {
1246    type Item = Result<LogSinkPuppetRequest, fidl::Error>;
1247
1248    fn poll_next(
1249        mut self: std::pin::Pin<&mut Self>,
1250        cx: &mut std::task::Context<'_>,
1251    ) -> std::task::Poll<Option<Self::Item>> {
1252        let this = &mut *self;
1253        if this.inner.check_shutdown(cx) {
1254            this.is_terminated = true;
1255            return std::task::Poll::Ready(None);
1256        }
1257        if this.is_terminated {
1258            panic!("polled LogSinkPuppetRequestStream after completion");
1259        }
1260        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1261            |bytes, handles| {
1262                match this.inner.channel().read_etc(cx, bytes, handles) {
1263                    std::task::Poll::Ready(Ok(())) => {}
1264                    std::task::Poll::Pending => return std::task::Poll::Pending,
1265                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1266                        this.is_terminated = true;
1267                        return std::task::Poll::Ready(None);
1268                    }
1269                    std::task::Poll::Ready(Err(e)) => {
1270                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1271                            e.into(),
1272                        ))))
1273                    }
1274                }
1275
1276                // A message has been received from the channel
1277                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1278
1279                std::task::Poll::Ready(Some(match header.ordinal {
1280                    0x5b1c3dac76c26425 => {
1281                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1282                        let mut req = fidl::new_empty!(
1283                            fidl::encoding::EmptyPayload,
1284                            fidl::encoding::DefaultFuchsiaResourceDialect
1285                        );
1286                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1287                        let control_handle =
1288                            LogSinkPuppetControlHandle { inner: this.inner.clone() };
1289                        Ok(LogSinkPuppetRequest::GetInfo {
1290                            responder: LogSinkPuppetGetInfoResponder {
1291                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1292                                tx_id: header.tx_id,
1293                            },
1294                        })
1295                    }
1296                    0x58b64b6672ed66de => {
1297                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1298                        let mut req = fidl::new_empty!(
1299                            LogSinkPuppetEmitLogRequest,
1300                            fidl::encoding::DefaultFuchsiaResourceDialect
1301                        );
1302                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LogSinkPuppetEmitLogRequest>(&header, _body_bytes, handles, &mut req)?;
1303                        let control_handle =
1304                            LogSinkPuppetControlHandle { inner: this.inner.clone() };
1305                        Ok(LogSinkPuppetRequest::EmitLog {
1306                            spec: req.spec,
1307
1308                            responder: LogSinkPuppetEmitLogResponder {
1309                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1310                                tx_id: header.tx_id,
1311                            },
1312                        })
1313                    }
1314                    0x4c69520a50828cbd => {
1315                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1316                        let mut req = fidl::new_empty!(
1317                            fidl::encoding::EmptyPayload,
1318                            fidl::encoding::DefaultFuchsiaResourceDialect
1319                        );
1320                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1321                        let control_handle =
1322                            LogSinkPuppetControlHandle { inner: this.inner.clone() };
1323                        Ok(LogSinkPuppetRequest::StopInterestListener {
1324                            responder: LogSinkPuppetStopInterestListenerResponder {
1325                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1326                                tx_id: header.tx_id,
1327                            },
1328                        })
1329                    }
1330                    _ => Err(fidl::Error::UnknownOrdinal {
1331                        ordinal: header.ordinal,
1332                        protocol_name:
1333                            <LogSinkPuppetMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1334                    }),
1335                }))
1336            },
1337        )
1338    }
1339}
1340
1341#[derive(Debug)]
1342pub enum LogSinkPuppetRequest {
1343    /// Returns the information the puppet knows about itself.
1344    GetInfo { responder: LogSinkPuppetGetInfoResponder },
1345    /// Logs a record.
1346    EmitLog { spec: RecordSpec, responder: LogSinkPuppetEmitLogResponder },
1347    /// Disables the interest listener
1348    StopInterestListener { responder: LogSinkPuppetStopInterestListenerResponder },
1349}
1350
1351impl LogSinkPuppetRequest {
1352    #[allow(irrefutable_let_patterns)]
1353    pub fn into_get_info(self) -> Option<(LogSinkPuppetGetInfoResponder)> {
1354        if let LogSinkPuppetRequest::GetInfo { responder } = self {
1355            Some((responder))
1356        } else {
1357            None
1358        }
1359    }
1360
1361    #[allow(irrefutable_let_patterns)]
1362    pub fn into_emit_log(self) -> Option<(RecordSpec, LogSinkPuppetEmitLogResponder)> {
1363        if let LogSinkPuppetRequest::EmitLog { spec, responder } = self {
1364            Some((spec, responder))
1365        } else {
1366            None
1367        }
1368    }
1369
1370    #[allow(irrefutable_let_patterns)]
1371    pub fn into_stop_interest_listener(
1372        self,
1373    ) -> Option<(LogSinkPuppetStopInterestListenerResponder)> {
1374        if let LogSinkPuppetRequest::StopInterestListener { responder } = self {
1375            Some((responder))
1376        } else {
1377            None
1378        }
1379    }
1380
1381    /// Name of the method defined in FIDL
1382    pub fn method_name(&self) -> &'static str {
1383        match *self {
1384            LogSinkPuppetRequest::GetInfo { .. } => "get_info",
1385            LogSinkPuppetRequest::EmitLog { .. } => "emit_log",
1386            LogSinkPuppetRequest::StopInterestListener { .. } => "stop_interest_listener",
1387        }
1388    }
1389}
1390
1391#[derive(Debug, Clone)]
1392pub struct LogSinkPuppetControlHandle {
1393    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1394}
1395
1396impl fidl::endpoints::ControlHandle for LogSinkPuppetControlHandle {
1397    fn shutdown(&self) {
1398        self.inner.shutdown()
1399    }
1400    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1401        self.inner.shutdown_with_epitaph(status)
1402    }
1403
1404    fn is_closed(&self) -> bool {
1405        self.inner.channel().is_closed()
1406    }
1407    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1408        self.inner.channel().on_closed()
1409    }
1410
1411    #[cfg(target_os = "fuchsia")]
1412    fn signal_peer(
1413        &self,
1414        clear_mask: zx::Signals,
1415        set_mask: zx::Signals,
1416    ) -> Result<(), zx_status::Status> {
1417        use fidl::Peered;
1418        self.inner.channel().signal_peer(clear_mask, set_mask)
1419    }
1420}
1421
1422impl LogSinkPuppetControlHandle {}
1423
1424#[must_use = "FIDL methods require a response to be sent"]
1425#[derive(Debug)]
1426pub struct LogSinkPuppetGetInfoResponder {
1427    control_handle: std::mem::ManuallyDrop<LogSinkPuppetControlHandle>,
1428    tx_id: u32,
1429}
1430
1431/// Set the the channel to be shutdown (see [`LogSinkPuppetControlHandle::shutdown`])
1432/// if the responder is dropped without sending a response, so that the client
1433/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1434impl std::ops::Drop for LogSinkPuppetGetInfoResponder {
1435    fn drop(&mut self) {
1436        self.control_handle.shutdown();
1437        // Safety: drops once, never accessed again
1438        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1439    }
1440}
1441
1442impl fidl::endpoints::Responder for LogSinkPuppetGetInfoResponder {
1443    type ControlHandle = LogSinkPuppetControlHandle;
1444
1445    fn control_handle(&self) -> &LogSinkPuppetControlHandle {
1446        &self.control_handle
1447    }
1448
1449    fn drop_without_shutdown(mut self) {
1450        // Safety: drops once, never accessed again due to mem::forget
1451        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1452        // Prevent Drop from running (which would shut down the channel)
1453        std::mem::forget(self);
1454    }
1455}
1456
1457impl LogSinkPuppetGetInfoResponder {
1458    /// Sends a response to the FIDL transaction.
1459    ///
1460    /// Sets the channel to shutdown if an error occurs.
1461    pub fn send(self, mut info: &PuppetInfo) -> Result<(), fidl::Error> {
1462        let _result = self.send_raw(info);
1463        if _result.is_err() {
1464            self.control_handle.shutdown();
1465        }
1466        self.drop_without_shutdown();
1467        _result
1468    }
1469
1470    /// Similar to "send" but does not shutdown the channel if an error occurs.
1471    pub fn send_no_shutdown_on_err(self, mut info: &PuppetInfo) -> Result<(), fidl::Error> {
1472        let _result = self.send_raw(info);
1473        self.drop_without_shutdown();
1474        _result
1475    }
1476
1477    fn send_raw(&self, mut info: &PuppetInfo) -> Result<(), fidl::Error> {
1478        self.control_handle.inner.send::<LogSinkPuppetGetInfoResponse>(
1479            (info,),
1480            self.tx_id,
1481            0x5b1c3dac76c26425,
1482            fidl::encoding::DynamicFlags::empty(),
1483        )
1484    }
1485}
1486
1487#[must_use = "FIDL methods require a response to be sent"]
1488#[derive(Debug)]
1489pub struct LogSinkPuppetEmitLogResponder {
1490    control_handle: std::mem::ManuallyDrop<LogSinkPuppetControlHandle>,
1491    tx_id: u32,
1492}
1493
1494/// Set the the channel to be shutdown (see [`LogSinkPuppetControlHandle::shutdown`])
1495/// if the responder is dropped without sending a response, so that the client
1496/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1497impl std::ops::Drop for LogSinkPuppetEmitLogResponder {
1498    fn drop(&mut self) {
1499        self.control_handle.shutdown();
1500        // Safety: drops once, never accessed again
1501        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1502    }
1503}
1504
1505impl fidl::endpoints::Responder for LogSinkPuppetEmitLogResponder {
1506    type ControlHandle = LogSinkPuppetControlHandle;
1507
1508    fn control_handle(&self) -> &LogSinkPuppetControlHandle {
1509        &self.control_handle
1510    }
1511
1512    fn drop_without_shutdown(mut self) {
1513        // Safety: drops once, never accessed again due to mem::forget
1514        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1515        // Prevent Drop from running (which would shut down the channel)
1516        std::mem::forget(self);
1517    }
1518}
1519
1520impl LogSinkPuppetEmitLogResponder {
1521    /// Sends a response to the FIDL transaction.
1522    ///
1523    /// Sets the channel to shutdown if an error occurs.
1524    pub fn send(self) -> Result<(), fidl::Error> {
1525        let _result = self.send_raw();
1526        if _result.is_err() {
1527            self.control_handle.shutdown();
1528        }
1529        self.drop_without_shutdown();
1530        _result
1531    }
1532
1533    /// Similar to "send" but does not shutdown the channel if an error occurs.
1534    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1535        let _result = self.send_raw();
1536        self.drop_without_shutdown();
1537        _result
1538    }
1539
1540    fn send_raw(&self) -> Result<(), fidl::Error> {
1541        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
1542            (),
1543            self.tx_id,
1544            0x58b64b6672ed66de,
1545            fidl::encoding::DynamicFlags::empty(),
1546        )
1547    }
1548}
1549
1550#[must_use = "FIDL methods require a response to be sent"]
1551#[derive(Debug)]
1552pub struct LogSinkPuppetStopInterestListenerResponder {
1553    control_handle: std::mem::ManuallyDrop<LogSinkPuppetControlHandle>,
1554    tx_id: u32,
1555}
1556
1557/// Set the the channel to be shutdown (see [`LogSinkPuppetControlHandle::shutdown`])
1558/// if the responder is dropped without sending a response, so that the client
1559/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1560impl std::ops::Drop for LogSinkPuppetStopInterestListenerResponder {
1561    fn drop(&mut self) {
1562        self.control_handle.shutdown();
1563        // Safety: drops once, never accessed again
1564        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1565    }
1566}
1567
1568impl fidl::endpoints::Responder for LogSinkPuppetStopInterestListenerResponder {
1569    type ControlHandle = LogSinkPuppetControlHandle;
1570
1571    fn control_handle(&self) -> &LogSinkPuppetControlHandle {
1572        &self.control_handle
1573    }
1574
1575    fn drop_without_shutdown(mut self) {
1576        // Safety: drops once, never accessed again due to mem::forget
1577        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1578        // Prevent Drop from running (which would shut down the channel)
1579        std::mem::forget(self);
1580    }
1581}
1582
1583impl LogSinkPuppetStopInterestListenerResponder {
1584    /// Sends a response to the FIDL transaction.
1585    ///
1586    /// Sets the channel to shutdown if an error occurs.
1587    pub fn send(self) -> Result<(), fidl::Error> {
1588        let _result = self.send_raw();
1589        if _result.is_err() {
1590            self.control_handle.shutdown();
1591        }
1592        self.drop_without_shutdown();
1593        _result
1594    }
1595
1596    /// Similar to "send" but does not shutdown the channel if an error occurs.
1597    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1598        let _result = self.send_raw();
1599        self.drop_without_shutdown();
1600        _result
1601    }
1602
1603    fn send_raw(&self) -> Result<(), fidl::Error> {
1604        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
1605            (),
1606            self.tx_id,
1607            0x4c69520a50828cbd,
1608            fidl::encoding::DynamicFlags::empty(),
1609        )
1610    }
1611}
1612
1613#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1614pub struct ValidateResultsIteratorMarker;
1615
1616impl fidl::endpoints::ProtocolMarker for ValidateResultsIteratorMarker {
1617    type Proxy = ValidateResultsIteratorProxy;
1618    type RequestStream = ValidateResultsIteratorRequestStream;
1619    #[cfg(target_os = "fuchsia")]
1620    type SynchronousProxy = ValidateResultsIteratorSynchronousProxy;
1621
1622    const DEBUG_NAME: &'static str = "(anonymous) ValidateResultsIterator";
1623}
1624
1625pub trait ValidateResultsIteratorProxyInterface: Send + Sync {
1626    type GetNextResponseFut: std::future::Future<Output = Result<ValidateResultsIteratorGetNextResponse, fidl::Error>>
1627        + Send;
1628    fn r#get_next(&self) -> Self::GetNextResponseFut;
1629}
1630#[derive(Debug)]
1631#[cfg(target_os = "fuchsia")]
1632pub struct ValidateResultsIteratorSynchronousProxy {
1633    client: fidl::client::sync::Client,
1634}
1635
1636#[cfg(target_os = "fuchsia")]
1637impl fidl::endpoints::SynchronousProxy for ValidateResultsIteratorSynchronousProxy {
1638    type Proxy = ValidateResultsIteratorProxy;
1639    type Protocol = ValidateResultsIteratorMarker;
1640
1641    fn from_channel(inner: fidl::Channel) -> Self {
1642        Self::new(inner)
1643    }
1644
1645    fn into_channel(self) -> fidl::Channel {
1646        self.client.into_channel()
1647    }
1648
1649    fn as_channel(&self) -> &fidl::Channel {
1650        self.client.as_channel()
1651    }
1652}
1653
1654#[cfg(target_os = "fuchsia")]
1655impl ValidateResultsIteratorSynchronousProxy {
1656    pub fn new(channel: fidl::Channel) -> Self {
1657        let protocol_name =
1658            <ValidateResultsIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1659        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1660    }
1661
1662    pub fn into_channel(self) -> fidl::Channel {
1663        self.client.into_channel()
1664    }
1665
1666    /// Waits until an event arrives and returns it. It is safe for other
1667    /// threads to make concurrent requests while waiting for an event.
1668    pub fn wait_for_event(
1669        &self,
1670        deadline: zx::MonotonicInstant,
1671    ) -> Result<ValidateResultsIteratorEvent, fidl::Error> {
1672        ValidateResultsIteratorEvent::decode(self.client.wait_for_event(deadline)?)
1673    }
1674
1675    /// Returns the result of a test case execution.
1676    pub fn r#get_next(
1677        &self,
1678        ___deadline: zx::MonotonicInstant,
1679    ) -> Result<ValidateResultsIteratorGetNextResponse, fidl::Error> {
1680        let _response = self
1681            .client
1682            .send_query::<fidl::encoding::EmptyPayload, ValidateResultsIteratorGetNextResponse>(
1683                (),
1684                0x1b1573e93311e8b7,
1685                fidl::encoding::DynamicFlags::empty(),
1686                ___deadline,
1687            )?;
1688        Ok(_response)
1689    }
1690}
1691
1692#[cfg(target_os = "fuchsia")]
1693impl From<ValidateResultsIteratorSynchronousProxy> for zx::Handle {
1694    fn from(value: ValidateResultsIteratorSynchronousProxy) -> Self {
1695        value.into_channel().into()
1696    }
1697}
1698
1699#[cfg(target_os = "fuchsia")]
1700impl From<fidl::Channel> for ValidateResultsIteratorSynchronousProxy {
1701    fn from(value: fidl::Channel) -> Self {
1702        Self::new(value)
1703    }
1704}
1705
1706#[cfg(target_os = "fuchsia")]
1707impl fidl::endpoints::FromClient for ValidateResultsIteratorSynchronousProxy {
1708    type Protocol = ValidateResultsIteratorMarker;
1709
1710    fn from_client(value: fidl::endpoints::ClientEnd<ValidateResultsIteratorMarker>) -> Self {
1711        Self::new(value.into_channel())
1712    }
1713}
1714
1715#[derive(Debug, Clone)]
1716pub struct ValidateResultsIteratorProxy {
1717    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1718}
1719
1720impl fidl::endpoints::Proxy for ValidateResultsIteratorProxy {
1721    type Protocol = ValidateResultsIteratorMarker;
1722
1723    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1724        Self::new(inner)
1725    }
1726
1727    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1728        self.client.into_channel().map_err(|client| Self { client })
1729    }
1730
1731    fn as_channel(&self) -> &::fidl::AsyncChannel {
1732        self.client.as_channel()
1733    }
1734}
1735
1736impl ValidateResultsIteratorProxy {
1737    /// Create a new Proxy for fuchsia.validate.logs/ValidateResultsIterator.
1738    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1739        let protocol_name =
1740            <ValidateResultsIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1741        Self { client: fidl::client::Client::new(channel, protocol_name) }
1742    }
1743
1744    /// Get a Stream of events from the remote end of the protocol.
1745    ///
1746    /// # Panics
1747    ///
1748    /// Panics if the event stream was already taken.
1749    pub fn take_event_stream(&self) -> ValidateResultsIteratorEventStream {
1750        ValidateResultsIteratorEventStream { event_receiver: self.client.take_event_receiver() }
1751    }
1752
1753    /// Returns the result of a test case execution.
1754    pub fn r#get_next(
1755        &self,
1756    ) -> fidl::client::QueryResponseFut<
1757        ValidateResultsIteratorGetNextResponse,
1758        fidl::encoding::DefaultFuchsiaResourceDialect,
1759    > {
1760        ValidateResultsIteratorProxyInterface::r#get_next(self)
1761    }
1762}
1763
1764impl ValidateResultsIteratorProxyInterface for ValidateResultsIteratorProxy {
1765    type GetNextResponseFut = fidl::client::QueryResponseFut<
1766        ValidateResultsIteratorGetNextResponse,
1767        fidl::encoding::DefaultFuchsiaResourceDialect,
1768    >;
1769    fn r#get_next(&self) -> Self::GetNextResponseFut {
1770        fn _decode(
1771            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1772        ) -> Result<ValidateResultsIteratorGetNextResponse, fidl::Error> {
1773            let _response = fidl::client::decode_transaction_body::<
1774                ValidateResultsIteratorGetNextResponse,
1775                fidl::encoding::DefaultFuchsiaResourceDialect,
1776                0x1b1573e93311e8b7,
1777            >(_buf?)?;
1778            Ok(_response)
1779        }
1780        self.client.send_query_and_decode::<
1781            fidl::encoding::EmptyPayload,
1782            ValidateResultsIteratorGetNextResponse,
1783        >(
1784            (),
1785            0x1b1573e93311e8b7,
1786            fidl::encoding::DynamicFlags::empty(),
1787            _decode,
1788        )
1789    }
1790}
1791
1792pub struct ValidateResultsIteratorEventStream {
1793    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1794}
1795
1796impl std::marker::Unpin for ValidateResultsIteratorEventStream {}
1797
1798impl futures::stream::FusedStream for ValidateResultsIteratorEventStream {
1799    fn is_terminated(&self) -> bool {
1800        self.event_receiver.is_terminated()
1801    }
1802}
1803
1804impl futures::Stream for ValidateResultsIteratorEventStream {
1805    type Item = Result<ValidateResultsIteratorEvent, fidl::Error>;
1806
1807    fn poll_next(
1808        mut self: std::pin::Pin<&mut Self>,
1809        cx: &mut std::task::Context<'_>,
1810    ) -> std::task::Poll<Option<Self::Item>> {
1811        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1812            &mut self.event_receiver,
1813            cx
1814        )?) {
1815            Some(buf) => std::task::Poll::Ready(Some(ValidateResultsIteratorEvent::decode(buf))),
1816            None => std::task::Poll::Ready(None),
1817        }
1818    }
1819}
1820
1821#[derive(Debug)]
1822pub enum ValidateResultsIteratorEvent {}
1823
1824impl ValidateResultsIteratorEvent {
1825    /// Decodes a message buffer as a [`ValidateResultsIteratorEvent`].
1826    fn decode(
1827        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1828    ) -> Result<ValidateResultsIteratorEvent, fidl::Error> {
1829        let (bytes, _handles) = buf.split_mut();
1830        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1831        debug_assert_eq!(tx_header.tx_id, 0);
1832        match tx_header.ordinal {
1833            _ => Err(fidl::Error::UnknownOrdinal {
1834                ordinal: tx_header.ordinal,
1835                protocol_name:
1836                    <ValidateResultsIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1837            }),
1838        }
1839    }
1840}
1841
1842/// A Stream of incoming requests for fuchsia.validate.logs/ValidateResultsIterator.
1843pub struct ValidateResultsIteratorRequestStream {
1844    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1845    is_terminated: bool,
1846}
1847
1848impl std::marker::Unpin for ValidateResultsIteratorRequestStream {}
1849
1850impl futures::stream::FusedStream for ValidateResultsIteratorRequestStream {
1851    fn is_terminated(&self) -> bool {
1852        self.is_terminated
1853    }
1854}
1855
1856impl fidl::endpoints::RequestStream for ValidateResultsIteratorRequestStream {
1857    type Protocol = ValidateResultsIteratorMarker;
1858    type ControlHandle = ValidateResultsIteratorControlHandle;
1859
1860    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1861        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1862    }
1863
1864    fn control_handle(&self) -> Self::ControlHandle {
1865        ValidateResultsIteratorControlHandle { inner: self.inner.clone() }
1866    }
1867
1868    fn into_inner(
1869        self,
1870    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1871    {
1872        (self.inner, self.is_terminated)
1873    }
1874
1875    fn from_inner(
1876        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1877        is_terminated: bool,
1878    ) -> Self {
1879        Self { inner, is_terminated }
1880    }
1881}
1882
1883impl futures::Stream for ValidateResultsIteratorRequestStream {
1884    type Item = Result<ValidateResultsIteratorRequest, fidl::Error>;
1885
1886    fn poll_next(
1887        mut self: std::pin::Pin<&mut Self>,
1888        cx: &mut std::task::Context<'_>,
1889    ) -> std::task::Poll<Option<Self::Item>> {
1890        let this = &mut *self;
1891        if this.inner.check_shutdown(cx) {
1892            this.is_terminated = true;
1893            return std::task::Poll::Ready(None);
1894        }
1895        if this.is_terminated {
1896            panic!("polled ValidateResultsIteratorRequestStream after completion");
1897        }
1898        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1899            |bytes, handles| {
1900                match this.inner.channel().read_etc(cx, bytes, handles) {
1901                    std::task::Poll::Ready(Ok(())) => {}
1902                    std::task::Poll::Pending => return std::task::Poll::Pending,
1903                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1904                        this.is_terminated = true;
1905                        return std::task::Poll::Ready(None);
1906                    }
1907                    std::task::Poll::Ready(Err(e)) => {
1908                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1909                            e.into(),
1910                        ))))
1911                    }
1912                }
1913
1914                // A message has been received from the channel
1915                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1916
1917                std::task::Poll::Ready(Some(match header.ordinal {
1918                0x1b1573e93311e8b7 => {
1919                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1920                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
1921                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1922                    let control_handle = ValidateResultsIteratorControlHandle {
1923                        inner: this.inner.clone(),
1924                    };
1925                    Ok(ValidateResultsIteratorRequest::GetNext {
1926                        responder: ValidateResultsIteratorGetNextResponder {
1927                            control_handle: std::mem::ManuallyDrop::new(control_handle),
1928                            tx_id: header.tx_id,
1929                        },
1930                    })
1931                }
1932                _ => Err(fidl::Error::UnknownOrdinal {
1933                    ordinal: header.ordinal,
1934                    protocol_name: <ValidateResultsIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1935                }),
1936            }))
1937            },
1938        )
1939    }
1940}
1941
1942#[derive(Debug)]
1943pub enum ValidateResultsIteratorRequest {
1944    /// Returns the result of a test case execution.
1945    GetNext { responder: ValidateResultsIteratorGetNextResponder },
1946}
1947
1948impl ValidateResultsIteratorRequest {
1949    #[allow(irrefutable_let_patterns)]
1950    pub fn into_get_next(self) -> Option<(ValidateResultsIteratorGetNextResponder)> {
1951        if let ValidateResultsIteratorRequest::GetNext { responder } = self {
1952            Some((responder))
1953        } else {
1954            None
1955        }
1956    }
1957
1958    /// Name of the method defined in FIDL
1959    pub fn method_name(&self) -> &'static str {
1960        match *self {
1961            ValidateResultsIteratorRequest::GetNext { .. } => "get_next",
1962        }
1963    }
1964}
1965
1966#[derive(Debug, Clone)]
1967pub struct ValidateResultsIteratorControlHandle {
1968    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1969}
1970
1971impl fidl::endpoints::ControlHandle for ValidateResultsIteratorControlHandle {
1972    fn shutdown(&self) {
1973        self.inner.shutdown()
1974    }
1975    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1976        self.inner.shutdown_with_epitaph(status)
1977    }
1978
1979    fn is_closed(&self) -> bool {
1980        self.inner.channel().is_closed()
1981    }
1982    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1983        self.inner.channel().on_closed()
1984    }
1985
1986    #[cfg(target_os = "fuchsia")]
1987    fn signal_peer(
1988        &self,
1989        clear_mask: zx::Signals,
1990        set_mask: zx::Signals,
1991    ) -> Result<(), zx_status::Status> {
1992        use fidl::Peered;
1993        self.inner.channel().signal_peer(clear_mask, set_mask)
1994    }
1995}
1996
1997impl ValidateResultsIteratorControlHandle {}
1998
1999#[must_use = "FIDL methods require a response to be sent"]
2000#[derive(Debug)]
2001pub struct ValidateResultsIteratorGetNextResponder {
2002    control_handle: std::mem::ManuallyDrop<ValidateResultsIteratorControlHandle>,
2003    tx_id: u32,
2004}
2005
2006/// Set the the channel to be shutdown (see [`ValidateResultsIteratorControlHandle::shutdown`])
2007/// if the responder is dropped without sending a response, so that the client
2008/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2009impl std::ops::Drop for ValidateResultsIteratorGetNextResponder {
2010    fn drop(&mut self) {
2011        self.control_handle.shutdown();
2012        // Safety: drops once, never accessed again
2013        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2014    }
2015}
2016
2017impl fidl::endpoints::Responder for ValidateResultsIteratorGetNextResponder {
2018    type ControlHandle = ValidateResultsIteratorControlHandle;
2019
2020    fn control_handle(&self) -> &ValidateResultsIteratorControlHandle {
2021        &self.control_handle
2022    }
2023
2024    fn drop_without_shutdown(mut self) {
2025        // Safety: drops once, never accessed again due to mem::forget
2026        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2027        // Prevent Drop from running (which would shut down the channel)
2028        std::mem::forget(self);
2029    }
2030}
2031
2032impl ValidateResultsIteratorGetNextResponder {
2033    /// Sends a response to the FIDL transaction.
2034    ///
2035    /// Sets the channel to shutdown if an error occurs.
2036    pub fn send(
2037        self,
2038        mut payload: ValidateResultsIteratorGetNextResponse,
2039    ) -> Result<(), fidl::Error> {
2040        let _result = self.send_raw(payload);
2041        if _result.is_err() {
2042            self.control_handle.shutdown();
2043        }
2044        self.drop_without_shutdown();
2045        _result
2046    }
2047
2048    /// Similar to "send" but does not shutdown the channel if an error occurs.
2049    pub fn send_no_shutdown_on_err(
2050        self,
2051        mut payload: ValidateResultsIteratorGetNextResponse,
2052    ) -> Result<(), fidl::Error> {
2053        let _result = self.send_raw(payload);
2054        self.drop_without_shutdown();
2055        _result
2056    }
2057
2058    fn send_raw(
2059        &self,
2060        mut payload: ValidateResultsIteratorGetNextResponse,
2061    ) -> Result<(), fidl::Error> {
2062        self.control_handle.inner.send::<ValidateResultsIteratorGetNextResponse>(
2063            &mut payload,
2064            self.tx_id,
2065            0x1b1573e93311e8b7,
2066            fidl::encoding::DynamicFlags::empty(),
2067        )
2068    }
2069}
2070
2071mod internal {
2072    use super::*;
2073
2074    impl fidl::encoding::ResourceTypeMarker for EncodingPuppetEncodeResponse {
2075        type Borrowed<'a> = &'a mut Self;
2076        fn take_or_borrow<'a>(
2077            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2078        ) -> Self::Borrowed<'a> {
2079            value
2080        }
2081    }
2082
2083    unsafe impl fidl::encoding::TypeMarker for EncodingPuppetEncodeResponse {
2084        type Owned = Self;
2085
2086        #[inline(always)]
2087        fn inline_align(_context: fidl::encoding::Context) -> usize {
2088            8
2089        }
2090
2091        #[inline(always)]
2092        fn inline_size(_context: fidl::encoding::Context) -> usize {
2093            16
2094        }
2095    }
2096
2097    unsafe impl
2098        fidl::encoding::Encode<
2099            EncodingPuppetEncodeResponse,
2100            fidl::encoding::DefaultFuchsiaResourceDialect,
2101        > for &mut EncodingPuppetEncodeResponse
2102    {
2103        #[inline]
2104        unsafe fn encode(
2105            self,
2106            encoder: &mut fidl::encoding::Encoder<
2107                '_,
2108                fidl::encoding::DefaultFuchsiaResourceDialect,
2109            >,
2110            offset: usize,
2111            _depth: fidl::encoding::Depth,
2112        ) -> fidl::Result<()> {
2113            encoder.debug_check_bounds::<EncodingPuppetEncodeResponse>(offset);
2114            // Delegate to tuple encoding.
2115            fidl::encoding::Encode::<
2116                EncodingPuppetEncodeResponse,
2117                fidl::encoding::DefaultFuchsiaResourceDialect,
2118            >::encode(
2119                (<fidl_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2120                    &mut self.result,
2121                ),),
2122                encoder,
2123                offset,
2124                _depth,
2125            )
2126        }
2127    }
2128    unsafe impl<
2129            T0: fidl::encoding::Encode<
2130                fidl_fuchsia_mem::Buffer,
2131                fidl::encoding::DefaultFuchsiaResourceDialect,
2132            >,
2133        >
2134        fidl::encoding::Encode<
2135            EncodingPuppetEncodeResponse,
2136            fidl::encoding::DefaultFuchsiaResourceDialect,
2137        > for (T0,)
2138    {
2139        #[inline]
2140        unsafe fn encode(
2141            self,
2142            encoder: &mut fidl::encoding::Encoder<
2143                '_,
2144                fidl::encoding::DefaultFuchsiaResourceDialect,
2145            >,
2146            offset: usize,
2147            depth: fidl::encoding::Depth,
2148        ) -> fidl::Result<()> {
2149            encoder.debug_check_bounds::<EncodingPuppetEncodeResponse>(offset);
2150            // Zero out padding regions. There's no need to apply masks
2151            // because the unmasked parts will be overwritten by fields.
2152            // Write the fields.
2153            self.0.encode(encoder, offset + 0, depth)?;
2154            Ok(())
2155        }
2156    }
2157
2158    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2159        for EncodingPuppetEncodeResponse
2160    {
2161        #[inline(always)]
2162        fn new_empty() -> Self {
2163            Self {
2164                result: fidl::new_empty!(
2165                    fidl_fuchsia_mem::Buffer,
2166                    fidl::encoding::DefaultFuchsiaResourceDialect
2167                ),
2168            }
2169        }
2170
2171        #[inline]
2172        unsafe fn decode(
2173            &mut self,
2174            decoder: &mut fidl::encoding::Decoder<
2175                '_,
2176                fidl::encoding::DefaultFuchsiaResourceDialect,
2177            >,
2178            offset: usize,
2179            _depth: fidl::encoding::Depth,
2180        ) -> fidl::Result<()> {
2181            decoder.debug_check_bounds::<Self>(offset);
2182            // Verify that padding bytes are zero.
2183            fidl::decode!(
2184                fidl_fuchsia_mem::Buffer,
2185                fidl::encoding::DefaultFuchsiaResourceDialect,
2186                &mut self.result,
2187                decoder,
2188                offset + 0,
2189                _depth
2190            )?;
2191            Ok(())
2192        }
2193    }
2194
2195    impl fidl::encoding::ResourceTypeMarker for EncodingValidatorValidateRequest {
2196        type Borrowed<'a> = &'a mut Self;
2197        fn take_or_borrow<'a>(
2198            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2199        ) -> Self::Borrowed<'a> {
2200            value
2201        }
2202    }
2203
2204    unsafe impl fidl::encoding::TypeMarker for EncodingValidatorValidateRequest {
2205        type Owned = Self;
2206
2207        #[inline(always)]
2208        fn inline_align(_context: fidl::encoding::Context) -> usize {
2209            4
2210        }
2211
2212        #[inline(always)]
2213        fn inline_size(_context: fidl::encoding::Context) -> usize {
2214            4
2215        }
2216    }
2217
2218    unsafe impl
2219        fidl::encoding::Encode<
2220            EncodingValidatorValidateRequest,
2221            fidl::encoding::DefaultFuchsiaResourceDialect,
2222        > for &mut EncodingValidatorValidateRequest
2223    {
2224        #[inline]
2225        unsafe fn encode(
2226            self,
2227            encoder: &mut fidl::encoding::Encoder<
2228                '_,
2229                fidl::encoding::DefaultFuchsiaResourceDialect,
2230            >,
2231            offset: usize,
2232            _depth: fidl::encoding::Depth,
2233        ) -> fidl::Result<()> {
2234            encoder.debug_check_bounds::<EncodingValidatorValidateRequest>(offset);
2235            // Delegate to tuple encoding.
2236            fidl::encoding::Encode::<
2237                EncodingValidatorValidateRequest,
2238                fidl::encoding::DefaultFuchsiaResourceDialect,
2239            >::encode(
2240                (<fidl::encoding::Endpoint<
2241                    fidl::endpoints::ServerEnd<ValidateResultsIteratorMarker>,
2242                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2243                    &mut self.results
2244                ),),
2245                encoder,
2246                offset,
2247                _depth,
2248            )
2249        }
2250    }
2251    unsafe impl<
2252            T0: fidl::encoding::Encode<
2253                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ValidateResultsIteratorMarker>>,
2254                fidl::encoding::DefaultFuchsiaResourceDialect,
2255            >,
2256        >
2257        fidl::encoding::Encode<
2258            EncodingValidatorValidateRequest,
2259            fidl::encoding::DefaultFuchsiaResourceDialect,
2260        > for (T0,)
2261    {
2262        #[inline]
2263        unsafe fn encode(
2264            self,
2265            encoder: &mut fidl::encoding::Encoder<
2266                '_,
2267                fidl::encoding::DefaultFuchsiaResourceDialect,
2268            >,
2269            offset: usize,
2270            depth: fidl::encoding::Depth,
2271        ) -> fidl::Result<()> {
2272            encoder.debug_check_bounds::<EncodingValidatorValidateRequest>(offset);
2273            // Zero out padding regions. There's no need to apply masks
2274            // because the unmasked parts will be overwritten by fields.
2275            // Write the fields.
2276            self.0.encode(encoder, offset + 0, depth)?;
2277            Ok(())
2278        }
2279    }
2280
2281    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2282        for EncodingValidatorValidateRequest
2283    {
2284        #[inline(always)]
2285        fn new_empty() -> Self {
2286            Self {
2287                results: fidl::new_empty!(
2288                    fidl::encoding::Endpoint<
2289                        fidl::endpoints::ServerEnd<ValidateResultsIteratorMarker>,
2290                    >,
2291                    fidl::encoding::DefaultFuchsiaResourceDialect
2292                ),
2293            }
2294        }
2295
2296        #[inline]
2297        unsafe fn decode(
2298            &mut self,
2299            decoder: &mut fidl::encoding::Decoder<
2300                '_,
2301                fidl::encoding::DefaultFuchsiaResourceDialect,
2302            >,
2303            offset: usize,
2304            _depth: fidl::encoding::Depth,
2305        ) -> fidl::Result<()> {
2306            decoder.debug_check_bounds::<Self>(offset);
2307            // Verify that padding bytes are zero.
2308            fidl::decode!(
2309                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ValidateResultsIteratorMarker>>,
2310                fidl::encoding::DefaultFuchsiaResourceDialect,
2311                &mut self.results,
2312                decoder,
2313                offset + 0,
2314                _depth
2315            )?;
2316            Ok(())
2317        }
2318    }
2319
2320    impl ValidateResultsIteratorGetNextResponse {
2321        #[inline(always)]
2322        fn max_ordinal_present(&self) -> u64 {
2323            if let Some(_) = self.result {
2324                return 1;
2325            }
2326            0
2327        }
2328    }
2329
2330    impl fidl::encoding::ResourceTypeMarker for ValidateResultsIteratorGetNextResponse {
2331        type Borrowed<'a> = &'a mut Self;
2332        fn take_or_borrow<'a>(
2333            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2334        ) -> Self::Borrowed<'a> {
2335            value
2336        }
2337    }
2338
2339    unsafe impl fidl::encoding::TypeMarker for ValidateResultsIteratorGetNextResponse {
2340        type Owned = Self;
2341
2342        #[inline(always)]
2343        fn inline_align(_context: fidl::encoding::Context) -> usize {
2344            8
2345        }
2346
2347        #[inline(always)]
2348        fn inline_size(_context: fidl::encoding::Context) -> usize {
2349            16
2350        }
2351    }
2352
2353    unsafe impl
2354        fidl::encoding::Encode<
2355            ValidateResultsIteratorGetNextResponse,
2356            fidl::encoding::DefaultFuchsiaResourceDialect,
2357        > for &mut ValidateResultsIteratorGetNextResponse
2358    {
2359        unsafe fn encode(
2360            self,
2361            encoder: &mut fidl::encoding::Encoder<
2362                '_,
2363                fidl::encoding::DefaultFuchsiaResourceDialect,
2364            >,
2365            offset: usize,
2366            mut depth: fidl::encoding::Depth,
2367        ) -> fidl::Result<()> {
2368            encoder.debug_check_bounds::<ValidateResultsIteratorGetNextResponse>(offset);
2369            // Vector header
2370            let max_ordinal: u64 = self.max_ordinal_present();
2371            encoder.write_num(max_ordinal, offset);
2372            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2373            // Calling encoder.out_of_line_offset(0) is not allowed.
2374            if max_ordinal == 0 {
2375                return Ok(());
2376            }
2377            depth.increment()?;
2378            let envelope_size = 8;
2379            let bytes_len = max_ordinal as usize * envelope_size;
2380            #[allow(unused_variables)]
2381            let offset = encoder.out_of_line_offset(bytes_len);
2382            let mut _prev_end_offset: usize = 0;
2383            if 1 > max_ordinal {
2384                return Ok(());
2385            }
2386
2387            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2388            // are envelope_size bytes.
2389            let cur_offset: usize = (1 - 1) * envelope_size;
2390
2391            // Zero reserved fields.
2392            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2393
2394            // Safety:
2395            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2396            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2397            //   envelope_size bytes, there is always sufficient room.
2398            fidl::encoding::encode_in_envelope_optional::<
2399                ValidateResult,
2400                fidl::encoding::DefaultFuchsiaResourceDialect,
2401            >(
2402                self.result
2403                    .as_ref()
2404                    .map(<ValidateResult as fidl::encoding::ValueTypeMarker>::borrow),
2405                encoder,
2406                offset + cur_offset,
2407                depth,
2408            )?;
2409
2410            _prev_end_offset = cur_offset + envelope_size;
2411
2412            Ok(())
2413        }
2414    }
2415
2416    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2417        for ValidateResultsIteratorGetNextResponse
2418    {
2419        #[inline(always)]
2420        fn new_empty() -> Self {
2421            Self::default()
2422        }
2423
2424        unsafe fn decode(
2425            &mut self,
2426            decoder: &mut fidl::encoding::Decoder<
2427                '_,
2428                fidl::encoding::DefaultFuchsiaResourceDialect,
2429            >,
2430            offset: usize,
2431            mut depth: fidl::encoding::Depth,
2432        ) -> fidl::Result<()> {
2433            decoder.debug_check_bounds::<Self>(offset);
2434            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2435                None => return Err(fidl::Error::NotNullable),
2436                Some(len) => len,
2437            };
2438            // Calling decoder.out_of_line_offset(0) is not allowed.
2439            if len == 0 {
2440                return Ok(());
2441            };
2442            depth.increment()?;
2443            let envelope_size = 8;
2444            let bytes_len = len * envelope_size;
2445            let offset = decoder.out_of_line_offset(bytes_len)?;
2446            // Decode the envelope for each type.
2447            let mut _next_ordinal_to_read = 0;
2448            let mut next_offset = offset;
2449            let end_offset = offset + bytes_len;
2450            _next_ordinal_to_read += 1;
2451            if next_offset >= end_offset {
2452                return Ok(());
2453            }
2454
2455            // Decode unknown envelopes for gaps in ordinals.
2456            while _next_ordinal_to_read < 1 {
2457                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2458                _next_ordinal_to_read += 1;
2459                next_offset += envelope_size;
2460            }
2461
2462            let next_out_of_line = decoder.next_out_of_line();
2463            let handles_before = decoder.remaining_handles();
2464            if let Some((inlined, num_bytes, num_handles)) =
2465                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2466            {
2467                let member_inline_size =
2468                    <ValidateResult as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2469                if inlined != (member_inline_size <= 4) {
2470                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2471                }
2472                let inner_offset;
2473                let mut inner_depth = depth.clone();
2474                if inlined {
2475                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2476                    inner_offset = next_offset;
2477                } else {
2478                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2479                    inner_depth.increment()?;
2480                }
2481                let val_ref = self.result.get_or_insert_with(|| {
2482                    fidl::new_empty!(ValidateResult, fidl::encoding::DefaultFuchsiaResourceDialect)
2483                });
2484                fidl::decode!(
2485                    ValidateResult,
2486                    fidl::encoding::DefaultFuchsiaResourceDialect,
2487                    val_ref,
2488                    decoder,
2489                    inner_offset,
2490                    inner_depth
2491                )?;
2492                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2493                {
2494                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2495                }
2496                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2497                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2498                }
2499            }
2500
2501            next_offset += envelope_size;
2502
2503            // Decode the remaining unknown envelopes.
2504            while next_offset < end_offset {
2505                _next_ordinal_to_read += 1;
2506                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2507                next_offset += envelope_size;
2508            }
2509
2510            Ok(())
2511        }
2512    }
2513}