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