Skip to main content

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