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