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}
915#[derive(Debug)]
916#[cfg(target_os = "fuchsia")]
917pub struct LogSinkPuppetSynchronousProxy {
918    client: fidl::client::sync::Client,
919}
920
921#[cfg(target_os = "fuchsia")]
922impl fidl::endpoints::SynchronousProxy for LogSinkPuppetSynchronousProxy {
923    type Proxy = LogSinkPuppetProxy;
924    type Protocol = LogSinkPuppetMarker;
925
926    fn from_channel(inner: fidl::Channel) -> Self {
927        Self::new(inner)
928    }
929
930    fn into_channel(self) -> fidl::Channel {
931        self.client.into_channel()
932    }
933
934    fn as_channel(&self) -> &fidl::Channel {
935        self.client.as_channel()
936    }
937}
938
939#[cfg(target_os = "fuchsia")]
940impl LogSinkPuppetSynchronousProxy {
941    pub fn new(channel: fidl::Channel) -> Self {
942        let protocol_name = <LogSinkPuppetMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
943        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
944    }
945
946    pub fn into_channel(self) -> fidl::Channel {
947        self.client.into_channel()
948    }
949
950    /// Waits until an event arrives and returns it. It is safe for other
951    /// threads to make concurrent requests while waiting for an event.
952    pub fn wait_for_event(
953        &self,
954        deadline: zx::MonotonicInstant,
955    ) -> Result<LogSinkPuppetEvent, fidl::Error> {
956        LogSinkPuppetEvent::decode(self.client.wait_for_event(deadline)?)
957    }
958
959    /// Returns the information the puppet knows about itself.
960    pub fn r#get_info(&self, ___deadline: zx::MonotonicInstant) -> Result<PuppetInfo, fidl::Error> {
961        let _response =
962            self.client.send_query::<fidl::encoding::EmptyPayload, LogSinkPuppetGetInfoResponse>(
963                (),
964                0x5b1c3dac76c26425,
965                fidl::encoding::DynamicFlags::empty(),
966                ___deadline,
967            )?;
968        Ok(_response.info)
969    }
970
971    /// Logs a record.
972    pub fn r#emit_log(
973        &self,
974        mut spec: &RecordSpec,
975        ___deadline: zx::MonotonicInstant,
976    ) -> Result<(), fidl::Error> {
977        let _response =
978            self.client.send_query::<LogSinkPuppetEmitLogRequest, fidl::encoding::EmptyPayload>(
979                (spec,),
980                0x58b64b6672ed66de,
981                fidl::encoding::DynamicFlags::empty(),
982                ___deadline,
983            )?;
984        Ok(_response)
985    }
986}
987
988#[cfg(target_os = "fuchsia")]
989impl From<LogSinkPuppetSynchronousProxy> for zx::Handle {
990    fn from(value: LogSinkPuppetSynchronousProxy) -> Self {
991        value.into_channel().into()
992    }
993}
994
995#[cfg(target_os = "fuchsia")]
996impl From<fidl::Channel> for LogSinkPuppetSynchronousProxy {
997    fn from(value: fidl::Channel) -> Self {
998        Self::new(value)
999    }
1000}
1001
1002#[cfg(target_os = "fuchsia")]
1003impl fidl::endpoints::FromClient for LogSinkPuppetSynchronousProxy {
1004    type Protocol = LogSinkPuppetMarker;
1005
1006    fn from_client(value: fidl::endpoints::ClientEnd<LogSinkPuppetMarker>) -> Self {
1007        Self::new(value.into_channel())
1008    }
1009}
1010
1011#[derive(Debug, Clone)]
1012pub struct LogSinkPuppetProxy {
1013    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1014}
1015
1016impl fidl::endpoints::Proxy for LogSinkPuppetProxy {
1017    type Protocol = LogSinkPuppetMarker;
1018
1019    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1020        Self::new(inner)
1021    }
1022
1023    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1024        self.client.into_channel().map_err(|client| Self { client })
1025    }
1026
1027    fn as_channel(&self) -> &::fidl::AsyncChannel {
1028        self.client.as_channel()
1029    }
1030}
1031
1032impl LogSinkPuppetProxy {
1033    /// Create a new Proxy for fuchsia.validate.logs/LogSinkPuppet.
1034    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1035        let protocol_name = <LogSinkPuppetMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1036        Self { client: fidl::client::Client::new(channel, protocol_name) }
1037    }
1038
1039    /// Get a Stream of events from the remote end of the protocol.
1040    ///
1041    /// # Panics
1042    ///
1043    /// Panics if the event stream was already taken.
1044    pub fn take_event_stream(&self) -> LogSinkPuppetEventStream {
1045        LogSinkPuppetEventStream { event_receiver: self.client.take_event_receiver() }
1046    }
1047
1048    /// Returns the information the puppet knows about itself.
1049    pub fn r#get_info(
1050        &self,
1051    ) -> fidl::client::QueryResponseFut<PuppetInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
1052    {
1053        LogSinkPuppetProxyInterface::r#get_info(self)
1054    }
1055
1056    /// Logs a record.
1057    pub fn r#emit_log(
1058        &self,
1059        mut spec: &RecordSpec,
1060    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
1061        LogSinkPuppetProxyInterface::r#emit_log(self, spec)
1062    }
1063}
1064
1065impl LogSinkPuppetProxyInterface for LogSinkPuppetProxy {
1066    type GetInfoResponseFut =
1067        fidl::client::QueryResponseFut<PuppetInfo, fidl::encoding::DefaultFuchsiaResourceDialect>;
1068    fn r#get_info(&self) -> Self::GetInfoResponseFut {
1069        fn _decode(
1070            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1071        ) -> Result<PuppetInfo, fidl::Error> {
1072            let _response = fidl::client::decode_transaction_body::<
1073                LogSinkPuppetGetInfoResponse,
1074                fidl::encoding::DefaultFuchsiaResourceDialect,
1075                0x5b1c3dac76c26425,
1076            >(_buf?)?;
1077            Ok(_response.info)
1078        }
1079        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, PuppetInfo>(
1080            (),
1081            0x5b1c3dac76c26425,
1082            fidl::encoding::DynamicFlags::empty(),
1083            _decode,
1084        )
1085    }
1086
1087    type EmitLogResponseFut =
1088        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
1089    fn r#emit_log(&self, mut spec: &RecordSpec) -> Self::EmitLogResponseFut {
1090        fn _decode(
1091            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1092        ) -> Result<(), fidl::Error> {
1093            let _response = fidl::client::decode_transaction_body::<
1094                fidl::encoding::EmptyPayload,
1095                fidl::encoding::DefaultFuchsiaResourceDialect,
1096                0x58b64b6672ed66de,
1097            >(_buf?)?;
1098            Ok(_response)
1099        }
1100        self.client.send_query_and_decode::<LogSinkPuppetEmitLogRequest, ()>(
1101            (spec,),
1102            0x58b64b6672ed66de,
1103            fidl::encoding::DynamicFlags::empty(),
1104            _decode,
1105        )
1106    }
1107}
1108
1109pub struct LogSinkPuppetEventStream {
1110    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1111}
1112
1113impl std::marker::Unpin for LogSinkPuppetEventStream {}
1114
1115impl futures::stream::FusedStream for LogSinkPuppetEventStream {
1116    fn is_terminated(&self) -> bool {
1117        self.event_receiver.is_terminated()
1118    }
1119}
1120
1121impl futures::Stream for LogSinkPuppetEventStream {
1122    type Item = Result<LogSinkPuppetEvent, fidl::Error>;
1123
1124    fn poll_next(
1125        mut self: std::pin::Pin<&mut Self>,
1126        cx: &mut std::task::Context<'_>,
1127    ) -> std::task::Poll<Option<Self::Item>> {
1128        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1129            &mut self.event_receiver,
1130            cx
1131        )?) {
1132            Some(buf) => std::task::Poll::Ready(Some(LogSinkPuppetEvent::decode(buf))),
1133            None => std::task::Poll::Ready(None),
1134        }
1135    }
1136}
1137
1138#[derive(Debug)]
1139pub enum LogSinkPuppetEvent {}
1140
1141impl LogSinkPuppetEvent {
1142    /// Decodes a message buffer as a [`LogSinkPuppetEvent`].
1143    fn decode(
1144        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1145    ) -> Result<LogSinkPuppetEvent, fidl::Error> {
1146        let (bytes, _handles) = buf.split_mut();
1147        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1148        debug_assert_eq!(tx_header.tx_id, 0);
1149        match tx_header.ordinal {
1150            _ => Err(fidl::Error::UnknownOrdinal {
1151                ordinal: tx_header.ordinal,
1152                protocol_name: <LogSinkPuppetMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1153            }),
1154        }
1155    }
1156}
1157
1158/// A Stream of incoming requests for fuchsia.validate.logs/LogSinkPuppet.
1159pub struct LogSinkPuppetRequestStream {
1160    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1161    is_terminated: bool,
1162}
1163
1164impl std::marker::Unpin for LogSinkPuppetRequestStream {}
1165
1166impl futures::stream::FusedStream for LogSinkPuppetRequestStream {
1167    fn is_terminated(&self) -> bool {
1168        self.is_terminated
1169    }
1170}
1171
1172impl fidl::endpoints::RequestStream for LogSinkPuppetRequestStream {
1173    type Protocol = LogSinkPuppetMarker;
1174    type ControlHandle = LogSinkPuppetControlHandle;
1175
1176    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1177        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1178    }
1179
1180    fn control_handle(&self) -> Self::ControlHandle {
1181        LogSinkPuppetControlHandle { inner: self.inner.clone() }
1182    }
1183
1184    fn into_inner(
1185        self,
1186    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1187    {
1188        (self.inner, self.is_terminated)
1189    }
1190
1191    fn from_inner(
1192        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1193        is_terminated: bool,
1194    ) -> Self {
1195        Self { inner, is_terminated }
1196    }
1197}
1198
1199impl futures::Stream for LogSinkPuppetRequestStream {
1200    type Item = Result<LogSinkPuppetRequest, fidl::Error>;
1201
1202    fn poll_next(
1203        mut self: std::pin::Pin<&mut Self>,
1204        cx: &mut std::task::Context<'_>,
1205    ) -> std::task::Poll<Option<Self::Item>> {
1206        let this = &mut *self;
1207        if this.inner.check_shutdown(cx) {
1208            this.is_terminated = true;
1209            return std::task::Poll::Ready(None);
1210        }
1211        if this.is_terminated {
1212            panic!("polled LogSinkPuppetRequestStream after completion");
1213        }
1214        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1215            |bytes, handles| {
1216                match this.inner.channel().read_etc(cx, bytes, handles) {
1217                    std::task::Poll::Ready(Ok(())) => {}
1218                    std::task::Poll::Pending => return std::task::Poll::Pending,
1219                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1220                        this.is_terminated = true;
1221                        return std::task::Poll::Ready(None);
1222                    }
1223                    std::task::Poll::Ready(Err(e)) => {
1224                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1225                            e.into(),
1226                        ))));
1227                    }
1228                }
1229
1230                // A message has been received from the channel
1231                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1232
1233                std::task::Poll::Ready(Some(match header.ordinal {
1234                    0x5b1c3dac76c26425 => {
1235                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1236                        let mut req = fidl::new_empty!(
1237                            fidl::encoding::EmptyPayload,
1238                            fidl::encoding::DefaultFuchsiaResourceDialect
1239                        );
1240                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1241                        let control_handle =
1242                            LogSinkPuppetControlHandle { inner: this.inner.clone() };
1243                        Ok(LogSinkPuppetRequest::GetInfo {
1244                            responder: LogSinkPuppetGetInfoResponder {
1245                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1246                                tx_id: header.tx_id,
1247                            },
1248                        })
1249                    }
1250                    0x58b64b6672ed66de => {
1251                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1252                        let mut req = fidl::new_empty!(
1253                            LogSinkPuppetEmitLogRequest,
1254                            fidl::encoding::DefaultFuchsiaResourceDialect
1255                        );
1256                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LogSinkPuppetEmitLogRequest>(&header, _body_bytes, handles, &mut req)?;
1257                        let control_handle =
1258                            LogSinkPuppetControlHandle { inner: this.inner.clone() };
1259                        Ok(LogSinkPuppetRequest::EmitLog {
1260                            spec: req.spec,
1261
1262                            responder: LogSinkPuppetEmitLogResponder {
1263                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1264                                tx_id: header.tx_id,
1265                            },
1266                        })
1267                    }
1268                    _ => Err(fidl::Error::UnknownOrdinal {
1269                        ordinal: header.ordinal,
1270                        protocol_name:
1271                            <LogSinkPuppetMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1272                    }),
1273                }))
1274            },
1275        )
1276    }
1277}
1278
1279#[derive(Debug)]
1280pub enum LogSinkPuppetRequest {
1281    /// Returns the information the puppet knows about itself.
1282    GetInfo { responder: LogSinkPuppetGetInfoResponder },
1283    /// Logs a record.
1284    EmitLog { spec: RecordSpec, responder: LogSinkPuppetEmitLogResponder },
1285}
1286
1287impl LogSinkPuppetRequest {
1288    #[allow(irrefutable_let_patterns)]
1289    pub fn into_get_info(self) -> Option<(LogSinkPuppetGetInfoResponder)> {
1290        if let LogSinkPuppetRequest::GetInfo { responder } = self {
1291            Some((responder))
1292        } else {
1293            None
1294        }
1295    }
1296
1297    #[allow(irrefutable_let_patterns)]
1298    pub fn into_emit_log(self) -> Option<(RecordSpec, LogSinkPuppetEmitLogResponder)> {
1299        if let LogSinkPuppetRequest::EmitLog { spec, responder } = self {
1300            Some((spec, responder))
1301        } else {
1302            None
1303        }
1304    }
1305
1306    /// Name of the method defined in FIDL
1307    pub fn method_name(&self) -> &'static str {
1308        match *self {
1309            LogSinkPuppetRequest::GetInfo { .. } => "get_info",
1310            LogSinkPuppetRequest::EmitLog { .. } => "emit_log",
1311        }
1312    }
1313}
1314
1315#[derive(Debug, Clone)]
1316pub struct LogSinkPuppetControlHandle {
1317    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1318}
1319
1320impl fidl::endpoints::ControlHandle for LogSinkPuppetControlHandle {
1321    fn shutdown(&self) {
1322        self.inner.shutdown()
1323    }
1324    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1325        self.inner.shutdown_with_epitaph(status)
1326    }
1327
1328    fn is_closed(&self) -> bool {
1329        self.inner.channel().is_closed()
1330    }
1331    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1332        self.inner.channel().on_closed()
1333    }
1334
1335    #[cfg(target_os = "fuchsia")]
1336    fn signal_peer(
1337        &self,
1338        clear_mask: zx::Signals,
1339        set_mask: zx::Signals,
1340    ) -> Result<(), zx_status::Status> {
1341        use fidl::Peered;
1342        self.inner.channel().signal_peer(clear_mask, set_mask)
1343    }
1344}
1345
1346impl LogSinkPuppetControlHandle {}
1347
1348#[must_use = "FIDL methods require a response to be sent"]
1349#[derive(Debug)]
1350pub struct LogSinkPuppetGetInfoResponder {
1351    control_handle: std::mem::ManuallyDrop<LogSinkPuppetControlHandle>,
1352    tx_id: u32,
1353}
1354
1355/// Set the the channel to be shutdown (see [`LogSinkPuppetControlHandle::shutdown`])
1356/// if the responder is dropped without sending a response, so that the client
1357/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1358impl std::ops::Drop for LogSinkPuppetGetInfoResponder {
1359    fn drop(&mut self) {
1360        self.control_handle.shutdown();
1361        // Safety: drops once, never accessed again
1362        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1363    }
1364}
1365
1366impl fidl::endpoints::Responder for LogSinkPuppetGetInfoResponder {
1367    type ControlHandle = LogSinkPuppetControlHandle;
1368
1369    fn control_handle(&self) -> &LogSinkPuppetControlHandle {
1370        &self.control_handle
1371    }
1372
1373    fn drop_without_shutdown(mut self) {
1374        // Safety: drops once, never accessed again due to mem::forget
1375        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1376        // Prevent Drop from running (which would shut down the channel)
1377        std::mem::forget(self);
1378    }
1379}
1380
1381impl LogSinkPuppetGetInfoResponder {
1382    /// Sends a response to the FIDL transaction.
1383    ///
1384    /// Sets the channel to shutdown if an error occurs.
1385    pub fn send(self, mut info: &PuppetInfo) -> Result<(), fidl::Error> {
1386        let _result = self.send_raw(info);
1387        if _result.is_err() {
1388            self.control_handle.shutdown();
1389        }
1390        self.drop_without_shutdown();
1391        _result
1392    }
1393
1394    /// Similar to "send" but does not shutdown the channel if an error occurs.
1395    pub fn send_no_shutdown_on_err(self, mut info: &PuppetInfo) -> Result<(), fidl::Error> {
1396        let _result = self.send_raw(info);
1397        self.drop_without_shutdown();
1398        _result
1399    }
1400
1401    fn send_raw(&self, mut info: &PuppetInfo) -> Result<(), fidl::Error> {
1402        self.control_handle.inner.send::<LogSinkPuppetGetInfoResponse>(
1403            (info,),
1404            self.tx_id,
1405            0x5b1c3dac76c26425,
1406            fidl::encoding::DynamicFlags::empty(),
1407        )
1408    }
1409}
1410
1411#[must_use = "FIDL methods require a response to be sent"]
1412#[derive(Debug)]
1413pub struct LogSinkPuppetEmitLogResponder {
1414    control_handle: std::mem::ManuallyDrop<LogSinkPuppetControlHandle>,
1415    tx_id: u32,
1416}
1417
1418/// Set the the channel to be shutdown (see [`LogSinkPuppetControlHandle::shutdown`])
1419/// if the responder is dropped without sending a response, so that the client
1420/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1421impl std::ops::Drop for LogSinkPuppetEmitLogResponder {
1422    fn drop(&mut self) {
1423        self.control_handle.shutdown();
1424        // Safety: drops once, never accessed again
1425        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1426    }
1427}
1428
1429impl fidl::endpoints::Responder for LogSinkPuppetEmitLogResponder {
1430    type ControlHandle = LogSinkPuppetControlHandle;
1431
1432    fn control_handle(&self) -> &LogSinkPuppetControlHandle {
1433        &self.control_handle
1434    }
1435
1436    fn drop_without_shutdown(mut self) {
1437        // Safety: drops once, never accessed again due to mem::forget
1438        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1439        // Prevent Drop from running (which would shut down the channel)
1440        std::mem::forget(self);
1441    }
1442}
1443
1444impl LogSinkPuppetEmitLogResponder {
1445    /// Sends a response to the FIDL transaction.
1446    ///
1447    /// Sets the channel to shutdown if an error occurs.
1448    pub fn send(self) -> Result<(), fidl::Error> {
1449        let _result = self.send_raw();
1450        if _result.is_err() {
1451            self.control_handle.shutdown();
1452        }
1453        self.drop_without_shutdown();
1454        _result
1455    }
1456
1457    /// Similar to "send" but does not shutdown the channel if an error occurs.
1458    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1459        let _result = self.send_raw();
1460        self.drop_without_shutdown();
1461        _result
1462    }
1463
1464    fn send_raw(&self) -> Result<(), fidl::Error> {
1465        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
1466            (),
1467            self.tx_id,
1468            0x58b64b6672ed66de,
1469            fidl::encoding::DynamicFlags::empty(),
1470        )
1471    }
1472}
1473
1474#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1475pub struct ValidateResultsIteratorMarker;
1476
1477impl fidl::endpoints::ProtocolMarker for ValidateResultsIteratorMarker {
1478    type Proxy = ValidateResultsIteratorProxy;
1479    type RequestStream = ValidateResultsIteratorRequestStream;
1480    #[cfg(target_os = "fuchsia")]
1481    type SynchronousProxy = ValidateResultsIteratorSynchronousProxy;
1482
1483    const DEBUG_NAME: &'static str = "(anonymous) ValidateResultsIterator";
1484}
1485
1486pub trait ValidateResultsIteratorProxyInterface: Send + Sync {
1487    type GetNextResponseFut: std::future::Future<Output = Result<ValidateResultsIteratorGetNextResponse, fidl::Error>>
1488        + Send;
1489    fn r#get_next(&self) -> Self::GetNextResponseFut;
1490}
1491#[derive(Debug)]
1492#[cfg(target_os = "fuchsia")]
1493pub struct ValidateResultsIteratorSynchronousProxy {
1494    client: fidl::client::sync::Client,
1495}
1496
1497#[cfg(target_os = "fuchsia")]
1498impl fidl::endpoints::SynchronousProxy for ValidateResultsIteratorSynchronousProxy {
1499    type Proxy = ValidateResultsIteratorProxy;
1500    type Protocol = ValidateResultsIteratorMarker;
1501
1502    fn from_channel(inner: fidl::Channel) -> Self {
1503        Self::new(inner)
1504    }
1505
1506    fn into_channel(self) -> fidl::Channel {
1507        self.client.into_channel()
1508    }
1509
1510    fn as_channel(&self) -> &fidl::Channel {
1511        self.client.as_channel()
1512    }
1513}
1514
1515#[cfg(target_os = "fuchsia")]
1516impl ValidateResultsIteratorSynchronousProxy {
1517    pub fn new(channel: fidl::Channel) -> Self {
1518        let protocol_name =
1519            <ValidateResultsIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1520        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1521    }
1522
1523    pub fn into_channel(self) -> fidl::Channel {
1524        self.client.into_channel()
1525    }
1526
1527    /// Waits until an event arrives and returns it. It is safe for other
1528    /// threads to make concurrent requests while waiting for an event.
1529    pub fn wait_for_event(
1530        &self,
1531        deadline: zx::MonotonicInstant,
1532    ) -> Result<ValidateResultsIteratorEvent, fidl::Error> {
1533        ValidateResultsIteratorEvent::decode(self.client.wait_for_event(deadline)?)
1534    }
1535
1536    /// Returns the result of a test case execution.
1537    pub fn r#get_next(
1538        &self,
1539        ___deadline: zx::MonotonicInstant,
1540    ) -> Result<ValidateResultsIteratorGetNextResponse, fidl::Error> {
1541        let _response = self
1542            .client
1543            .send_query::<fidl::encoding::EmptyPayload, ValidateResultsIteratorGetNextResponse>(
1544                (),
1545                0x1b1573e93311e8b7,
1546                fidl::encoding::DynamicFlags::empty(),
1547                ___deadline,
1548            )?;
1549        Ok(_response)
1550    }
1551}
1552
1553#[cfg(target_os = "fuchsia")]
1554impl From<ValidateResultsIteratorSynchronousProxy> for zx::Handle {
1555    fn from(value: ValidateResultsIteratorSynchronousProxy) -> Self {
1556        value.into_channel().into()
1557    }
1558}
1559
1560#[cfg(target_os = "fuchsia")]
1561impl From<fidl::Channel> for ValidateResultsIteratorSynchronousProxy {
1562    fn from(value: fidl::Channel) -> Self {
1563        Self::new(value)
1564    }
1565}
1566
1567#[cfg(target_os = "fuchsia")]
1568impl fidl::endpoints::FromClient for ValidateResultsIteratorSynchronousProxy {
1569    type Protocol = ValidateResultsIteratorMarker;
1570
1571    fn from_client(value: fidl::endpoints::ClientEnd<ValidateResultsIteratorMarker>) -> Self {
1572        Self::new(value.into_channel())
1573    }
1574}
1575
1576#[derive(Debug, Clone)]
1577pub struct ValidateResultsIteratorProxy {
1578    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1579}
1580
1581impl fidl::endpoints::Proxy for ValidateResultsIteratorProxy {
1582    type Protocol = ValidateResultsIteratorMarker;
1583
1584    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1585        Self::new(inner)
1586    }
1587
1588    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1589        self.client.into_channel().map_err(|client| Self { client })
1590    }
1591
1592    fn as_channel(&self) -> &::fidl::AsyncChannel {
1593        self.client.as_channel()
1594    }
1595}
1596
1597impl ValidateResultsIteratorProxy {
1598    /// Create a new Proxy for fuchsia.validate.logs/ValidateResultsIterator.
1599    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1600        let protocol_name =
1601            <ValidateResultsIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1602        Self { client: fidl::client::Client::new(channel, protocol_name) }
1603    }
1604
1605    /// Get a Stream of events from the remote end of the protocol.
1606    ///
1607    /// # Panics
1608    ///
1609    /// Panics if the event stream was already taken.
1610    pub fn take_event_stream(&self) -> ValidateResultsIteratorEventStream {
1611        ValidateResultsIteratorEventStream { event_receiver: self.client.take_event_receiver() }
1612    }
1613
1614    /// Returns the result of a test case execution.
1615    pub fn r#get_next(
1616        &self,
1617    ) -> fidl::client::QueryResponseFut<
1618        ValidateResultsIteratorGetNextResponse,
1619        fidl::encoding::DefaultFuchsiaResourceDialect,
1620    > {
1621        ValidateResultsIteratorProxyInterface::r#get_next(self)
1622    }
1623}
1624
1625impl ValidateResultsIteratorProxyInterface for ValidateResultsIteratorProxy {
1626    type GetNextResponseFut = fidl::client::QueryResponseFut<
1627        ValidateResultsIteratorGetNextResponse,
1628        fidl::encoding::DefaultFuchsiaResourceDialect,
1629    >;
1630    fn r#get_next(&self) -> Self::GetNextResponseFut {
1631        fn _decode(
1632            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1633        ) -> Result<ValidateResultsIteratorGetNextResponse, fidl::Error> {
1634            let _response = fidl::client::decode_transaction_body::<
1635                ValidateResultsIteratorGetNextResponse,
1636                fidl::encoding::DefaultFuchsiaResourceDialect,
1637                0x1b1573e93311e8b7,
1638            >(_buf?)?;
1639            Ok(_response)
1640        }
1641        self.client.send_query_and_decode::<
1642            fidl::encoding::EmptyPayload,
1643            ValidateResultsIteratorGetNextResponse,
1644        >(
1645            (),
1646            0x1b1573e93311e8b7,
1647            fidl::encoding::DynamicFlags::empty(),
1648            _decode,
1649        )
1650    }
1651}
1652
1653pub struct ValidateResultsIteratorEventStream {
1654    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1655}
1656
1657impl std::marker::Unpin for ValidateResultsIteratorEventStream {}
1658
1659impl futures::stream::FusedStream for ValidateResultsIteratorEventStream {
1660    fn is_terminated(&self) -> bool {
1661        self.event_receiver.is_terminated()
1662    }
1663}
1664
1665impl futures::Stream for ValidateResultsIteratorEventStream {
1666    type Item = Result<ValidateResultsIteratorEvent, fidl::Error>;
1667
1668    fn poll_next(
1669        mut self: std::pin::Pin<&mut Self>,
1670        cx: &mut std::task::Context<'_>,
1671    ) -> std::task::Poll<Option<Self::Item>> {
1672        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1673            &mut self.event_receiver,
1674            cx
1675        )?) {
1676            Some(buf) => std::task::Poll::Ready(Some(ValidateResultsIteratorEvent::decode(buf))),
1677            None => std::task::Poll::Ready(None),
1678        }
1679    }
1680}
1681
1682#[derive(Debug)]
1683pub enum ValidateResultsIteratorEvent {}
1684
1685impl ValidateResultsIteratorEvent {
1686    /// Decodes a message buffer as a [`ValidateResultsIteratorEvent`].
1687    fn decode(
1688        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1689    ) -> Result<ValidateResultsIteratorEvent, fidl::Error> {
1690        let (bytes, _handles) = buf.split_mut();
1691        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1692        debug_assert_eq!(tx_header.tx_id, 0);
1693        match tx_header.ordinal {
1694            _ => Err(fidl::Error::UnknownOrdinal {
1695                ordinal: tx_header.ordinal,
1696                protocol_name:
1697                    <ValidateResultsIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1698            }),
1699        }
1700    }
1701}
1702
1703/// A Stream of incoming requests for fuchsia.validate.logs/ValidateResultsIterator.
1704pub struct ValidateResultsIteratorRequestStream {
1705    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1706    is_terminated: bool,
1707}
1708
1709impl std::marker::Unpin for ValidateResultsIteratorRequestStream {}
1710
1711impl futures::stream::FusedStream for ValidateResultsIteratorRequestStream {
1712    fn is_terminated(&self) -> bool {
1713        self.is_terminated
1714    }
1715}
1716
1717impl fidl::endpoints::RequestStream for ValidateResultsIteratorRequestStream {
1718    type Protocol = ValidateResultsIteratorMarker;
1719    type ControlHandle = ValidateResultsIteratorControlHandle;
1720
1721    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1722        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1723    }
1724
1725    fn control_handle(&self) -> Self::ControlHandle {
1726        ValidateResultsIteratorControlHandle { inner: self.inner.clone() }
1727    }
1728
1729    fn into_inner(
1730        self,
1731    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1732    {
1733        (self.inner, self.is_terminated)
1734    }
1735
1736    fn from_inner(
1737        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1738        is_terminated: bool,
1739    ) -> Self {
1740        Self { inner, is_terminated }
1741    }
1742}
1743
1744impl futures::Stream for ValidateResultsIteratorRequestStream {
1745    type Item = Result<ValidateResultsIteratorRequest, fidl::Error>;
1746
1747    fn poll_next(
1748        mut self: std::pin::Pin<&mut Self>,
1749        cx: &mut std::task::Context<'_>,
1750    ) -> std::task::Poll<Option<Self::Item>> {
1751        let this = &mut *self;
1752        if this.inner.check_shutdown(cx) {
1753            this.is_terminated = true;
1754            return std::task::Poll::Ready(None);
1755        }
1756        if this.is_terminated {
1757            panic!("polled ValidateResultsIteratorRequestStream after completion");
1758        }
1759        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1760            |bytes, handles| {
1761                match this.inner.channel().read_etc(cx, bytes, handles) {
1762                    std::task::Poll::Ready(Ok(())) => {}
1763                    std::task::Poll::Pending => return std::task::Poll::Pending,
1764                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1765                        this.is_terminated = true;
1766                        return std::task::Poll::Ready(None);
1767                    }
1768                    std::task::Poll::Ready(Err(e)) => {
1769                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1770                            e.into(),
1771                        ))));
1772                    }
1773                }
1774
1775                // A message has been received from the channel
1776                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1777
1778                std::task::Poll::Ready(Some(match header.ordinal {
1779                0x1b1573e93311e8b7 => {
1780                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1781                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
1782                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1783                    let control_handle = ValidateResultsIteratorControlHandle {
1784                        inner: this.inner.clone(),
1785                    };
1786                    Ok(ValidateResultsIteratorRequest::GetNext {
1787                        responder: ValidateResultsIteratorGetNextResponder {
1788                            control_handle: std::mem::ManuallyDrop::new(control_handle),
1789                            tx_id: header.tx_id,
1790                        },
1791                    })
1792                }
1793                _ => Err(fidl::Error::UnknownOrdinal {
1794                    ordinal: header.ordinal,
1795                    protocol_name: <ValidateResultsIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1796                }),
1797            }))
1798            },
1799        )
1800    }
1801}
1802
1803#[derive(Debug)]
1804pub enum ValidateResultsIteratorRequest {
1805    /// Returns the result of a test case execution.
1806    GetNext { responder: ValidateResultsIteratorGetNextResponder },
1807}
1808
1809impl ValidateResultsIteratorRequest {
1810    #[allow(irrefutable_let_patterns)]
1811    pub fn into_get_next(self) -> Option<(ValidateResultsIteratorGetNextResponder)> {
1812        if let ValidateResultsIteratorRequest::GetNext { responder } = self {
1813            Some((responder))
1814        } else {
1815            None
1816        }
1817    }
1818
1819    /// Name of the method defined in FIDL
1820    pub fn method_name(&self) -> &'static str {
1821        match *self {
1822            ValidateResultsIteratorRequest::GetNext { .. } => "get_next",
1823        }
1824    }
1825}
1826
1827#[derive(Debug, Clone)]
1828pub struct ValidateResultsIteratorControlHandle {
1829    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1830}
1831
1832impl fidl::endpoints::ControlHandle for ValidateResultsIteratorControlHandle {
1833    fn shutdown(&self) {
1834        self.inner.shutdown()
1835    }
1836    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1837        self.inner.shutdown_with_epitaph(status)
1838    }
1839
1840    fn is_closed(&self) -> bool {
1841        self.inner.channel().is_closed()
1842    }
1843    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1844        self.inner.channel().on_closed()
1845    }
1846
1847    #[cfg(target_os = "fuchsia")]
1848    fn signal_peer(
1849        &self,
1850        clear_mask: zx::Signals,
1851        set_mask: zx::Signals,
1852    ) -> Result<(), zx_status::Status> {
1853        use fidl::Peered;
1854        self.inner.channel().signal_peer(clear_mask, set_mask)
1855    }
1856}
1857
1858impl ValidateResultsIteratorControlHandle {}
1859
1860#[must_use = "FIDL methods require a response to be sent"]
1861#[derive(Debug)]
1862pub struct ValidateResultsIteratorGetNextResponder {
1863    control_handle: std::mem::ManuallyDrop<ValidateResultsIteratorControlHandle>,
1864    tx_id: u32,
1865}
1866
1867/// Set the the channel to be shutdown (see [`ValidateResultsIteratorControlHandle::shutdown`])
1868/// if the responder is dropped without sending a response, so that the client
1869/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1870impl std::ops::Drop for ValidateResultsIteratorGetNextResponder {
1871    fn drop(&mut self) {
1872        self.control_handle.shutdown();
1873        // Safety: drops once, never accessed again
1874        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1875    }
1876}
1877
1878impl fidl::endpoints::Responder for ValidateResultsIteratorGetNextResponder {
1879    type ControlHandle = ValidateResultsIteratorControlHandle;
1880
1881    fn control_handle(&self) -> &ValidateResultsIteratorControlHandle {
1882        &self.control_handle
1883    }
1884
1885    fn drop_without_shutdown(mut self) {
1886        // Safety: drops once, never accessed again due to mem::forget
1887        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1888        // Prevent Drop from running (which would shut down the channel)
1889        std::mem::forget(self);
1890    }
1891}
1892
1893impl ValidateResultsIteratorGetNextResponder {
1894    /// Sends a response to the FIDL transaction.
1895    ///
1896    /// Sets the channel to shutdown if an error occurs.
1897    pub fn send(
1898        self,
1899        mut payload: ValidateResultsIteratorGetNextResponse,
1900    ) -> Result<(), fidl::Error> {
1901        let _result = self.send_raw(payload);
1902        if _result.is_err() {
1903            self.control_handle.shutdown();
1904        }
1905        self.drop_without_shutdown();
1906        _result
1907    }
1908
1909    /// Similar to "send" but does not shutdown the channel if an error occurs.
1910    pub fn send_no_shutdown_on_err(
1911        self,
1912        mut payload: ValidateResultsIteratorGetNextResponse,
1913    ) -> Result<(), fidl::Error> {
1914        let _result = self.send_raw(payload);
1915        self.drop_without_shutdown();
1916        _result
1917    }
1918
1919    fn send_raw(
1920        &self,
1921        mut payload: ValidateResultsIteratorGetNextResponse,
1922    ) -> Result<(), fidl::Error> {
1923        self.control_handle.inner.send::<ValidateResultsIteratorGetNextResponse>(
1924            &mut payload,
1925            self.tx_id,
1926            0x1b1573e93311e8b7,
1927            fidl::encoding::DynamicFlags::empty(),
1928        )
1929    }
1930}
1931
1932mod internal {
1933    use super::*;
1934
1935    impl fidl::encoding::ResourceTypeMarker for EncodingPuppetEncodeResponse {
1936        type Borrowed<'a> = &'a mut Self;
1937        fn take_or_borrow<'a>(
1938            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1939        ) -> Self::Borrowed<'a> {
1940            value
1941        }
1942    }
1943
1944    unsafe impl fidl::encoding::TypeMarker for EncodingPuppetEncodeResponse {
1945        type Owned = Self;
1946
1947        #[inline(always)]
1948        fn inline_align(_context: fidl::encoding::Context) -> usize {
1949            8
1950        }
1951
1952        #[inline(always)]
1953        fn inline_size(_context: fidl::encoding::Context) -> usize {
1954            16
1955        }
1956    }
1957
1958    unsafe impl
1959        fidl::encoding::Encode<
1960            EncodingPuppetEncodeResponse,
1961            fidl::encoding::DefaultFuchsiaResourceDialect,
1962        > for &mut EncodingPuppetEncodeResponse
1963    {
1964        #[inline]
1965        unsafe fn encode(
1966            self,
1967            encoder: &mut fidl::encoding::Encoder<
1968                '_,
1969                fidl::encoding::DefaultFuchsiaResourceDialect,
1970            >,
1971            offset: usize,
1972            _depth: fidl::encoding::Depth,
1973        ) -> fidl::Result<()> {
1974            encoder.debug_check_bounds::<EncodingPuppetEncodeResponse>(offset);
1975            // Delegate to tuple encoding.
1976            fidl::encoding::Encode::<
1977                EncodingPuppetEncodeResponse,
1978                fidl::encoding::DefaultFuchsiaResourceDialect,
1979            >::encode(
1980                (<fidl_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1981                    &mut self.result,
1982                ),),
1983                encoder,
1984                offset,
1985                _depth,
1986            )
1987        }
1988    }
1989    unsafe impl<
1990        T0: fidl::encoding::Encode<
1991                fidl_fuchsia_mem::Buffer,
1992                fidl::encoding::DefaultFuchsiaResourceDialect,
1993            >,
1994    >
1995        fidl::encoding::Encode<
1996            EncodingPuppetEncodeResponse,
1997            fidl::encoding::DefaultFuchsiaResourceDialect,
1998        > for (T0,)
1999    {
2000        #[inline]
2001        unsafe fn encode(
2002            self,
2003            encoder: &mut fidl::encoding::Encoder<
2004                '_,
2005                fidl::encoding::DefaultFuchsiaResourceDialect,
2006            >,
2007            offset: usize,
2008            depth: fidl::encoding::Depth,
2009        ) -> fidl::Result<()> {
2010            encoder.debug_check_bounds::<EncodingPuppetEncodeResponse>(offset);
2011            // Zero out padding regions. There's no need to apply masks
2012            // because the unmasked parts will be overwritten by fields.
2013            // Write the fields.
2014            self.0.encode(encoder, offset + 0, depth)?;
2015            Ok(())
2016        }
2017    }
2018
2019    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2020        for EncodingPuppetEncodeResponse
2021    {
2022        #[inline(always)]
2023        fn new_empty() -> Self {
2024            Self {
2025                result: fidl::new_empty!(
2026                    fidl_fuchsia_mem::Buffer,
2027                    fidl::encoding::DefaultFuchsiaResourceDialect
2028                ),
2029            }
2030        }
2031
2032        #[inline]
2033        unsafe fn decode(
2034            &mut self,
2035            decoder: &mut fidl::encoding::Decoder<
2036                '_,
2037                fidl::encoding::DefaultFuchsiaResourceDialect,
2038            >,
2039            offset: usize,
2040            _depth: fidl::encoding::Depth,
2041        ) -> fidl::Result<()> {
2042            decoder.debug_check_bounds::<Self>(offset);
2043            // Verify that padding bytes are zero.
2044            fidl::decode!(
2045                fidl_fuchsia_mem::Buffer,
2046                fidl::encoding::DefaultFuchsiaResourceDialect,
2047                &mut self.result,
2048                decoder,
2049                offset + 0,
2050                _depth
2051            )?;
2052            Ok(())
2053        }
2054    }
2055
2056    impl fidl::encoding::ResourceTypeMarker for EncodingValidatorValidateRequest {
2057        type Borrowed<'a> = &'a mut Self;
2058        fn take_or_borrow<'a>(
2059            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2060        ) -> Self::Borrowed<'a> {
2061            value
2062        }
2063    }
2064
2065    unsafe impl fidl::encoding::TypeMarker for EncodingValidatorValidateRequest {
2066        type Owned = Self;
2067
2068        #[inline(always)]
2069        fn inline_align(_context: fidl::encoding::Context) -> usize {
2070            4
2071        }
2072
2073        #[inline(always)]
2074        fn inline_size(_context: fidl::encoding::Context) -> usize {
2075            4
2076        }
2077    }
2078
2079    unsafe impl
2080        fidl::encoding::Encode<
2081            EncodingValidatorValidateRequest,
2082            fidl::encoding::DefaultFuchsiaResourceDialect,
2083        > for &mut EncodingValidatorValidateRequest
2084    {
2085        #[inline]
2086        unsafe fn encode(
2087            self,
2088            encoder: &mut fidl::encoding::Encoder<
2089                '_,
2090                fidl::encoding::DefaultFuchsiaResourceDialect,
2091            >,
2092            offset: usize,
2093            _depth: fidl::encoding::Depth,
2094        ) -> fidl::Result<()> {
2095            encoder.debug_check_bounds::<EncodingValidatorValidateRequest>(offset);
2096            // Delegate to tuple encoding.
2097            fidl::encoding::Encode::<
2098                EncodingValidatorValidateRequest,
2099                fidl::encoding::DefaultFuchsiaResourceDialect,
2100            >::encode(
2101                (<fidl::encoding::Endpoint<
2102                    fidl::endpoints::ServerEnd<ValidateResultsIteratorMarker>,
2103                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2104                    &mut self.results
2105                ),),
2106                encoder,
2107                offset,
2108                _depth,
2109            )
2110        }
2111    }
2112    unsafe impl<
2113        T0: fidl::encoding::Encode<
2114                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ValidateResultsIteratorMarker>>,
2115                fidl::encoding::DefaultFuchsiaResourceDialect,
2116            >,
2117    >
2118        fidl::encoding::Encode<
2119            EncodingValidatorValidateRequest,
2120            fidl::encoding::DefaultFuchsiaResourceDialect,
2121        > for (T0,)
2122    {
2123        #[inline]
2124        unsafe fn encode(
2125            self,
2126            encoder: &mut fidl::encoding::Encoder<
2127                '_,
2128                fidl::encoding::DefaultFuchsiaResourceDialect,
2129            >,
2130            offset: usize,
2131            depth: fidl::encoding::Depth,
2132        ) -> fidl::Result<()> {
2133            encoder.debug_check_bounds::<EncodingValidatorValidateRequest>(offset);
2134            // Zero out padding regions. There's no need to apply masks
2135            // because the unmasked parts will be overwritten by fields.
2136            // Write the fields.
2137            self.0.encode(encoder, offset + 0, depth)?;
2138            Ok(())
2139        }
2140    }
2141
2142    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2143        for EncodingValidatorValidateRequest
2144    {
2145        #[inline(always)]
2146        fn new_empty() -> Self {
2147            Self {
2148                results: fidl::new_empty!(
2149                    fidl::encoding::Endpoint<
2150                        fidl::endpoints::ServerEnd<ValidateResultsIteratorMarker>,
2151                    >,
2152                    fidl::encoding::DefaultFuchsiaResourceDialect
2153                ),
2154            }
2155        }
2156
2157        #[inline]
2158        unsafe fn decode(
2159            &mut self,
2160            decoder: &mut fidl::encoding::Decoder<
2161                '_,
2162                fidl::encoding::DefaultFuchsiaResourceDialect,
2163            >,
2164            offset: usize,
2165            _depth: fidl::encoding::Depth,
2166        ) -> fidl::Result<()> {
2167            decoder.debug_check_bounds::<Self>(offset);
2168            // Verify that padding bytes are zero.
2169            fidl::decode!(
2170                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ValidateResultsIteratorMarker>>,
2171                fidl::encoding::DefaultFuchsiaResourceDialect,
2172                &mut self.results,
2173                decoder,
2174                offset + 0,
2175                _depth
2176            )?;
2177            Ok(())
2178        }
2179    }
2180
2181    impl ValidateResultsIteratorGetNextResponse {
2182        #[inline(always)]
2183        fn max_ordinal_present(&self) -> u64 {
2184            if let Some(_) = self.result {
2185                return 1;
2186            }
2187            0
2188        }
2189    }
2190
2191    impl fidl::encoding::ResourceTypeMarker for ValidateResultsIteratorGetNextResponse {
2192        type Borrowed<'a> = &'a mut Self;
2193        fn take_or_borrow<'a>(
2194            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2195        ) -> Self::Borrowed<'a> {
2196            value
2197        }
2198    }
2199
2200    unsafe impl fidl::encoding::TypeMarker for ValidateResultsIteratorGetNextResponse {
2201        type Owned = Self;
2202
2203        #[inline(always)]
2204        fn inline_align(_context: fidl::encoding::Context) -> usize {
2205            8
2206        }
2207
2208        #[inline(always)]
2209        fn inline_size(_context: fidl::encoding::Context) -> usize {
2210            16
2211        }
2212    }
2213
2214    unsafe impl
2215        fidl::encoding::Encode<
2216            ValidateResultsIteratorGetNextResponse,
2217            fidl::encoding::DefaultFuchsiaResourceDialect,
2218        > for &mut ValidateResultsIteratorGetNextResponse
2219    {
2220        unsafe fn encode(
2221            self,
2222            encoder: &mut fidl::encoding::Encoder<
2223                '_,
2224                fidl::encoding::DefaultFuchsiaResourceDialect,
2225            >,
2226            offset: usize,
2227            mut depth: fidl::encoding::Depth,
2228        ) -> fidl::Result<()> {
2229            encoder.debug_check_bounds::<ValidateResultsIteratorGetNextResponse>(offset);
2230            // Vector header
2231            let max_ordinal: u64 = self.max_ordinal_present();
2232            encoder.write_num(max_ordinal, offset);
2233            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2234            // Calling encoder.out_of_line_offset(0) is not allowed.
2235            if max_ordinal == 0 {
2236                return Ok(());
2237            }
2238            depth.increment()?;
2239            let envelope_size = 8;
2240            let bytes_len = max_ordinal as usize * envelope_size;
2241            #[allow(unused_variables)]
2242            let offset = encoder.out_of_line_offset(bytes_len);
2243            let mut _prev_end_offset: usize = 0;
2244            if 1 > max_ordinal {
2245                return Ok(());
2246            }
2247
2248            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2249            // are envelope_size bytes.
2250            let cur_offset: usize = (1 - 1) * envelope_size;
2251
2252            // Zero reserved fields.
2253            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2254
2255            // Safety:
2256            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2257            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2258            //   envelope_size bytes, there is always sufficient room.
2259            fidl::encoding::encode_in_envelope_optional::<
2260                ValidateResult,
2261                fidl::encoding::DefaultFuchsiaResourceDialect,
2262            >(
2263                self.result
2264                    .as_ref()
2265                    .map(<ValidateResult as fidl::encoding::ValueTypeMarker>::borrow),
2266                encoder,
2267                offset + cur_offset,
2268                depth,
2269            )?;
2270
2271            _prev_end_offset = cur_offset + envelope_size;
2272
2273            Ok(())
2274        }
2275    }
2276
2277    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2278        for ValidateResultsIteratorGetNextResponse
2279    {
2280        #[inline(always)]
2281        fn new_empty() -> Self {
2282            Self::default()
2283        }
2284
2285        unsafe fn decode(
2286            &mut self,
2287            decoder: &mut fidl::encoding::Decoder<
2288                '_,
2289                fidl::encoding::DefaultFuchsiaResourceDialect,
2290            >,
2291            offset: usize,
2292            mut depth: fidl::encoding::Depth,
2293        ) -> fidl::Result<()> {
2294            decoder.debug_check_bounds::<Self>(offset);
2295            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2296                None => return Err(fidl::Error::NotNullable),
2297                Some(len) => len,
2298            };
2299            // Calling decoder.out_of_line_offset(0) is not allowed.
2300            if len == 0 {
2301                return Ok(());
2302            };
2303            depth.increment()?;
2304            let envelope_size = 8;
2305            let bytes_len = len * envelope_size;
2306            let offset = decoder.out_of_line_offset(bytes_len)?;
2307            // Decode the envelope for each type.
2308            let mut _next_ordinal_to_read = 0;
2309            let mut next_offset = offset;
2310            let end_offset = offset + bytes_len;
2311            _next_ordinal_to_read += 1;
2312            if next_offset >= end_offset {
2313                return Ok(());
2314            }
2315
2316            // Decode unknown envelopes for gaps in ordinals.
2317            while _next_ordinal_to_read < 1 {
2318                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2319                _next_ordinal_to_read += 1;
2320                next_offset += envelope_size;
2321            }
2322
2323            let next_out_of_line = decoder.next_out_of_line();
2324            let handles_before = decoder.remaining_handles();
2325            if let Some((inlined, num_bytes, num_handles)) =
2326                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2327            {
2328                let member_inline_size =
2329                    <ValidateResult as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2330                if inlined != (member_inline_size <= 4) {
2331                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2332                }
2333                let inner_offset;
2334                let mut inner_depth = depth.clone();
2335                if inlined {
2336                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2337                    inner_offset = next_offset;
2338                } else {
2339                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2340                    inner_depth.increment()?;
2341                }
2342                let val_ref = self.result.get_or_insert_with(|| {
2343                    fidl::new_empty!(ValidateResult, fidl::encoding::DefaultFuchsiaResourceDialect)
2344                });
2345                fidl::decode!(
2346                    ValidateResult,
2347                    fidl::encoding::DefaultFuchsiaResourceDialect,
2348                    val_ref,
2349                    decoder,
2350                    inner_offset,
2351                    inner_depth
2352                )?;
2353                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2354                {
2355                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2356                }
2357                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2358                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2359                }
2360            }
2361
2362            next_offset += envelope_size;
2363
2364            // Decode the remaining unknown envelopes.
2365            while next_offset < end_offset {
2366                _next_ordinal_to_read += 1;
2367                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2368                next_offset += envelope_size;
2369            }
2370
2371            Ok(())
2372        }
2373    }
2374}