fidl_fuchsia_archivist_test/
fidl_fuchsia_archivist_test.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_archivist_test__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct InspectPuppetCreateInspectorFromEscrowResponse {
16    pub writer: fidl::endpoints::ClientEnd<InspectWriterMarker>,
17    pub data: fidl::Vmo,
18}
19
20impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
21    for InspectPuppetCreateInspectorFromEscrowResponse
22{
23}
24
25#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
26pub struct InspectPuppetCreateInspectorResponse {
27    pub writer: fidl::endpoints::ClientEnd<InspectWriterMarker>,
28}
29
30impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
31    for InspectPuppetCreateInspectorResponse
32{
33}
34
35#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
36pub struct InspectWriterRecordLazyValuesResponse {
37    pub client: fidl::endpoints::ClientEnd<LazyInspectPuppetMarker>,
38}
39
40impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
41    for InspectWriterRecordLazyValuesResponse
42{
43}
44
45#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
46pub struct PuppetRecordLazyValuesResponse {
47    pub client: fidl::endpoints::ClientEnd<LazyInspectPuppetMarker>,
48}
49
50impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
51    for PuppetRecordLazyValuesResponse
52{
53}
54
55#[derive(Debug, PartialEq)]
56pub struct RealmFactoryCreateRealmRequest {
57    pub options: RealmOptions,
58    pub realm_server: fidl::endpoints::ServerEnd<fidl_fuchsia_testing_harness::RealmProxy_Marker>,
59}
60
61impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
62    for RealmFactoryCreateRealmRequest
63{
64}
65
66#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
67pub struct StopWatcherWatchComponentResponse {
68    pub client: fidl::endpoints::ClientEnd<StopWaiterMarker>,
69}
70
71impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
72    for StopWatcherWatchComponentResponse
73{
74}
75
76#[derive(Debug, Default, PartialEq)]
77pub struct InspectPuppetCreateInspectorFromEscrowRequest {
78    pub token: Option<fidl_fuchsia_inspect::EscrowToken>,
79    #[doc(hidden)]
80    pub __source_breaking: fidl::marker::SourceBreaking,
81}
82
83impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
84    for InspectPuppetCreateInspectorFromEscrowRequest
85{
86}
87
88#[derive(Debug, Default, PartialEq)]
89pub struct InspectWriterEscrowAndExitResponse {
90    pub token: Option<fidl_fuchsia_inspect::EscrowToken>,
91    #[doc(hidden)]
92    pub __source_breaking: fidl::marker::SourceBreaking,
93}
94
95impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
96    for InspectWriterEscrowAndExitResponse
97{
98}
99
100#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
101pub struct InspectPuppetMarker;
102
103impl fidl::endpoints::ProtocolMarker for InspectPuppetMarker {
104    type Proxy = InspectPuppetProxy;
105    type RequestStream = InspectPuppetRequestStream;
106    #[cfg(target_os = "fuchsia")]
107    type SynchronousProxy = InspectPuppetSynchronousProxy;
108
109    const DEBUG_NAME: &'static str = "fuchsia.archivist.test.InspectPuppet";
110}
111impl fidl::endpoints::DiscoverableProtocolMarker for InspectPuppetMarker {}
112
113pub trait InspectPuppetProxyInterface: Send + Sync {
114    type CreateInspectorResponseFut: std::future::Future<
115            Output = Result<fidl::endpoints::ClientEnd<InspectWriterMarker>, fidl::Error>,
116        > + Send;
117    fn r#create_inspector(
118        &self,
119        payload: &InspectPuppetCreateInspectorRequest,
120    ) -> Self::CreateInspectorResponseFut;
121    type CreateInspectorFromEscrowResponseFut: std::future::Future<
122            Output = Result<
123                (fidl::endpoints::ClientEnd<InspectWriterMarker>, fidl::Vmo),
124                fidl::Error,
125            >,
126        > + Send;
127    fn r#create_inspector_from_escrow(
128        &self,
129        payload: InspectPuppetCreateInspectorFromEscrowRequest,
130    ) -> Self::CreateInspectorFromEscrowResponseFut;
131}
132#[derive(Debug)]
133#[cfg(target_os = "fuchsia")]
134pub struct InspectPuppetSynchronousProxy {
135    client: fidl::client::sync::Client,
136}
137
138#[cfg(target_os = "fuchsia")]
139impl fidl::endpoints::SynchronousProxy for InspectPuppetSynchronousProxy {
140    type Proxy = InspectPuppetProxy;
141    type Protocol = InspectPuppetMarker;
142
143    fn from_channel(inner: fidl::Channel) -> Self {
144        Self::new(inner)
145    }
146
147    fn into_channel(self) -> fidl::Channel {
148        self.client.into_channel()
149    }
150
151    fn as_channel(&self) -> &fidl::Channel {
152        self.client.as_channel()
153    }
154}
155
156#[cfg(target_os = "fuchsia")]
157impl InspectPuppetSynchronousProxy {
158    pub fn new(channel: fidl::Channel) -> Self {
159        let protocol_name = <InspectPuppetMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
160        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
161    }
162
163    pub fn into_channel(self) -> fidl::Channel {
164        self.client.into_channel()
165    }
166
167    /// Waits until an event arrives and returns it. It is safe for other
168    /// threads to make concurrent requests while waiting for an event.
169    pub fn wait_for_event(
170        &self,
171        deadline: zx::MonotonicInstant,
172    ) -> Result<InspectPuppetEvent, fidl::Error> {
173        InspectPuppetEvent::decode(self.client.wait_for_event(deadline)?)
174    }
175
176    /// Create and serve an Inspector with the provided name.
177    /// InspectWriters created this way are RAII.
178    pub fn r#create_inspector(
179        &self,
180        mut payload: &InspectPuppetCreateInspectorRequest,
181        ___deadline: zx::MonotonicInstant,
182    ) -> Result<fidl::endpoints::ClientEnd<InspectWriterMarker>, fidl::Error> {
183        let _response = self.client.send_query::<
184            InspectPuppetCreateInspectorRequest,
185            fidl::encoding::FlexibleType<InspectPuppetCreateInspectorResponse>,
186        >(
187            payload,
188            0x2c0f807d7d159bb,
189            fidl::encoding::DynamicFlags::FLEXIBLE,
190            ___deadline,
191        )?
192        .into_result::<InspectPuppetMarker>("create_inspector")?;
193        Ok(_response.writer)
194    }
195
196    /// Create and serve an Inspector with the same name as a previous escrowed instance.
197    /// Also returns a VMO with the previously escrowed inspect data.
198    /// InspectWriters created this way are RAII.
199    pub fn r#create_inspector_from_escrow(
200        &self,
201        mut payload: InspectPuppetCreateInspectorFromEscrowRequest,
202        ___deadline: zx::MonotonicInstant,
203    ) -> Result<(fidl::endpoints::ClientEnd<InspectWriterMarker>, fidl::Vmo), fidl::Error> {
204        let _response = self.client.send_query::<
205            InspectPuppetCreateInspectorFromEscrowRequest,
206            fidl::encoding::FlexibleType<InspectPuppetCreateInspectorFromEscrowResponse>,
207        >(
208            &mut payload,
209            0xe79c0d0606c5df,
210            fidl::encoding::DynamicFlags::FLEXIBLE,
211            ___deadline,
212        )?
213        .into_result::<InspectPuppetMarker>("create_inspector_from_escrow")?;
214        Ok((_response.writer, _response.data))
215    }
216}
217
218#[cfg(target_os = "fuchsia")]
219impl From<InspectPuppetSynchronousProxy> for zx::NullableHandle {
220    fn from(value: InspectPuppetSynchronousProxy) -> Self {
221        value.into_channel().into()
222    }
223}
224
225#[cfg(target_os = "fuchsia")]
226impl From<fidl::Channel> for InspectPuppetSynchronousProxy {
227    fn from(value: fidl::Channel) -> Self {
228        Self::new(value)
229    }
230}
231
232#[cfg(target_os = "fuchsia")]
233impl fidl::endpoints::FromClient for InspectPuppetSynchronousProxy {
234    type Protocol = InspectPuppetMarker;
235
236    fn from_client(value: fidl::endpoints::ClientEnd<InspectPuppetMarker>) -> Self {
237        Self::new(value.into_channel())
238    }
239}
240
241#[derive(Debug, Clone)]
242pub struct InspectPuppetProxy {
243    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
244}
245
246impl fidl::endpoints::Proxy for InspectPuppetProxy {
247    type Protocol = InspectPuppetMarker;
248
249    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
250        Self::new(inner)
251    }
252
253    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
254        self.client.into_channel().map_err(|client| Self { client })
255    }
256
257    fn as_channel(&self) -> &::fidl::AsyncChannel {
258        self.client.as_channel()
259    }
260}
261
262impl InspectPuppetProxy {
263    /// Create a new Proxy for fuchsia.archivist.test/InspectPuppet.
264    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
265        let protocol_name = <InspectPuppetMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
266        Self { client: fidl::client::Client::new(channel, protocol_name) }
267    }
268
269    /// Get a Stream of events from the remote end of the protocol.
270    ///
271    /// # Panics
272    ///
273    /// Panics if the event stream was already taken.
274    pub fn take_event_stream(&self) -> InspectPuppetEventStream {
275        InspectPuppetEventStream { event_receiver: self.client.take_event_receiver() }
276    }
277
278    /// Create and serve an Inspector with the provided name.
279    /// InspectWriters created this way are RAII.
280    pub fn r#create_inspector(
281        &self,
282        mut payload: &InspectPuppetCreateInspectorRequest,
283    ) -> fidl::client::QueryResponseFut<
284        fidl::endpoints::ClientEnd<InspectWriterMarker>,
285        fidl::encoding::DefaultFuchsiaResourceDialect,
286    > {
287        InspectPuppetProxyInterface::r#create_inspector(self, payload)
288    }
289
290    /// Create and serve an Inspector with the same name as a previous escrowed instance.
291    /// Also returns a VMO with the previously escrowed inspect data.
292    /// InspectWriters created this way are RAII.
293    pub fn r#create_inspector_from_escrow(
294        &self,
295        mut payload: InspectPuppetCreateInspectorFromEscrowRequest,
296    ) -> fidl::client::QueryResponseFut<
297        (fidl::endpoints::ClientEnd<InspectWriterMarker>, fidl::Vmo),
298        fidl::encoding::DefaultFuchsiaResourceDialect,
299    > {
300        InspectPuppetProxyInterface::r#create_inspector_from_escrow(self, payload)
301    }
302}
303
304impl InspectPuppetProxyInterface for InspectPuppetProxy {
305    type CreateInspectorResponseFut = fidl::client::QueryResponseFut<
306        fidl::endpoints::ClientEnd<InspectWriterMarker>,
307        fidl::encoding::DefaultFuchsiaResourceDialect,
308    >;
309    fn r#create_inspector(
310        &self,
311        mut payload: &InspectPuppetCreateInspectorRequest,
312    ) -> Self::CreateInspectorResponseFut {
313        fn _decode(
314            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
315        ) -> Result<fidl::endpoints::ClientEnd<InspectWriterMarker>, fidl::Error> {
316            let _response = fidl::client::decode_transaction_body::<
317                fidl::encoding::FlexibleType<InspectPuppetCreateInspectorResponse>,
318                fidl::encoding::DefaultFuchsiaResourceDialect,
319                0x2c0f807d7d159bb,
320            >(_buf?)?
321            .into_result::<InspectPuppetMarker>("create_inspector")?;
322            Ok(_response.writer)
323        }
324        self.client.send_query_and_decode::<
325            InspectPuppetCreateInspectorRequest,
326            fidl::endpoints::ClientEnd<InspectWriterMarker>,
327        >(
328            payload,
329            0x2c0f807d7d159bb,
330            fidl::encoding::DynamicFlags::FLEXIBLE,
331            _decode,
332        )
333    }
334
335    type CreateInspectorFromEscrowResponseFut = fidl::client::QueryResponseFut<
336        (fidl::endpoints::ClientEnd<InspectWriterMarker>, fidl::Vmo),
337        fidl::encoding::DefaultFuchsiaResourceDialect,
338    >;
339    fn r#create_inspector_from_escrow(
340        &self,
341        mut payload: InspectPuppetCreateInspectorFromEscrowRequest,
342    ) -> Self::CreateInspectorFromEscrowResponseFut {
343        fn _decode(
344            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
345        ) -> Result<(fidl::endpoints::ClientEnd<InspectWriterMarker>, fidl::Vmo), fidl::Error>
346        {
347            let _response = fidl::client::decode_transaction_body::<
348                fidl::encoding::FlexibleType<InspectPuppetCreateInspectorFromEscrowResponse>,
349                fidl::encoding::DefaultFuchsiaResourceDialect,
350                0xe79c0d0606c5df,
351            >(_buf?)?
352            .into_result::<InspectPuppetMarker>("create_inspector_from_escrow")?;
353            Ok((_response.writer, _response.data))
354        }
355        self.client.send_query_and_decode::<
356            InspectPuppetCreateInspectorFromEscrowRequest,
357            (fidl::endpoints::ClientEnd<InspectWriterMarker>, fidl::Vmo),
358        >(
359            &mut payload,
360            0xe79c0d0606c5df,
361            fidl::encoding::DynamicFlags::FLEXIBLE,
362            _decode,
363        )
364    }
365}
366
367pub struct InspectPuppetEventStream {
368    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
369}
370
371impl std::marker::Unpin for InspectPuppetEventStream {}
372
373impl futures::stream::FusedStream for InspectPuppetEventStream {
374    fn is_terminated(&self) -> bool {
375        self.event_receiver.is_terminated()
376    }
377}
378
379impl futures::Stream for InspectPuppetEventStream {
380    type Item = Result<InspectPuppetEvent, fidl::Error>;
381
382    fn poll_next(
383        mut self: std::pin::Pin<&mut Self>,
384        cx: &mut std::task::Context<'_>,
385    ) -> std::task::Poll<Option<Self::Item>> {
386        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
387            &mut self.event_receiver,
388            cx
389        )?) {
390            Some(buf) => std::task::Poll::Ready(Some(InspectPuppetEvent::decode(buf))),
391            None => std::task::Poll::Ready(None),
392        }
393    }
394}
395
396#[derive(Debug)]
397pub enum InspectPuppetEvent {
398    #[non_exhaustive]
399    _UnknownEvent {
400        /// Ordinal of the event that was sent.
401        ordinal: u64,
402    },
403}
404
405impl InspectPuppetEvent {
406    /// Decodes a message buffer as a [`InspectPuppetEvent`].
407    fn decode(
408        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
409    ) -> Result<InspectPuppetEvent, fidl::Error> {
410        let (bytes, _handles) = buf.split_mut();
411        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
412        debug_assert_eq!(tx_header.tx_id, 0);
413        match tx_header.ordinal {
414            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
415                Ok(InspectPuppetEvent::_UnknownEvent { ordinal: tx_header.ordinal })
416            }
417            _ => Err(fidl::Error::UnknownOrdinal {
418                ordinal: tx_header.ordinal,
419                protocol_name: <InspectPuppetMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
420            }),
421        }
422    }
423}
424
425/// A Stream of incoming requests for fuchsia.archivist.test/InspectPuppet.
426pub struct InspectPuppetRequestStream {
427    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
428    is_terminated: bool,
429}
430
431impl std::marker::Unpin for InspectPuppetRequestStream {}
432
433impl futures::stream::FusedStream for InspectPuppetRequestStream {
434    fn is_terminated(&self) -> bool {
435        self.is_terminated
436    }
437}
438
439impl fidl::endpoints::RequestStream for InspectPuppetRequestStream {
440    type Protocol = InspectPuppetMarker;
441    type ControlHandle = InspectPuppetControlHandle;
442
443    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
444        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
445    }
446
447    fn control_handle(&self) -> Self::ControlHandle {
448        InspectPuppetControlHandle { inner: self.inner.clone() }
449    }
450
451    fn into_inner(
452        self,
453    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
454    {
455        (self.inner, self.is_terminated)
456    }
457
458    fn from_inner(
459        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
460        is_terminated: bool,
461    ) -> Self {
462        Self { inner, is_terminated }
463    }
464}
465
466impl futures::Stream for InspectPuppetRequestStream {
467    type Item = Result<InspectPuppetRequest, fidl::Error>;
468
469    fn poll_next(
470        mut self: std::pin::Pin<&mut Self>,
471        cx: &mut std::task::Context<'_>,
472    ) -> std::task::Poll<Option<Self::Item>> {
473        let this = &mut *self;
474        if this.inner.check_shutdown(cx) {
475            this.is_terminated = true;
476            return std::task::Poll::Ready(None);
477        }
478        if this.is_terminated {
479            panic!("polled InspectPuppetRequestStream after completion");
480        }
481        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
482            |bytes, handles| {
483                match this.inner.channel().read_etc(cx, bytes, handles) {
484                    std::task::Poll::Ready(Ok(())) => {}
485                    std::task::Poll::Pending => return std::task::Poll::Pending,
486                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
487                        this.is_terminated = true;
488                        return std::task::Poll::Ready(None);
489                    }
490                    std::task::Poll::Ready(Err(e)) => {
491                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
492                            e.into(),
493                        ))));
494                    }
495                }
496
497                // A message has been received from the channel
498                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
499
500                std::task::Poll::Ready(Some(match header.ordinal {
501                    0x2c0f807d7d159bb => {
502                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
503                        let mut req = fidl::new_empty!(
504                            InspectPuppetCreateInspectorRequest,
505                            fidl::encoding::DefaultFuchsiaResourceDialect
506                        );
507                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InspectPuppetCreateInspectorRequest>(&header, _body_bytes, handles, &mut req)?;
508                        let control_handle =
509                            InspectPuppetControlHandle { inner: this.inner.clone() };
510                        Ok(InspectPuppetRequest::CreateInspector {
511                            payload: req,
512                            responder: InspectPuppetCreateInspectorResponder {
513                                control_handle: std::mem::ManuallyDrop::new(control_handle),
514                                tx_id: header.tx_id,
515                            },
516                        })
517                    }
518                    0xe79c0d0606c5df => {
519                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
520                        let mut req = fidl::new_empty!(
521                            InspectPuppetCreateInspectorFromEscrowRequest,
522                            fidl::encoding::DefaultFuchsiaResourceDialect
523                        );
524                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InspectPuppetCreateInspectorFromEscrowRequest>(&header, _body_bytes, handles, &mut req)?;
525                        let control_handle =
526                            InspectPuppetControlHandle { inner: this.inner.clone() };
527                        Ok(InspectPuppetRequest::CreateInspectorFromEscrow {
528                            payload: req,
529                            responder: InspectPuppetCreateInspectorFromEscrowResponder {
530                                control_handle: std::mem::ManuallyDrop::new(control_handle),
531                                tx_id: header.tx_id,
532                            },
533                        })
534                    }
535                    _ if header.tx_id == 0
536                        && header
537                            .dynamic_flags()
538                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
539                    {
540                        Ok(InspectPuppetRequest::_UnknownMethod {
541                            ordinal: header.ordinal,
542                            control_handle: InspectPuppetControlHandle {
543                                inner: this.inner.clone(),
544                            },
545                            method_type: fidl::MethodType::OneWay,
546                        })
547                    }
548                    _ if header
549                        .dynamic_flags()
550                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
551                    {
552                        this.inner.send_framework_err(
553                            fidl::encoding::FrameworkErr::UnknownMethod,
554                            header.tx_id,
555                            header.ordinal,
556                            header.dynamic_flags(),
557                            (bytes, handles),
558                        )?;
559                        Ok(InspectPuppetRequest::_UnknownMethod {
560                            ordinal: header.ordinal,
561                            control_handle: InspectPuppetControlHandle {
562                                inner: this.inner.clone(),
563                            },
564                            method_type: fidl::MethodType::TwoWay,
565                        })
566                    }
567                    _ => Err(fidl::Error::UnknownOrdinal {
568                        ordinal: header.ordinal,
569                        protocol_name:
570                            <InspectPuppetMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
571                    }),
572                }))
573            },
574        )
575    }
576}
577
578/// InspectPuppet allows creating and serving Inspectors.
579#[derive(Debug)]
580pub enum InspectPuppetRequest {
581    /// Create and serve an Inspector with the provided name.
582    /// InspectWriters created this way are RAII.
583    CreateInspector {
584        payload: InspectPuppetCreateInspectorRequest,
585        responder: InspectPuppetCreateInspectorResponder,
586    },
587    /// Create and serve an Inspector with the same name as a previous escrowed instance.
588    /// Also returns a VMO with the previously escrowed inspect data.
589    /// InspectWriters created this way are RAII.
590    CreateInspectorFromEscrow {
591        payload: InspectPuppetCreateInspectorFromEscrowRequest,
592        responder: InspectPuppetCreateInspectorFromEscrowResponder,
593    },
594    /// An interaction was received which does not match any known method.
595    #[non_exhaustive]
596    _UnknownMethod {
597        /// Ordinal of the method that was called.
598        ordinal: u64,
599        control_handle: InspectPuppetControlHandle,
600        method_type: fidl::MethodType,
601    },
602}
603
604impl InspectPuppetRequest {
605    #[allow(irrefutable_let_patterns)]
606    pub fn into_create_inspector(
607        self,
608    ) -> Option<(InspectPuppetCreateInspectorRequest, InspectPuppetCreateInspectorResponder)> {
609        if let InspectPuppetRequest::CreateInspector { payload, responder } = self {
610            Some((payload, responder))
611        } else {
612            None
613        }
614    }
615
616    #[allow(irrefutable_let_patterns)]
617    pub fn into_create_inspector_from_escrow(
618        self,
619    ) -> Option<(
620        InspectPuppetCreateInspectorFromEscrowRequest,
621        InspectPuppetCreateInspectorFromEscrowResponder,
622    )> {
623        if let InspectPuppetRequest::CreateInspectorFromEscrow { payload, responder } = self {
624            Some((payload, responder))
625        } else {
626            None
627        }
628    }
629
630    /// Name of the method defined in FIDL
631    pub fn method_name(&self) -> &'static str {
632        match *self {
633            InspectPuppetRequest::CreateInspector { .. } => "create_inspector",
634            InspectPuppetRequest::CreateInspectorFromEscrow { .. } => {
635                "create_inspector_from_escrow"
636            }
637            InspectPuppetRequest::_UnknownMethod {
638                method_type: fidl::MethodType::OneWay, ..
639            } => "unknown one-way method",
640            InspectPuppetRequest::_UnknownMethod {
641                method_type: fidl::MethodType::TwoWay, ..
642            } => "unknown two-way method",
643        }
644    }
645}
646
647#[derive(Debug, Clone)]
648pub struct InspectPuppetControlHandle {
649    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
650}
651
652impl fidl::endpoints::ControlHandle for InspectPuppetControlHandle {
653    fn shutdown(&self) {
654        self.inner.shutdown()
655    }
656
657    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
658        self.inner.shutdown_with_epitaph(status)
659    }
660
661    fn is_closed(&self) -> bool {
662        self.inner.channel().is_closed()
663    }
664    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
665        self.inner.channel().on_closed()
666    }
667
668    #[cfg(target_os = "fuchsia")]
669    fn signal_peer(
670        &self,
671        clear_mask: zx::Signals,
672        set_mask: zx::Signals,
673    ) -> Result<(), zx_status::Status> {
674        use fidl::Peered;
675        self.inner.channel().signal_peer(clear_mask, set_mask)
676    }
677}
678
679impl InspectPuppetControlHandle {}
680
681#[must_use = "FIDL methods require a response to be sent"]
682#[derive(Debug)]
683pub struct InspectPuppetCreateInspectorResponder {
684    control_handle: std::mem::ManuallyDrop<InspectPuppetControlHandle>,
685    tx_id: u32,
686}
687
688/// Set the the channel to be shutdown (see [`InspectPuppetControlHandle::shutdown`])
689/// if the responder is dropped without sending a response, so that the client
690/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
691impl std::ops::Drop for InspectPuppetCreateInspectorResponder {
692    fn drop(&mut self) {
693        self.control_handle.shutdown();
694        // Safety: drops once, never accessed again
695        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
696    }
697}
698
699impl fidl::endpoints::Responder for InspectPuppetCreateInspectorResponder {
700    type ControlHandle = InspectPuppetControlHandle;
701
702    fn control_handle(&self) -> &InspectPuppetControlHandle {
703        &self.control_handle
704    }
705
706    fn drop_without_shutdown(mut self) {
707        // Safety: drops once, never accessed again due to mem::forget
708        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
709        // Prevent Drop from running (which would shut down the channel)
710        std::mem::forget(self);
711    }
712}
713
714impl InspectPuppetCreateInspectorResponder {
715    /// Sends a response to the FIDL transaction.
716    ///
717    /// Sets the channel to shutdown if an error occurs.
718    pub fn send(
719        self,
720        mut writer: fidl::endpoints::ClientEnd<InspectWriterMarker>,
721    ) -> Result<(), fidl::Error> {
722        let _result = self.send_raw(writer);
723        if _result.is_err() {
724            self.control_handle.shutdown();
725        }
726        self.drop_without_shutdown();
727        _result
728    }
729
730    /// Similar to "send" but does not shutdown the channel if an error occurs.
731    pub fn send_no_shutdown_on_err(
732        self,
733        mut writer: fidl::endpoints::ClientEnd<InspectWriterMarker>,
734    ) -> Result<(), fidl::Error> {
735        let _result = self.send_raw(writer);
736        self.drop_without_shutdown();
737        _result
738    }
739
740    fn send_raw(
741        &self,
742        mut writer: fidl::endpoints::ClientEnd<InspectWriterMarker>,
743    ) -> Result<(), fidl::Error> {
744        self.control_handle
745            .inner
746            .send::<fidl::encoding::FlexibleType<InspectPuppetCreateInspectorResponse>>(
747                fidl::encoding::Flexible::new((writer,)),
748                self.tx_id,
749                0x2c0f807d7d159bb,
750                fidl::encoding::DynamicFlags::FLEXIBLE,
751            )
752    }
753}
754
755#[must_use = "FIDL methods require a response to be sent"]
756#[derive(Debug)]
757pub struct InspectPuppetCreateInspectorFromEscrowResponder {
758    control_handle: std::mem::ManuallyDrop<InspectPuppetControlHandle>,
759    tx_id: u32,
760}
761
762/// Set the the channel to be shutdown (see [`InspectPuppetControlHandle::shutdown`])
763/// if the responder is dropped without sending a response, so that the client
764/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
765impl std::ops::Drop for InspectPuppetCreateInspectorFromEscrowResponder {
766    fn drop(&mut self) {
767        self.control_handle.shutdown();
768        // Safety: drops once, never accessed again
769        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
770    }
771}
772
773impl fidl::endpoints::Responder for InspectPuppetCreateInspectorFromEscrowResponder {
774    type ControlHandle = InspectPuppetControlHandle;
775
776    fn control_handle(&self) -> &InspectPuppetControlHandle {
777        &self.control_handle
778    }
779
780    fn drop_without_shutdown(mut self) {
781        // Safety: drops once, never accessed again due to mem::forget
782        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
783        // Prevent Drop from running (which would shut down the channel)
784        std::mem::forget(self);
785    }
786}
787
788impl InspectPuppetCreateInspectorFromEscrowResponder {
789    /// Sends a response to the FIDL transaction.
790    ///
791    /// Sets the channel to shutdown if an error occurs.
792    pub fn send(
793        self,
794        mut writer: fidl::endpoints::ClientEnd<InspectWriterMarker>,
795        mut data: fidl::Vmo,
796    ) -> Result<(), fidl::Error> {
797        let _result = self.send_raw(writer, data);
798        if _result.is_err() {
799            self.control_handle.shutdown();
800        }
801        self.drop_without_shutdown();
802        _result
803    }
804
805    /// Similar to "send" but does not shutdown the channel if an error occurs.
806    pub fn send_no_shutdown_on_err(
807        self,
808        mut writer: fidl::endpoints::ClientEnd<InspectWriterMarker>,
809        mut data: fidl::Vmo,
810    ) -> Result<(), fidl::Error> {
811        let _result = self.send_raw(writer, data);
812        self.drop_without_shutdown();
813        _result
814    }
815
816    fn send_raw(
817        &self,
818        mut writer: fidl::endpoints::ClientEnd<InspectWriterMarker>,
819        mut data: fidl::Vmo,
820    ) -> Result<(), fidl::Error> {
821        self.control_handle.inner.send::<fidl::encoding::FlexibleType<
822            InspectPuppetCreateInspectorFromEscrowResponse,
823        >>(
824            fidl::encoding::Flexible::new((writer, data)),
825            self.tx_id,
826            0xe79c0d0606c5df,
827            fidl::encoding::DynamicFlags::FLEXIBLE,
828        )
829    }
830}
831
832#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
833pub struct InspectWriterMarker;
834
835impl fidl::endpoints::ProtocolMarker for InspectWriterMarker {
836    type Proxy = InspectWriterProxy;
837    type RequestStream = InspectWriterRequestStream;
838    #[cfg(target_os = "fuchsia")]
839    type SynchronousProxy = InspectWriterSynchronousProxy;
840
841    const DEBUG_NAME: &'static str = "(anonymous) InspectWriter";
842}
843
844pub trait InspectWriterProxyInterface: Send + Sync {
845    type SetHealthOkResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
846    fn r#set_health_ok(&self) -> Self::SetHealthOkResponseFut;
847    type SetHealthStartingUpResponseFut: std::future::Future<Output = Result<(), fidl::Error>>
848        + Send;
849    fn r#set_health_starting_up(&self) -> Self::SetHealthStartingUpResponseFut;
850    type RecordStringResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
851    fn r#record_string(&self, key: &str, value: &str) -> Self::RecordStringResponseFut;
852    type RecordIntResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
853    fn r#record_int(&self, key: &str, value: i64) -> Self::RecordIntResponseFut;
854    type EmitExampleInspectDataResponseFut: std::future::Future<Output = Result<(), fidl::Error>>
855        + Send;
856    fn r#emit_example_inspect_data(&self) -> Self::EmitExampleInspectDataResponseFut;
857    type EscrowAndExitResponseFut: std::future::Future<Output = Result<InspectWriterEscrowAndExitResponse, fidl::Error>>
858        + Send;
859    fn r#escrow_and_exit(
860        &self,
861        payload: &InspectWriterEscrowAndExitRequest,
862    ) -> Self::EscrowAndExitResponseFut;
863    type RecordLazyValuesResponseFut: std::future::Future<
864            Output = Result<fidl::endpoints::ClientEnd<LazyInspectPuppetMarker>, fidl::Error>,
865        > + Send;
866    fn r#record_lazy_values(&self, key: &str) -> Self::RecordLazyValuesResponseFut;
867}
868#[derive(Debug)]
869#[cfg(target_os = "fuchsia")]
870pub struct InspectWriterSynchronousProxy {
871    client: fidl::client::sync::Client,
872}
873
874#[cfg(target_os = "fuchsia")]
875impl fidl::endpoints::SynchronousProxy for InspectWriterSynchronousProxy {
876    type Proxy = InspectWriterProxy;
877    type Protocol = InspectWriterMarker;
878
879    fn from_channel(inner: fidl::Channel) -> Self {
880        Self::new(inner)
881    }
882
883    fn into_channel(self) -> fidl::Channel {
884        self.client.into_channel()
885    }
886
887    fn as_channel(&self) -> &fidl::Channel {
888        self.client.as_channel()
889    }
890}
891
892#[cfg(target_os = "fuchsia")]
893impl InspectWriterSynchronousProxy {
894    pub fn new(channel: fidl::Channel) -> Self {
895        let protocol_name = <InspectWriterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
896        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
897    }
898
899    pub fn into_channel(self) -> fidl::Channel {
900        self.client.into_channel()
901    }
902
903    /// Waits until an event arrives and returns it. It is safe for other
904    /// threads to make concurrent requests while waiting for an event.
905    pub fn wait_for_event(
906        &self,
907        deadline: zx::MonotonicInstant,
908    ) -> Result<InspectWriterEvent, fidl::Error> {
909        InspectWriterEvent::decode(self.client.wait_for_event(deadline)?)
910    }
911
912    /// Emits a health inspect node with OK status.
913    pub fn r#set_health_ok(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
914        let _response = self.client.send_query::<
915            fidl::encoding::EmptyPayload,
916            fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
917        >(
918            (),
919            0xe7510549d99075e,
920            fidl::encoding::DynamicFlags::FLEXIBLE,
921            ___deadline,
922        )?
923        .into_result::<InspectWriterMarker>("set_health_ok")?;
924        Ok(_response)
925    }
926
927    /// Emits a health inspect node with STARTING_UP status.
928    pub fn r#set_health_starting_up(
929        &self,
930        ___deadline: zx::MonotonicInstant,
931    ) -> Result<(), fidl::Error> {
932        let _response = self.client.send_query::<
933            fidl::encoding::EmptyPayload,
934            fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
935        >(
936            (),
937            0x6a7dbea8c4f52015,
938            fidl::encoding::DynamicFlags::FLEXIBLE,
939            ___deadline,
940        )?
941        .into_result::<InspectWriterMarker>("set_health_starting_up")?;
942        Ok(_response)
943    }
944
945    /// Records a string inspect property.
946    pub fn r#record_string(
947        &self,
948        mut key: &str,
949        mut value: &str,
950        ___deadline: zx::MonotonicInstant,
951    ) -> Result<(), fidl::Error> {
952        let _response = self.client.send_query::<
953            InspectWriterRecordStringRequest,
954            fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
955        >(
956            (key, value,),
957            0x195be230721d712b,
958            fidl::encoding::DynamicFlags::FLEXIBLE,
959            ___deadline,
960        )?
961        .into_result::<InspectWriterMarker>("record_string")?;
962        Ok(_response)
963    }
964
965    /// Records an integer inspect property.
966    pub fn r#record_int(
967        &self,
968        mut key: &str,
969        mut value: i64,
970        ___deadline: zx::MonotonicInstant,
971    ) -> Result<(), fidl::Error> {
972        let _response = self.client.send_query::<
973            InspectWriterRecordIntRequest,
974            fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
975        >(
976            (key, value,),
977            0xa2c6cbf0df0949,
978            fidl::encoding::DynamicFlags::FLEXIBLE,
979            ___deadline,
980        )?
981        .into_result::<InspectWriterMarker>("record_int")?;
982        Ok(_response)
983    }
984
985    /// Emits a collection of example of inspect data.
986    ///
987    /// TODO(https://fuchsia.dev/302716196): Split this into several methods
988    /// tests can call to explicitly emit the same data as this method.
989    pub fn r#emit_example_inspect_data(
990        &self,
991        ___deadline: zx::MonotonicInstant,
992    ) -> Result<(), fidl::Error> {
993        let _response = self.client.send_query::<
994            fidl::encoding::EmptyPayload,
995            fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
996        >(
997            (),
998            0x228ae4647773fd94,
999            fidl::encoding::DynamicFlags::FLEXIBLE,
1000            ___deadline,
1001        )?
1002        .into_result::<InspectWriterMarker>("emit_example_inspect_data")?;
1003        Ok(_response)
1004    }
1005
1006    /// Escrow the current inspect data and immediately exit afterwards.
1007    pub fn r#escrow_and_exit(
1008        &self,
1009        mut payload: &InspectWriterEscrowAndExitRequest,
1010        ___deadline: zx::MonotonicInstant,
1011    ) -> Result<InspectWriterEscrowAndExitResponse, fidl::Error> {
1012        let _response = self.client.send_query::<
1013            InspectWriterEscrowAndExitRequest,
1014            fidl::encoding::FlexibleType<InspectWriterEscrowAndExitResponse>,
1015        >(
1016            payload,
1017            0x60e24adbd0e588ff,
1018            fidl::encoding::DynamicFlags::FLEXIBLE,
1019            ___deadline,
1020        )?
1021        .into_result::<InspectWriterMarker>("escrow_and_exit")?;
1022        Ok(_response)
1023    }
1024
1025    /// Returns a LazyInspectPuppet client for recording lazy values.
1026    pub fn r#record_lazy_values(
1027        &self,
1028        mut key: &str,
1029        ___deadline: zx::MonotonicInstant,
1030    ) -> Result<fidl::endpoints::ClientEnd<LazyInspectPuppetMarker>, fidl::Error> {
1031        let _response = self.client.send_query::<
1032            InspectWriterRecordLazyValuesRequest,
1033            fidl::encoding::FlexibleType<InspectWriterRecordLazyValuesResponse>,
1034        >(
1035            (key,),
1036            0xc637cf5d48e9063,
1037            fidl::encoding::DynamicFlags::FLEXIBLE,
1038            ___deadline,
1039        )?
1040        .into_result::<InspectWriterMarker>("record_lazy_values")?;
1041        Ok(_response.client)
1042    }
1043}
1044
1045#[cfg(target_os = "fuchsia")]
1046impl From<InspectWriterSynchronousProxy> for zx::NullableHandle {
1047    fn from(value: InspectWriterSynchronousProxy) -> Self {
1048        value.into_channel().into()
1049    }
1050}
1051
1052#[cfg(target_os = "fuchsia")]
1053impl From<fidl::Channel> for InspectWriterSynchronousProxy {
1054    fn from(value: fidl::Channel) -> Self {
1055        Self::new(value)
1056    }
1057}
1058
1059#[cfg(target_os = "fuchsia")]
1060impl fidl::endpoints::FromClient for InspectWriterSynchronousProxy {
1061    type Protocol = InspectWriterMarker;
1062
1063    fn from_client(value: fidl::endpoints::ClientEnd<InspectWriterMarker>) -> Self {
1064        Self::new(value.into_channel())
1065    }
1066}
1067
1068#[derive(Debug, Clone)]
1069pub struct InspectWriterProxy {
1070    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1071}
1072
1073impl fidl::endpoints::Proxy for InspectWriterProxy {
1074    type Protocol = InspectWriterMarker;
1075
1076    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1077        Self::new(inner)
1078    }
1079
1080    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1081        self.client.into_channel().map_err(|client| Self { client })
1082    }
1083
1084    fn as_channel(&self) -> &::fidl::AsyncChannel {
1085        self.client.as_channel()
1086    }
1087}
1088
1089impl InspectWriterProxy {
1090    /// Create a new Proxy for fuchsia.archivist.test/InspectWriter.
1091    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1092        let protocol_name = <InspectWriterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1093        Self { client: fidl::client::Client::new(channel, protocol_name) }
1094    }
1095
1096    /// Get a Stream of events from the remote end of the protocol.
1097    ///
1098    /// # Panics
1099    ///
1100    /// Panics if the event stream was already taken.
1101    pub fn take_event_stream(&self) -> InspectWriterEventStream {
1102        InspectWriterEventStream { event_receiver: self.client.take_event_receiver() }
1103    }
1104
1105    /// Emits a health inspect node with OK status.
1106    pub fn r#set_health_ok(
1107        &self,
1108    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
1109        InspectWriterProxyInterface::r#set_health_ok(self)
1110    }
1111
1112    /// Emits a health inspect node with STARTING_UP status.
1113    pub fn r#set_health_starting_up(
1114        &self,
1115    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
1116        InspectWriterProxyInterface::r#set_health_starting_up(self)
1117    }
1118
1119    /// Records a string inspect property.
1120    pub fn r#record_string(
1121        &self,
1122        mut key: &str,
1123        mut value: &str,
1124    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
1125        InspectWriterProxyInterface::r#record_string(self, key, value)
1126    }
1127
1128    /// Records an integer inspect property.
1129    pub fn r#record_int(
1130        &self,
1131        mut key: &str,
1132        mut value: i64,
1133    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
1134        InspectWriterProxyInterface::r#record_int(self, key, value)
1135    }
1136
1137    /// Emits a collection of example of inspect data.
1138    ///
1139    /// TODO(https://fuchsia.dev/302716196): Split this into several methods
1140    /// tests can call to explicitly emit the same data as this method.
1141    pub fn r#emit_example_inspect_data(
1142        &self,
1143    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
1144        InspectWriterProxyInterface::r#emit_example_inspect_data(self)
1145    }
1146
1147    /// Escrow the current inspect data and immediately exit afterwards.
1148    pub fn r#escrow_and_exit(
1149        &self,
1150        mut payload: &InspectWriterEscrowAndExitRequest,
1151    ) -> fidl::client::QueryResponseFut<
1152        InspectWriterEscrowAndExitResponse,
1153        fidl::encoding::DefaultFuchsiaResourceDialect,
1154    > {
1155        InspectWriterProxyInterface::r#escrow_and_exit(self, payload)
1156    }
1157
1158    /// Returns a LazyInspectPuppet client for recording lazy values.
1159    pub fn r#record_lazy_values(
1160        &self,
1161        mut key: &str,
1162    ) -> fidl::client::QueryResponseFut<
1163        fidl::endpoints::ClientEnd<LazyInspectPuppetMarker>,
1164        fidl::encoding::DefaultFuchsiaResourceDialect,
1165    > {
1166        InspectWriterProxyInterface::r#record_lazy_values(self, key)
1167    }
1168}
1169
1170impl InspectWriterProxyInterface for InspectWriterProxy {
1171    type SetHealthOkResponseFut =
1172        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
1173    fn r#set_health_ok(&self) -> Self::SetHealthOkResponseFut {
1174        fn _decode(
1175            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1176        ) -> Result<(), fidl::Error> {
1177            let _response = fidl::client::decode_transaction_body::<
1178                fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
1179                fidl::encoding::DefaultFuchsiaResourceDialect,
1180                0xe7510549d99075e,
1181            >(_buf?)?
1182            .into_result::<InspectWriterMarker>("set_health_ok")?;
1183            Ok(_response)
1184        }
1185        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
1186            (),
1187            0xe7510549d99075e,
1188            fidl::encoding::DynamicFlags::FLEXIBLE,
1189            _decode,
1190        )
1191    }
1192
1193    type SetHealthStartingUpResponseFut =
1194        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
1195    fn r#set_health_starting_up(&self) -> Self::SetHealthStartingUpResponseFut {
1196        fn _decode(
1197            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1198        ) -> Result<(), fidl::Error> {
1199            let _response = fidl::client::decode_transaction_body::<
1200                fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
1201                fidl::encoding::DefaultFuchsiaResourceDialect,
1202                0x6a7dbea8c4f52015,
1203            >(_buf?)?
1204            .into_result::<InspectWriterMarker>("set_health_starting_up")?;
1205            Ok(_response)
1206        }
1207        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
1208            (),
1209            0x6a7dbea8c4f52015,
1210            fidl::encoding::DynamicFlags::FLEXIBLE,
1211            _decode,
1212        )
1213    }
1214
1215    type RecordStringResponseFut =
1216        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
1217    fn r#record_string(&self, mut key: &str, mut value: &str) -> Self::RecordStringResponseFut {
1218        fn _decode(
1219            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1220        ) -> Result<(), fidl::Error> {
1221            let _response = fidl::client::decode_transaction_body::<
1222                fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
1223                fidl::encoding::DefaultFuchsiaResourceDialect,
1224                0x195be230721d712b,
1225            >(_buf?)?
1226            .into_result::<InspectWriterMarker>("record_string")?;
1227            Ok(_response)
1228        }
1229        self.client.send_query_and_decode::<InspectWriterRecordStringRequest, ()>(
1230            (key, value),
1231            0x195be230721d712b,
1232            fidl::encoding::DynamicFlags::FLEXIBLE,
1233            _decode,
1234        )
1235    }
1236
1237    type RecordIntResponseFut =
1238        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
1239    fn r#record_int(&self, mut key: &str, mut value: i64) -> Self::RecordIntResponseFut {
1240        fn _decode(
1241            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1242        ) -> Result<(), fidl::Error> {
1243            let _response = fidl::client::decode_transaction_body::<
1244                fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
1245                fidl::encoding::DefaultFuchsiaResourceDialect,
1246                0xa2c6cbf0df0949,
1247            >(_buf?)?
1248            .into_result::<InspectWriterMarker>("record_int")?;
1249            Ok(_response)
1250        }
1251        self.client.send_query_and_decode::<InspectWriterRecordIntRequest, ()>(
1252            (key, value),
1253            0xa2c6cbf0df0949,
1254            fidl::encoding::DynamicFlags::FLEXIBLE,
1255            _decode,
1256        )
1257    }
1258
1259    type EmitExampleInspectDataResponseFut =
1260        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
1261    fn r#emit_example_inspect_data(&self) -> Self::EmitExampleInspectDataResponseFut {
1262        fn _decode(
1263            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1264        ) -> Result<(), fidl::Error> {
1265            let _response = fidl::client::decode_transaction_body::<
1266                fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
1267                fidl::encoding::DefaultFuchsiaResourceDialect,
1268                0x228ae4647773fd94,
1269            >(_buf?)?
1270            .into_result::<InspectWriterMarker>("emit_example_inspect_data")?;
1271            Ok(_response)
1272        }
1273        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
1274            (),
1275            0x228ae4647773fd94,
1276            fidl::encoding::DynamicFlags::FLEXIBLE,
1277            _decode,
1278        )
1279    }
1280
1281    type EscrowAndExitResponseFut = fidl::client::QueryResponseFut<
1282        InspectWriterEscrowAndExitResponse,
1283        fidl::encoding::DefaultFuchsiaResourceDialect,
1284    >;
1285    fn r#escrow_and_exit(
1286        &self,
1287        mut payload: &InspectWriterEscrowAndExitRequest,
1288    ) -> Self::EscrowAndExitResponseFut {
1289        fn _decode(
1290            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1291        ) -> Result<InspectWriterEscrowAndExitResponse, fidl::Error> {
1292            let _response = fidl::client::decode_transaction_body::<
1293                fidl::encoding::FlexibleType<InspectWriterEscrowAndExitResponse>,
1294                fidl::encoding::DefaultFuchsiaResourceDialect,
1295                0x60e24adbd0e588ff,
1296            >(_buf?)?
1297            .into_result::<InspectWriterMarker>("escrow_and_exit")?;
1298            Ok(_response)
1299        }
1300        self.client.send_query_and_decode::<
1301            InspectWriterEscrowAndExitRequest,
1302            InspectWriterEscrowAndExitResponse,
1303        >(
1304            payload,
1305            0x60e24adbd0e588ff,
1306            fidl::encoding::DynamicFlags::FLEXIBLE,
1307            _decode,
1308        )
1309    }
1310
1311    type RecordLazyValuesResponseFut = fidl::client::QueryResponseFut<
1312        fidl::endpoints::ClientEnd<LazyInspectPuppetMarker>,
1313        fidl::encoding::DefaultFuchsiaResourceDialect,
1314    >;
1315    fn r#record_lazy_values(&self, mut key: &str) -> Self::RecordLazyValuesResponseFut {
1316        fn _decode(
1317            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1318        ) -> Result<fidl::endpoints::ClientEnd<LazyInspectPuppetMarker>, fidl::Error> {
1319            let _response = fidl::client::decode_transaction_body::<
1320                fidl::encoding::FlexibleType<InspectWriterRecordLazyValuesResponse>,
1321                fidl::encoding::DefaultFuchsiaResourceDialect,
1322                0xc637cf5d48e9063,
1323            >(_buf?)?
1324            .into_result::<InspectWriterMarker>("record_lazy_values")?;
1325            Ok(_response.client)
1326        }
1327        self.client.send_query_and_decode::<
1328            InspectWriterRecordLazyValuesRequest,
1329            fidl::endpoints::ClientEnd<LazyInspectPuppetMarker>,
1330        >(
1331            (key,),
1332            0xc637cf5d48e9063,
1333            fidl::encoding::DynamicFlags::FLEXIBLE,
1334            _decode,
1335        )
1336    }
1337}
1338
1339pub struct InspectWriterEventStream {
1340    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1341}
1342
1343impl std::marker::Unpin for InspectWriterEventStream {}
1344
1345impl futures::stream::FusedStream for InspectWriterEventStream {
1346    fn is_terminated(&self) -> bool {
1347        self.event_receiver.is_terminated()
1348    }
1349}
1350
1351impl futures::Stream for InspectWriterEventStream {
1352    type Item = Result<InspectWriterEvent, fidl::Error>;
1353
1354    fn poll_next(
1355        mut self: std::pin::Pin<&mut Self>,
1356        cx: &mut std::task::Context<'_>,
1357    ) -> std::task::Poll<Option<Self::Item>> {
1358        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1359            &mut self.event_receiver,
1360            cx
1361        )?) {
1362            Some(buf) => std::task::Poll::Ready(Some(InspectWriterEvent::decode(buf))),
1363            None => std::task::Poll::Ready(None),
1364        }
1365    }
1366}
1367
1368#[derive(Debug)]
1369pub enum InspectWriterEvent {
1370    #[non_exhaustive]
1371    _UnknownEvent {
1372        /// Ordinal of the event that was sent.
1373        ordinal: u64,
1374    },
1375}
1376
1377impl InspectWriterEvent {
1378    /// Decodes a message buffer as a [`InspectWriterEvent`].
1379    fn decode(
1380        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1381    ) -> Result<InspectWriterEvent, fidl::Error> {
1382        let (bytes, _handles) = buf.split_mut();
1383        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1384        debug_assert_eq!(tx_header.tx_id, 0);
1385        match tx_header.ordinal {
1386            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1387                Ok(InspectWriterEvent::_UnknownEvent { ordinal: tx_header.ordinal })
1388            }
1389            _ => Err(fidl::Error::UnknownOrdinal {
1390                ordinal: tx_header.ordinal,
1391                protocol_name: <InspectWriterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1392            }),
1393        }
1394    }
1395}
1396
1397/// A Stream of incoming requests for fuchsia.archivist.test/InspectWriter.
1398pub struct InspectWriterRequestStream {
1399    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1400    is_terminated: bool,
1401}
1402
1403impl std::marker::Unpin for InspectWriterRequestStream {}
1404
1405impl futures::stream::FusedStream for InspectWriterRequestStream {
1406    fn is_terminated(&self) -> bool {
1407        self.is_terminated
1408    }
1409}
1410
1411impl fidl::endpoints::RequestStream for InspectWriterRequestStream {
1412    type Protocol = InspectWriterMarker;
1413    type ControlHandle = InspectWriterControlHandle;
1414
1415    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1416        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1417    }
1418
1419    fn control_handle(&self) -> Self::ControlHandle {
1420        InspectWriterControlHandle { inner: self.inner.clone() }
1421    }
1422
1423    fn into_inner(
1424        self,
1425    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1426    {
1427        (self.inner, self.is_terminated)
1428    }
1429
1430    fn from_inner(
1431        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1432        is_terminated: bool,
1433    ) -> Self {
1434        Self { inner, is_terminated }
1435    }
1436}
1437
1438impl futures::Stream for InspectWriterRequestStream {
1439    type Item = Result<InspectWriterRequest, fidl::Error>;
1440
1441    fn poll_next(
1442        mut self: std::pin::Pin<&mut Self>,
1443        cx: &mut std::task::Context<'_>,
1444    ) -> std::task::Poll<Option<Self::Item>> {
1445        let this = &mut *self;
1446        if this.inner.check_shutdown(cx) {
1447            this.is_terminated = true;
1448            return std::task::Poll::Ready(None);
1449        }
1450        if this.is_terminated {
1451            panic!("polled InspectWriterRequestStream after completion");
1452        }
1453        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1454            |bytes, handles| {
1455                match this.inner.channel().read_etc(cx, bytes, handles) {
1456                    std::task::Poll::Ready(Ok(())) => {}
1457                    std::task::Poll::Pending => return std::task::Poll::Pending,
1458                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1459                        this.is_terminated = true;
1460                        return std::task::Poll::Ready(None);
1461                    }
1462                    std::task::Poll::Ready(Err(e)) => {
1463                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1464                            e.into(),
1465                        ))));
1466                    }
1467                }
1468
1469                // A message has been received from the channel
1470                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1471
1472                std::task::Poll::Ready(Some(match header.ordinal {
1473                    0xe7510549d99075e => {
1474                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1475                        let mut req = fidl::new_empty!(
1476                            fidl::encoding::EmptyPayload,
1477                            fidl::encoding::DefaultFuchsiaResourceDialect
1478                        );
1479                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1480                        let control_handle =
1481                            InspectWriterControlHandle { inner: this.inner.clone() };
1482                        Ok(InspectWriterRequest::SetHealthOk {
1483                            responder: InspectWriterSetHealthOkResponder {
1484                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1485                                tx_id: header.tx_id,
1486                            },
1487                        })
1488                    }
1489                    0x6a7dbea8c4f52015 => {
1490                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1491                        let mut req = fidl::new_empty!(
1492                            fidl::encoding::EmptyPayload,
1493                            fidl::encoding::DefaultFuchsiaResourceDialect
1494                        );
1495                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1496                        let control_handle =
1497                            InspectWriterControlHandle { inner: this.inner.clone() };
1498                        Ok(InspectWriterRequest::SetHealthStartingUp {
1499                            responder: InspectWriterSetHealthStartingUpResponder {
1500                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1501                                tx_id: header.tx_id,
1502                            },
1503                        })
1504                    }
1505                    0x195be230721d712b => {
1506                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1507                        let mut req = fidl::new_empty!(
1508                            InspectWriterRecordStringRequest,
1509                            fidl::encoding::DefaultFuchsiaResourceDialect
1510                        );
1511                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InspectWriterRecordStringRequest>(&header, _body_bytes, handles, &mut req)?;
1512                        let control_handle =
1513                            InspectWriterControlHandle { inner: this.inner.clone() };
1514                        Ok(InspectWriterRequest::RecordString {
1515                            key: req.key,
1516                            value: req.value,
1517
1518                            responder: InspectWriterRecordStringResponder {
1519                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1520                                tx_id: header.tx_id,
1521                            },
1522                        })
1523                    }
1524                    0xa2c6cbf0df0949 => {
1525                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1526                        let mut req = fidl::new_empty!(
1527                            InspectWriterRecordIntRequest,
1528                            fidl::encoding::DefaultFuchsiaResourceDialect
1529                        );
1530                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InspectWriterRecordIntRequest>(&header, _body_bytes, handles, &mut req)?;
1531                        let control_handle =
1532                            InspectWriterControlHandle { inner: this.inner.clone() };
1533                        Ok(InspectWriterRequest::RecordInt {
1534                            key: req.key,
1535                            value: req.value,
1536
1537                            responder: InspectWriterRecordIntResponder {
1538                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1539                                tx_id: header.tx_id,
1540                            },
1541                        })
1542                    }
1543                    0x228ae4647773fd94 => {
1544                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1545                        let mut req = fidl::new_empty!(
1546                            fidl::encoding::EmptyPayload,
1547                            fidl::encoding::DefaultFuchsiaResourceDialect
1548                        );
1549                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1550                        let control_handle =
1551                            InspectWriterControlHandle { inner: this.inner.clone() };
1552                        Ok(InspectWriterRequest::EmitExampleInspectData {
1553                            responder: InspectWriterEmitExampleInspectDataResponder {
1554                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1555                                tx_id: header.tx_id,
1556                            },
1557                        })
1558                    }
1559                    0x60e24adbd0e588ff => {
1560                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1561                        let mut req = fidl::new_empty!(
1562                            InspectWriterEscrowAndExitRequest,
1563                            fidl::encoding::DefaultFuchsiaResourceDialect
1564                        );
1565                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InspectWriterEscrowAndExitRequest>(&header, _body_bytes, handles, &mut req)?;
1566                        let control_handle =
1567                            InspectWriterControlHandle { inner: this.inner.clone() };
1568                        Ok(InspectWriterRequest::EscrowAndExit {
1569                            payload: req,
1570                            responder: InspectWriterEscrowAndExitResponder {
1571                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1572                                tx_id: header.tx_id,
1573                            },
1574                        })
1575                    }
1576                    0xc637cf5d48e9063 => {
1577                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1578                        let mut req = fidl::new_empty!(
1579                            InspectWriterRecordLazyValuesRequest,
1580                            fidl::encoding::DefaultFuchsiaResourceDialect
1581                        );
1582                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InspectWriterRecordLazyValuesRequest>(&header, _body_bytes, handles, &mut req)?;
1583                        let control_handle =
1584                            InspectWriterControlHandle { inner: this.inner.clone() };
1585                        Ok(InspectWriterRequest::RecordLazyValues {
1586                            key: req.key,
1587
1588                            responder: InspectWriterRecordLazyValuesResponder {
1589                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1590                                tx_id: header.tx_id,
1591                            },
1592                        })
1593                    }
1594                    _ if header.tx_id == 0
1595                        && header
1596                            .dynamic_flags()
1597                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1598                    {
1599                        Ok(InspectWriterRequest::_UnknownMethod {
1600                            ordinal: header.ordinal,
1601                            control_handle: InspectWriterControlHandle {
1602                                inner: this.inner.clone(),
1603                            },
1604                            method_type: fidl::MethodType::OneWay,
1605                        })
1606                    }
1607                    _ if header
1608                        .dynamic_flags()
1609                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1610                    {
1611                        this.inner.send_framework_err(
1612                            fidl::encoding::FrameworkErr::UnknownMethod,
1613                            header.tx_id,
1614                            header.ordinal,
1615                            header.dynamic_flags(),
1616                            (bytes, handles),
1617                        )?;
1618                        Ok(InspectWriterRequest::_UnknownMethod {
1619                            ordinal: header.ordinal,
1620                            control_handle: InspectWriterControlHandle {
1621                                inner: this.inner.clone(),
1622                            },
1623                            method_type: fidl::MethodType::TwoWay,
1624                        })
1625                    }
1626                    _ => Err(fidl::Error::UnknownOrdinal {
1627                        ordinal: header.ordinal,
1628                        protocol_name:
1629                            <InspectWriterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1630                    }),
1631                }))
1632            },
1633        )
1634    }
1635}
1636
1637/// InspectWriter emits inspect data when requested.
1638///
1639/// Values are always reported on the root inspect node.
1640#[derive(Debug)]
1641pub enum InspectWriterRequest {
1642    /// Emits a health inspect node with OK status.
1643    SetHealthOk { responder: InspectWriterSetHealthOkResponder },
1644    /// Emits a health inspect node with STARTING_UP status.
1645    SetHealthStartingUp { responder: InspectWriterSetHealthStartingUpResponder },
1646    /// Records a string inspect property.
1647    RecordString { key: String, value: String, responder: InspectWriterRecordStringResponder },
1648    /// Records an integer inspect property.
1649    RecordInt { key: String, value: i64, responder: InspectWriterRecordIntResponder },
1650    /// Emits a collection of example of inspect data.
1651    ///
1652    /// TODO(https://fuchsia.dev/302716196): Split this into several methods
1653    /// tests can call to explicitly emit the same data as this method.
1654    EmitExampleInspectData { responder: InspectWriterEmitExampleInspectDataResponder },
1655    /// Escrow the current inspect data and immediately exit afterwards.
1656    EscrowAndExit {
1657        payload: InspectWriterEscrowAndExitRequest,
1658        responder: InspectWriterEscrowAndExitResponder,
1659    },
1660    /// Returns a LazyInspectPuppet client for recording lazy values.
1661    RecordLazyValues { key: String, responder: InspectWriterRecordLazyValuesResponder },
1662    /// An interaction was received which does not match any known method.
1663    #[non_exhaustive]
1664    _UnknownMethod {
1665        /// Ordinal of the method that was called.
1666        ordinal: u64,
1667        control_handle: InspectWriterControlHandle,
1668        method_type: fidl::MethodType,
1669    },
1670}
1671
1672impl InspectWriterRequest {
1673    #[allow(irrefutable_let_patterns)]
1674    pub fn into_set_health_ok(self) -> Option<(InspectWriterSetHealthOkResponder)> {
1675        if let InspectWriterRequest::SetHealthOk { responder } = self {
1676            Some((responder))
1677        } else {
1678            None
1679        }
1680    }
1681
1682    #[allow(irrefutable_let_patterns)]
1683    pub fn into_set_health_starting_up(
1684        self,
1685    ) -> Option<(InspectWriterSetHealthStartingUpResponder)> {
1686        if let InspectWriterRequest::SetHealthStartingUp { responder } = self {
1687            Some((responder))
1688        } else {
1689            None
1690        }
1691    }
1692
1693    #[allow(irrefutable_let_patterns)]
1694    pub fn into_record_string(
1695        self,
1696    ) -> Option<(String, String, InspectWriterRecordStringResponder)> {
1697        if let InspectWriterRequest::RecordString { key, value, responder } = self {
1698            Some((key, value, responder))
1699        } else {
1700            None
1701        }
1702    }
1703
1704    #[allow(irrefutable_let_patterns)]
1705    pub fn into_record_int(self) -> Option<(String, i64, InspectWriterRecordIntResponder)> {
1706        if let InspectWriterRequest::RecordInt { key, value, responder } = self {
1707            Some((key, value, responder))
1708        } else {
1709            None
1710        }
1711    }
1712
1713    #[allow(irrefutable_let_patterns)]
1714    pub fn into_emit_example_inspect_data(
1715        self,
1716    ) -> Option<(InspectWriterEmitExampleInspectDataResponder)> {
1717        if let InspectWriterRequest::EmitExampleInspectData { responder } = self {
1718            Some((responder))
1719        } else {
1720            None
1721        }
1722    }
1723
1724    #[allow(irrefutable_let_patterns)]
1725    pub fn into_escrow_and_exit(
1726        self,
1727    ) -> Option<(InspectWriterEscrowAndExitRequest, InspectWriterEscrowAndExitResponder)> {
1728        if let InspectWriterRequest::EscrowAndExit { payload, responder } = self {
1729            Some((payload, responder))
1730        } else {
1731            None
1732        }
1733    }
1734
1735    #[allow(irrefutable_let_patterns)]
1736    pub fn into_record_lazy_values(
1737        self,
1738    ) -> Option<(String, InspectWriterRecordLazyValuesResponder)> {
1739        if let InspectWriterRequest::RecordLazyValues { key, responder } = self {
1740            Some((key, responder))
1741        } else {
1742            None
1743        }
1744    }
1745
1746    /// Name of the method defined in FIDL
1747    pub fn method_name(&self) -> &'static str {
1748        match *self {
1749            InspectWriterRequest::SetHealthOk { .. } => "set_health_ok",
1750            InspectWriterRequest::SetHealthStartingUp { .. } => "set_health_starting_up",
1751            InspectWriterRequest::RecordString { .. } => "record_string",
1752            InspectWriterRequest::RecordInt { .. } => "record_int",
1753            InspectWriterRequest::EmitExampleInspectData { .. } => "emit_example_inspect_data",
1754            InspectWriterRequest::EscrowAndExit { .. } => "escrow_and_exit",
1755            InspectWriterRequest::RecordLazyValues { .. } => "record_lazy_values",
1756            InspectWriterRequest::_UnknownMethod {
1757                method_type: fidl::MethodType::OneWay, ..
1758            } => "unknown one-way method",
1759            InspectWriterRequest::_UnknownMethod {
1760                method_type: fidl::MethodType::TwoWay, ..
1761            } => "unknown two-way method",
1762        }
1763    }
1764}
1765
1766#[derive(Debug, Clone)]
1767pub struct InspectWriterControlHandle {
1768    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1769}
1770
1771impl fidl::endpoints::ControlHandle for InspectWriterControlHandle {
1772    fn shutdown(&self) {
1773        self.inner.shutdown()
1774    }
1775
1776    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1777        self.inner.shutdown_with_epitaph(status)
1778    }
1779
1780    fn is_closed(&self) -> bool {
1781        self.inner.channel().is_closed()
1782    }
1783    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1784        self.inner.channel().on_closed()
1785    }
1786
1787    #[cfg(target_os = "fuchsia")]
1788    fn signal_peer(
1789        &self,
1790        clear_mask: zx::Signals,
1791        set_mask: zx::Signals,
1792    ) -> Result<(), zx_status::Status> {
1793        use fidl::Peered;
1794        self.inner.channel().signal_peer(clear_mask, set_mask)
1795    }
1796}
1797
1798impl InspectWriterControlHandle {}
1799
1800#[must_use = "FIDL methods require a response to be sent"]
1801#[derive(Debug)]
1802pub struct InspectWriterSetHealthOkResponder {
1803    control_handle: std::mem::ManuallyDrop<InspectWriterControlHandle>,
1804    tx_id: u32,
1805}
1806
1807/// Set the the channel to be shutdown (see [`InspectWriterControlHandle::shutdown`])
1808/// if the responder is dropped without sending a response, so that the client
1809/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1810impl std::ops::Drop for InspectWriterSetHealthOkResponder {
1811    fn drop(&mut self) {
1812        self.control_handle.shutdown();
1813        // Safety: drops once, never accessed again
1814        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1815    }
1816}
1817
1818impl fidl::endpoints::Responder for InspectWriterSetHealthOkResponder {
1819    type ControlHandle = InspectWriterControlHandle;
1820
1821    fn control_handle(&self) -> &InspectWriterControlHandle {
1822        &self.control_handle
1823    }
1824
1825    fn drop_without_shutdown(mut self) {
1826        // Safety: drops once, never accessed again due to mem::forget
1827        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1828        // Prevent Drop from running (which would shut down the channel)
1829        std::mem::forget(self);
1830    }
1831}
1832
1833impl InspectWriterSetHealthOkResponder {
1834    /// Sends a response to the FIDL transaction.
1835    ///
1836    /// Sets the channel to shutdown if an error occurs.
1837    pub fn send(self) -> Result<(), fidl::Error> {
1838        let _result = self.send_raw();
1839        if _result.is_err() {
1840            self.control_handle.shutdown();
1841        }
1842        self.drop_without_shutdown();
1843        _result
1844    }
1845
1846    /// Similar to "send" but does not shutdown the channel if an error occurs.
1847    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1848        let _result = self.send_raw();
1849        self.drop_without_shutdown();
1850        _result
1851    }
1852
1853    fn send_raw(&self) -> Result<(), fidl::Error> {
1854        self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
1855            fidl::encoding::Flexible::new(()),
1856            self.tx_id,
1857            0xe7510549d99075e,
1858            fidl::encoding::DynamicFlags::FLEXIBLE,
1859        )
1860    }
1861}
1862
1863#[must_use = "FIDL methods require a response to be sent"]
1864#[derive(Debug)]
1865pub struct InspectWriterSetHealthStartingUpResponder {
1866    control_handle: std::mem::ManuallyDrop<InspectWriterControlHandle>,
1867    tx_id: u32,
1868}
1869
1870/// Set the the channel to be shutdown (see [`InspectWriterControlHandle::shutdown`])
1871/// if the responder is dropped without sending a response, so that the client
1872/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1873impl std::ops::Drop for InspectWriterSetHealthStartingUpResponder {
1874    fn drop(&mut self) {
1875        self.control_handle.shutdown();
1876        // Safety: drops once, never accessed again
1877        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1878    }
1879}
1880
1881impl fidl::endpoints::Responder for InspectWriterSetHealthStartingUpResponder {
1882    type ControlHandle = InspectWriterControlHandle;
1883
1884    fn control_handle(&self) -> &InspectWriterControlHandle {
1885        &self.control_handle
1886    }
1887
1888    fn drop_without_shutdown(mut self) {
1889        // Safety: drops once, never accessed again due to mem::forget
1890        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1891        // Prevent Drop from running (which would shut down the channel)
1892        std::mem::forget(self);
1893    }
1894}
1895
1896impl InspectWriterSetHealthStartingUpResponder {
1897    /// Sends a response to the FIDL transaction.
1898    ///
1899    /// Sets the channel to shutdown if an error occurs.
1900    pub fn send(self) -> Result<(), fidl::Error> {
1901        let _result = self.send_raw();
1902        if _result.is_err() {
1903            self.control_handle.shutdown();
1904        }
1905        self.drop_without_shutdown();
1906        _result
1907    }
1908
1909    /// Similar to "send" but does not shutdown the channel if an error occurs.
1910    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1911        let _result = self.send_raw();
1912        self.drop_without_shutdown();
1913        _result
1914    }
1915
1916    fn send_raw(&self) -> Result<(), fidl::Error> {
1917        self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
1918            fidl::encoding::Flexible::new(()),
1919            self.tx_id,
1920            0x6a7dbea8c4f52015,
1921            fidl::encoding::DynamicFlags::FLEXIBLE,
1922        )
1923    }
1924}
1925
1926#[must_use = "FIDL methods require a response to be sent"]
1927#[derive(Debug)]
1928pub struct InspectWriterRecordStringResponder {
1929    control_handle: std::mem::ManuallyDrop<InspectWriterControlHandle>,
1930    tx_id: u32,
1931}
1932
1933/// Set the the channel to be shutdown (see [`InspectWriterControlHandle::shutdown`])
1934/// if the responder is dropped without sending a response, so that the client
1935/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1936impl std::ops::Drop for InspectWriterRecordStringResponder {
1937    fn drop(&mut self) {
1938        self.control_handle.shutdown();
1939        // Safety: drops once, never accessed again
1940        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1941    }
1942}
1943
1944impl fidl::endpoints::Responder for InspectWriterRecordStringResponder {
1945    type ControlHandle = InspectWriterControlHandle;
1946
1947    fn control_handle(&self) -> &InspectWriterControlHandle {
1948        &self.control_handle
1949    }
1950
1951    fn drop_without_shutdown(mut self) {
1952        // Safety: drops once, never accessed again due to mem::forget
1953        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1954        // Prevent Drop from running (which would shut down the channel)
1955        std::mem::forget(self);
1956    }
1957}
1958
1959impl InspectWriterRecordStringResponder {
1960    /// Sends a response to the FIDL transaction.
1961    ///
1962    /// Sets the channel to shutdown if an error occurs.
1963    pub fn send(self) -> Result<(), fidl::Error> {
1964        let _result = self.send_raw();
1965        if _result.is_err() {
1966            self.control_handle.shutdown();
1967        }
1968        self.drop_without_shutdown();
1969        _result
1970    }
1971
1972    /// Similar to "send" but does not shutdown the channel if an error occurs.
1973    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1974        let _result = self.send_raw();
1975        self.drop_without_shutdown();
1976        _result
1977    }
1978
1979    fn send_raw(&self) -> Result<(), fidl::Error> {
1980        self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
1981            fidl::encoding::Flexible::new(()),
1982            self.tx_id,
1983            0x195be230721d712b,
1984            fidl::encoding::DynamicFlags::FLEXIBLE,
1985        )
1986    }
1987}
1988
1989#[must_use = "FIDL methods require a response to be sent"]
1990#[derive(Debug)]
1991pub struct InspectWriterRecordIntResponder {
1992    control_handle: std::mem::ManuallyDrop<InspectWriterControlHandle>,
1993    tx_id: u32,
1994}
1995
1996/// Set the the channel to be shutdown (see [`InspectWriterControlHandle::shutdown`])
1997/// if the responder is dropped without sending a response, so that the client
1998/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1999impl std::ops::Drop for InspectWriterRecordIntResponder {
2000    fn drop(&mut self) {
2001        self.control_handle.shutdown();
2002        // Safety: drops once, never accessed again
2003        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2004    }
2005}
2006
2007impl fidl::endpoints::Responder for InspectWriterRecordIntResponder {
2008    type ControlHandle = InspectWriterControlHandle;
2009
2010    fn control_handle(&self) -> &InspectWriterControlHandle {
2011        &self.control_handle
2012    }
2013
2014    fn drop_without_shutdown(mut self) {
2015        // Safety: drops once, never accessed again due to mem::forget
2016        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2017        // Prevent Drop from running (which would shut down the channel)
2018        std::mem::forget(self);
2019    }
2020}
2021
2022impl InspectWriterRecordIntResponder {
2023    /// Sends a response to the FIDL transaction.
2024    ///
2025    /// Sets the channel to shutdown if an error occurs.
2026    pub fn send(self) -> Result<(), fidl::Error> {
2027        let _result = self.send_raw();
2028        if _result.is_err() {
2029            self.control_handle.shutdown();
2030        }
2031        self.drop_without_shutdown();
2032        _result
2033    }
2034
2035    /// Similar to "send" but does not shutdown the channel if an error occurs.
2036    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
2037        let _result = self.send_raw();
2038        self.drop_without_shutdown();
2039        _result
2040    }
2041
2042    fn send_raw(&self) -> Result<(), fidl::Error> {
2043        self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
2044            fidl::encoding::Flexible::new(()),
2045            self.tx_id,
2046            0xa2c6cbf0df0949,
2047            fidl::encoding::DynamicFlags::FLEXIBLE,
2048        )
2049    }
2050}
2051
2052#[must_use = "FIDL methods require a response to be sent"]
2053#[derive(Debug)]
2054pub struct InspectWriterEmitExampleInspectDataResponder {
2055    control_handle: std::mem::ManuallyDrop<InspectWriterControlHandle>,
2056    tx_id: u32,
2057}
2058
2059/// Set the the channel to be shutdown (see [`InspectWriterControlHandle::shutdown`])
2060/// if the responder is dropped without sending a response, so that the client
2061/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2062impl std::ops::Drop for InspectWriterEmitExampleInspectDataResponder {
2063    fn drop(&mut self) {
2064        self.control_handle.shutdown();
2065        // Safety: drops once, never accessed again
2066        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2067    }
2068}
2069
2070impl fidl::endpoints::Responder for InspectWriterEmitExampleInspectDataResponder {
2071    type ControlHandle = InspectWriterControlHandle;
2072
2073    fn control_handle(&self) -> &InspectWriterControlHandle {
2074        &self.control_handle
2075    }
2076
2077    fn drop_without_shutdown(mut self) {
2078        // Safety: drops once, never accessed again due to mem::forget
2079        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2080        // Prevent Drop from running (which would shut down the channel)
2081        std::mem::forget(self);
2082    }
2083}
2084
2085impl InspectWriterEmitExampleInspectDataResponder {
2086    /// Sends a response to the FIDL transaction.
2087    ///
2088    /// Sets the channel to shutdown if an error occurs.
2089    pub fn send(self) -> Result<(), fidl::Error> {
2090        let _result = self.send_raw();
2091        if _result.is_err() {
2092            self.control_handle.shutdown();
2093        }
2094        self.drop_without_shutdown();
2095        _result
2096    }
2097
2098    /// Similar to "send" but does not shutdown the channel if an error occurs.
2099    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
2100        let _result = self.send_raw();
2101        self.drop_without_shutdown();
2102        _result
2103    }
2104
2105    fn send_raw(&self) -> Result<(), fidl::Error> {
2106        self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
2107            fidl::encoding::Flexible::new(()),
2108            self.tx_id,
2109            0x228ae4647773fd94,
2110            fidl::encoding::DynamicFlags::FLEXIBLE,
2111        )
2112    }
2113}
2114
2115#[must_use = "FIDL methods require a response to be sent"]
2116#[derive(Debug)]
2117pub struct InspectWriterEscrowAndExitResponder {
2118    control_handle: std::mem::ManuallyDrop<InspectWriterControlHandle>,
2119    tx_id: u32,
2120}
2121
2122/// Set the the channel to be shutdown (see [`InspectWriterControlHandle::shutdown`])
2123/// if the responder is dropped without sending a response, so that the client
2124/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2125impl std::ops::Drop for InspectWriterEscrowAndExitResponder {
2126    fn drop(&mut self) {
2127        self.control_handle.shutdown();
2128        // Safety: drops once, never accessed again
2129        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2130    }
2131}
2132
2133impl fidl::endpoints::Responder for InspectWriterEscrowAndExitResponder {
2134    type ControlHandle = InspectWriterControlHandle;
2135
2136    fn control_handle(&self) -> &InspectWriterControlHandle {
2137        &self.control_handle
2138    }
2139
2140    fn drop_without_shutdown(mut self) {
2141        // Safety: drops once, never accessed again due to mem::forget
2142        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2143        // Prevent Drop from running (which would shut down the channel)
2144        std::mem::forget(self);
2145    }
2146}
2147
2148impl InspectWriterEscrowAndExitResponder {
2149    /// Sends a response to the FIDL transaction.
2150    ///
2151    /// Sets the channel to shutdown if an error occurs.
2152    pub fn send(self, mut payload: InspectWriterEscrowAndExitResponse) -> Result<(), fidl::Error> {
2153        let _result = self.send_raw(payload);
2154        if _result.is_err() {
2155            self.control_handle.shutdown();
2156        }
2157        self.drop_without_shutdown();
2158        _result
2159    }
2160
2161    /// Similar to "send" but does not shutdown the channel if an error occurs.
2162    pub fn send_no_shutdown_on_err(
2163        self,
2164        mut payload: InspectWriterEscrowAndExitResponse,
2165    ) -> Result<(), fidl::Error> {
2166        let _result = self.send_raw(payload);
2167        self.drop_without_shutdown();
2168        _result
2169    }
2170
2171    fn send_raw(&self, mut payload: InspectWriterEscrowAndExitResponse) -> Result<(), fidl::Error> {
2172        self.control_handle
2173            .inner
2174            .send::<fidl::encoding::FlexibleType<InspectWriterEscrowAndExitResponse>>(
2175                fidl::encoding::Flexible::new(&mut payload),
2176                self.tx_id,
2177                0x60e24adbd0e588ff,
2178                fidl::encoding::DynamicFlags::FLEXIBLE,
2179            )
2180    }
2181}
2182
2183#[must_use = "FIDL methods require a response to be sent"]
2184#[derive(Debug)]
2185pub struct InspectWriterRecordLazyValuesResponder {
2186    control_handle: std::mem::ManuallyDrop<InspectWriterControlHandle>,
2187    tx_id: u32,
2188}
2189
2190/// Set the the channel to be shutdown (see [`InspectWriterControlHandle::shutdown`])
2191/// if the responder is dropped without sending a response, so that the client
2192/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2193impl std::ops::Drop for InspectWriterRecordLazyValuesResponder {
2194    fn drop(&mut self) {
2195        self.control_handle.shutdown();
2196        // Safety: drops once, never accessed again
2197        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2198    }
2199}
2200
2201impl fidl::endpoints::Responder for InspectWriterRecordLazyValuesResponder {
2202    type ControlHandle = InspectWriterControlHandle;
2203
2204    fn control_handle(&self) -> &InspectWriterControlHandle {
2205        &self.control_handle
2206    }
2207
2208    fn drop_without_shutdown(mut self) {
2209        // Safety: drops once, never accessed again due to mem::forget
2210        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2211        // Prevent Drop from running (which would shut down the channel)
2212        std::mem::forget(self);
2213    }
2214}
2215
2216impl InspectWriterRecordLazyValuesResponder {
2217    /// Sends a response to the FIDL transaction.
2218    ///
2219    /// Sets the channel to shutdown if an error occurs.
2220    pub fn send(
2221        self,
2222        mut client: fidl::endpoints::ClientEnd<LazyInspectPuppetMarker>,
2223    ) -> Result<(), fidl::Error> {
2224        let _result = self.send_raw(client);
2225        if _result.is_err() {
2226            self.control_handle.shutdown();
2227        }
2228        self.drop_without_shutdown();
2229        _result
2230    }
2231
2232    /// Similar to "send" but does not shutdown the channel if an error occurs.
2233    pub fn send_no_shutdown_on_err(
2234        self,
2235        mut client: fidl::endpoints::ClientEnd<LazyInspectPuppetMarker>,
2236    ) -> Result<(), fidl::Error> {
2237        let _result = self.send_raw(client);
2238        self.drop_without_shutdown();
2239        _result
2240    }
2241
2242    fn send_raw(
2243        &self,
2244        mut client: fidl::endpoints::ClientEnd<LazyInspectPuppetMarker>,
2245    ) -> Result<(), fidl::Error> {
2246        self.control_handle
2247            .inner
2248            .send::<fidl::encoding::FlexibleType<InspectWriterRecordLazyValuesResponse>>(
2249                fidl::encoding::Flexible::new((client,)),
2250                self.tx_id,
2251                0xc637cf5d48e9063,
2252                fidl::encoding::DynamicFlags::FLEXIBLE,
2253            )
2254    }
2255}
2256
2257#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2258pub struct LazyInspectPuppetMarker;
2259
2260impl fidl::endpoints::ProtocolMarker for LazyInspectPuppetMarker {
2261    type Proxy = LazyInspectPuppetProxy;
2262    type RequestStream = LazyInspectPuppetRequestStream;
2263    #[cfg(target_os = "fuchsia")]
2264    type SynchronousProxy = LazyInspectPuppetSynchronousProxy;
2265
2266    const DEBUG_NAME: &'static str = "(anonymous) LazyInspectPuppet";
2267}
2268
2269pub trait LazyInspectPuppetProxyInterface: Send + Sync {
2270    type SetHealthOkResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
2271    fn r#set_health_ok(&self) -> Self::SetHealthOkResponseFut;
2272    type SetHealthStartingUpResponseFut: std::future::Future<Output = Result<(), fidl::Error>>
2273        + Send;
2274    fn r#set_health_starting_up(&self) -> Self::SetHealthStartingUpResponseFut;
2275    type RecordStringResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
2276    fn r#record_string(&self, key: &str, value: &str) -> Self::RecordStringResponseFut;
2277    type RecordIntResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
2278    fn r#record_int(&self, key: &str, value: i64) -> Self::RecordIntResponseFut;
2279    type EmitExampleInspectDataResponseFut: std::future::Future<Output = Result<(), fidl::Error>>
2280        + Send;
2281    fn r#emit_example_inspect_data(&self) -> Self::EmitExampleInspectDataResponseFut;
2282    type EscrowAndExitResponseFut: std::future::Future<Output = Result<InspectWriterEscrowAndExitResponse, fidl::Error>>
2283        + Send;
2284    fn r#escrow_and_exit(
2285        &self,
2286        payload: &InspectWriterEscrowAndExitRequest,
2287    ) -> Self::EscrowAndExitResponseFut;
2288    type RecordLazyValuesResponseFut: std::future::Future<
2289            Output = Result<fidl::endpoints::ClientEnd<LazyInspectPuppetMarker>, fidl::Error>,
2290        > + Send;
2291    fn r#record_lazy_values(&self, key: &str) -> Self::RecordLazyValuesResponseFut;
2292    type CommitResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
2293    fn r#commit(&self, options: &CommitOptions) -> Self::CommitResponseFut;
2294}
2295#[derive(Debug)]
2296#[cfg(target_os = "fuchsia")]
2297pub struct LazyInspectPuppetSynchronousProxy {
2298    client: fidl::client::sync::Client,
2299}
2300
2301#[cfg(target_os = "fuchsia")]
2302impl fidl::endpoints::SynchronousProxy for LazyInspectPuppetSynchronousProxy {
2303    type Proxy = LazyInspectPuppetProxy;
2304    type Protocol = LazyInspectPuppetMarker;
2305
2306    fn from_channel(inner: fidl::Channel) -> Self {
2307        Self::new(inner)
2308    }
2309
2310    fn into_channel(self) -> fidl::Channel {
2311        self.client.into_channel()
2312    }
2313
2314    fn as_channel(&self) -> &fidl::Channel {
2315        self.client.as_channel()
2316    }
2317}
2318
2319#[cfg(target_os = "fuchsia")]
2320impl LazyInspectPuppetSynchronousProxy {
2321    pub fn new(channel: fidl::Channel) -> Self {
2322        let protocol_name =
2323            <LazyInspectPuppetMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2324        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2325    }
2326
2327    pub fn into_channel(self) -> fidl::Channel {
2328        self.client.into_channel()
2329    }
2330
2331    /// Waits until an event arrives and returns it. It is safe for other
2332    /// threads to make concurrent requests while waiting for an event.
2333    pub fn wait_for_event(
2334        &self,
2335        deadline: zx::MonotonicInstant,
2336    ) -> Result<LazyInspectPuppetEvent, fidl::Error> {
2337        LazyInspectPuppetEvent::decode(self.client.wait_for_event(deadline)?)
2338    }
2339
2340    /// Emits a health inspect node with OK status.
2341    pub fn r#set_health_ok(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
2342        let _response = self.client.send_query::<
2343            fidl::encoding::EmptyPayload,
2344            fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
2345        >(
2346            (),
2347            0xe7510549d99075e,
2348            fidl::encoding::DynamicFlags::FLEXIBLE,
2349            ___deadline,
2350        )?
2351        .into_result::<LazyInspectPuppetMarker>("set_health_ok")?;
2352        Ok(_response)
2353    }
2354
2355    /// Emits a health inspect node with STARTING_UP status.
2356    pub fn r#set_health_starting_up(
2357        &self,
2358        ___deadline: zx::MonotonicInstant,
2359    ) -> Result<(), fidl::Error> {
2360        let _response = self.client.send_query::<
2361            fidl::encoding::EmptyPayload,
2362            fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
2363        >(
2364            (),
2365            0x6a7dbea8c4f52015,
2366            fidl::encoding::DynamicFlags::FLEXIBLE,
2367            ___deadline,
2368        )?
2369        .into_result::<LazyInspectPuppetMarker>("set_health_starting_up")?;
2370        Ok(_response)
2371    }
2372
2373    /// Records a string inspect property.
2374    pub fn r#record_string(
2375        &self,
2376        mut key: &str,
2377        mut value: &str,
2378        ___deadline: zx::MonotonicInstant,
2379    ) -> Result<(), fidl::Error> {
2380        let _response = self.client.send_query::<
2381            InspectWriterRecordStringRequest,
2382            fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
2383        >(
2384            (key, value,),
2385            0x195be230721d712b,
2386            fidl::encoding::DynamicFlags::FLEXIBLE,
2387            ___deadline,
2388        )?
2389        .into_result::<LazyInspectPuppetMarker>("record_string")?;
2390        Ok(_response)
2391    }
2392
2393    /// Records an integer inspect property.
2394    pub fn r#record_int(
2395        &self,
2396        mut key: &str,
2397        mut value: i64,
2398        ___deadline: zx::MonotonicInstant,
2399    ) -> Result<(), fidl::Error> {
2400        let _response = self.client.send_query::<
2401            InspectWriterRecordIntRequest,
2402            fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
2403        >(
2404            (key, value,),
2405            0xa2c6cbf0df0949,
2406            fidl::encoding::DynamicFlags::FLEXIBLE,
2407            ___deadline,
2408        )?
2409        .into_result::<LazyInspectPuppetMarker>("record_int")?;
2410        Ok(_response)
2411    }
2412
2413    /// Emits a collection of example of inspect data.
2414    ///
2415    /// TODO(https://fuchsia.dev/302716196): Split this into several methods
2416    /// tests can call to explicitly emit the same data as this method.
2417    pub fn r#emit_example_inspect_data(
2418        &self,
2419        ___deadline: zx::MonotonicInstant,
2420    ) -> Result<(), fidl::Error> {
2421        let _response = self.client.send_query::<
2422            fidl::encoding::EmptyPayload,
2423            fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
2424        >(
2425            (),
2426            0x228ae4647773fd94,
2427            fidl::encoding::DynamicFlags::FLEXIBLE,
2428            ___deadline,
2429        )?
2430        .into_result::<LazyInspectPuppetMarker>("emit_example_inspect_data")?;
2431        Ok(_response)
2432    }
2433
2434    /// Escrow the current inspect data and immediately exit afterwards.
2435    pub fn r#escrow_and_exit(
2436        &self,
2437        mut payload: &InspectWriterEscrowAndExitRequest,
2438        ___deadline: zx::MonotonicInstant,
2439    ) -> Result<InspectWriterEscrowAndExitResponse, fidl::Error> {
2440        let _response = self.client.send_query::<
2441            InspectWriterEscrowAndExitRequest,
2442            fidl::encoding::FlexibleType<InspectWriterEscrowAndExitResponse>,
2443        >(
2444            payload,
2445            0x60e24adbd0e588ff,
2446            fidl::encoding::DynamicFlags::FLEXIBLE,
2447            ___deadline,
2448        )?
2449        .into_result::<LazyInspectPuppetMarker>("escrow_and_exit")?;
2450        Ok(_response)
2451    }
2452
2453    /// Returns a LazyInspectPuppet client for recording lazy values.
2454    pub fn r#record_lazy_values(
2455        &self,
2456        mut key: &str,
2457        ___deadline: zx::MonotonicInstant,
2458    ) -> Result<fidl::endpoints::ClientEnd<LazyInspectPuppetMarker>, fidl::Error> {
2459        let _response = self.client.send_query::<
2460            InspectWriterRecordLazyValuesRequest,
2461            fidl::encoding::FlexibleType<InspectWriterRecordLazyValuesResponse>,
2462        >(
2463            (key,),
2464            0xc637cf5d48e9063,
2465            fidl::encoding::DynamicFlags::FLEXIBLE,
2466            ___deadline,
2467        )?
2468        .into_result::<LazyInspectPuppetMarker>("record_lazy_values")?;
2469        Ok(_response.client)
2470    }
2471
2472    /// Reports all recorded values on the root node.
2473    ///
2474    /// The server will close the connection after this method is called.
2475    pub fn r#commit(
2476        &self,
2477        mut options: &CommitOptions,
2478        ___deadline: zx::MonotonicInstant,
2479    ) -> Result<(), fidl::Error> {
2480        let _response = self.client.send_query::<
2481            LazyInspectPuppetCommitRequest,
2482            fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
2483        >(
2484            (options,),
2485            0x79524e5e00cbf03f,
2486            fidl::encoding::DynamicFlags::FLEXIBLE,
2487            ___deadline,
2488        )?
2489        .into_result::<LazyInspectPuppetMarker>("commit")?;
2490        Ok(_response)
2491    }
2492}
2493
2494#[cfg(target_os = "fuchsia")]
2495impl From<LazyInspectPuppetSynchronousProxy> for zx::NullableHandle {
2496    fn from(value: LazyInspectPuppetSynchronousProxy) -> Self {
2497        value.into_channel().into()
2498    }
2499}
2500
2501#[cfg(target_os = "fuchsia")]
2502impl From<fidl::Channel> for LazyInspectPuppetSynchronousProxy {
2503    fn from(value: fidl::Channel) -> Self {
2504        Self::new(value)
2505    }
2506}
2507
2508#[cfg(target_os = "fuchsia")]
2509impl fidl::endpoints::FromClient for LazyInspectPuppetSynchronousProxy {
2510    type Protocol = LazyInspectPuppetMarker;
2511
2512    fn from_client(value: fidl::endpoints::ClientEnd<LazyInspectPuppetMarker>) -> Self {
2513        Self::new(value.into_channel())
2514    }
2515}
2516
2517#[derive(Debug, Clone)]
2518pub struct LazyInspectPuppetProxy {
2519    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2520}
2521
2522impl fidl::endpoints::Proxy for LazyInspectPuppetProxy {
2523    type Protocol = LazyInspectPuppetMarker;
2524
2525    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2526        Self::new(inner)
2527    }
2528
2529    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2530        self.client.into_channel().map_err(|client| Self { client })
2531    }
2532
2533    fn as_channel(&self) -> &::fidl::AsyncChannel {
2534        self.client.as_channel()
2535    }
2536}
2537
2538impl LazyInspectPuppetProxy {
2539    /// Create a new Proxy for fuchsia.archivist.test/LazyInspectPuppet.
2540    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2541        let protocol_name =
2542            <LazyInspectPuppetMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2543        Self { client: fidl::client::Client::new(channel, protocol_name) }
2544    }
2545
2546    /// Get a Stream of events from the remote end of the protocol.
2547    ///
2548    /// # Panics
2549    ///
2550    /// Panics if the event stream was already taken.
2551    pub fn take_event_stream(&self) -> LazyInspectPuppetEventStream {
2552        LazyInspectPuppetEventStream { event_receiver: self.client.take_event_receiver() }
2553    }
2554
2555    /// Emits a health inspect node with OK status.
2556    pub fn r#set_health_ok(
2557        &self,
2558    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
2559        LazyInspectPuppetProxyInterface::r#set_health_ok(self)
2560    }
2561
2562    /// Emits a health inspect node with STARTING_UP status.
2563    pub fn r#set_health_starting_up(
2564        &self,
2565    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
2566        LazyInspectPuppetProxyInterface::r#set_health_starting_up(self)
2567    }
2568
2569    /// Records a string inspect property.
2570    pub fn r#record_string(
2571        &self,
2572        mut key: &str,
2573        mut value: &str,
2574    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
2575        LazyInspectPuppetProxyInterface::r#record_string(self, key, value)
2576    }
2577
2578    /// Records an integer inspect property.
2579    pub fn r#record_int(
2580        &self,
2581        mut key: &str,
2582        mut value: i64,
2583    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
2584        LazyInspectPuppetProxyInterface::r#record_int(self, key, value)
2585    }
2586
2587    /// Emits a collection of example of inspect data.
2588    ///
2589    /// TODO(https://fuchsia.dev/302716196): Split this into several methods
2590    /// tests can call to explicitly emit the same data as this method.
2591    pub fn r#emit_example_inspect_data(
2592        &self,
2593    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
2594        LazyInspectPuppetProxyInterface::r#emit_example_inspect_data(self)
2595    }
2596
2597    /// Escrow the current inspect data and immediately exit afterwards.
2598    pub fn r#escrow_and_exit(
2599        &self,
2600        mut payload: &InspectWriterEscrowAndExitRequest,
2601    ) -> fidl::client::QueryResponseFut<
2602        InspectWriterEscrowAndExitResponse,
2603        fidl::encoding::DefaultFuchsiaResourceDialect,
2604    > {
2605        LazyInspectPuppetProxyInterface::r#escrow_and_exit(self, payload)
2606    }
2607
2608    /// Returns a LazyInspectPuppet client for recording lazy values.
2609    pub fn r#record_lazy_values(
2610        &self,
2611        mut key: &str,
2612    ) -> fidl::client::QueryResponseFut<
2613        fidl::endpoints::ClientEnd<LazyInspectPuppetMarker>,
2614        fidl::encoding::DefaultFuchsiaResourceDialect,
2615    > {
2616        LazyInspectPuppetProxyInterface::r#record_lazy_values(self, key)
2617    }
2618
2619    /// Reports all recorded values on the root node.
2620    ///
2621    /// The server will close the connection after this method is called.
2622    pub fn r#commit(
2623        &self,
2624        mut options: &CommitOptions,
2625    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
2626        LazyInspectPuppetProxyInterface::r#commit(self, options)
2627    }
2628}
2629
2630impl LazyInspectPuppetProxyInterface for LazyInspectPuppetProxy {
2631    type SetHealthOkResponseFut =
2632        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
2633    fn r#set_health_ok(&self) -> Self::SetHealthOkResponseFut {
2634        fn _decode(
2635            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2636        ) -> Result<(), fidl::Error> {
2637            let _response = fidl::client::decode_transaction_body::<
2638                fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
2639                fidl::encoding::DefaultFuchsiaResourceDialect,
2640                0xe7510549d99075e,
2641            >(_buf?)?
2642            .into_result::<LazyInspectPuppetMarker>("set_health_ok")?;
2643            Ok(_response)
2644        }
2645        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
2646            (),
2647            0xe7510549d99075e,
2648            fidl::encoding::DynamicFlags::FLEXIBLE,
2649            _decode,
2650        )
2651    }
2652
2653    type SetHealthStartingUpResponseFut =
2654        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
2655    fn r#set_health_starting_up(&self) -> Self::SetHealthStartingUpResponseFut {
2656        fn _decode(
2657            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2658        ) -> Result<(), fidl::Error> {
2659            let _response = fidl::client::decode_transaction_body::<
2660                fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
2661                fidl::encoding::DefaultFuchsiaResourceDialect,
2662                0x6a7dbea8c4f52015,
2663            >(_buf?)?
2664            .into_result::<LazyInspectPuppetMarker>("set_health_starting_up")?;
2665            Ok(_response)
2666        }
2667        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
2668            (),
2669            0x6a7dbea8c4f52015,
2670            fidl::encoding::DynamicFlags::FLEXIBLE,
2671            _decode,
2672        )
2673    }
2674
2675    type RecordStringResponseFut =
2676        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
2677    fn r#record_string(&self, mut key: &str, mut value: &str) -> Self::RecordStringResponseFut {
2678        fn _decode(
2679            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2680        ) -> Result<(), fidl::Error> {
2681            let _response = fidl::client::decode_transaction_body::<
2682                fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
2683                fidl::encoding::DefaultFuchsiaResourceDialect,
2684                0x195be230721d712b,
2685            >(_buf?)?
2686            .into_result::<LazyInspectPuppetMarker>("record_string")?;
2687            Ok(_response)
2688        }
2689        self.client.send_query_and_decode::<InspectWriterRecordStringRequest, ()>(
2690            (key, value),
2691            0x195be230721d712b,
2692            fidl::encoding::DynamicFlags::FLEXIBLE,
2693            _decode,
2694        )
2695    }
2696
2697    type RecordIntResponseFut =
2698        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
2699    fn r#record_int(&self, mut key: &str, mut value: i64) -> Self::RecordIntResponseFut {
2700        fn _decode(
2701            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2702        ) -> Result<(), fidl::Error> {
2703            let _response = fidl::client::decode_transaction_body::<
2704                fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
2705                fidl::encoding::DefaultFuchsiaResourceDialect,
2706                0xa2c6cbf0df0949,
2707            >(_buf?)?
2708            .into_result::<LazyInspectPuppetMarker>("record_int")?;
2709            Ok(_response)
2710        }
2711        self.client.send_query_and_decode::<InspectWriterRecordIntRequest, ()>(
2712            (key, value),
2713            0xa2c6cbf0df0949,
2714            fidl::encoding::DynamicFlags::FLEXIBLE,
2715            _decode,
2716        )
2717    }
2718
2719    type EmitExampleInspectDataResponseFut =
2720        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
2721    fn r#emit_example_inspect_data(&self) -> Self::EmitExampleInspectDataResponseFut {
2722        fn _decode(
2723            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2724        ) -> Result<(), fidl::Error> {
2725            let _response = fidl::client::decode_transaction_body::<
2726                fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
2727                fidl::encoding::DefaultFuchsiaResourceDialect,
2728                0x228ae4647773fd94,
2729            >(_buf?)?
2730            .into_result::<LazyInspectPuppetMarker>("emit_example_inspect_data")?;
2731            Ok(_response)
2732        }
2733        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
2734            (),
2735            0x228ae4647773fd94,
2736            fidl::encoding::DynamicFlags::FLEXIBLE,
2737            _decode,
2738        )
2739    }
2740
2741    type EscrowAndExitResponseFut = fidl::client::QueryResponseFut<
2742        InspectWriterEscrowAndExitResponse,
2743        fidl::encoding::DefaultFuchsiaResourceDialect,
2744    >;
2745    fn r#escrow_and_exit(
2746        &self,
2747        mut payload: &InspectWriterEscrowAndExitRequest,
2748    ) -> Self::EscrowAndExitResponseFut {
2749        fn _decode(
2750            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2751        ) -> Result<InspectWriterEscrowAndExitResponse, fidl::Error> {
2752            let _response = fidl::client::decode_transaction_body::<
2753                fidl::encoding::FlexibleType<InspectWriterEscrowAndExitResponse>,
2754                fidl::encoding::DefaultFuchsiaResourceDialect,
2755                0x60e24adbd0e588ff,
2756            >(_buf?)?
2757            .into_result::<LazyInspectPuppetMarker>("escrow_and_exit")?;
2758            Ok(_response)
2759        }
2760        self.client.send_query_and_decode::<
2761            InspectWriterEscrowAndExitRequest,
2762            InspectWriterEscrowAndExitResponse,
2763        >(
2764            payload,
2765            0x60e24adbd0e588ff,
2766            fidl::encoding::DynamicFlags::FLEXIBLE,
2767            _decode,
2768        )
2769    }
2770
2771    type RecordLazyValuesResponseFut = fidl::client::QueryResponseFut<
2772        fidl::endpoints::ClientEnd<LazyInspectPuppetMarker>,
2773        fidl::encoding::DefaultFuchsiaResourceDialect,
2774    >;
2775    fn r#record_lazy_values(&self, mut key: &str) -> Self::RecordLazyValuesResponseFut {
2776        fn _decode(
2777            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2778        ) -> Result<fidl::endpoints::ClientEnd<LazyInspectPuppetMarker>, fidl::Error> {
2779            let _response = fidl::client::decode_transaction_body::<
2780                fidl::encoding::FlexibleType<InspectWriterRecordLazyValuesResponse>,
2781                fidl::encoding::DefaultFuchsiaResourceDialect,
2782                0xc637cf5d48e9063,
2783            >(_buf?)?
2784            .into_result::<LazyInspectPuppetMarker>("record_lazy_values")?;
2785            Ok(_response.client)
2786        }
2787        self.client.send_query_and_decode::<
2788            InspectWriterRecordLazyValuesRequest,
2789            fidl::endpoints::ClientEnd<LazyInspectPuppetMarker>,
2790        >(
2791            (key,),
2792            0xc637cf5d48e9063,
2793            fidl::encoding::DynamicFlags::FLEXIBLE,
2794            _decode,
2795        )
2796    }
2797
2798    type CommitResponseFut =
2799        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
2800    fn r#commit(&self, mut options: &CommitOptions) -> Self::CommitResponseFut {
2801        fn _decode(
2802            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2803        ) -> Result<(), fidl::Error> {
2804            let _response = fidl::client::decode_transaction_body::<
2805                fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
2806                fidl::encoding::DefaultFuchsiaResourceDialect,
2807                0x79524e5e00cbf03f,
2808            >(_buf?)?
2809            .into_result::<LazyInspectPuppetMarker>("commit")?;
2810            Ok(_response)
2811        }
2812        self.client.send_query_and_decode::<LazyInspectPuppetCommitRequest, ()>(
2813            (options,),
2814            0x79524e5e00cbf03f,
2815            fidl::encoding::DynamicFlags::FLEXIBLE,
2816            _decode,
2817        )
2818    }
2819}
2820
2821pub struct LazyInspectPuppetEventStream {
2822    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2823}
2824
2825impl std::marker::Unpin for LazyInspectPuppetEventStream {}
2826
2827impl futures::stream::FusedStream for LazyInspectPuppetEventStream {
2828    fn is_terminated(&self) -> bool {
2829        self.event_receiver.is_terminated()
2830    }
2831}
2832
2833impl futures::Stream for LazyInspectPuppetEventStream {
2834    type Item = Result<LazyInspectPuppetEvent, fidl::Error>;
2835
2836    fn poll_next(
2837        mut self: std::pin::Pin<&mut Self>,
2838        cx: &mut std::task::Context<'_>,
2839    ) -> std::task::Poll<Option<Self::Item>> {
2840        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2841            &mut self.event_receiver,
2842            cx
2843        )?) {
2844            Some(buf) => std::task::Poll::Ready(Some(LazyInspectPuppetEvent::decode(buf))),
2845            None => std::task::Poll::Ready(None),
2846        }
2847    }
2848}
2849
2850#[derive(Debug)]
2851pub enum LazyInspectPuppetEvent {
2852    #[non_exhaustive]
2853    _UnknownEvent {
2854        /// Ordinal of the event that was sent.
2855        ordinal: u64,
2856    },
2857}
2858
2859impl LazyInspectPuppetEvent {
2860    /// Decodes a message buffer as a [`LazyInspectPuppetEvent`].
2861    fn decode(
2862        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2863    ) -> Result<LazyInspectPuppetEvent, fidl::Error> {
2864        let (bytes, _handles) = buf.split_mut();
2865        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2866        debug_assert_eq!(tx_header.tx_id, 0);
2867        match tx_header.ordinal {
2868            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
2869                Ok(LazyInspectPuppetEvent::_UnknownEvent { ordinal: tx_header.ordinal })
2870            }
2871            _ => Err(fidl::Error::UnknownOrdinal {
2872                ordinal: tx_header.ordinal,
2873                protocol_name:
2874                    <LazyInspectPuppetMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2875            }),
2876        }
2877    }
2878}
2879
2880/// A Stream of incoming requests for fuchsia.archivist.test/LazyInspectPuppet.
2881pub struct LazyInspectPuppetRequestStream {
2882    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2883    is_terminated: bool,
2884}
2885
2886impl std::marker::Unpin for LazyInspectPuppetRequestStream {}
2887
2888impl futures::stream::FusedStream for LazyInspectPuppetRequestStream {
2889    fn is_terminated(&self) -> bool {
2890        self.is_terminated
2891    }
2892}
2893
2894impl fidl::endpoints::RequestStream for LazyInspectPuppetRequestStream {
2895    type Protocol = LazyInspectPuppetMarker;
2896    type ControlHandle = LazyInspectPuppetControlHandle;
2897
2898    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2899        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2900    }
2901
2902    fn control_handle(&self) -> Self::ControlHandle {
2903        LazyInspectPuppetControlHandle { inner: self.inner.clone() }
2904    }
2905
2906    fn into_inner(
2907        self,
2908    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2909    {
2910        (self.inner, self.is_terminated)
2911    }
2912
2913    fn from_inner(
2914        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2915        is_terminated: bool,
2916    ) -> Self {
2917        Self { inner, is_terminated }
2918    }
2919}
2920
2921impl futures::Stream for LazyInspectPuppetRequestStream {
2922    type Item = Result<LazyInspectPuppetRequest, fidl::Error>;
2923
2924    fn poll_next(
2925        mut self: std::pin::Pin<&mut Self>,
2926        cx: &mut std::task::Context<'_>,
2927    ) -> std::task::Poll<Option<Self::Item>> {
2928        let this = &mut *self;
2929        if this.inner.check_shutdown(cx) {
2930            this.is_terminated = true;
2931            return std::task::Poll::Ready(None);
2932        }
2933        if this.is_terminated {
2934            panic!("polled LazyInspectPuppetRequestStream after completion");
2935        }
2936        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2937            |bytes, handles| {
2938                match this.inner.channel().read_etc(cx, bytes, handles) {
2939                    std::task::Poll::Ready(Ok(())) => {}
2940                    std::task::Poll::Pending => return std::task::Poll::Pending,
2941                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2942                        this.is_terminated = true;
2943                        return std::task::Poll::Ready(None);
2944                    }
2945                    std::task::Poll::Ready(Err(e)) => {
2946                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2947                            e.into(),
2948                        ))));
2949                    }
2950                }
2951
2952                // A message has been received from the channel
2953                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2954
2955                std::task::Poll::Ready(Some(match header.ordinal {
2956                    0xe7510549d99075e => {
2957                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2958                        let mut req = fidl::new_empty!(
2959                            fidl::encoding::EmptyPayload,
2960                            fidl::encoding::DefaultFuchsiaResourceDialect
2961                        );
2962                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2963                        let control_handle =
2964                            LazyInspectPuppetControlHandle { inner: this.inner.clone() };
2965                        Ok(LazyInspectPuppetRequest::SetHealthOk {
2966                            responder: LazyInspectPuppetSetHealthOkResponder {
2967                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2968                                tx_id: header.tx_id,
2969                            },
2970                        })
2971                    }
2972                    0x6a7dbea8c4f52015 => {
2973                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2974                        let mut req = fidl::new_empty!(
2975                            fidl::encoding::EmptyPayload,
2976                            fidl::encoding::DefaultFuchsiaResourceDialect
2977                        );
2978                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2979                        let control_handle =
2980                            LazyInspectPuppetControlHandle { inner: this.inner.clone() };
2981                        Ok(LazyInspectPuppetRequest::SetHealthStartingUp {
2982                            responder: LazyInspectPuppetSetHealthStartingUpResponder {
2983                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2984                                tx_id: header.tx_id,
2985                            },
2986                        })
2987                    }
2988                    0x195be230721d712b => {
2989                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2990                        let mut req = fidl::new_empty!(
2991                            InspectWriterRecordStringRequest,
2992                            fidl::encoding::DefaultFuchsiaResourceDialect
2993                        );
2994                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InspectWriterRecordStringRequest>(&header, _body_bytes, handles, &mut req)?;
2995                        let control_handle =
2996                            LazyInspectPuppetControlHandle { inner: this.inner.clone() };
2997                        Ok(LazyInspectPuppetRequest::RecordString {
2998                            key: req.key,
2999                            value: req.value,
3000
3001                            responder: LazyInspectPuppetRecordStringResponder {
3002                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3003                                tx_id: header.tx_id,
3004                            },
3005                        })
3006                    }
3007                    0xa2c6cbf0df0949 => {
3008                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3009                        let mut req = fidl::new_empty!(
3010                            InspectWriterRecordIntRequest,
3011                            fidl::encoding::DefaultFuchsiaResourceDialect
3012                        );
3013                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InspectWriterRecordIntRequest>(&header, _body_bytes, handles, &mut req)?;
3014                        let control_handle =
3015                            LazyInspectPuppetControlHandle { inner: this.inner.clone() };
3016                        Ok(LazyInspectPuppetRequest::RecordInt {
3017                            key: req.key,
3018                            value: req.value,
3019
3020                            responder: LazyInspectPuppetRecordIntResponder {
3021                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3022                                tx_id: header.tx_id,
3023                            },
3024                        })
3025                    }
3026                    0x228ae4647773fd94 => {
3027                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3028                        let mut req = fidl::new_empty!(
3029                            fidl::encoding::EmptyPayload,
3030                            fidl::encoding::DefaultFuchsiaResourceDialect
3031                        );
3032                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3033                        let control_handle =
3034                            LazyInspectPuppetControlHandle { inner: this.inner.clone() };
3035                        Ok(LazyInspectPuppetRequest::EmitExampleInspectData {
3036                            responder: LazyInspectPuppetEmitExampleInspectDataResponder {
3037                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3038                                tx_id: header.tx_id,
3039                            },
3040                        })
3041                    }
3042                    0x60e24adbd0e588ff => {
3043                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3044                        let mut req = fidl::new_empty!(
3045                            InspectWriterEscrowAndExitRequest,
3046                            fidl::encoding::DefaultFuchsiaResourceDialect
3047                        );
3048                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InspectWriterEscrowAndExitRequest>(&header, _body_bytes, handles, &mut req)?;
3049                        let control_handle =
3050                            LazyInspectPuppetControlHandle { inner: this.inner.clone() };
3051                        Ok(LazyInspectPuppetRequest::EscrowAndExit {
3052                            payload: req,
3053                            responder: LazyInspectPuppetEscrowAndExitResponder {
3054                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3055                                tx_id: header.tx_id,
3056                            },
3057                        })
3058                    }
3059                    0xc637cf5d48e9063 => {
3060                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3061                        let mut req = fidl::new_empty!(
3062                            InspectWriterRecordLazyValuesRequest,
3063                            fidl::encoding::DefaultFuchsiaResourceDialect
3064                        );
3065                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InspectWriterRecordLazyValuesRequest>(&header, _body_bytes, handles, &mut req)?;
3066                        let control_handle =
3067                            LazyInspectPuppetControlHandle { inner: this.inner.clone() };
3068                        Ok(LazyInspectPuppetRequest::RecordLazyValues {
3069                            key: req.key,
3070
3071                            responder: LazyInspectPuppetRecordLazyValuesResponder {
3072                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3073                                tx_id: header.tx_id,
3074                            },
3075                        })
3076                    }
3077                    0x79524e5e00cbf03f => {
3078                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3079                        let mut req = fidl::new_empty!(
3080                            LazyInspectPuppetCommitRequest,
3081                            fidl::encoding::DefaultFuchsiaResourceDialect
3082                        );
3083                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LazyInspectPuppetCommitRequest>(&header, _body_bytes, handles, &mut req)?;
3084                        let control_handle =
3085                            LazyInspectPuppetControlHandle { inner: this.inner.clone() };
3086                        Ok(LazyInspectPuppetRequest::Commit {
3087                            options: req.options,
3088
3089                            responder: LazyInspectPuppetCommitResponder {
3090                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3091                                tx_id: header.tx_id,
3092                            },
3093                        })
3094                    }
3095                    _ if header.tx_id == 0
3096                        && header
3097                            .dynamic_flags()
3098                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
3099                    {
3100                        Ok(LazyInspectPuppetRequest::_UnknownMethod {
3101                            ordinal: header.ordinal,
3102                            control_handle: LazyInspectPuppetControlHandle {
3103                                inner: this.inner.clone(),
3104                            },
3105                            method_type: fidl::MethodType::OneWay,
3106                        })
3107                    }
3108                    _ if header
3109                        .dynamic_flags()
3110                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
3111                    {
3112                        this.inner.send_framework_err(
3113                            fidl::encoding::FrameworkErr::UnknownMethod,
3114                            header.tx_id,
3115                            header.ordinal,
3116                            header.dynamic_flags(),
3117                            (bytes, handles),
3118                        )?;
3119                        Ok(LazyInspectPuppetRequest::_UnknownMethod {
3120                            ordinal: header.ordinal,
3121                            control_handle: LazyInspectPuppetControlHandle {
3122                                inner: this.inner.clone(),
3123                            },
3124                            method_type: fidl::MethodType::TwoWay,
3125                        })
3126                    }
3127                    _ => Err(fidl::Error::UnknownOrdinal {
3128                        ordinal: header.ordinal,
3129                        protocol_name:
3130                            <LazyInspectPuppetMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3131                    }),
3132                }))
3133            },
3134        )
3135    }
3136}
3137
3138/// Records values on a lazy inspect node.
3139///
3140/// If this connection is dropped before [`CommitLazyValues`] is called, no
3141/// values are recorded.
3142///
3143/// Values are always reported on the root inspect node.
3144#[derive(Debug)]
3145pub enum LazyInspectPuppetRequest {
3146    /// Emits a health inspect node with OK status.
3147    SetHealthOk { responder: LazyInspectPuppetSetHealthOkResponder },
3148    /// Emits a health inspect node with STARTING_UP status.
3149    SetHealthStartingUp { responder: LazyInspectPuppetSetHealthStartingUpResponder },
3150    /// Records a string inspect property.
3151    RecordString { key: String, value: String, responder: LazyInspectPuppetRecordStringResponder },
3152    /// Records an integer inspect property.
3153    RecordInt { key: String, value: i64, responder: LazyInspectPuppetRecordIntResponder },
3154    /// Emits a collection of example of inspect data.
3155    ///
3156    /// TODO(https://fuchsia.dev/302716196): Split this into several methods
3157    /// tests can call to explicitly emit the same data as this method.
3158    EmitExampleInspectData { responder: LazyInspectPuppetEmitExampleInspectDataResponder },
3159    /// Escrow the current inspect data and immediately exit afterwards.
3160    EscrowAndExit {
3161        payload: InspectWriterEscrowAndExitRequest,
3162        responder: LazyInspectPuppetEscrowAndExitResponder,
3163    },
3164    /// Returns a LazyInspectPuppet client for recording lazy values.
3165    RecordLazyValues { key: String, responder: LazyInspectPuppetRecordLazyValuesResponder },
3166    /// Reports all recorded values on the root node.
3167    ///
3168    /// The server will close the connection after this method is called.
3169    Commit { options: CommitOptions, responder: LazyInspectPuppetCommitResponder },
3170    /// An interaction was received which does not match any known method.
3171    #[non_exhaustive]
3172    _UnknownMethod {
3173        /// Ordinal of the method that was called.
3174        ordinal: u64,
3175        control_handle: LazyInspectPuppetControlHandle,
3176        method_type: fidl::MethodType,
3177    },
3178}
3179
3180impl LazyInspectPuppetRequest {
3181    #[allow(irrefutable_let_patterns)]
3182    pub fn into_set_health_ok(self) -> Option<(LazyInspectPuppetSetHealthOkResponder)> {
3183        if let LazyInspectPuppetRequest::SetHealthOk { responder } = self {
3184            Some((responder))
3185        } else {
3186            None
3187        }
3188    }
3189
3190    #[allow(irrefutable_let_patterns)]
3191    pub fn into_set_health_starting_up(
3192        self,
3193    ) -> Option<(LazyInspectPuppetSetHealthStartingUpResponder)> {
3194        if let LazyInspectPuppetRequest::SetHealthStartingUp { responder } = self {
3195            Some((responder))
3196        } else {
3197            None
3198        }
3199    }
3200
3201    #[allow(irrefutable_let_patterns)]
3202    pub fn into_record_string(
3203        self,
3204    ) -> Option<(String, String, LazyInspectPuppetRecordStringResponder)> {
3205        if let LazyInspectPuppetRequest::RecordString { key, value, responder } = self {
3206            Some((key, value, responder))
3207        } else {
3208            None
3209        }
3210    }
3211
3212    #[allow(irrefutable_let_patterns)]
3213    pub fn into_record_int(self) -> Option<(String, i64, LazyInspectPuppetRecordIntResponder)> {
3214        if let LazyInspectPuppetRequest::RecordInt { key, value, responder } = self {
3215            Some((key, value, responder))
3216        } else {
3217            None
3218        }
3219    }
3220
3221    #[allow(irrefutable_let_patterns)]
3222    pub fn into_emit_example_inspect_data(
3223        self,
3224    ) -> Option<(LazyInspectPuppetEmitExampleInspectDataResponder)> {
3225        if let LazyInspectPuppetRequest::EmitExampleInspectData { responder } = self {
3226            Some((responder))
3227        } else {
3228            None
3229        }
3230    }
3231
3232    #[allow(irrefutable_let_patterns)]
3233    pub fn into_escrow_and_exit(
3234        self,
3235    ) -> Option<(InspectWriterEscrowAndExitRequest, LazyInspectPuppetEscrowAndExitResponder)> {
3236        if let LazyInspectPuppetRequest::EscrowAndExit { payload, responder } = self {
3237            Some((payload, responder))
3238        } else {
3239            None
3240        }
3241    }
3242
3243    #[allow(irrefutable_let_patterns)]
3244    pub fn into_record_lazy_values(
3245        self,
3246    ) -> Option<(String, LazyInspectPuppetRecordLazyValuesResponder)> {
3247        if let LazyInspectPuppetRequest::RecordLazyValues { key, responder } = self {
3248            Some((key, responder))
3249        } else {
3250            None
3251        }
3252    }
3253
3254    #[allow(irrefutable_let_patterns)]
3255    pub fn into_commit(self) -> Option<(CommitOptions, LazyInspectPuppetCommitResponder)> {
3256        if let LazyInspectPuppetRequest::Commit { options, responder } = self {
3257            Some((options, responder))
3258        } else {
3259            None
3260        }
3261    }
3262
3263    /// Name of the method defined in FIDL
3264    pub fn method_name(&self) -> &'static str {
3265        match *self {
3266            LazyInspectPuppetRequest::SetHealthOk { .. } => "set_health_ok",
3267            LazyInspectPuppetRequest::SetHealthStartingUp { .. } => "set_health_starting_up",
3268            LazyInspectPuppetRequest::RecordString { .. } => "record_string",
3269            LazyInspectPuppetRequest::RecordInt { .. } => "record_int",
3270            LazyInspectPuppetRequest::EmitExampleInspectData { .. } => "emit_example_inspect_data",
3271            LazyInspectPuppetRequest::EscrowAndExit { .. } => "escrow_and_exit",
3272            LazyInspectPuppetRequest::RecordLazyValues { .. } => "record_lazy_values",
3273            LazyInspectPuppetRequest::Commit { .. } => "commit",
3274            LazyInspectPuppetRequest::_UnknownMethod {
3275                method_type: fidl::MethodType::OneWay,
3276                ..
3277            } => "unknown one-way method",
3278            LazyInspectPuppetRequest::_UnknownMethod {
3279                method_type: fidl::MethodType::TwoWay,
3280                ..
3281            } => "unknown two-way method",
3282        }
3283    }
3284}
3285
3286#[derive(Debug, Clone)]
3287pub struct LazyInspectPuppetControlHandle {
3288    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3289}
3290
3291impl fidl::endpoints::ControlHandle for LazyInspectPuppetControlHandle {
3292    fn shutdown(&self) {
3293        self.inner.shutdown()
3294    }
3295
3296    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3297        self.inner.shutdown_with_epitaph(status)
3298    }
3299
3300    fn is_closed(&self) -> bool {
3301        self.inner.channel().is_closed()
3302    }
3303    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3304        self.inner.channel().on_closed()
3305    }
3306
3307    #[cfg(target_os = "fuchsia")]
3308    fn signal_peer(
3309        &self,
3310        clear_mask: zx::Signals,
3311        set_mask: zx::Signals,
3312    ) -> Result<(), zx_status::Status> {
3313        use fidl::Peered;
3314        self.inner.channel().signal_peer(clear_mask, set_mask)
3315    }
3316}
3317
3318impl LazyInspectPuppetControlHandle {}
3319
3320#[must_use = "FIDL methods require a response to be sent"]
3321#[derive(Debug)]
3322pub struct LazyInspectPuppetSetHealthOkResponder {
3323    control_handle: std::mem::ManuallyDrop<LazyInspectPuppetControlHandle>,
3324    tx_id: u32,
3325}
3326
3327/// Set the the channel to be shutdown (see [`LazyInspectPuppetControlHandle::shutdown`])
3328/// if the responder is dropped without sending a response, so that the client
3329/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3330impl std::ops::Drop for LazyInspectPuppetSetHealthOkResponder {
3331    fn drop(&mut self) {
3332        self.control_handle.shutdown();
3333        // Safety: drops once, never accessed again
3334        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3335    }
3336}
3337
3338impl fidl::endpoints::Responder for LazyInspectPuppetSetHealthOkResponder {
3339    type ControlHandle = LazyInspectPuppetControlHandle;
3340
3341    fn control_handle(&self) -> &LazyInspectPuppetControlHandle {
3342        &self.control_handle
3343    }
3344
3345    fn drop_without_shutdown(mut self) {
3346        // Safety: drops once, never accessed again due to mem::forget
3347        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3348        // Prevent Drop from running (which would shut down the channel)
3349        std::mem::forget(self);
3350    }
3351}
3352
3353impl LazyInspectPuppetSetHealthOkResponder {
3354    /// Sends a response to the FIDL transaction.
3355    ///
3356    /// Sets the channel to shutdown if an error occurs.
3357    pub fn send(self) -> Result<(), fidl::Error> {
3358        let _result = self.send_raw();
3359        if _result.is_err() {
3360            self.control_handle.shutdown();
3361        }
3362        self.drop_without_shutdown();
3363        _result
3364    }
3365
3366    /// Similar to "send" but does not shutdown the channel if an error occurs.
3367    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
3368        let _result = self.send_raw();
3369        self.drop_without_shutdown();
3370        _result
3371    }
3372
3373    fn send_raw(&self) -> Result<(), fidl::Error> {
3374        self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
3375            fidl::encoding::Flexible::new(()),
3376            self.tx_id,
3377            0xe7510549d99075e,
3378            fidl::encoding::DynamicFlags::FLEXIBLE,
3379        )
3380    }
3381}
3382
3383#[must_use = "FIDL methods require a response to be sent"]
3384#[derive(Debug)]
3385pub struct LazyInspectPuppetSetHealthStartingUpResponder {
3386    control_handle: std::mem::ManuallyDrop<LazyInspectPuppetControlHandle>,
3387    tx_id: u32,
3388}
3389
3390/// Set the the channel to be shutdown (see [`LazyInspectPuppetControlHandle::shutdown`])
3391/// if the responder is dropped without sending a response, so that the client
3392/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3393impl std::ops::Drop for LazyInspectPuppetSetHealthStartingUpResponder {
3394    fn drop(&mut self) {
3395        self.control_handle.shutdown();
3396        // Safety: drops once, never accessed again
3397        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3398    }
3399}
3400
3401impl fidl::endpoints::Responder for LazyInspectPuppetSetHealthStartingUpResponder {
3402    type ControlHandle = LazyInspectPuppetControlHandle;
3403
3404    fn control_handle(&self) -> &LazyInspectPuppetControlHandle {
3405        &self.control_handle
3406    }
3407
3408    fn drop_without_shutdown(mut self) {
3409        // Safety: drops once, never accessed again due to mem::forget
3410        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3411        // Prevent Drop from running (which would shut down the channel)
3412        std::mem::forget(self);
3413    }
3414}
3415
3416impl LazyInspectPuppetSetHealthStartingUpResponder {
3417    /// Sends a response to the FIDL transaction.
3418    ///
3419    /// Sets the channel to shutdown if an error occurs.
3420    pub fn send(self) -> Result<(), fidl::Error> {
3421        let _result = self.send_raw();
3422        if _result.is_err() {
3423            self.control_handle.shutdown();
3424        }
3425        self.drop_without_shutdown();
3426        _result
3427    }
3428
3429    /// Similar to "send" but does not shutdown the channel if an error occurs.
3430    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
3431        let _result = self.send_raw();
3432        self.drop_without_shutdown();
3433        _result
3434    }
3435
3436    fn send_raw(&self) -> Result<(), fidl::Error> {
3437        self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
3438            fidl::encoding::Flexible::new(()),
3439            self.tx_id,
3440            0x6a7dbea8c4f52015,
3441            fidl::encoding::DynamicFlags::FLEXIBLE,
3442        )
3443    }
3444}
3445
3446#[must_use = "FIDL methods require a response to be sent"]
3447#[derive(Debug)]
3448pub struct LazyInspectPuppetRecordStringResponder {
3449    control_handle: std::mem::ManuallyDrop<LazyInspectPuppetControlHandle>,
3450    tx_id: u32,
3451}
3452
3453/// Set the the channel to be shutdown (see [`LazyInspectPuppetControlHandle::shutdown`])
3454/// if the responder is dropped without sending a response, so that the client
3455/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3456impl std::ops::Drop for LazyInspectPuppetRecordStringResponder {
3457    fn drop(&mut self) {
3458        self.control_handle.shutdown();
3459        // Safety: drops once, never accessed again
3460        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3461    }
3462}
3463
3464impl fidl::endpoints::Responder for LazyInspectPuppetRecordStringResponder {
3465    type ControlHandle = LazyInspectPuppetControlHandle;
3466
3467    fn control_handle(&self) -> &LazyInspectPuppetControlHandle {
3468        &self.control_handle
3469    }
3470
3471    fn drop_without_shutdown(mut self) {
3472        // Safety: drops once, never accessed again due to mem::forget
3473        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3474        // Prevent Drop from running (which would shut down the channel)
3475        std::mem::forget(self);
3476    }
3477}
3478
3479impl LazyInspectPuppetRecordStringResponder {
3480    /// Sends a response to the FIDL transaction.
3481    ///
3482    /// Sets the channel to shutdown if an error occurs.
3483    pub fn send(self) -> Result<(), fidl::Error> {
3484        let _result = self.send_raw();
3485        if _result.is_err() {
3486            self.control_handle.shutdown();
3487        }
3488        self.drop_without_shutdown();
3489        _result
3490    }
3491
3492    /// Similar to "send" but does not shutdown the channel if an error occurs.
3493    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
3494        let _result = self.send_raw();
3495        self.drop_without_shutdown();
3496        _result
3497    }
3498
3499    fn send_raw(&self) -> Result<(), fidl::Error> {
3500        self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
3501            fidl::encoding::Flexible::new(()),
3502            self.tx_id,
3503            0x195be230721d712b,
3504            fidl::encoding::DynamicFlags::FLEXIBLE,
3505        )
3506    }
3507}
3508
3509#[must_use = "FIDL methods require a response to be sent"]
3510#[derive(Debug)]
3511pub struct LazyInspectPuppetRecordIntResponder {
3512    control_handle: std::mem::ManuallyDrop<LazyInspectPuppetControlHandle>,
3513    tx_id: u32,
3514}
3515
3516/// Set the the channel to be shutdown (see [`LazyInspectPuppetControlHandle::shutdown`])
3517/// if the responder is dropped without sending a response, so that the client
3518/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3519impl std::ops::Drop for LazyInspectPuppetRecordIntResponder {
3520    fn drop(&mut self) {
3521        self.control_handle.shutdown();
3522        // Safety: drops once, never accessed again
3523        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3524    }
3525}
3526
3527impl fidl::endpoints::Responder for LazyInspectPuppetRecordIntResponder {
3528    type ControlHandle = LazyInspectPuppetControlHandle;
3529
3530    fn control_handle(&self) -> &LazyInspectPuppetControlHandle {
3531        &self.control_handle
3532    }
3533
3534    fn drop_without_shutdown(mut self) {
3535        // Safety: drops once, never accessed again due to mem::forget
3536        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3537        // Prevent Drop from running (which would shut down the channel)
3538        std::mem::forget(self);
3539    }
3540}
3541
3542impl LazyInspectPuppetRecordIntResponder {
3543    /// Sends a response to the FIDL transaction.
3544    ///
3545    /// Sets the channel to shutdown if an error occurs.
3546    pub fn send(self) -> Result<(), fidl::Error> {
3547        let _result = self.send_raw();
3548        if _result.is_err() {
3549            self.control_handle.shutdown();
3550        }
3551        self.drop_without_shutdown();
3552        _result
3553    }
3554
3555    /// Similar to "send" but does not shutdown the channel if an error occurs.
3556    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
3557        let _result = self.send_raw();
3558        self.drop_without_shutdown();
3559        _result
3560    }
3561
3562    fn send_raw(&self) -> Result<(), fidl::Error> {
3563        self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
3564            fidl::encoding::Flexible::new(()),
3565            self.tx_id,
3566            0xa2c6cbf0df0949,
3567            fidl::encoding::DynamicFlags::FLEXIBLE,
3568        )
3569    }
3570}
3571
3572#[must_use = "FIDL methods require a response to be sent"]
3573#[derive(Debug)]
3574pub struct LazyInspectPuppetEmitExampleInspectDataResponder {
3575    control_handle: std::mem::ManuallyDrop<LazyInspectPuppetControlHandle>,
3576    tx_id: u32,
3577}
3578
3579/// Set the the channel to be shutdown (see [`LazyInspectPuppetControlHandle::shutdown`])
3580/// if the responder is dropped without sending a response, so that the client
3581/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3582impl std::ops::Drop for LazyInspectPuppetEmitExampleInspectDataResponder {
3583    fn drop(&mut self) {
3584        self.control_handle.shutdown();
3585        // Safety: drops once, never accessed again
3586        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3587    }
3588}
3589
3590impl fidl::endpoints::Responder for LazyInspectPuppetEmitExampleInspectDataResponder {
3591    type ControlHandle = LazyInspectPuppetControlHandle;
3592
3593    fn control_handle(&self) -> &LazyInspectPuppetControlHandle {
3594        &self.control_handle
3595    }
3596
3597    fn drop_without_shutdown(mut self) {
3598        // Safety: drops once, never accessed again due to mem::forget
3599        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3600        // Prevent Drop from running (which would shut down the channel)
3601        std::mem::forget(self);
3602    }
3603}
3604
3605impl LazyInspectPuppetEmitExampleInspectDataResponder {
3606    /// Sends a response to the FIDL transaction.
3607    ///
3608    /// Sets the channel to shutdown if an error occurs.
3609    pub fn send(self) -> Result<(), fidl::Error> {
3610        let _result = self.send_raw();
3611        if _result.is_err() {
3612            self.control_handle.shutdown();
3613        }
3614        self.drop_without_shutdown();
3615        _result
3616    }
3617
3618    /// Similar to "send" but does not shutdown the channel if an error occurs.
3619    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
3620        let _result = self.send_raw();
3621        self.drop_without_shutdown();
3622        _result
3623    }
3624
3625    fn send_raw(&self) -> Result<(), fidl::Error> {
3626        self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
3627            fidl::encoding::Flexible::new(()),
3628            self.tx_id,
3629            0x228ae4647773fd94,
3630            fidl::encoding::DynamicFlags::FLEXIBLE,
3631        )
3632    }
3633}
3634
3635#[must_use = "FIDL methods require a response to be sent"]
3636#[derive(Debug)]
3637pub struct LazyInspectPuppetEscrowAndExitResponder {
3638    control_handle: std::mem::ManuallyDrop<LazyInspectPuppetControlHandle>,
3639    tx_id: u32,
3640}
3641
3642/// Set the the channel to be shutdown (see [`LazyInspectPuppetControlHandle::shutdown`])
3643/// if the responder is dropped without sending a response, so that the client
3644/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3645impl std::ops::Drop for LazyInspectPuppetEscrowAndExitResponder {
3646    fn drop(&mut self) {
3647        self.control_handle.shutdown();
3648        // Safety: drops once, never accessed again
3649        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3650    }
3651}
3652
3653impl fidl::endpoints::Responder for LazyInspectPuppetEscrowAndExitResponder {
3654    type ControlHandle = LazyInspectPuppetControlHandle;
3655
3656    fn control_handle(&self) -> &LazyInspectPuppetControlHandle {
3657        &self.control_handle
3658    }
3659
3660    fn drop_without_shutdown(mut self) {
3661        // Safety: drops once, never accessed again due to mem::forget
3662        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3663        // Prevent Drop from running (which would shut down the channel)
3664        std::mem::forget(self);
3665    }
3666}
3667
3668impl LazyInspectPuppetEscrowAndExitResponder {
3669    /// Sends a response to the FIDL transaction.
3670    ///
3671    /// Sets the channel to shutdown if an error occurs.
3672    pub fn send(self, mut payload: InspectWriterEscrowAndExitResponse) -> Result<(), fidl::Error> {
3673        let _result = self.send_raw(payload);
3674        if _result.is_err() {
3675            self.control_handle.shutdown();
3676        }
3677        self.drop_without_shutdown();
3678        _result
3679    }
3680
3681    /// Similar to "send" but does not shutdown the channel if an error occurs.
3682    pub fn send_no_shutdown_on_err(
3683        self,
3684        mut payload: InspectWriterEscrowAndExitResponse,
3685    ) -> Result<(), fidl::Error> {
3686        let _result = self.send_raw(payload);
3687        self.drop_without_shutdown();
3688        _result
3689    }
3690
3691    fn send_raw(&self, mut payload: InspectWriterEscrowAndExitResponse) -> Result<(), fidl::Error> {
3692        self.control_handle
3693            .inner
3694            .send::<fidl::encoding::FlexibleType<InspectWriterEscrowAndExitResponse>>(
3695                fidl::encoding::Flexible::new(&mut payload),
3696                self.tx_id,
3697                0x60e24adbd0e588ff,
3698                fidl::encoding::DynamicFlags::FLEXIBLE,
3699            )
3700    }
3701}
3702
3703#[must_use = "FIDL methods require a response to be sent"]
3704#[derive(Debug)]
3705pub struct LazyInspectPuppetRecordLazyValuesResponder {
3706    control_handle: std::mem::ManuallyDrop<LazyInspectPuppetControlHandle>,
3707    tx_id: u32,
3708}
3709
3710/// Set the the channel to be shutdown (see [`LazyInspectPuppetControlHandle::shutdown`])
3711/// if the responder is dropped without sending a response, so that the client
3712/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3713impl std::ops::Drop for LazyInspectPuppetRecordLazyValuesResponder {
3714    fn drop(&mut self) {
3715        self.control_handle.shutdown();
3716        // Safety: drops once, never accessed again
3717        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3718    }
3719}
3720
3721impl fidl::endpoints::Responder for LazyInspectPuppetRecordLazyValuesResponder {
3722    type ControlHandle = LazyInspectPuppetControlHandle;
3723
3724    fn control_handle(&self) -> &LazyInspectPuppetControlHandle {
3725        &self.control_handle
3726    }
3727
3728    fn drop_without_shutdown(mut self) {
3729        // Safety: drops once, never accessed again due to mem::forget
3730        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3731        // Prevent Drop from running (which would shut down the channel)
3732        std::mem::forget(self);
3733    }
3734}
3735
3736impl LazyInspectPuppetRecordLazyValuesResponder {
3737    /// Sends a response to the FIDL transaction.
3738    ///
3739    /// Sets the channel to shutdown if an error occurs.
3740    pub fn send(
3741        self,
3742        mut client: fidl::endpoints::ClientEnd<LazyInspectPuppetMarker>,
3743    ) -> Result<(), fidl::Error> {
3744        let _result = self.send_raw(client);
3745        if _result.is_err() {
3746            self.control_handle.shutdown();
3747        }
3748        self.drop_without_shutdown();
3749        _result
3750    }
3751
3752    /// Similar to "send" but does not shutdown the channel if an error occurs.
3753    pub fn send_no_shutdown_on_err(
3754        self,
3755        mut client: fidl::endpoints::ClientEnd<LazyInspectPuppetMarker>,
3756    ) -> Result<(), fidl::Error> {
3757        let _result = self.send_raw(client);
3758        self.drop_without_shutdown();
3759        _result
3760    }
3761
3762    fn send_raw(
3763        &self,
3764        mut client: fidl::endpoints::ClientEnd<LazyInspectPuppetMarker>,
3765    ) -> Result<(), fidl::Error> {
3766        self.control_handle
3767            .inner
3768            .send::<fidl::encoding::FlexibleType<InspectWriterRecordLazyValuesResponse>>(
3769                fidl::encoding::Flexible::new((client,)),
3770                self.tx_id,
3771                0xc637cf5d48e9063,
3772                fidl::encoding::DynamicFlags::FLEXIBLE,
3773            )
3774    }
3775}
3776
3777#[must_use = "FIDL methods require a response to be sent"]
3778#[derive(Debug)]
3779pub struct LazyInspectPuppetCommitResponder {
3780    control_handle: std::mem::ManuallyDrop<LazyInspectPuppetControlHandle>,
3781    tx_id: u32,
3782}
3783
3784/// Set the the channel to be shutdown (see [`LazyInspectPuppetControlHandle::shutdown`])
3785/// if the responder is dropped without sending a response, so that the client
3786/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3787impl std::ops::Drop for LazyInspectPuppetCommitResponder {
3788    fn drop(&mut self) {
3789        self.control_handle.shutdown();
3790        // Safety: drops once, never accessed again
3791        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3792    }
3793}
3794
3795impl fidl::endpoints::Responder for LazyInspectPuppetCommitResponder {
3796    type ControlHandle = LazyInspectPuppetControlHandle;
3797
3798    fn control_handle(&self) -> &LazyInspectPuppetControlHandle {
3799        &self.control_handle
3800    }
3801
3802    fn drop_without_shutdown(mut self) {
3803        // Safety: drops once, never accessed again due to mem::forget
3804        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3805        // Prevent Drop from running (which would shut down the channel)
3806        std::mem::forget(self);
3807    }
3808}
3809
3810impl LazyInspectPuppetCommitResponder {
3811    /// Sends a response to the FIDL transaction.
3812    ///
3813    /// Sets the channel to shutdown if an error occurs.
3814    pub fn send(self) -> Result<(), fidl::Error> {
3815        let _result = self.send_raw();
3816        if _result.is_err() {
3817            self.control_handle.shutdown();
3818        }
3819        self.drop_without_shutdown();
3820        _result
3821    }
3822
3823    /// Similar to "send" but does not shutdown the channel if an error occurs.
3824    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
3825        let _result = self.send_raw();
3826        self.drop_without_shutdown();
3827        _result
3828    }
3829
3830    fn send_raw(&self) -> Result<(), fidl::Error> {
3831        self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
3832            fidl::encoding::Flexible::new(()),
3833            self.tx_id,
3834            0x79524e5e00cbf03f,
3835            fidl::encoding::DynamicFlags::FLEXIBLE,
3836        )
3837    }
3838}
3839
3840#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3841pub struct LogPuppetMarker;
3842
3843impl fidl::endpoints::ProtocolMarker for LogPuppetMarker {
3844    type Proxy = LogPuppetProxy;
3845    type RequestStream = LogPuppetRequestStream;
3846    #[cfg(target_os = "fuchsia")]
3847    type SynchronousProxy = LogPuppetSynchronousProxy;
3848
3849    const DEBUG_NAME: &'static str = "(anonymous) LogPuppet";
3850}
3851
3852pub trait LogPuppetProxyInterface: Send + Sync {
3853    type PrintlnResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
3854    fn r#println(&self, message: &str) -> Self::PrintlnResponseFut;
3855    type EprintlnResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
3856    fn r#eprintln(&self, message: &str) -> Self::EprintlnResponseFut;
3857    type LogResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
3858    fn r#log(&self, payload: &LogPuppetLogRequest) -> Self::LogResponseFut;
3859    type WaitForInterestChangeResponseFut: std::future::Future<Output = Result<LogPuppetWaitForInterestChangeResponse, fidl::Error>>
3860        + Send;
3861    fn r#wait_for_interest_change(&self) -> Self::WaitForInterestChangeResponseFut;
3862}
3863#[derive(Debug)]
3864#[cfg(target_os = "fuchsia")]
3865pub struct LogPuppetSynchronousProxy {
3866    client: fidl::client::sync::Client,
3867}
3868
3869#[cfg(target_os = "fuchsia")]
3870impl fidl::endpoints::SynchronousProxy for LogPuppetSynchronousProxy {
3871    type Proxy = LogPuppetProxy;
3872    type Protocol = LogPuppetMarker;
3873
3874    fn from_channel(inner: fidl::Channel) -> Self {
3875        Self::new(inner)
3876    }
3877
3878    fn into_channel(self) -> fidl::Channel {
3879        self.client.into_channel()
3880    }
3881
3882    fn as_channel(&self) -> &fidl::Channel {
3883        self.client.as_channel()
3884    }
3885}
3886
3887#[cfg(target_os = "fuchsia")]
3888impl LogPuppetSynchronousProxy {
3889    pub fn new(channel: fidl::Channel) -> Self {
3890        let protocol_name = <LogPuppetMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3891        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
3892    }
3893
3894    pub fn into_channel(self) -> fidl::Channel {
3895        self.client.into_channel()
3896    }
3897
3898    /// Waits until an event arrives and returns it. It is safe for other
3899    /// threads to make concurrent requests while waiting for an event.
3900    pub fn wait_for_event(
3901        &self,
3902        deadline: zx::MonotonicInstant,
3903    ) -> Result<LogPuppetEvent, fidl::Error> {
3904        LogPuppetEvent::decode(self.client.wait_for_event(deadline)?)
3905    }
3906
3907    /// Prints a message to stdout and appends a newline.
3908    pub fn r#println(
3909        &self,
3910        mut message: &str,
3911        ___deadline: zx::MonotonicInstant,
3912    ) -> Result<(), fidl::Error> {
3913        let _response = self.client.send_query::<
3914            LogPuppetPrintlnRequest,
3915            fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
3916        >(
3917            (message,),
3918            0x6584cb93e1978da0,
3919            fidl::encoding::DynamicFlags::FLEXIBLE,
3920            ___deadline,
3921        )?
3922        .into_result::<LogPuppetMarker>("println")?;
3923        Ok(_response)
3924    }
3925
3926    /// Prints a message stderr and appends a newline.
3927    pub fn r#eprintln(
3928        &self,
3929        mut message: &str,
3930        ___deadline: zx::MonotonicInstant,
3931    ) -> Result<(), fidl::Error> {
3932        let _response = self.client.send_query::<
3933            LogPuppetEprintlnRequest,
3934            fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
3935        >(
3936            (message,),
3937            0x770e4524f6b093ef,
3938            fidl::encoding::DynamicFlags::FLEXIBLE,
3939            ___deadline,
3940        )?
3941        .into_result::<LogPuppetMarker>("eprintln")?;
3942        Ok(_response)
3943    }
3944
3945    /// Emits a tracing event at the specified severity level.
3946    pub fn r#log(
3947        &self,
3948        mut payload: &LogPuppetLogRequest,
3949        ___deadline: zx::MonotonicInstant,
3950    ) -> Result<(), fidl::Error> {
3951        let _response = self.client.send_query::<
3952            LogPuppetLogRequest,
3953            fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
3954        >(
3955            payload,
3956            0x34d3dd4225e79a8b,
3957            fidl::encoding::DynamicFlags::FLEXIBLE,
3958            ___deadline,
3959        )?
3960        .into_result::<LogPuppetMarker>("log")?;
3961        Ok(_response)
3962    }
3963
3964    /// Blocks the caller until the next time an interest change event is observed.
3965    /// Messages are lost if they are emitted using LogPuppet.Log before the
3966    /// puppet has observed the the interest change.
3967    pub fn r#wait_for_interest_change(
3968        &self,
3969        ___deadline: zx::MonotonicInstant,
3970    ) -> Result<LogPuppetWaitForInterestChangeResponse, fidl::Error> {
3971        let _response = self.client.send_query::<
3972            fidl::encoding::EmptyPayload,
3973            fidl::encoding::FlexibleType<LogPuppetWaitForInterestChangeResponse>,
3974        >(
3975            (),
3976            0x3645d3ad544bc546,
3977            fidl::encoding::DynamicFlags::FLEXIBLE,
3978            ___deadline,
3979        )?
3980        .into_result::<LogPuppetMarker>("wait_for_interest_change")?;
3981        Ok(_response)
3982    }
3983}
3984
3985#[cfg(target_os = "fuchsia")]
3986impl From<LogPuppetSynchronousProxy> for zx::NullableHandle {
3987    fn from(value: LogPuppetSynchronousProxy) -> Self {
3988        value.into_channel().into()
3989    }
3990}
3991
3992#[cfg(target_os = "fuchsia")]
3993impl From<fidl::Channel> for LogPuppetSynchronousProxy {
3994    fn from(value: fidl::Channel) -> Self {
3995        Self::new(value)
3996    }
3997}
3998
3999#[cfg(target_os = "fuchsia")]
4000impl fidl::endpoints::FromClient for LogPuppetSynchronousProxy {
4001    type Protocol = LogPuppetMarker;
4002
4003    fn from_client(value: fidl::endpoints::ClientEnd<LogPuppetMarker>) -> Self {
4004        Self::new(value.into_channel())
4005    }
4006}
4007
4008#[derive(Debug, Clone)]
4009pub struct LogPuppetProxy {
4010    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4011}
4012
4013impl fidl::endpoints::Proxy for LogPuppetProxy {
4014    type Protocol = LogPuppetMarker;
4015
4016    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4017        Self::new(inner)
4018    }
4019
4020    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4021        self.client.into_channel().map_err(|client| Self { client })
4022    }
4023
4024    fn as_channel(&self) -> &::fidl::AsyncChannel {
4025        self.client.as_channel()
4026    }
4027}
4028
4029impl LogPuppetProxy {
4030    /// Create a new Proxy for fuchsia.archivist.test/LogPuppet.
4031    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4032        let protocol_name = <LogPuppetMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4033        Self { client: fidl::client::Client::new(channel, protocol_name) }
4034    }
4035
4036    /// Get a Stream of events from the remote end of the protocol.
4037    ///
4038    /// # Panics
4039    ///
4040    /// Panics if the event stream was already taken.
4041    pub fn take_event_stream(&self) -> LogPuppetEventStream {
4042        LogPuppetEventStream { event_receiver: self.client.take_event_receiver() }
4043    }
4044
4045    /// Prints a message to stdout and appends a newline.
4046    pub fn r#println(
4047        &self,
4048        mut message: &str,
4049    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
4050        LogPuppetProxyInterface::r#println(self, message)
4051    }
4052
4053    /// Prints a message stderr and appends a newline.
4054    pub fn r#eprintln(
4055        &self,
4056        mut message: &str,
4057    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
4058        LogPuppetProxyInterface::r#eprintln(self, message)
4059    }
4060
4061    /// Emits a tracing event at the specified severity level.
4062    pub fn r#log(
4063        &self,
4064        mut payload: &LogPuppetLogRequest,
4065    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
4066        LogPuppetProxyInterface::r#log(self, payload)
4067    }
4068
4069    /// Blocks the caller until the next time an interest change event is observed.
4070    /// Messages are lost if they are emitted using LogPuppet.Log before the
4071    /// puppet has observed the the interest change.
4072    pub fn r#wait_for_interest_change(
4073        &self,
4074    ) -> fidl::client::QueryResponseFut<
4075        LogPuppetWaitForInterestChangeResponse,
4076        fidl::encoding::DefaultFuchsiaResourceDialect,
4077    > {
4078        LogPuppetProxyInterface::r#wait_for_interest_change(self)
4079    }
4080}
4081
4082impl LogPuppetProxyInterface for LogPuppetProxy {
4083    type PrintlnResponseFut =
4084        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
4085    fn r#println(&self, mut message: &str) -> Self::PrintlnResponseFut {
4086        fn _decode(
4087            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4088        ) -> Result<(), fidl::Error> {
4089            let _response = fidl::client::decode_transaction_body::<
4090                fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
4091                fidl::encoding::DefaultFuchsiaResourceDialect,
4092                0x6584cb93e1978da0,
4093            >(_buf?)?
4094            .into_result::<LogPuppetMarker>("println")?;
4095            Ok(_response)
4096        }
4097        self.client.send_query_and_decode::<LogPuppetPrintlnRequest, ()>(
4098            (message,),
4099            0x6584cb93e1978da0,
4100            fidl::encoding::DynamicFlags::FLEXIBLE,
4101            _decode,
4102        )
4103    }
4104
4105    type EprintlnResponseFut =
4106        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
4107    fn r#eprintln(&self, mut message: &str) -> Self::EprintlnResponseFut {
4108        fn _decode(
4109            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4110        ) -> Result<(), fidl::Error> {
4111            let _response = fidl::client::decode_transaction_body::<
4112                fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
4113                fidl::encoding::DefaultFuchsiaResourceDialect,
4114                0x770e4524f6b093ef,
4115            >(_buf?)?
4116            .into_result::<LogPuppetMarker>("eprintln")?;
4117            Ok(_response)
4118        }
4119        self.client.send_query_and_decode::<LogPuppetEprintlnRequest, ()>(
4120            (message,),
4121            0x770e4524f6b093ef,
4122            fidl::encoding::DynamicFlags::FLEXIBLE,
4123            _decode,
4124        )
4125    }
4126
4127    type LogResponseFut =
4128        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
4129    fn r#log(&self, mut payload: &LogPuppetLogRequest) -> Self::LogResponseFut {
4130        fn _decode(
4131            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4132        ) -> Result<(), fidl::Error> {
4133            let _response = fidl::client::decode_transaction_body::<
4134                fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
4135                fidl::encoding::DefaultFuchsiaResourceDialect,
4136                0x34d3dd4225e79a8b,
4137            >(_buf?)?
4138            .into_result::<LogPuppetMarker>("log")?;
4139            Ok(_response)
4140        }
4141        self.client.send_query_and_decode::<LogPuppetLogRequest, ()>(
4142            payload,
4143            0x34d3dd4225e79a8b,
4144            fidl::encoding::DynamicFlags::FLEXIBLE,
4145            _decode,
4146        )
4147    }
4148
4149    type WaitForInterestChangeResponseFut = fidl::client::QueryResponseFut<
4150        LogPuppetWaitForInterestChangeResponse,
4151        fidl::encoding::DefaultFuchsiaResourceDialect,
4152    >;
4153    fn r#wait_for_interest_change(&self) -> Self::WaitForInterestChangeResponseFut {
4154        fn _decode(
4155            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4156        ) -> Result<LogPuppetWaitForInterestChangeResponse, fidl::Error> {
4157            let _response = fidl::client::decode_transaction_body::<
4158                fidl::encoding::FlexibleType<LogPuppetWaitForInterestChangeResponse>,
4159                fidl::encoding::DefaultFuchsiaResourceDialect,
4160                0x3645d3ad544bc546,
4161            >(_buf?)?
4162            .into_result::<LogPuppetMarker>("wait_for_interest_change")?;
4163            Ok(_response)
4164        }
4165        self.client.send_query_and_decode::<
4166            fidl::encoding::EmptyPayload,
4167            LogPuppetWaitForInterestChangeResponse,
4168        >(
4169            (),
4170            0x3645d3ad544bc546,
4171            fidl::encoding::DynamicFlags::FLEXIBLE,
4172            _decode,
4173        )
4174    }
4175}
4176
4177pub struct LogPuppetEventStream {
4178    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4179}
4180
4181impl std::marker::Unpin for LogPuppetEventStream {}
4182
4183impl futures::stream::FusedStream for LogPuppetEventStream {
4184    fn is_terminated(&self) -> bool {
4185        self.event_receiver.is_terminated()
4186    }
4187}
4188
4189impl futures::Stream for LogPuppetEventStream {
4190    type Item = Result<LogPuppetEvent, fidl::Error>;
4191
4192    fn poll_next(
4193        mut self: std::pin::Pin<&mut Self>,
4194        cx: &mut std::task::Context<'_>,
4195    ) -> std::task::Poll<Option<Self::Item>> {
4196        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4197            &mut self.event_receiver,
4198            cx
4199        )?) {
4200            Some(buf) => std::task::Poll::Ready(Some(LogPuppetEvent::decode(buf))),
4201            None => std::task::Poll::Ready(None),
4202        }
4203    }
4204}
4205
4206#[derive(Debug)]
4207pub enum LogPuppetEvent {
4208    #[non_exhaustive]
4209    _UnknownEvent {
4210        /// Ordinal of the event that was sent.
4211        ordinal: u64,
4212    },
4213}
4214
4215impl LogPuppetEvent {
4216    /// Decodes a message buffer as a [`LogPuppetEvent`].
4217    fn decode(
4218        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4219    ) -> Result<LogPuppetEvent, fidl::Error> {
4220        let (bytes, _handles) = buf.split_mut();
4221        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4222        debug_assert_eq!(tx_header.tx_id, 0);
4223        match tx_header.ordinal {
4224            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
4225                Ok(LogPuppetEvent::_UnknownEvent { ordinal: tx_header.ordinal })
4226            }
4227            _ => Err(fidl::Error::UnknownOrdinal {
4228                ordinal: tx_header.ordinal,
4229                protocol_name: <LogPuppetMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4230            }),
4231        }
4232    }
4233}
4234
4235/// A Stream of incoming requests for fuchsia.archivist.test/LogPuppet.
4236pub struct LogPuppetRequestStream {
4237    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4238    is_terminated: bool,
4239}
4240
4241impl std::marker::Unpin for LogPuppetRequestStream {}
4242
4243impl futures::stream::FusedStream for LogPuppetRequestStream {
4244    fn is_terminated(&self) -> bool {
4245        self.is_terminated
4246    }
4247}
4248
4249impl fidl::endpoints::RequestStream for LogPuppetRequestStream {
4250    type Protocol = LogPuppetMarker;
4251    type ControlHandle = LogPuppetControlHandle;
4252
4253    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4254        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4255    }
4256
4257    fn control_handle(&self) -> Self::ControlHandle {
4258        LogPuppetControlHandle { inner: self.inner.clone() }
4259    }
4260
4261    fn into_inner(
4262        self,
4263    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4264    {
4265        (self.inner, self.is_terminated)
4266    }
4267
4268    fn from_inner(
4269        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4270        is_terminated: bool,
4271    ) -> Self {
4272        Self { inner, is_terminated }
4273    }
4274}
4275
4276impl futures::Stream for LogPuppetRequestStream {
4277    type Item = Result<LogPuppetRequest, fidl::Error>;
4278
4279    fn poll_next(
4280        mut self: std::pin::Pin<&mut Self>,
4281        cx: &mut std::task::Context<'_>,
4282    ) -> std::task::Poll<Option<Self::Item>> {
4283        let this = &mut *self;
4284        if this.inner.check_shutdown(cx) {
4285            this.is_terminated = true;
4286            return std::task::Poll::Ready(None);
4287        }
4288        if this.is_terminated {
4289            panic!("polled LogPuppetRequestStream after completion");
4290        }
4291        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4292            |bytes, handles| {
4293                match this.inner.channel().read_etc(cx, bytes, handles) {
4294                    std::task::Poll::Ready(Ok(())) => {}
4295                    std::task::Poll::Pending => return std::task::Poll::Pending,
4296                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4297                        this.is_terminated = true;
4298                        return std::task::Poll::Ready(None);
4299                    }
4300                    std::task::Poll::Ready(Err(e)) => {
4301                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4302                            e.into(),
4303                        ))));
4304                    }
4305                }
4306
4307                // A message has been received from the channel
4308                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4309
4310                std::task::Poll::Ready(Some(match header.ordinal {
4311                    0x6584cb93e1978da0 => {
4312                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4313                        let mut req = fidl::new_empty!(
4314                            LogPuppetPrintlnRequest,
4315                            fidl::encoding::DefaultFuchsiaResourceDialect
4316                        );
4317                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LogPuppetPrintlnRequest>(&header, _body_bytes, handles, &mut req)?;
4318                        let control_handle = LogPuppetControlHandle { inner: this.inner.clone() };
4319                        Ok(LogPuppetRequest::Println {
4320                            message: req.message,
4321
4322                            responder: LogPuppetPrintlnResponder {
4323                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4324                                tx_id: header.tx_id,
4325                            },
4326                        })
4327                    }
4328                    0x770e4524f6b093ef => {
4329                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4330                        let mut req = fidl::new_empty!(
4331                            LogPuppetEprintlnRequest,
4332                            fidl::encoding::DefaultFuchsiaResourceDialect
4333                        );
4334                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LogPuppetEprintlnRequest>(&header, _body_bytes, handles, &mut req)?;
4335                        let control_handle = LogPuppetControlHandle { inner: this.inner.clone() };
4336                        Ok(LogPuppetRequest::Eprintln {
4337                            message: req.message,
4338
4339                            responder: LogPuppetEprintlnResponder {
4340                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4341                                tx_id: header.tx_id,
4342                            },
4343                        })
4344                    }
4345                    0x34d3dd4225e79a8b => {
4346                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4347                        let mut req = fidl::new_empty!(
4348                            LogPuppetLogRequest,
4349                            fidl::encoding::DefaultFuchsiaResourceDialect
4350                        );
4351                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LogPuppetLogRequest>(&header, _body_bytes, handles, &mut req)?;
4352                        let control_handle = LogPuppetControlHandle { inner: this.inner.clone() };
4353                        Ok(LogPuppetRequest::Log {
4354                            payload: req,
4355                            responder: LogPuppetLogResponder {
4356                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4357                                tx_id: header.tx_id,
4358                            },
4359                        })
4360                    }
4361                    0x3645d3ad544bc546 => {
4362                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4363                        let mut req = fidl::new_empty!(
4364                            fidl::encoding::EmptyPayload,
4365                            fidl::encoding::DefaultFuchsiaResourceDialect
4366                        );
4367                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4368                        let control_handle = LogPuppetControlHandle { inner: this.inner.clone() };
4369                        Ok(LogPuppetRequest::WaitForInterestChange {
4370                            responder: LogPuppetWaitForInterestChangeResponder {
4371                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4372                                tx_id: header.tx_id,
4373                            },
4374                        })
4375                    }
4376                    _ if header.tx_id == 0
4377                        && header
4378                            .dynamic_flags()
4379                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
4380                    {
4381                        Ok(LogPuppetRequest::_UnknownMethod {
4382                            ordinal: header.ordinal,
4383                            control_handle: LogPuppetControlHandle { inner: this.inner.clone() },
4384                            method_type: fidl::MethodType::OneWay,
4385                        })
4386                    }
4387                    _ if header
4388                        .dynamic_flags()
4389                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
4390                    {
4391                        this.inner.send_framework_err(
4392                            fidl::encoding::FrameworkErr::UnknownMethod,
4393                            header.tx_id,
4394                            header.ordinal,
4395                            header.dynamic_flags(),
4396                            (bytes, handles),
4397                        )?;
4398                        Ok(LogPuppetRequest::_UnknownMethod {
4399                            ordinal: header.ordinal,
4400                            control_handle: LogPuppetControlHandle { inner: this.inner.clone() },
4401                            method_type: fidl::MethodType::TwoWay,
4402                        })
4403                    }
4404                    _ => Err(fidl::Error::UnknownOrdinal {
4405                        ordinal: header.ordinal,
4406                        protocol_name:
4407                            <LogPuppetMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4408                    }),
4409                }))
4410            },
4411        )
4412    }
4413}
4414
4415/// LoggerPuppet emits log messages when requested.
4416#[derive(Debug)]
4417pub enum LogPuppetRequest {
4418    /// Prints a message to stdout and appends a newline.
4419    Println { message: String, responder: LogPuppetPrintlnResponder },
4420    /// Prints a message stderr and appends a newline.
4421    Eprintln { message: String, responder: LogPuppetEprintlnResponder },
4422    /// Emits a tracing event at the specified severity level.
4423    Log { payload: LogPuppetLogRequest, responder: LogPuppetLogResponder },
4424    /// Blocks the caller until the next time an interest change event is observed.
4425    /// Messages are lost if they are emitted using LogPuppet.Log before the
4426    /// puppet has observed the the interest change.
4427    WaitForInterestChange { responder: LogPuppetWaitForInterestChangeResponder },
4428    /// An interaction was received which does not match any known method.
4429    #[non_exhaustive]
4430    _UnknownMethod {
4431        /// Ordinal of the method that was called.
4432        ordinal: u64,
4433        control_handle: LogPuppetControlHandle,
4434        method_type: fidl::MethodType,
4435    },
4436}
4437
4438impl LogPuppetRequest {
4439    #[allow(irrefutable_let_patterns)]
4440    pub fn into_println(self) -> Option<(String, LogPuppetPrintlnResponder)> {
4441        if let LogPuppetRequest::Println { message, responder } = self {
4442            Some((message, responder))
4443        } else {
4444            None
4445        }
4446    }
4447
4448    #[allow(irrefutable_let_patterns)]
4449    pub fn into_eprintln(self) -> Option<(String, LogPuppetEprintlnResponder)> {
4450        if let LogPuppetRequest::Eprintln { message, responder } = self {
4451            Some((message, responder))
4452        } else {
4453            None
4454        }
4455    }
4456
4457    #[allow(irrefutable_let_patterns)]
4458    pub fn into_log(self) -> Option<(LogPuppetLogRequest, LogPuppetLogResponder)> {
4459        if let LogPuppetRequest::Log { payload, responder } = self {
4460            Some((payload, responder))
4461        } else {
4462            None
4463        }
4464    }
4465
4466    #[allow(irrefutable_let_patterns)]
4467    pub fn into_wait_for_interest_change(
4468        self,
4469    ) -> Option<(LogPuppetWaitForInterestChangeResponder)> {
4470        if let LogPuppetRequest::WaitForInterestChange { responder } = self {
4471            Some((responder))
4472        } else {
4473            None
4474        }
4475    }
4476
4477    /// Name of the method defined in FIDL
4478    pub fn method_name(&self) -> &'static str {
4479        match *self {
4480            LogPuppetRequest::Println { .. } => "println",
4481            LogPuppetRequest::Eprintln { .. } => "eprintln",
4482            LogPuppetRequest::Log { .. } => "log",
4483            LogPuppetRequest::WaitForInterestChange { .. } => "wait_for_interest_change",
4484            LogPuppetRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
4485                "unknown one-way method"
4486            }
4487            LogPuppetRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
4488                "unknown two-way method"
4489            }
4490        }
4491    }
4492}
4493
4494#[derive(Debug, Clone)]
4495pub struct LogPuppetControlHandle {
4496    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4497}
4498
4499impl fidl::endpoints::ControlHandle for LogPuppetControlHandle {
4500    fn shutdown(&self) {
4501        self.inner.shutdown()
4502    }
4503
4504    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4505        self.inner.shutdown_with_epitaph(status)
4506    }
4507
4508    fn is_closed(&self) -> bool {
4509        self.inner.channel().is_closed()
4510    }
4511    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4512        self.inner.channel().on_closed()
4513    }
4514
4515    #[cfg(target_os = "fuchsia")]
4516    fn signal_peer(
4517        &self,
4518        clear_mask: zx::Signals,
4519        set_mask: zx::Signals,
4520    ) -> Result<(), zx_status::Status> {
4521        use fidl::Peered;
4522        self.inner.channel().signal_peer(clear_mask, set_mask)
4523    }
4524}
4525
4526impl LogPuppetControlHandle {}
4527
4528#[must_use = "FIDL methods require a response to be sent"]
4529#[derive(Debug)]
4530pub struct LogPuppetPrintlnResponder {
4531    control_handle: std::mem::ManuallyDrop<LogPuppetControlHandle>,
4532    tx_id: u32,
4533}
4534
4535/// Set the the channel to be shutdown (see [`LogPuppetControlHandle::shutdown`])
4536/// if the responder is dropped without sending a response, so that the client
4537/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4538impl std::ops::Drop for LogPuppetPrintlnResponder {
4539    fn drop(&mut self) {
4540        self.control_handle.shutdown();
4541        // Safety: drops once, never accessed again
4542        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4543    }
4544}
4545
4546impl fidl::endpoints::Responder for LogPuppetPrintlnResponder {
4547    type ControlHandle = LogPuppetControlHandle;
4548
4549    fn control_handle(&self) -> &LogPuppetControlHandle {
4550        &self.control_handle
4551    }
4552
4553    fn drop_without_shutdown(mut self) {
4554        // Safety: drops once, never accessed again due to mem::forget
4555        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4556        // Prevent Drop from running (which would shut down the channel)
4557        std::mem::forget(self);
4558    }
4559}
4560
4561impl LogPuppetPrintlnResponder {
4562    /// Sends a response to the FIDL transaction.
4563    ///
4564    /// Sets the channel to shutdown if an error occurs.
4565    pub fn send(self) -> Result<(), fidl::Error> {
4566        let _result = self.send_raw();
4567        if _result.is_err() {
4568            self.control_handle.shutdown();
4569        }
4570        self.drop_without_shutdown();
4571        _result
4572    }
4573
4574    /// Similar to "send" but does not shutdown the channel if an error occurs.
4575    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
4576        let _result = self.send_raw();
4577        self.drop_without_shutdown();
4578        _result
4579    }
4580
4581    fn send_raw(&self) -> Result<(), fidl::Error> {
4582        self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
4583            fidl::encoding::Flexible::new(()),
4584            self.tx_id,
4585            0x6584cb93e1978da0,
4586            fidl::encoding::DynamicFlags::FLEXIBLE,
4587        )
4588    }
4589}
4590
4591#[must_use = "FIDL methods require a response to be sent"]
4592#[derive(Debug)]
4593pub struct LogPuppetEprintlnResponder {
4594    control_handle: std::mem::ManuallyDrop<LogPuppetControlHandle>,
4595    tx_id: u32,
4596}
4597
4598/// Set the the channel to be shutdown (see [`LogPuppetControlHandle::shutdown`])
4599/// if the responder is dropped without sending a response, so that the client
4600/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4601impl std::ops::Drop for LogPuppetEprintlnResponder {
4602    fn drop(&mut self) {
4603        self.control_handle.shutdown();
4604        // Safety: drops once, never accessed again
4605        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4606    }
4607}
4608
4609impl fidl::endpoints::Responder for LogPuppetEprintlnResponder {
4610    type ControlHandle = LogPuppetControlHandle;
4611
4612    fn control_handle(&self) -> &LogPuppetControlHandle {
4613        &self.control_handle
4614    }
4615
4616    fn drop_without_shutdown(mut self) {
4617        // Safety: drops once, never accessed again due to mem::forget
4618        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4619        // Prevent Drop from running (which would shut down the channel)
4620        std::mem::forget(self);
4621    }
4622}
4623
4624impl LogPuppetEprintlnResponder {
4625    /// Sends a response to the FIDL transaction.
4626    ///
4627    /// Sets the channel to shutdown if an error occurs.
4628    pub fn send(self) -> Result<(), fidl::Error> {
4629        let _result = self.send_raw();
4630        if _result.is_err() {
4631            self.control_handle.shutdown();
4632        }
4633        self.drop_without_shutdown();
4634        _result
4635    }
4636
4637    /// Similar to "send" but does not shutdown the channel if an error occurs.
4638    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
4639        let _result = self.send_raw();
4640        self.drop_without_shutdown();
4641        _result
4642    }
4643
4644    fn send_raw(&self) -> Result<(), fidl::Error> {
4645        self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
4646            fidl::encoding::Flexible::new(()),
4647            self.tx_id,
4648            0x770e4524f6b093ef,
4649            fidl::encoding::DynamicFlags::FLEXIBLE,
4650        )
4651    }
4652}
4653
4654#[must_use = "FIDL methods require a response to be sent"]
4655#[derive(Debug)]
4656pub struct LogPuppetLogResponder {
4657    control_handle: std::mem::ManuallyDrop<LogPuppetControlHandle>,
4658    tx_id: u32,
4659}
4660
4661/// Set the the channel to be shutdown (see [`LogPuppetControlHandle::shutdown`])
4662/// if the responder is dropped without sending a response, so that the client
4663/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4664impl std::ops::Drop for LogPuppetLogResponder {
4665    fn drop(&mut self) {
4666        self.control_handle.shutdown();
4667        // Safety: drops once, never accessed again
4668        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4669    }
4670}
4671
4672impl fidl::endpoints::Responder for LogPuppetLogResponder {
4673    type ControlHandle = LogPuppetControlHandle;
4674
4675    fn control_handle(&self) -> &LogPuppetControlHandle {
4676        &self.control_handle
4677    }
4678
4679    fn drop_without_shutdown(mut self) {
4680        // Safety: drops once, never accessed again due to mem::forget
4681        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4682        // Prevent Drop from running (which would shut down the channel)
4683        std::mem::forget(self);
4684    }
4685}
4686
4687impl LogPuppetLogResponder {
4688    /// Sends a response to the FIDL transaction.
4689    ///
4690    /// Sets the channel to shutdown if an error occurs.
4691    pub fn send(self) -> Result<(), fidl::Error> {
4692        let _result = self.send_raw();
4693        if _result.is_err() {
4694            self.control_handle.shutdown();
4695        }
4696        self.drop_without_shutdown();
4697        _result
4698    }
4699
4700    /// Similar to "send" but does not shutdown the channel if an error occurs.
4701    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
4702        let _result = self.send_raw();
4703        self.drop_without_shutdown();
4704        _result
4705    }
4706
4707    fn send_raw(&self) -> Result<(), fidl::Error> {
4708        self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
4709            fidl::encoding::Flexible::new(()),
4710            self.tx_id,
4711            0x34d3dd4225e79a8b,
4712            fidl::encoding::DynamicFlags::FLEXIBLE,
4713        )
4714    }
4715}
4716
4717#[must_use = "FIDL methods require a response to be sent"]
4718#[derive(Debug)]
4719pub struct LogPuppetWaitForInterestChangeResponder {
4720    control_handle: std::mem::ManuallyDrop<LogPuppetControlHandle>,
4721    tx_id: u32,
4722}
4723
4724/// Set the the channel to be shutdown (see [`LogPuppetControlHandle::shutdown`])
4725/// if the responder is dropped without sending a response, so that the client
4726/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4727impl std::ops::Drop for LogPuppetWaitForInterestChangeResponder {
4728    fn drop(&mut self) {
4729        self.control_handle.shutdown();
4730        // Safety: drops once, never accessed again
4731        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4732    }
4733}
4734
4735impl fidl::endpoints::Responder for LogPuppetWaitForInterestChangeResponder {
4736    type ControlHandle = LogPuppetControlHandle;
4737
4738    fn control_handle(&self) -> &LogPuppetControlHandle {
4739        &self.control_handle
4740    }
4741
4742    fn drop_without_shutdown(mut self) {
4743        // Safety: drops once, never accessed again due to mem::forget
4744        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4745        // Prevent Drop from running (which would shut down the channel)
4746        std::mem::forget(self);
4747    }
4748}
4749
4750impl LogPuppetWaitForInterestChangeResponder {
4751    /// Sends a response to the FIDL transaction.
4752    ///
4753    /// Sets the channel to shutdown if an error occurs.
4754    pub fn send(
4755        self,
4756        mut payload: &LogPuppetWaitForInterestChangeResponse,
4757    ) -> Result<(), fidl::Error> {
4758        let _result = self.send_raw(payload);
4759        if _result.is_err() {
4760            self.control_handle.shutdown();
4761        }
4762        self.drop_without_shutdown();
4763        _result
4764    }
4765
4766    /// Similar to "send" but does not shutdown the channel if an error occurs.
4767    pub fn send_no_shutdown_on_err(
4768        self,
4769        mut payload: &LogPuppetWaitForInterestChangeResponse,
4770    ) -> Result<(), fidl::Error> {
4771        let _result = self.send_raw(payload);
4772        self.drop_without_shutdown();
4773        _result
4774    }
4775
4776    fn send_raw(
4777        &self,
4778        mut payload: &LogPuppetWaitForInterestChangeResponse,
4779    ) -> Result<(), fidl::Error> {
4780        self.control_handle.inner.send::<fidl::encoding::FlexibleType<
4781            LogPuppetWaitForInterestChangeResponse,
4782        >>(
4783            fidl::encoding::Flexible::new(payload),
4784            self.tx_id,
4785            0x3645d3ad544bc546,
4786            fidl::encoding::DynamicFlags::FLEXIBLE,
4787        )
4788    }
4789}
4790
4791#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4792pub struct PuppetMarker;
4793
4794impl fidl::endpoints::ProtocolMarker for PuppetMarker {
4795    type Proxy = PuppetProxy;
4796    type RequestStream = PuppetRequestStream;
4797    #[cfg(target_os = "fuchsia")]
4798    type SynchronousProxy = PuppetSynchronousProxy;
4799
4800    const DEBUG_NAME: &'static str = "fuchsia.archivist.test.Puppet";
4801}
4802impl fidl::endpoints::DiscoverableProtocolMarker for PuppetMarker {}
4803
4804pub trait PuppetProxyInterface: Send + Sync {
4805    type CreateInspectorResponseFut: std::future::Future<
4806            Output = Result<fidl::endpoints::ClientEnd<InspectWriterMarker>, fidl::Error>,
4807        > + Send;
4808    fn r#create_inspector(
4809        &self,
4810        payload: &InspectPuppetCreateInspectorRequest,
4811    ) -> Self::CreateInspectorResponseFut;
4812    type CreateInspectorFromEscrowResponseFut: std::future::Future<
4813            Output = Result<
4814                (fidl::endpoints::ClientEnd<InspectWriterMarker>, fidl::Vmo),
4815                fidl::Error,
4816            >,
4817        > + Send;
4818    fn r#create_inspector_from_escrow(
4819        &self,
4820        payload: InspectPuppetCreateInspectorFromEscrowRequest,
4821    ) -> Self::CreateInspectorFromEscrowResponseFut;
4822    type PrintlnResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
4823    fn r#println(&self, message: &str) -> Self::PrintlnResponseFut;
4824    type EprintlnResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
4825    fn r#eprintln(&self, message: &str) -> Self::EprintlnResponseFut;
4826    type LogResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
4827    fn r#log(&self, payload: &LogPuppetLogRequest) -> Self::LogResponseFut;
4828    type WaitForInterestChangeResponseFut: std::future::Future<Output = Result<LogPuppetWaitForInterestChangeResponse, fidl::Error>>
4829        + Send;
4830    fn r#wait_for_interest_change(&self) -> Self::WaitForInterestChangeResponseFut;
4831    type RecordLazyValuesResponseFut: std::future::Future<
4832            Output = Result<fidl::endpoints::ClientEnd<LazyInspectPuppetMarker>, fidl::Error>,
4833        > + Send;
4834    fn r#record_lazy_values(&self, key: &str) -> Self::RecordLazyValuesResponseFut;
4835    fn r#crash(&self, message: &str) -> Result<(), fidl::Error>;
4836}
4837#[derive(Debug)]
4838#[cfg(target_os = "fuchsia")]
4839pub struct PuppetSynchronousProxy {
4840    client: fidl::client::sync::Client,
4841}
4842
4843#[cfg(target_os = "fuchsia")]
4844impl fidl::endpoints::SynchronousProxy for PuppetSynchronousProxy {
4845    type Proxy = PuppetProxy;
4846    type Protocol = PuppetMarker;
4847
4848    fn from_channel(inner: fidl::Channel) -> Self {
4849        Self::new(inner)
4850    }
4851
4852    fn into_channel(self) -> fidl::Channel {
4853        self.client.into_channel()
4854    }
4855
4856    fn as_channel(&self) -> &fidl::Channel {
4857        self.client.as_channel()
4858    }
4859}
4860
4861#[cfg(target_os = "fuchsia")]
4862impl PuppetSynchronousProxy {
4863    pub fn new(channel: fidl::Channel) -> Self {
4864        let protocol_name = <PuppetMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4865        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
4866    }
4867
4868    pub fn into_channel(self) -> fidl::Channel {
4869        self.client.into_channel()
4870    }
4871
4872    /// Waits until an event arrives and returns it. It is safe for other
4873    /// threads to make concurrent requests while waiting for an event.
4874    pub fn wait_for_event(
4875        &self,
4876        deadline: zx::MonotonicInstant,
4877    ) -> Result<PuppetEvent, fidl::Error> {
4878        PuppetEvent::decode(self.client.wait_for_event(deadline)?)
4879    }
4880
4881    /// Create and serve an Inspector with the provided name.
4882    /// InspectWriters created this way are RAII.
4883    pub fn r#create_inspector(
4884        &self,
4885        mut payload: &InspectPuppetCreateInspectorRequest,
4886        ___deadline: zx::MonotonicInstant,
4887    ) -> Result<fidl::endpoints::ClientEnd<InspectWriterMarker>, fidl::Error> {
4888        let _response = self.client.send_query::<
4889            InspectPuppetCreateInspectorRequest,
4890            fidl::encoding::FlexibleType<InspectPuppetCreateInspectorResponse>,
4891        >(
4892            payload,
4893            0x2c0f807d7d159bb,
4894            fidl::encoding::DynamicFlags::FLEXIBLE,
4895            ___deadline,
4896        )?
4897        .into_result::<PuppetMarker>("create_inspector")?;
4898        Ok(_response.writer)
4899    }
4900
4901    /// Create and serve an Inspector with the same name as a previous escrowed instance.
4902    /// Also returns a VMO with the previously escrowed inspect data.
4903    /// InspectWriters created this way are RAII.
4904    pub fn r#create_inspector_from_escrow(
4905        &self,
4906        mut payload: InspectPuppetCreateInspectorFromEscrowRequest,
4907        ___deadline: zx::MonotonicInstant,
4908    ) -> Result<(fidl::endpoints::ClientEnd<InspectWriterMarker>, fidl::Vmo), fidl::Error> {
4909        let _response = self.client.send_query::<
4910            InspectPuppetCreateInspectorFromEscrowRequest,
4911            fidl::encoding::FlexibleType<InspectPuppetCreateInspectorFromEscrowResponse>,
4912        >(
4913            &mut payload,
4914            0xe79c0d0606c5df,
4915            fidl::encoding::DynamicFlags::FLEXIBLE,
4916            ___deadline,
4917        )?
4918        .into_result::<PuppetMarker>("create_inspector_from_escrow")?;
4919        Ok((_response.writer, _response.data))
4920    }
4921
4922    /// Prints a message to stdout and appends a newline.
4923    pub fn r#println(
4924        &self,
4925        mut message: &str,
4926        ___deadline: zx::MonotonicInstant,
4927    ) -> Result<(), fidl::Error> {
4928        let _response = self.client.send_query::<
4929            LogPuppetPrintlnRequest,
4930            fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
4931        >(
4932            (message,),
4933            0x6584cb93e1978da0,
4934            fidl::encoding::DynamicFlags::FLEXIBLE,
4935            ___deadline,
4936        )?
4937        .into_result::<PuppetMarker>("println")?;
4938        Ok(_response)
4939    }
4940
4941    /// Prints a message stderr and appends a newline.
4942    pub fn r#eprintln(
4943        &self,
4944        mut message: &str,
4945        ___deadline: zx::MonotonicInstant,
4946    ) -> Result<(), fidl::Error> {
4947        let _response = self.client.send_query::<
4948            LogPuppetEprintlnRequest,
4949            fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
4950        >(
4951            (message,),
4952            0x770e4524f6b093ef,
4953            fidl::encoding::DynamicFlags::FLEXIBLE,
4954            ___deadline,
4955        )?
4956        .into_result::<PuppetMarker>("eprintln")?;
4957        Ok(_response)
4958    }
4959
4960    /// Emits a tracing event at the specified severity level.
4961    pub fn r#log(
4962        &self,
4963        mut payload: &LogPuppetLogRequest,
4964        ___deadline: zx::MonotonicInstant,
4965    ) -> Result<(), fidl::Error> {
4966        let _response = self.client.send_query::<
4967            LogPuppetLogRequest,
4968            fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
4969        >(
4970            payload,
4971            0x34d3dd4225e79a8b,
4972            fidl::encoding::DynamicFlags::FLEXIBLE,
4973            ___deadline,
4974        )?
4975        .into_result::<PuppetMarker>("log")?;
4976        Ok(_response)
4977    }
4978
4979    /// Blocks the caller until the next time an interest change event is observed.
4980    /// Messages are lost if they are emitted using LogPuppet.Log before the
4981    /// puppet has observed the the interest change.
4982    pub fn r#wait_for_interest_change(
4983        &self,
4984        ___deadline: zx::MonotonicInstant,
4985    ) -> Result<LogPuppetWaitForInterestChangeResponse, fidl::Error> {
4986        let _response = self.client.send_query::<
4987            fidl::encoding::EmptyPayload,
4988            fidl::encoding::FlexibleType<LogPuppetWaitForInterestChangeResponse>,
4989        >(
4990            (),
4991            0x3645d3ad544bc546,
4992            fidl::encoding::DynamicFlags::FLEXIBLE,
4993            ___deadline,
4994        )?
4995        .into_result::<PuppetMarker>("wait_for_interest_change")?;
4996        Ok(_response)
4997    }
4998
4999    /// Returns a LazyInspectPuppet client for recording lazy values.
5000    pub fn r#record_lazy_values(
5001        &self,
5002        mut key: &str,
5003        ___deadline: zx::MonotonicInstant,
5004    ) -> Result<fidl::endpoints::ClientEnd<LazyInspectPuppetMarker>, fidl::Error> {
5005        let _response = self.client.send_query::<
5006            PuppetRecordLazyValuesRequest,
5007            fidl::encoding::FlexibleType<PuppetRecordLazyValuesResponse>,
5008        >(
5009            (key,),
5010            0x339951b623dc9d7d,
5011            fidl::encoding::DynamicFlags::FLEXIBLE,
5012            ___deadline,
5013        )?
5014        .into_result::<PuppetMarker>("record_lazy_values")?;
5015        Ok(_response.client)
5016    }
5017
5018    /// Causes the puppet to crash with an optional error message.
5019    ///
5020    /// The connection will be closed after this is called.
5021    pub fn r#crash(&self, mut message: &str) -> Result<(), fidl::Error> {
5022        self.client.send::<PuppetCrashRequest>(
5023            (message,),
5024            0x2aeef488fb79c9db,
5025            fidl::encoding::DynamicFlags::FLEXIBLE,
5026        )
5027    }
5028}
5029
5030#[cfg(target_os = "fuchsia")]
5031impl From<PuppetSynchronousProxy> for zx::NullableHandle {
5032    fn from(value: PuppetSynchronousProxy) -> Self {
5033        value.into_channel().into()
5034    }
5035}
5036
5037#[cfg(target_os = "fuchsia")]
5038impl From<fidl::Channel> for PuppetSynchronousProxy {
5039    fn from(value: fidl::Channel) -> Self {
5040        Self::new(value)
5041    }
5042}
5043
5044#[cfg(target_os = "fuchsia")]
5045impl fidl::endpoints::FromClient for PuppetSynchronousProxy {
5046    type Protocol = PuppetMarker;
5047
5048    fn from_client(value: fidl::endpoints::ClientEnd<PuppetMarker>) -> Self {
5049        Self::new(value.into_channel())
5050    }
5051}
5052
5053#[derive(Debug, Clone)]
5054pub struct PuppetProxy {
5055    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5056}
5057
5058impl fidl::endpoints::Proxy for PuppetProxy {
5059    type Protocol = PuppetMarker;
5060
5061    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5062        Self::new(inner)
5063    }
5064
5065    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5066        self.client.into_channel().map_err(|client| Self { client })
5067    }
5068
5069    fn as_channel(&self) -> &::fidl::AsyncChannel {
5070        self.client.as_channel()
5071    }
5072}
5073
5074impl PuppetProxy {
5075    /// Create a new Proxy for fuchsia.archivist.test/Puppet.
5076    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5077        let protocol_name = <PuppetMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5078        Self { client: fidl::client::Client::new(channel, protocol_name) }
5079    }
5080
5081    /// Get a Stream of events from the remote end of the protocol.
5082    ///
5083    /// # Panics
5084    ///
5085    /// Panics if the event stream was already taken.
5086    pub fn take_event_stream(&self) -> PuppetEventStream {
5087        PuppetEventStream { event_receiver: self.client.take_event_receiver() }
5088    }
5089
5090    /// Create and serve an Inspector with the provided name.
5091    /// InspectWriters created this way are RAII.
5092    pub fn r#create_inspector(
5093        &self,
5094        mut payload: &InspectPuppetCreateInspectorRequest,
5095    ) -> fidl::client::QueryResponseFut<
5096        fidl::endpoints::ClientEnd<InspectWriterMarker>,
5097        fidl::encoding::DefaultFuchsiaResourceDialect,
5098    > {
5099        PuppetProxyInterface::r#create_inspector(self, payload)
5100    }
5101
5102    /// Create and serve an Inspector with the same name as a previous escrowed instance.
5103    /// Also returns a VMO with the previously escrowed inspect data.
5104    /// InspectWriters created this way are RAII.
5105    pub fn r#create_inspector_from_escrow(
5106        &self,
5107        mut payload: InspectPuppetCreateInspectorFromEscrowRequest,
5108    ) -> fidl::client::QueryResponseFut<
5109        (fidl::endpoints::ClientEnd<InspectWriterMarker>, fidl::Vmo),
5110        fidl::encoding::DefaultFuchsiaResourceDialect,
5111    > {
5112        PuppetProxyInterface::r#create_inspector_from_escrow(self, payload)
5113    }
5114
5115    /// Prints a message to stdout and appends a newline.
5116    pub fn r#println(
5117        &self,
5118        mut message: &str,
5119    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
5120        PuppetProxyInterface::r#println(self, message)
5121    }
5122
5123    /// Prints a message stderr and appends a newline.
5124    pub fn r#eprintln(
5125        &self,
5126        mut message: &str,
5127    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
5128        PuppetProxyInterface::r#eprintln(self, message)
5129    }
5130
5131    /// Emits a tracing event at the specified severity level.
5132    pub fn r#log(
5133        &self,
5134        mut payload: &LogPuppetLogRequest,
5135    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
5136        PuppetProxyInterface::r#log(self, payload)
5137    }
5138
5139    /// Blocks the caller until the next time an interest change event is observed.
5140    /// Messages are lost if they are emitted using LogPuppet.Log before the
5141    /// puppet has observed the the interest change.
5142    pub fn r#wait_for_interest_change(
5143        &self,
5144    ) -> fidl::client::QueryResponseFut<
5145        LogPuppetWaitForInterestChangeResponse,
5146        fidl::encoding::DefaultFuchsiaResourceDialect,
5147    > {
5148        PuppetProxyInterface::r#wait_for_interest_change(self)
5149    }
5150
5151    /// Returns a LazyInspectPuppet client for recording lazy values.
5152    pub fn r#record_lazy_values(
5153        &self,
5154        mut key: &str,
5155    ) -> fidl::client::QueryResponseFut<
5156        fidl::endpoints::ClientEnd<LazyInspectPuppetMarker>,
5157        fidl::encoding::DefaultFuchsiaResourceDialect,
5158    > {
5159        PuppetProxyInterface::r#record_lazy_values(self, key)
5160    }
5161
5162    /// Causes the puppet to crash with an optional error message.
5163    ///
5164    /// The connection will be closed after this is called.
5165    pub fn r#crash(&self, mut message: &str) -> Result<(), fidl::Error> {
5166        PuppetProxyInterface::r#crash(self, message)
5167    }
5168}
5169
5170impl PuppetProxyInterface for PuppetProxy {
5171    type CreateInspectorResponseFut = fidl::client::QueryResponseFut<
5172        fidl::endpoints::ClientEnd<InspectWriterMarker>,
5173        fidl::encoding::DefaultFuchsiaResourceDialect,
5174    >;
5175    fn r#create_inspector(
5176        &self,
5177        mut payload: &InspectPuppetCreateInspectorRequest,
5178    ) -> Self::CreateInspectorResponseFut {
5179        fn _decode(
5180            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5181        ) -> Result<fidl::endpoints::ClientEnd<InspectWriterMarker>, fidl::Error> {
5182            let _response = fidl::client::decode_transaction_body::<
5183                fidl::encoding::FlexibleType<InspectPuppetCreateInspectorResponse>,
5184                fidl::encoding::DefaultFuchsiaResourceDialect,
5185                0x2c0f807d7d159bb,
5186            >(_buf?)?
5187            .into_result::<PuppetMarker>("create_inspector")?;
5188            Ok(_response.writer)
5189        }
5190        self.client.send_query_and_decode::<
5191            InspectPuppetCreateInspectorRequest,
5192            fidl::endpoints::ClientEnd<InspectWriterMarker>,
5193        >(
5194            payload,
5195            0x2c0f807d7d159bb,
5196            fidl::encoding::DynamicFlags::FLEXIBLE,
5197            _decode,
5198        )
5199    }
5200
5201    type CreateInspectorFromEscrowResponseFut = fidl::client::QueryResponseFut<
5202        (fidl::endpoints::ClientEnd<InspectWriterMarker>, fidl::Vmo),
5203        fidl::encoding::DefaultFuchsiaResourceDialect,
5204    >;
5205    fn r#create_inspector_from_escrow(
5206        &self,
5207        mut payload: InspectPuppetCreateInspectorFromEscrowRequest,
5208    ) -> Self::CreateInspectorFromEscrowResponseFut {
5209        fn _decode(
5210            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5211        ) -> Result<(fidl::endpoints::ClientEnd<InspectWriterMarker>, fidl::Vmo), fidl::Error>
5212        {
5213            let _response = fidl::client::decode_transaction_body::<
5214                fidl::encoding::FlexibleType<InspectPuppetCreateInspectorFromEscrowResponse>,
5215                fidl::encoding::DefaultFuchsiaResourceDialect,
5216                0xe79c0d0606c5df,
5217            >(_buf?)?
5218            .into_result::<PuppetMarker>("create_inspector_from_escrow")?;
5219            Ok((_response.writer, _response.data))
5220        }
5221        self.client.send_query_and_decode::<
5222            InspectPuppetCreateInspectorFromEscrowRequest,
5223            (fidl::endpoints::ClientEnd<InspectWriterMarker>, fidl::Vmo),
5224        >(
5225            &mut payload,
5226            0xe79c0d0606c5df,
5227            fidl::encoding::DynamicFlags::FLEXIBLE,
5228            _decode,
5229        )
5230    }
5231
5232    type PrintlnResponseFut =
5233        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
5234    fn r#println(&self, mut message: &str) -> Self::PrintlnResponseFut {
5235        fn _decode(
5236            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5237        ) -> Result<(), fidl::Error> {
5238            let _response = fidl::client::decode_transaction_body::<
5239                fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
5240                fidl::encoding::DefaultFuchsiaResourceDialect,
5241                0x6584cb93e1978da0,
5242            >(_buf?)?
5243            .into_result::<PuppetMarker>("println")?;
5244            Ok(_response)
5245        }
5246        self.client.send_query_and_decode::<LogPuppetPrintlnRequest, ()>(
5247            (message,),
5248            0x6584cb93e1978da0,
5249            fidl::encoding::DynamicFlags::FLEXIBLE,
5250            _decode,
5251        )
5252    }
5253
5254    type EprintlnResponseFut =
5255        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
5256    fn r#eprintln(&self, mut message: &str) -> Self::EprintlnResponseFut {
5257        fn _decode(
5258            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5259        ) -> Result<(), fidl::Error> {
5260            let _response = fidl::client::decode_transaction_body::<
5261                fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
5262                fidl::encoding::DefaultFuchsiaResourceDialect,
5263                0x770e4524f6b093ef,
5264            >(_buf?)?
5265            .into_result::<PuppetMarker>("eprintln")?;
5266            Ok(_response)
5267        }
5268        self.client.send_query_and_decode::<LogPuppetEprintlnRequest, ()>(
5269            (message,),
5270            0x770e4524f6b093ef,
5271            fidl::encoding::DynamicFlags::FLEXIBLE,
5272            _decode,
5273        )
5274    }
5275
5276    type LogResponseFut =
5277        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
5278    fn r#log(&self, mut payload: &LogPuppetLogRequest) -> Self::LogResponseFut {
5279        fn _decode(
5280            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5281        ) -> Result<(), fidl::Error> {
5282            let _response = fidl::client::decode_transaction_body::<
5283                fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
5284                fidl::encoding::DefaultFuchsiaResourceDialect,
5285                0x34d3dd4225e79a8b,
5286            >(_buf?)?
5287            .into_result::<PuppetMarker>("log")?;
5288            Ok(_response)
5289        }
5290        self.client.send_query_and_decode::<LogPuppetLogRequest, ()>(
5291            payload,
5292            0x34d3dd4225e79a8b,
5293            fidl::encoding::DynamicFlags::FLEXIBLE,
5294            _decode,
5295        )
5296    }
5297
5298    type WaitForInterestChangeResponseFut = fidl::client::QueryResponseFut<
5299        LogPuppetWaitForInterestChangeResponse,
5300        fidl::encoding::DefaultFuchsiaResourceDialect,
5301    >;
5302    fn r#wait_for_interest_change(&self) -> Self::WaitForInterestChangeResponseFut {
5303        fn _decode(
5304            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5305        ) -> Result<LogPuppetWaitForInterestChangeResponse, fidl::Error> {
5306            let _response = fidl::client::decode_transaction_body::<
5307                fidl::encoding::FlexibleType<LogPuppetWaitForInterestChangeResponse>,
5308                fidl::encoding::DefaultFuchsiaResourceDialect,
5309                0x3645d3ad544bc546,
5310            >(_buf?)?
5311            .into_result::<PuppetMarker>("wait_for_interest_change")?;
5312            Ok(_response)
5313        }
5314        self.client.send_query_and_decode::<
5315            fidl::encoding::EmptyPayload,
5316            LogPuppetWaitForInterestChangeResponse,
5317        >(
5318            (),
5319            0x3645d3ad544bc546,
5320            fidl::encoding::DynamicFlags::FLEXIBLE,
5321            _decode,
5322        )
5323    }
5324
5325    type RecordLazyValuesResponseFut = fidl::client::QueryResponseFut<
5326        fidl::endpoints::ClientEnd<LazyInspectPuppetMarker>,
5327        fidl::encoding::DefaultFuchsiaResourceDialect,
5328    >;
5329    fn r#record_lazy_values(&self, mut key: &str) -> Self::RecordLazyValuesResponseFut {
5330        fn _decode(
5331            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5332        ) -> Result<fidl::endpoints::ClientEnd<LazyInspectPuppetMarker>, fidl::Error> {
5333            let _response = fidl::client::decode_transaction_body::<
5334                fidl::encoding::FlexibleType<PuppetRecordLazyValuesResponse>,
5335                fidl::encoding::DefaultFuchsiaResourceDialect,
5336                0x339951b623dc9d7d,
5337            >(_buf?)?
5338            .into_result::<PuppetMarker>("record_lazy_values")?;
5339            Ok(_response.client)
5340        }
5341        self.client.send_query_and_decode::<
5342            PuppetRecordLazyValuesRequest,
5343            fidl::endpoints::ClientEnd<LazyInspectPuppetMarker>,
5344        >(
5345            (key,),
5346            0x339951b623dc9d7d,
5347            fidl::encoding::DynamicFlags::FLEXIBLE,
5348            _decode,
5349        )
5350    }
5351
5352    fn r#crash(&self, mut message: &str) -> Result<(), fidl::Error> {
5353        self.client.send::<PuppetCrashRequest>(
5354            (message,),
5355            0x2aeef488fb79c9db,
5356            fidl::encoding::DynamicFlags::FLEXIBLE,
5357        )
5358    }
5359}
5360
5361pub struct PuppetEventStream {
5362    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5363}
5364
5365impl std::marker::Unpin for PuppetEventStream {}
5366
5367impl futures::stream::FusedStream for PuppetEventStream {
5368    fn is_terminated(&self) -> bool {
5369        self.event_receiver.is_terminated()
5370    }
5371}
5372
5373impl futures::Stream for PuppetEventStream {
5374    type Item = Result<PuppetEvent, fidl::Error>;
5375
5376    fn poll_next(
5377        mut self: std::pin::Pin<&mut Self>,
5378        cx: &mut std::task::Context<'_>,
5379    ) -> std::task::Poll<Option<Self::Item>> {
5380        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5381            &mut self.event_receiver,
5382            cx
5383        )?) {
5384            Some(buf) => std::task::Poll::Ready(Some(PuppetEvent::decode(buf))),
5385            None => std::task::Poll::Ready(None),
5386        }
5387    }
5388}
5389
5390#[derive(Debug)]
5391pub enum PuppetEvent {
5392    #[non_exhaustive]
5393    _UnknownEvent {
5394        /// Ordinal of the event that was sent.
5395        ordinal: u64,
5396    },
5397}
5398
5399impl PuppetEvent {
5400    /// Decodes a message buffer as a [`PuppetEvent`].
5401    fn decode(
5402        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5403    ) -> Result<PuppetEvent, fidl::Error> {
5404        let (bytes, _handles) = buf.split_mut();
5405        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5406        debug_assert_eq!(tx_header.tx_id, 0);
5407        match tx_header.ordinal {
5408            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
5409                Ok(PuppetEvent::_UnknownEvent { ordinal: tx_header.ordinal })
5410            }
5411            _ => Err(fidl::Error::UnknownOrdinal {
5412                ordinal: tx_header.ordinal,
5413                protocol_name: <PuppetMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5414            }),
5415        }
5416    }
5417}
5418
5419/// A Stream of incoming requests for fuchsia.archivist.test/Puppet.
5420pub struct PuppetRequestStream {
5421    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5422    is_terminated: bool,
5423}
5424
5425impl std::marker::Unpin for PuppetRequestStream {}
5426
5427impl futures::stream::FusedStream for PuppetRequestStream {
5428    fn is_terminated(&self) -> bool {
5429        self.is_terminated
5430    }
5431}
5432
5433impl fidl::endpoints::RequestStream for PuppetRequestStream {
5434    type Protocol = PuppetMarker;
5435    type ControlHandle = PuppetControlHandle;
5436
5437    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5438        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5439    }
5440
5441    fn control_handle(&self) -> Self::ControlHandle {
5442        PuppetControlHandle { inner: self.inner.clone() }
5443    }
5444
5445    fn into_inner(
5446        self,
5447    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5448    {
5449        (self.inner, self.is_terminated)
5450    }
5451
5452    fn from_inner(
5453        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5454        is_terminated: bool,
5455    ) -> Self {
5456        Self { inner, is_terminated }
5457    }
5458}
5459
5460impl futures::Stream for PuppetRequestStream {
5461    type Item = Result<PuppetRequest, fidl::Error>;
5462
5463    fn poll_next(
5464        mut self: std::pin::Pin<&mut Self>,
5465        cx: &mut std::task::Context<'_>,
5466    ) -> std::task::Poll<Option<Self::Item>> {
5467        let this = &mut *self;
5468        if this.inner.check_shutdown(cx) {
5469            this.is_terminated = true;
5470            return std::task::Poll::Ready(None);
5471        }
5472        if this.is_terminated {
5473            panic!("polled PuppetRequestStream after completion");
5474        }
5475        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5476            |bytes, handles| {
5477                match this.inner.channel().read_etc(cx, bytes, handles) {
5478                    std::task::Poll::Ready(Ok(())) => {}
5479                    std::task::Poll::Pending => return std::task::Poll::Pending,
5480                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5481                        this.is_terminated = true;
5482                        return std::task::Poll::Ready(None);
5483                    }
5484                    std::task::Poll::Ready(Err(e)) => {
5485                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5486                            e.into(),
5487                        ))));
5488                    }
5489                }
5490
5491                // A message has been received from the channel
5492                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5493
5494                std::task::Poll::Ready(Some(match header.ordinal {
5495                    0x2c0f807d7d159bb => {
5496                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5497                        let mut req = fidl::new_empty!(
5498                            InspectPuppetCreateInspectorRequest,
5499                            fidl::encoding::DefaultFuchsiaResourceDialect
5500                        );
5501                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InspectPuppetCreateInspectorRequest>(&header, _body_bytes, handles, &mut req)?;
5502                        let control_handle = PuppetControlHandle { inner: this.inner.clone() };
5503                        Ok(PuppetRequest::CreateInspector {
5504                            payload: req,
5505                            responder: PuppetCreateInspectorResponder {
5506                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5507                                tx_id: header.tx_id,
5508                            },
5509                        })
5510                    }
5511                    0xe79c0d0606c5df => {
5512                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5513                        let mut req = fidl::new_empty!(
5514                            InspectPuppetCreateInspectorFromEscrowRequest,
5515                            fidl::encoding::DefaultFuchsiaResourceDialect
5516                        );
5517                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InspectPuppetCreateInspectorFromEscrowRequest>(&header, _body_bytes, handles, &mut req)?;
5518                        let control_handle = PuppetControlHandle { inner: this.inner.clone() };
5519                        Ok(PuppetRequest::CreateInspectorFromEscrow {
5520                            payload: req,
5521                            responder: PuppetCreateInspectorFromEscrowResponder {
5522                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5523                                tx_id: header.tx_id,
5524                            },
5525                        })
5526                    }
5527                    0x6584cb93e1978da0 => {
5528                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5529                        let mut req = fidl::new_empty!(
5530                            LogPuppetPrintlnRequest,
5531                            fidl::encoding::DefaultFuchsiaResourceDialect
5532                        );
5533                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LogPuppetPrintlnRequest>(&header, _body_bytes, handles, &mut req)?;
5534                        let control_handle = PuppetControlHandle { inner: this.inner.clone() };
5535                        Ok(PuppetRequest::Println {
5536                            message: req.message,
5537
5538                            responder: PuppetPrintlnResponder {
5539                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5540                                tx_id: header.tx_id,
5541                            },
5542                        })
5543                    }
5544                    0x770e4524f6b093ef => {
5545                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5546                        let mut req = fidl::new_empty!(
5547                            LogPuppetEprintlnRequest,
5548                            fidl::encoding::DefaultFuchsiaResourceDialect
5549                        );
5550                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LogPuppetEprintlnRequest>(&header, _body_bytes, handles, &mut req)?;
5551                        let control_handle = PuppetControlHandle { inner: this.inner.clone() };
5552                        Ok(PuppetRequest::Eprintln {
5553                            message: req.message,
5554
5555                            responder: PuppetEprintlnResponder {
5556                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5557                                tx_id: header.tx_id,
5558                            },
5559                        })
5560                    }
5561                    0x34d3dd4225e79a8b => {
5562                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5563                        let mut req = fidl::new_empty!(
5564                            LogPuppetLogRequest,
5565                            fidl::encoding::DefaultFuchsiaResourceDialect
5566                        );
5567                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LogPuppetLogRequest>(&header, _body_bytes, handles, &mut req)?;
5568                        let control_handle = PuppetControlHandle { inner: this.inner.clone() };
5569                        Ok(PuppetRequest::Log {
5570                            payload: req,
5571                            responder: PuppetLogResponder {
5572                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5573                                tx_id: header.tx_id,
5574                            },
5575                        })
5576                    }
5577                    0x3645d3ad544bc546 => {
5578                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5579                        let mut req = fidl::new_empty!(
5580                            fidl::encoding::EmptyPayload,
5581                            fidl::encoding::DefaultFuchsiaResourceDialect
5582                        );
5583                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5584                        let control_handle = PuppetControlHandle { inner: this.inner.clone() };
5585                        Ok(PuppetRequest::WaitForInterestChange {
5586                            responder: PuppetWaitForInterestChangeResponder {
5587                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5588                                tx_id: header.tx_id,
5589                            },
5590                        })
5591                    }
5592                    0x339951b623dc9d7d => {
5593                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5594                        let mut req = fidl::new_empty!(
5595                            PuppetRecordLazyValuesRequest,
5596                            fidl::encoding::DefaultFuchsiaResourceDialect
5597                        );
5598                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PuppetRecordLazyValuesRequest>(&header, _body_bytes, handles, &mut req)?;
5599                        let control_handle = PuppetControlHandle { inner: this.inner.clone() };
5600                        Ok(PuppetRequest::RecordLazyValues {
5601                            key: req.key,
5602
5603                            responder: PuppetRecordLazyValuesResponder {
5604                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5605                                tx_id: header.tx_id,
5606                            },
5607                        })
5608                    }
5609                    0x2aeef488fb79c9db => {
5610                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5611                        let mut req = fidl::new_empty!(
5612                            PuppetCrashRequest,
5613                            fidl::encoding::DefaultFuchsiaResourceDialect
5614                        );
5615                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PuppetCrashRequest>(&header, _body_bytes, handles, &mut req)?;
5616                        let control_handle = PuppetControlHandle { inner: this.inner.clone() };
5617                        Ok(PuppetRequest::Crash { message: req.message, control_handle })
5618                    }
5619                    _ if header.tx_id == 0
5620                        && header
5621                            .dynamic_flags()
5622                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
5623                    {
5624                        Ok(PuppetRequest::_UnknownMethod {
5625                            ordinal: header.ordinal,
5626                            control_handle: PuppetControlHandle { inner: this.inner.clone() },
5627                            method_type: fidl::MethodType::OneWay,
5628                        })
5629                    }
5630                    _ if header
5631                        .dynamic_flags()
5632                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
5633                    {
5634                        this.inner.send_framework_err(
5635                            fidl::encoding::FrameworkErr::UnknownMethod,
5636                            header.tx_id,
5637                            header.ordinal,
5638                            header.dynamic_flags(),
5639                            (bytes, handles),
5640                        )?;
5641                        Ok(PuppetRequest::_UnknownMethod {
5642                            ordinal: header.ordinal,
5643                            control_handle: PuppetControlHandle { inner: this.inner.clone() },
5644                            method_type: fidl::MethodType::TwoWay,
5645                        })
5646                    }
5647                    _ => Err(fidl::Error::UnknownOrdinal {
5648                        ordinal: header.ordinal,
5649                        protocol_name:
5650                            <PuppetMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5651                    }),
5652                }))
5653            },
5654        )
5655    }
5656}
5657
5658/// Puppet is testing component that interacts with Archivist.
5659///
5660/// For full documentation see //src/diagnostics/testing/realm-factory/README.md.
5661#[derive(Debug)]
5662pub enum PuppetRequest {
5663    /// Create and serve an Inspector with the provided name.
5664    /// InspectWriters created this way are RAII.
5665    CreateInspector {
5666        payload: InspectPuppetCreateInspectorRequest,
5667        responder: PuppetCreateInspectorResponder,
5668    },
5669    /// Create and serve an Inspector with the same name as a previous escrowed instance.
5670    /// Also returns a VMO with the previously escrowed inspect data.
5671    /// InspectWriters created this way are RAII.
5672    CreateInspectorFromEscrow {
5673        payload: InspectPuppetCreateInspectorFromEscrowRequest,
5674        responder: PuppetCreateInspectorFromEscrowResponder,
5675    },
5676    /// Prints a message to stdout and appends a newline.
5677    Println { message: String, responder: PuppetPrintlnResponder },
5678    /// Prints a message stderr and appends a newline.
5679    Eprintln { message: String, responder: PuppetEprintlnResponder },
5680    /// Emits a tracing event at the specified severity level.
5681    Log { payload: LogPuppetLogRequest, responder: PuppetLogResponder },
5682    /// Blocks the caller until the next time an interest change event is observed.
5683    /// Messages are lost if they are emitted using LogPuppet.Log before the
5684    /// puppet has observed the the interest change.
5685    WaitForInterestChange { responder: PuppetWaitForInterestChangeResponder },
5686    /// Returns a LazyInspectPuppet client for recording lazy values.
5687    RecordLazyValues { key: String, responder: PuppetRecordLazyValuesResponder },
5688    /// Causes the puppet to crash with an optional error message.
5689    ///
5690    /// The connection will be closed after this is called.
5691    Crash { message: String, control_handle: PuppetControlHandle },
5692    /// An interaction was received which does not match any known method.
5693    #[non_exhaustive]
5694    _UnknownMethod {
5695        /// Ordinal of the method that was called.
5696        ordinal: u64,
5697        control_handle: PuppetControlHandle,
5698        method_type: fidl::MethodType,
5699    },
5700}
5701
5702impl PuppetRequest {
5703    #[allow(irrefutable_let_patterns)]
5704    pub fn into_create_inspector(
5705        self,
5706    ) -> Option<(InspectPuppetCreateInspectorRequest, PuppetCreateInspectorResponder)> {
5707        if let PuppetRequest::CreateInspector { payload, responder } = self {
5708            Some((payload, responder))
5709        } else {
5710            None
5711        }
5712    }
5713
5714    #[allow(irrefutable_let_patterns)]
5715    pub fn into_create_inspector_from_escrow(
5716        self,
5717    ) -> Option<(
5718        InspectPuppetCreateInspectorFromEscrowRequest,
5719        PuppetCreateInspectorFromEscrowResponder,
5720    )> {
5721        if let PuppetRequest::CreateInspectorFromEscrow { payload, responder } = self {
5722            Some((payload, responder))
5723        } else {
5724            None
5725        }
5726    }
5727
5728    #[allow(irrefutable_let_patterns)]
5729    pub fn into_println(self) -> Option<(String, PuppetPrintlnResponder)> {
5730        if let PuppetRequest::Println { message, responder } = self {
5731            Some((message, responder))
5732        } else {
5733            None
5734        }
5735    }
5736
5737    #[allow(irrefutable_let_patterns)]
5738    pub fn into_eprintln(self) -> Option<(String, PuppetEprintlnResponder)> {
5739        if let PuppetRequest::Eprintln { message, responder } = self {
5740            Some((message, responder))
5741        } else {
5742            None
5743        }
5744    }
5745
5746    #[allow(irrefutable_let_patterns)]
5747    pub fn into_log(self) -> Option<(LogPuppetLogRequest, PuppetLogResponder)> {
5748        if let PuppetRequest::Log { payload, responder } = self {
5749            Some((payload, responder))
5750        } else {
5751            None
5752        }
5753    }
5754
5755    #[allow(irrefutable_let_patterns)]
5756    pub fn into_wait_for_interest_change(self) -> Option<(PuppetWaitForInterestChangeResponder)> {
5757        if let PuppetRequest::WaitForInterestChange { responder } = self {
5758            Some((responder))
5759        } else {
5760            None
5761        }
5762    }
5763
5764    #[allow(irrefutable_let_patterns)]
5765    pub fn into_record_lazy_values(self) -> Option<(String, PuppetRecordLazyValuesResponder)> {
5766        if let PuppetRequest::RecordLazyValues { key, responder } = self {
5767            Some((key, responder))
5768        } else {
5769            None
5770        }
5771    }
5772
5773    #[allow(irrefutable_let_patterns)]
5774    pub fn into_crash(self) -> Option<(String, PuppetControlHandle)> {
5775        if let PuppetRequest::Crash { message, control_handle } = self {
5776            Some((message, control_handle))
5777        } else {
5778            None
5779        }
5780    }
5781
5782    /// Name of the method defined in FIDL
5783    pub fn method_name(&self) -> &'static str {
5784        match *self {
5785            PuppetRequest::CreateInspector { .. } => "create_inspector",
5786            PuppetRequest::CreateInspectorFromEscrow { .. } => "create_inspector_from_escrow",
5787            PuppetRequest::Println { .. } => "println",
5788            PuppetRequest::Eprintln { .. } => "eprintln",
5789            PuppetRequest::Log { .. } => "log",
5790            PuppetRequest::WaitForInterestChange { .. } => "wait_for_interest_change",
5791            PuppetRequest::RecordLazyValues { .. } => "record_lazy_values",
5792            PuppetRequest::Crash { .. } => "crash",
5793            PuppetRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
5794                "unknown one-way method"
5795            }
5796            PuppetRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
5797                "unknown two-way method"
5798            }
5799        }
5800    }
5801}
5802
5803#[derive(Debug, Clone)]
5804pub struct PuppetControlHandle {
5805    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5806}
5807
5808impl fidl::endpoints::ControlHandle for PuppetControlHandle {
5809    fn shutdown(&self) {
5810        self.inner.shutdown()
5811    }
5812
5813    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5814        self.inner.shutdown_with_epitaph(status)
5815    }
5816
5817    fn is_closed(&self) -> bool {
5818        self.inner.channel().is_closed()
5819    }
5820    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5821        self.inner.channel().on_closed()
5822    }
5823
5824    #[cfg(target_os = "fuchsia")]
5825    fn signal_peer(
5826        &self,
5827        clear_mask: zx::Signals,
5828        set_mask: zx::Signals,
5829    ) -> Result<(), zx_status::Status> {
5830        use fidl::Peered;
5831        self.inner.channel().signal_peer(clear_mask, set_mask)
5832    }
5833}
5834
5835impl PuppetControlHandle {}
5836
5837#[must_use = "FIDL methods require a response to be sent"]
5838#[derive(Debug)]
5839pub struct PuppetCreateInspectorResponder {
5840    control_handle: std::mem::ManuallyDrop<PuppetControlHandle>,
5841    tx_id: u32,
5842}
5843
5844/// Set the the channel to be shutdown (see [`PuppetControlHandle::shutdown`])
5845/// if the responder is dropped without sending a response, so that the client
5846/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5847impl std::ops::Drop for PuppetCreateInspectorResponder {
5848    fn drop(&mut self) {
5849        self.control_handle.shutdown();
5850        // Safety: drops once, never accessed again
5851        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5852    }
5853}
5854
5855impl fidl::endpoints::Responder for PuppetCreateInspectorResponder {
5856    type ControlHandle = PuppetControlHandle;
5857
5858    fn control_handle(&self) -> &PuppetControlHandle {
5859        &self.control_handle
5860    }
5861
5862    fn drop_without_shutdown(mut self) {
5863        // Safety: drops once, never accessed again due to mem::forget
5864        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5865        // Prevent Drop from running (which would shut down the channel)
5866        std::mem::forget(self);
5867    }
5868}
5869
5870impl PuppetCreateInspectorResponder {
5871    /// Sends a response to the FIDL transaction.
5872    ///
5873    /// Sets the channel to shutdown if an error occurs.
5874    pub fn send(
5875        self,
5876        mut writer: fidl::endpoints::ClientEnd<InspectWriterMarker>,
5877    ) -> Result<(), fidl::Error> {
5878        let _result = self.send_raw(writer);
5879        if _result.is_err() {
5880            self.control_handle.shutdown();
5881        }
5882        self.drop_without_shutdown();
5883        _result
5884    }
5885
5886    /// Similar to "send" but does not shutdown the channel if an error occurs.
5887    pub fn send_no_shutdown_on_err(
5888        self,
5889        mut writer: fidl::endpoints::ClientEnd<InspectWriterMarker>,
5890    ) -> Result<(), fidl::Error> {
5891        let _result = self.send_raw(writer);
5892        self.drop_without_shutdown();
5893        _result
5894    }
5895
5896    fn send_raw(
5897        &self,
5898        mut writer: fidl::endpoints::ClientEnd<InspectWriterMarker>,
5899    ) -> Result<(), fidl::Error> {
5900        self.control_handle
5901            .inner
5902            .send::<fidl::encoding::FlexibleType<InspectPuppetCreateInspectorResponse>>(
5903                fidl::encoding::Flexible::new((writer,)),
5904                self.tx_id,
5905                0x2c0f807d7d159bb,
5906                fidl::encoding::DynamicFlags::FLEXIBLE,
5907            )
5908    }
5909}
5910
5911#[must_use = "FIDL methods require a response to be sent"]
5912#[derive(Debug)]
5913pub struct PuppetCreateInspectorFromEscrowResponder {
5914    control_handle: std::mem::ManuallyDrop<PuppetControlHandle>,
5915    tx_id: u32,
5916}
5917
5918/// Set the the channel to be shutdown (see [`PuppetControlHandle::shutdown`])
5919/// if the responder is dropped without sending a response, so that the client
5920/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5921impl std::ops::Drop for PuppetCreateInspectorFromEscrowResponder {
5922    fn drop(&mut self) {
5923        self.control_handle.shutdown();
5924        // Safety: drops once, never accessed again
5925        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5926    }
5927}
5928
5929impl fidl::endpoints::Responder for PuppetCreateInspectorFromEscrowResponder {
5930    type ControlHandle = PuppetControlHandle;
5931
5932    fn control_handle(&self) -> &PuppetControlHandle {
5933        &self.control_handle
5934    }
5935
5936    fn drop_without_shutdown(mut self) {
5937        // Safety: drops once, never accessed again due to mem::forget
5938        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5939        // Prevent Drop from running (which would shut down the channel)
5940        std::mem::forget(self);
5941    }
5942}
5943
5944impl PuppetCreateInspectorFromEscrowResponder {
5945    /// Sends a response to the FIDL transaction.
5946    ///
5947    /// Sets the channel to shutdown if an error occurs.
5948    pub fn send(
5949        self,
5950        mut writer: fidl::endpoints::ClientEnd<InspectWriterMarker>,
5951        mut data: fidl::Vmo,
5952    ) -> Result<(), fidl::Error> {
5953        let _result = self.send_raw(writer, data);
5954        if _result.is_err() {
5955            self.control_handle.shutdown();
5956        }
5957        self.drop_without_shutdown();
5958        _result
5959    }
5960
5961    /// Similar to "send" but does not shutdown the channel if an error occurs.
5962    pub fn send_no_shutdown_on_err(
5963        self,
5964        mut writer: fidl::endpoints::ClientEnd<InspectWriterMarker>,
5965        mut data: fidl::Vmo,
5966    ) -> Result<(), fidl::Error> {
5967        let _result = self.send_raw(writer, data);
5968        self.drop_without_shutdown();
5969        _result
5970    }
5971
5972    fn send_raw(
5973        &self,
5974        mut writer: fidl::endpoints::ClientEnd<InspectWriterMarker>,
5975        mut data: fidl::Vmo,
5976    ) -> Result<(), fidl::Error> {
5977        self.control_handle.inner.send::<fidl::encoding::FlexibleType<
5978            InspectPuppetCreateInspectorFromEscrowResponse,
5979        >>(
5980            fidl::encoding::Flexible::new((writer, data)),
5981            self.tx_id,
5982            0xe79c0d0606c5df,
5983            fidl::encoding::DynamicFlags::FLEXIBLE,
5984        )
5985    }
5986}
5987
5988#[must_use = "FIDL methods require a response to be sent"]
5989#[derive(Debug)]
5990pub struct PuppetPrintlnResponder {
5991    control_handle: std::mem::ManuallyDrop<PuppetControlHandle>,
5992    tx_id: u32,
5993}
5994
5995/// Set the the channel to be shutdown (see [`PuppetControlHandle::shutdown`])
5996/// if the responder is dropped without sending a response, so that the client
5997/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5998impl std::ops::Drop for PuppetPrintlnResponder {
5999    fn drop(&mut self) {
6000        self.control_handle.shutdown();
6001        // Safety: drops once, never accessed again
6002        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6003    }
6004}
6005
6006impl fidl::endpoints::Responder for PuppetPrintlnResponder {
6007    type ControlHandle = PuppetControlHandle;
6008
6009    fn control_handle(&self) -> &PuppetControlHandle {
6010        &self.control_handle
6011    }
6012
6013    fn drop_without_shutdown(mut self) {
6014        // Safety: drops once, never accessed again due to mem::forget
6015        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6016        // Prevent Drop from running (which would shut down the channel)
6017        std::mem::forget(self);
6018    }
6019}
6020
6021impl PuppetPrintlnResponder {
6022    /// Sends a response to the FIDL transaction.
6023    ///
6024    /// Sets the channel to shutdown if an error occurs.
6025    pub fn send(self) -> Result<(), fidl::Error> {
6026        let _result = self.send_raw();
6027        if _result.is_err() {
6028            self.control_handle.shutdown();
6029        }
6030        self.drop_without_shutdown();
6031        _result
6032    }
6033
6034    /// Similar to "send" but does not shutdown the channel if an error occurs.
6035    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
6036        let _result = self.send_raw();
6037        self.drop_without_shutdown();
6038        _result
6039    }
6040
6041    fn send_raw(&self) -> Result<(), fidl::Error> {
6042        self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
6043            fidl::encoding::Flexible::new(()),
6044            self.tx_id,
6045            0x6584cb93e1978da0,
6046            fidl::encoding::DynamicFlags::FLEXIBLE,
6047        )
6048    }
6049}
6050
6051#[must_use = "FIDL methods require a response to be sent"]
6052#[derive(Debug)]
6053pub struct PuppetEprintlnResponder {
6054    control_handle: std::mem::ManuallyDrop<PuppetControlHandle>,
6055    tx_id: u32,
6056}
6057
6058/// Set the the channel to be shutdown (see [`PuppetControlHandle::shutdown`])
6059/// if the responder is dropped without sending a response, so that the client
6060/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6061impl std::ops::Drop for PuppetEprintlnResponder {
6062    fn drop(&mut self) {
6063        self.control_handle.shutdown();
6064        // Safety: drops once, never accessed again
6065        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6066    }
6067}
6068
6069impl fidl::endpoints::Responder for PuppetEprintlnResponder {
6070    type ControlHandle = PuppetControlHandle;
6071
6072    fn control_handle(&self) -> &PuppetControlHandle {
6073        &self.control_handle
6074    }
6075
6076    fn drop_without_shutdown(mut self) {
6077        // Safety: drops once, never accessed again due to mem::forget
6078        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6079        // Prevent Drop from running (which would shut down the channel)
6080        std::mem::forget(self);
6081    }
6082}
6083
6084impl PuppetEprintlnResponder {
6085    /// Sends a response to the FIDL transaction.
6086    ///
6087    /// Sets the channel to shutdown if an error occurs.
6088    pub fn send(self) -> Result<(), fidl::Error> {
6089        let _result = self.send_raw();
6090        if _result.is_err() {
6091            self.control_handle.shutdown();
6092        }
6093        self.drop_without_shutdown();
6094        _result
6095    }
6096
6097    /// Similar to "send" but does not shutdown the channel if an error occurs.
6098    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
6099        let _result = self.send_raw();
6100        self.drop_without_shutdown();
6101        _result
6102    }
6103
6104    fn send_raw(&self) -> Result<(), fidl::Error> {
6105        self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
6106            fidl::encoding::Flexible::new(()),
6107            self.tx_id,
6108            0x770e4524f6b093ef,
6109            fidl::encoding::DynamicFlags::FLEXIBLE,
6110        )
6111    }
6112}
6113
6114#[must_use = "FIDL methods require a response to be sent"]
6115#[derive(Debug)]
6116pub struct PuppetLogResponder {
6117    control_handle: std::mem::ManuallyDrop<PuppetControlHandle>,
6118    tx_id: u32,
6119}
6120
6121/// Set the the channel to be shutdown (see [`PuppetControlHandle::shutdown`])
6122/// if the responder is dropped without sending a response, so that the client
6123/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6124impl std::ops::Drop for PuppetLogResponder {
6125    fn drop(&mut self) {
6126        self.control_handle.shutdown();
6127        // Safety: drops once, never accessed again
6128        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6129    }
6130}
6131
6132impl fidl::endpoints::Responder for PuppetLogResponder {
6133    type ControlHandle = PuppetControlHandle;
6134
6135    fn control_handle(&self) -> &PuppetControlHandle {
6136        &self.control_handle
6137    }
6138
6139    fn drop_without_shutdown(mut self) {
6140        // Safety: drops once, never accessed again due to mem::forget
6141        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6142        // Prevent Drop from running (which would shut down the channel)
6143        std::mem::forget(self);
6144    }
6145}
6146
6147impl PuppetLogResponder {
6148    /// Sends a response to the FIDL transaction.
6149    ///
6150    /// Sets the channel to shutdown if an error occurs.
6151    pub fn send(self) -> Result<(), fidl::Error> {
6152        let _result = self.send_raw();
6153        if _result.is_err() {
6154            self.control_handle.shutdown();
6155        }
6156        self.drop_without_shutdown();
6157        _result
6158    }
6159
6160    /// Similar to "send" but does not shutdown the channel if an error occurs.
6161    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
6162        let _result = self.send_raw();
6163        self.drop_without_shutdown();
6164        _result
6165    }
6166
6167    fn send_raw(&self) -> Result<(), fidl::Error> {
6168        self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
6169            fidl::encoding::Flexible::new(()),
6170            self.tx_id,
6171            0x34d3dd4225e79a8b,
6172            fidl::encoding::DynamicFlags::FLEXIBLE,
6173        )
6174    }
6175}
6176
6177#[must_use = "FIDL methods require a response to be sent"]
6178#[derive(Debug)]
6179pub struct PuppetWaitForInterestChangeResponder {
6180    control_handle: std::mem::ManuallyDrop<PuppetControlHandle>,
6181    tx_id: u32,
6182}
6183
6184/// Set the the channel to be shutdown (see [`PuppetControlHandle::shutdown`])
6185/// if the responder is dropped without sending a response, so that the client
6186/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6187impl std::ops::Drop for PuppetWaitForInterestChangeResponder {
6188    fn drop(&mut self) {
6189        self.control_handle.shutdown();
6190        // Safety: drops once, never accessed again
6191        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6192    }
6193}
6194
6195impl fidl::endpoints::Responder for PuppetWaitForInterestChangeResponder {
6196    type ControlHandle = PuppetControlHandle;
6197
6198    fn control_handle(&self) -> &PuppetControlHandle {
6199        &self.control_handle
6200    }
6201
6202    fn drop_without_shutdown(mut self) {
6203        // Safety: drops once, never accessed again due to mem::forget
6204        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6205        // Prevent Drop from running (which would shut down the channel)
6206        std::mem::forget(self);
6207    }
6208}
6209
6210impl PuppetWaitForInterestChangeResponder {
6211    /// Sends a response to the FIDL transaction.
6212    ///
6213    /// Sets the channel to shutdown if an error occurs.
6214    pub fn send(
6215        self,
6216        mut payload: &LogPuppetWaitForInterestChangeResponse,
6217    ) -> Result<(), fidl::Error> {
6218        let _result = self.send_raw(payload);
6219        if _result.is_err() {
6220            self.control_handle.shutdown();
6221        }
6222        self.drop_without_shutdown();
6223        _result
6224    }
6225
6226    /// Similar to "send" but does not shutdown the channel if an error occurs.
6227    pub fn send_no_shutdown_on_err(
6228        self,
6229        mut payload: &LogPuppetWaitForInterestChangeResponse,
6230    ) -> Result<(), fidl::Error> {
6231        let _result = self.send_raw(payload);
6232        self.drop_without_shutdown();
6233        _result
6234    }
6235
6236    fn send_raw(
6237        &self,
6238        mut payload: &LogPuppetWaitForInterestChangeResponse,
6239    ) -> Result<(), fidl::Error> {
6240        self.control_handle.inner.send::<fidl::encoding::FlexibleType<
6241            LogPuppetWaitForInterestChangeResponse,
6242        >>(
6243            fidl::encoding::Flexible::new(payload),
6244            self.tx_id,
6245            0x3645d3ad544bc546,
6246            fidl::encoding::DynamicFlags::FLEXIBLE,
6247        )
6248    }
6249}
6250
6251#[must_use = "FIDL methods require a response to be sent"]
6252#[derive(Debug)]
6253pub struct PuppetRecordLazyValuesResponder {
6254    control_handle: std::mem::ManuallyDrop<PuppetControlHandle>,
6255    tx_id: u32,
6256}
6257
6258/// Set the the channel to be shutdown (see [`PuppetControlHandle::shutdown`])
6259/// if the responder is dropped without sending a response, so that the client
6260/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6261impl std::ops::Drop for PuppetRecordLazyValuesResponder {
6262    fn drop(&mut self) {
6263        self.control_handle.shutdown();
6264        // Safety: drops once, never accessed again
6265        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6266    }
6267}
6268
6269impl fidl::endpoints::Responder for PuppetRecordLazyValuesResponder {
6270    type ControlHandle = PuppetControlHandle;
6271
6272    fn control_handle(&self) -> &PuppetControlHandle {
6273        &self.control_handle
6274    }
6275
6276    fn drop_without_shutdown(mut self) {
6277        // Safety: drops once, never accessed again due to mem::forget
6278        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6279        // Prevent Drop from running (which would shut down the channel)
6280        std::mem::forget(self);
6281    }
6282}
6283
6284impl PuppetRecordLazyValuesResponder {
6285    /// Sends a response to the FIDL transaction.
6286    ///
6287    /// Sets the channel to shutdown if an error occurs.
6288    pub fn send(
6289        self,
6290        mut client: fidl::endpoints::ClientEnd<LazyInspectPuppetMarker>,
6291    ) -> Result<(), fidl::Error> {
6292        let _result = self.send_raw(client);
6293        if _result.is_err() {
6294            self.control_handle.shutdown();
6295        }
6296        self.drop_without_shutdown();
6297        _result
6298    }
6299
6300    /// Similar to "send" but does not shutdown the channel if an error occurs.
6301    pub fn send_no_shutdown_on_err(
6302        self,
6303        mut client: fidl::endpoints::ClientEnd<LazyInspectPuppetMarker>,
6304    ) -> Result<(), fidl::Error> {
6305        let _result = self.send_raw(client);
6306        self.drop_without_shutdown();
6307        _result
6308    }
6309
6310    fn send_raw(
6311        &self,
6312        mut client: fidl::endpoints::ClientEnd<LazyInspectPuppetMarker>,
6313    ) -> Result<(), fidl::Error> {
6314        self.control_handle
6315            .inner
6316            .send::<fidl::encoding::FlexibleType<PuppetRecordLazyValuesResponse>>(
6317                fidl::encoding::Flexible::new((client,)),
6318                self.tx_id,
6319                0x339951b623dc9d7d,
6320                fidl::encoding::DynamicFlags::FLEXIBLE,
6321            )
6322    }
6323}
6324
6325#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
6326pub struct RealmFactoryMarker;
6327
6328impl fidl::endpoints::ProtocolMarker for RealmFactoryMarker {
6329    type Proxy = RealmFactoryProxy;
6330    type RequestStream = RealmFactoryRequestStream;
6331    #[cfg(target_os = "fuchsia")]
6332    type SynchronousProxy = RealmFactorySynchronousProxy;
6333
6334    const DEBUG_NAME: &'static str = "fuchsia.archivist.test.RealmFactory";
6335}
6336impl fidl::endpoints::DiscoverableProtocolMarker for RealmFactoryMarker {}
6337pub type RealmFactoryCreateRealmResult = Result<(), fidl_fuchsia_testing_harness::OperationError>;
6338
6339pub trait RealmFactoryProxyInterface: Send + Sync {
6340    type CreateRealmResponseFut: std::future::Future<Output = Result<RealmFactoryCreateRealmResult, fidl::Error>>
6341        + Send;
6342    fn r#create_realm(
6343        &self,
6344        options: &RealmOptions,
6345        realm_server: fidl::endpoints::ServerEnd<fidl_fuchsia_testing_harness::RealmProxy_Marker>,
6346    ) -> Self::CreateRealmResponseFut;
6347}
6348#[derive(Debug)]
6349#[cfg(target_os = "fuchsia")]
6350pub struct RealmFactorySynchronousProxy {
6351    client: fidl::client::sync::Client,
6352}
6353
6354#[cfg(target_os = "fuchsia")]
6355impl fidl::endpoints::SynchronousProxy for RealmFactorySynchronousProxy {
6356    type Proxy = RealmFactoryProxy;
6357    type Protocol = RealmFactoryMarker;
6358
6359    fn from_channel(inner: fidl::Channel) -> Self {
6360        Self::new(inner)
6361    }
6362
6363    fn into_channel(self) -> fidl::Channel {
6364        self.client.into_channel()
6365    }
6366
6367    fn as_channel(&self) -> &fidl::Channel {
6368        self.client.as_channel()
6369    }
6370}
6371
6372#[cfg(target_os = "fuchsia")]
6373impl RealmFactorySynchronousProxy {
6374    pub fn new(channel: fidl::Channel) -> Self {
6375        let protocol_name = <RealmFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6376        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
6377    }
6378
6379    pub fn into_channel(self) -> fidl::Channel {
6380        self.client.into_channel()
6381    }
6382
6383    /// Waits until an event arrives and returns it. It is safe for other
6384    /// threads to make concurrent requests while waiting for an event.
6385    pub fn wait_for_event(
6386        &self,
6387        deadline: zx::MonotonicInstant,
6388    ) -> Result<RealmFactoryEvent, fidl::Error> {
6389        RealmFactoryEvent::decode(self.client.wait_for_event(deadline)?)
6390    }
6391
6392    /// Specifies the options to use when creating the realm.
6393    ///
6394    /// Returns OperationError.INVALID if called more than once.
6395    pub fn r#create_realm(
6396        &self,
6397        mut options: &RealmOptions,
6398        mut realm_server: fidl::endpoints::ServerEnd<
6399            fidl_fuchsia_testing_harness::RealmProxy_Marker,
6400        >,
6401        ___deadline: zx::MonotonicInstant,
6402    ) -> Result<RealmFactoryCreateRealmResult, fidl::Error> {
6403        let _response = self
6404            .client
6405            .send_query::<RealmFactoryCreateRealmRequest, fidl::encoding::FlexibleResultType<
6406                fidl::encoding::EmptyStruct,
6407                fidl_fuchsia_testing_harness::OperationError,
6408            >>(
6409                (options, realm_server),
6410                0x176832ac7263ab99,
6411                fidl::encoding::DynamicFlags::FLEXIBLE,
6412                ___deadline,
6413            )?
6414            .into_result::<RealmFactoryMarker>("create_realm")?;
6415        Ok(_response.map(|x| x))
6416    }
6417}
6418
6419#[cfg(target_os = "fuchsia")]
6420impl From<RealmFactorySynchronousProxy> for zx::NullableHandle {
6421    fn from(value: RealmFactorySynchronousProxy) -> Self {
6422        value.into_channel().into()
6423    }
6424}
6425
6426#[cfg(target_os = "fuchsia")]
6427impl From<fidl::Channel> for RealmFactorySynchronousProxy {
6428    fn from(value: fidl::Channel) -> Self {
6429        Self::new(value)
6430    }
6431}
6432
6433#[cfg(target_os = "fuchsia")]
6434impl fidl::endpoints::FromClient for RealmFactorySynchronousProxy {
6435    type Protocol = RealmFactoryMarker;
6436
6437    fn from_client(value: fidl::endpoints::ClientEnd<RealmFactoryMarker>) -> Self {
6438        Self::new(value.into_channel())
6439    }
6440}
6441
6442#[derive(Debug, Clone)]
6443pub struct RealmFactoryProxy {
6444    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
6445}
6446
6447impl fidl::endpoints::Proxy for RealmFactoryProxy {
6448    type Protocol = RealmFactoryMarker;
6449
6450    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
6451        Self::new(inner)
6452    }
6453
6454    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
6455        self.client.into_channel().map_err(|client| Self { client })
6456    }
6457
6458    fn as_channel(&self) -> &::fidl::AsyncChannel {
6459        self.client.as_channel()
6460    }
6461}
6462
6463impl RealmFactoryProxy {
6464    /// Create a new Proxy for fuchsia.archivist.test/RealmFactory.
6465    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
6466        let protocol_name = <RealmFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6467        Self { client: fidl::client::Client::new(channel, protocol_name) }
6468    }
6469
6470    /// Get a Stream of events from the remote end of the protocol.
6471    ///
6472    /// # Panics
6473    ///
6474    /// Panics if the event stream was already taken.
6475    pub fn take_event_stream(&self) -> RealmFactoryEventStream {
6476        RealmFactoryEventStream { event_receiver: self.client.take_event_receiver() }
6477    }
6478
6479    /// Specifies the options to use when creating the realm.
6480    ///
6481    /// Returns OperationError.INVALID if called more than once.
6482    pub fn r#create_realm(
6483        &self,
6484        mut options: &RealmOptions,
6485        mut realm_server: fidl::endpoints::ServerEnd<
6486            fidl_fuchsia_testing_harness::RealmProxy_Marker,
6487        >,
6488    ) -> fidl::client::QueryResponseFut<
6489        RealmFactoryCreateRealmResult,
6490        fidl::encoding::DefaultFuchsiaResourceDialect,
6491    > {
6492        RealmFactoryProxyInterface::r#create_realm(self, options, realm_server)
6493    }
6494}
6495
6496impl RealmFactoryProxyInterface for RealmFactoryProxy {
6497    type CreateRealmResponseFut = fidl::client::QueryResponseFut<
6498        RealmFactoryCreateRealmResult,
6499        fidl::encoding::DefaultFuchsiaResourceDialect,
6500    >;
6501    fn r#create_realm(
6502        &self,
6503        mut options: &RealmOptions,
6504        mut realm_server: fidl::endpoints::ServerEnd<
6505            fidl_fuchsia_testing_harness::RealmProxy_Marker,
6506        >,
6507    ) -> Self::CreateRealmResponseFut {
6508        fn _decode(
6509            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6510        ) -> Result<RealmFactoryCreateRealmResult, fidl::Error> {
6511            let _response = fidl::client::decode_transaction_body::<
6512                fidl::encoding::FlexibleResultType<
6513                    fidl::encoding::EmptyStruct,
6514                    fidl_fuchsia_testing_harness::OperationError,
6515                >,
6516                fidl::encoding::DefaultFuchsiaResourceDialect,
6517                0x176832ac7263ab99,
6518            >(_buf?)?
6519            .into_result::<RealmFactoryMarker>("create_realm")?;
6520            Ok(_response.map(|x| x))
6521        }
6522        self.client
6523            .send_query_and_decode::<RealmFactoryCreateRealmRequest, RealmFactoryCreateRealmResult>(
6524                (options, realm_server),
6525                0x176832ac7263ab99,
6526                fidl::encoding::DynamicFlags::FLEXIBLE,
6527                _decode,
6528            )
6529    }
6530}
6531
6532pub struct RealmFactoryEventStream {
6533    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
6534}
6535
6536impl std::marker::Unpin for RealmFactoryEventStream {}
6537
6538impl futures::stream::FusedStream for RealmFactoryEventStream {
6539    fn is_terminated(&self) -> bool {
6540        self.event_receiver.is_terminated()
6541    }
6542}
6543
6544impl futures::Stream for RealmFactoryEventStream {
6545    type Item = Result<RealmFactoryEvent, fidl::Error>;
6546
6547    fn poll_next(
6548        mut self: std::pin::Pin<&mut Self>,
6549        cx: &mut std::task::Context<'_>,
6550    ) -> std::task::Poll<Option<Self::Item>> {
6551        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6552            &mut self.event_receiver,
6553            cx
6554        )?) {
6555            Some(buf) => std::task::Poll::Ready(Some(RealmFactoryEvent::decode(buf))),
6556            None => std::task::Poll::Ready(None),
6557        }
6558    }
6559}
6560
6561#[derive(Debug)]
6562pub enum RealmFactoryEvent {
6563    #[non_exhaustive]
6564    _UnknownEvent {
6565        /// Ordinal of the event that was sent.
6566        ordinal: u64,
6567    },
6568}
6569
6570impl RealmFactoryEvent {
6571    /// Decodes a message buffer as a [`RealmFactoryEvent`].
6572    fn decode(
6573        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6574    ) -> Result<RealmFactoryEvent, fidl::Error> {
6575        let (bytes, _handles) = buf.split_mut();
6576        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6577        debug_assert_eq!(tx_header.tx_id, 0);
6578        match tx_header.ordinal {
6579            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
6580                Ok(RealmFactoryEvent::_UnknownEvent { ordinal: tx_header.ordinal })
6581            }
6582            _ => Err(fidl::Error::UnknownOrdinal {
6583                ordinal: tx_header.ordinal,
6584                protocol_name: <RealmFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6585            }),
6586        }
6587    }
6588}
6589
6590/// A Stream of incoming requests for fuchsia.archivist.test/RealmFactory.
6591pub struct RealmFactoryRequestStream {
6592    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6593    is_terminated: bool,
6594}
6595
6596impl std::marker::Unpin for RealmFactoryRequestStream {}
6597
6598impl futures::stream::FusedStream for RealmFactoryRequestStream {
6599    fn is_terminated(&self) -> bool {
6600        self.is_terminated
6601    }
6602}
6603
6604impl fidl::endpoints::RequestStream for RealmFactoryRequestStream {
6605    type Protocol = RealmFactoryMarker;
6606    type ControlHandle = RealmFactoryControlHandle;
6607
6608    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
6609        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6610    }
6611
6612    fn control_handle(&self) -> Self::ControlHandle {
6613        RealmFactoryControlHandle { inner: self.inner.clone() }
6614    }
6615
6616    fn into_inner(
6617        self,
6618    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
6619    {
6620        (self.inner, self.is_terminated)
6621    }
6622
6623    fn from_inner(
6624        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6625        is_terminated: bool,
6626    ) -> Self {
6627        Self { inner, is_terminated }
6628    }
6629}
6630
6631impl futures::Stream for RealmFactoryRequestStream {
6632    type Item = Result<RealmFactoryRequest, fidl::Error>;
6633
6634    fn poll_next(
6635        mut self: std::pin::Pin<&mut Self>,
6636        cx: &mut std::task::Context<'_>,
6637    ) -> std::task::Poll<Option<Self::Item>> {
6638        let this = &mut *self;
6639        if this.inner.check_shutdown(cx) {
6640            this.is_terminated = true;
6641            return std::task::Poll::Ready(None);
6642        }
6643        if this.is_terminated {
6644            panic!("polled RealmFactoryRequestStream after completion");
6645        }
6646        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
6647            |bytes, handles| {
6648                match this.inner.channel().read_etc(cx, bytes, handles) {
6649                    std::task::Poll::Ready(Ok(())) => {}
6650                    std::task::Poll::Pending => return std::task::Poll::Pending,
6651                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
6652                        this.is_terminated = true;
6653                        return std::task::Poll::Ready(None);
6654                    }
6655                    std::task::Poll::Ready(Err(e)) => {
6656                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
6657                            e.into(),
6658                        ))));
6659                    }
6660                }
6661
6662                // A message has been received from the channel
6663                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6664
6665                std::task::Poll::Ready(Some(match header.ordinal {
6666                    0x176832ac7263ab99 => {
6667                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6668                        let mut req = fidl::new_empty!(
6669                            RealmFactoryCreateRealmRequest,
6670                            fidl::encoding::DefaultFuchsiaResourceDialect
6671                        );
6672                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RealmFactoryCreateRealmRequest>(&header, _body_bytes, handles, &mut req)?;
6673                        let control_handle =
6674                            RealmFactoryControlHandle { inner: this.inner.clone() };
6675                        Ok(RealmFactoryRequest::CreateRealm {
6676                            options: req.options,
6677                            realm_server: req.realm_server,
6678
6679                            responder: RealmFactoryCreateRealmResponder {
6680                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6681                                tx_id: header.tx_id,
6682                            },
6683                        })
6684                    }
6685                    _ if header.tx_id == 0
6686                        && header
6687                            .dynamic_flags()
6688                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
6689                    {
6690                        Ok(RealmFactoryRequest::_UnknownMethod {
6691                            ordinal: header.ordinal,
6692                            control_handle: RealmFactoryControlHandle { inner: this.inner.clone() },
6693                            method_type: fidl::MethodType::OneWay,
6694                        })
6695                    }
6696                    _ if header
6697                        .dynamic_flags()
6698                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
6699                    {
6700                        this.inner.send_framework_err(
6701                            fidl::encoding::FrameworkErr::UnknownMethod,
6702                            header.tx_id,
6703                            header.ordinal,
6704                            header.dynamic_flags(),
6705                            (bytes, handles),
6706                        )?;
6707                        Ok(RealmFactoryRequest::_UnknownMethod {
6708                            ordinal: header.ordinal,
6709                            control_handle: RealmFactoryControlHandle { inner: this.inner.clone() },
6710                            method_type: fidl::MethodType::TwoWay,
6711                        })
6712                    }
6713                    _ => Err(fidl::Error::UnknownOrdinal {
6714                        ordinal: header.ordinal,
6715                        protocol_name:
6716                            <RealmFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6717                    }),
6718                }))
6719            },
6720        )
6721    }
6722}
6723
6724/// The test realm factory protocol for archivist integration tests.
6725///
6726/// This protocol allows clients to build an archivist component in a hermetic
6727/// test realm that also includes several "puppet" components.
6728///
6729/// For full documentation see //src/diagnostics/testing/realm-factory/README.md.
6730#[derive(Debug)]
6731pub enum RealmFactoryRequest {
6732    /// Specifies the options to use when creating the realm.
6733    ///
6734    /// Returns OperationError.INVALID if called more than once.
6735    CreateRealm {
6736        options: RealmOptions,
6737        realm_server: fidl::endpoints::ServerEnd<fidl_fuchsia_testing_harness::RealmProxy_Marker>,
6738        responder: RealmFactoryCreateRealmResponder,
6739    },
6740    /// An interaction was received which does not match any known method.
6741    #[non_exhaustive]
6742    _UnknownMethod {
6743        /// Ordinal of the method that was called.
6744        ordinal: u64,
6745        control_handle: RealmFactoryControlHandle,
6746        method_type: fidl::MethodType,
6747    },
6748}
6749
6750impl RealmFactoryRequest {
6751    #[allow(irrefutable_let_patterns)]
6752    pub fn into_create_realm(
6753        self,
6754    ) -> Option<(
6755        RealmOptions,
6756        fidl::endpoints::ServerEnd<fidl_fuchsia_testing_harness::RealmProxy_Marker>,
6757        RealmFactoryCreateRealmResponder,
6758    )> {
6759        if let RealmFactoryRequest::CreateRealm { options, realm_server, responder } = self {
6760            Some((options, realm_server, responder))
6761        } else {
6762            None
6763        }
6764    }
6765
6766    /// Name of the method defined in FIDL
6767    pub fn method_name(&self) -> &'static str {
6768        match *self {
6769            RealmFactoryRequest::CreateRealm { .. } => "create_realm",
6770            RealmFactoryRequest::_UnknownMethod {
6771                method_type: fidl::MethodType::OneWay, ..
6772            } => "unknown one-way method",
6773            RealmFactoryRequest::_UnknownMethod {
6774                method_type: fidl::MethodType::TwoWay, ..
6775            } => "unknown two-way method",
6776        }
6777    }
6778}
6779
6780#[derive(Debug, Clone)]
6781pub struct RealmFactoryControlHandle {
6782    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6783}
6784
6785impl fidl::endpoints::ControlHandle for RealmFactoryControlHandle {
6786    fn shutdown(&self) {
6787        self.inner.shutdown()
6788    }
6789
6790    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
6791        self.inner.shutdown_with_epitaph(status)
6792    }
6793
6794    fn is_closed(&self) -> bool {
6795        self.inner.channel().is_closed()
6796    }
6797    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6798        self.inner.channel().on_closed()
6799    }
6800
6801    #[cfg(target_os = "fuchsia")]
6802    fn signal_peer(
6803        &self,
6804        clear_mask: zx::Signals,
6805        set_mask: zx::Signals,
6806    ) -> Result<(), zx_status::Status> {
6807        use fidl::Peered;
6808        self.inner.channel().signal_peer(clear_mask, set_mask)
6809    }
6810}
6811
6812impl RealmFactoryControlHandle {}
6813
6814#[must_use = "FIDL methods require a response to be sent"]
6815#[derive(Debug)]
6816pub struct RealmFactoryCreateRealmResponder {
6817    control_handle: std::mem::ManuallyDrop<RealmFactoryControlHandle>,
6818    tx_id: u32,
6819}
6820
6821/// Set the the channel to be shutdown (see [`RealmFactoryControlHandle::shutdown`])
6822/// if the responder is dropped without sending a response, so that the client
6823/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6824impl std::ops::Drop for RealmFactoryCreateRealmResponder {
6825    fn drop(&mut self) {
6826        self.control_handle.shutdown();
6827        // Safety: drops once, never accessed again
6828        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6829    }
6830}
6831
6832impl fidl::endpoints::Responder for RealmFactoryCreateRealmResponder {
6833    type ControlHandle = RealmFactoryControlHandle;
6834
6835    fn control_handle(&self) -> &RealmFactoryControlHandle {
6836        &self.control_handle
6837    }
6838
6839    fn drop_without_shutdown(mut self) {
6840        // Safety: drops once, never accessed again due to mem::forget
6841        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6842        // Prevent Drop from running (which would shut down the channel)
6843        std::mem::forget(self);
6844    }
6845}
6846
6847impl RealmFactoryCreateRealmResponder {
6848    /// Sends a response to the FIDL transaction.
6849    ///
6850    /// Sets the channel to shutdown if an error occurs.
6851    pub fn send(
6852        self,
6853        mut result: Result<(), fidl_fuchsia_testing_harness::OperationError>,
6854    ) -> Result<(), fidl::Error> {
6855        let _result = self.send_raw(result);
6856        if _result.is_err() {
6857            self.control_handle.shutdown();
6858        }
6859        self.drop_without_shutdown();
6860        _result
6861    }
6862
6863    /// Similar to "send" but does not shutdown the channel if an error occurs.
6864    pub fn send_no_shutdown_on_err(
6865        self,
6866        mut result: Result<(), fidl_fuchsia_testing_harness::OperationError>,
6867    ) -> Result<(), fidl::Error> {
6868        let _result = self.send_raw(result);
6869        self.drop_without_shutdown();
6870        _result
6871    }
6872
6873    fn send_raw(
6874        &self,
6875        mut result: Result<(), fidl_fuchsia_testing_harness::OperationError>,
6876    ) -> Result<(), fidl::Error> {
6877        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
6878            fidl::encoding::EmptyStruct,
6879            fidl_fuchsia_testing_harness::OperationError,
6880        >>(
6881            fidl::encoding::FlexibleResult::new(result),
6882            self.tx_id,
6883            0x176832ac7263ab99,
6884            fidl::encoding::DynamicFlags::FLEXIBLE,
6885        )
6886    }
6887}
6888
6889#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
6890pub struct StopWaiterMarker;
6891
6892impl fidl::endpoints::ProtocolMarker for StopWaiterMarker {
6893    type Proxy = StopWaiterProxy;
6894    type RequestStream = StopWaiterRequestStream;
6895    #[cfg(target_os = "fuchsia")]
6896    type SynchronousProxy = StopWaiterSynchronousProxy;
6897
6898    const DEBUG_NAME: &'static str = "(anonymous) StopWaiter";
6899}
6900
6901pub trait StopWaiterProxyInterface: Send + Sync {
6902    type WaitResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
6903    fn r#wait(&self) -> Self::WaitResponseFut;
6904}
6905#[derive(Debug)]
6906#[cfg(target_os = "fuchsia")]
6907pub struct StopWaiterSynchronousProxy {
6908    client: fidl::client::sync::Client,
6909}
6910
6911#[cfg(target_os = "fuchsia")]
6912impl fidl::endpoints::SynchronousProxy for StopWaiterSynchronousProxy {
6913    type Proxy = StopWaiterProxy;
6914    type Protocol = StopWaiterMarker;
6915
6916    fn from_channel(inner: fidl::Channel) -> Self {
6917        Self::new(inner)
6918    }
6919
6920    fn into_channel(self) -> fidl::Channel {
6921        self.client.into_channel()
6922    }
6923
6924    fn as_channel(&self) -> &fidl::Channel {
6925        self.client.as_channel()
6926    }
6927}
6928
6929#[cfg(target_os = "fuchsia")]
6930impl StopWaiterSynchronousProxy {
6931    pub fn new(channel: fidl::Channel) -> Self {
6932        let protocol_name = <StopWaiterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6933        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
6934    }
6935
6936    pub fn into_channel(self) -> fidl::Channel {
6937        self.client.into_channel()
6938    }
6939
6940    /// Waits until an event arrives and returns it. It is safe for other
6941    /// threads to make concurrent requests while waiting for an event.
6942    pub fn wait_for_event(
6943        &self,
6944        deadline: zx::MonotonicInstant,
6945    ) -> Result<StopWaiterEvent, fidl::Error> {
6946        StopWaiterEvent::decode(self.client.wait_for_event(deadline)?)
6947    }
6948
6949    /// Returns when the component this subscription is about stops. This will
6950    /// always resolve once it did for the first time it called more than once.
6951    pub fn r#wait(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
6952        let _response = self.client.send_query::<
6953            fidl::encoding::EmptyPayload,
6954            fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
6955        >(
6956            (),
6957            0x12d62812fe8aa263,
6958            fidl::encoding::DynamicFlags::FLEXIBLE,
6959            ___deadline,
6960        )?
6961        .into_result::<StopWaiterMarker>("wait")?;
6962        Ok(_response)
6963    }
6964}
6965
6966#[cfg(target_os = "fuchsia")]
6967impl From<StopWaiterSynchronousProxy> for zx::NullableHandle {
6968    fn from(value: StopWaiterSynchronousProxy) -> Self {
6969        value.into_channel().into()
6970    }
6971}
6972
6973#[cfg(target_os = "fuchsia")]
6974impl From<fidl::Channel> for StopWaiterSynchronousProxy {
6975    fn from(value: fidl::Channel) -> Self {
6976        Self::new(value)
6977    }
6978}
6979
6980#[cfg(target_os = "fuchsia")]
6981impl fidl::endpoints::FromClient for StopWaiterSynchronousProxy {
6982    type Protocol = StopWaiterMarker;
6983
6984    fn from_client(value: fidl::endpoints::ClientEnd<StopWaiterMarker>) -> Self {
6985        Self::new(value.into_channel())
6986    }
6987}
6988
6989#[derive(Debug, Clone)]
6990pub struct StopWaiterProxy {
6991    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
6992}
6993
6994impl fidl::endpoints::Proxy for StopWaiterProxy {
6995    type Protocol = StopWaiterMarker;
6996
6997    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
6998        Self::new(inner)
6999    }
7000
7001    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
7002        self.client.into_channel().map_err(|client| Self { client })
7003    }
7004
7005    fn as_channel(&self) -> &::fidl::AsyncChannel {
7006        self.client.as_channel()
7007    }
7008}
7009
7010impl StopWaiterProxy {
7011    /// Create a new Proxy for fuchsia.archivist.test/StopWaiter.
7012    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
7013        let protocol_name = <StopWaiterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7014        Self { client: fidl::client::Client::new(channel, protocol_name) }
7015    }
7016
7017    /// Get a Stream of events from the remote end of the protocol.
7018    ///
7019    /// # Panics
7020    ///
7021    /// Panics if the event stream was already taken.
7022    pub fn take_event_stream(&self) -> StopWaiterEventStream {
7023        StopWaiterEventStream { event_receiver: self.client.take_event_receiver() }
7024    }
7025
7026    /// Returns when the component this subscription is about stops. This will
7027    /// always resolve once it did for the first time it called more than once.
7028    pub fn r#wait(
7029        &self,
7030    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
7031        StopWaiterProxyInterface::r#wait(self)
7032    }
7033}
7034
7035impl StopWaiterProxyInterface for StopWaiterProxy {
7036    type WaitResponseFut =
7037        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
7038    fn r#wait(&self) -> Self::WaitResponseFut {
7039        fn _decode(
7040            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7041        ) -> Result<(), fidl::Error> {
7042            let _response = fidl::client::decode_transaction_body::<
7043                fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
7044                fidl::encoding::DefaultFuchsiaResourceDialect,
7045                0x12d62812fe8aa263,
7046            >(_buf?)?
7047            .into_result::<StopWaiterMarker>("wait")?;
7048            Ok(_response)
7049        }
7050        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
7051            (),
7052            0x12d62812fe8aa263,
7053            fidl::encoding::DynamicFlags::FLEXIBLE,
7054            _decode,
7055        )
7056    }
7057}
7058
7059pub struct StopWaiterEventStream {
7060    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
7061}
7062
7063impl std::marker::Unpin for StopWaiterEventStream {}
7064
7065impl futures::stream::FusedStream for StopWaiterEventStream {
7066    fn is_terminated(&self) -> bool {
7067        self.event_receiver.is_terminated()
7068    }
7069}
7070
7071impl futures::Stream for StopWaiterEventStream {
7072    type Item = Result<StopWaiterEvent, fidl::Error>;
7073
7074    fn poll_next(
7075        mut self: std::pin::Pin<&mut Self>,
7076        cx: &mut std::task::Context<'_>,
7077    ) -> std::task::Poll<Option<Self::Item>> {
7078        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
7079            &mut self.event_receiver,
7080            cx
7081        )?) {
7082            Some(buf) => std::task::Poll::Ready(Some(StopWaiterEvent::decode(buf))),
7083            None => std::task::Poll::Ready(None),
7084        }
7085    }
7086}
7087
7088#[derive(Debug)]
7089pub enum StopWaiterEvent {
7090    #[non_exhaustive]
7091    _UnknownEvent {
7092        /// Ordinal of the event that was sent.
7093        ordinal: u64,
7094    },
7095}
7096
7097impl StopWaiterEvent {
7098    /// Decodes a message buffer as a [`StopWaiterEvent`].
7099    fn decode(
7100        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
7101    ) -> Result<StopWaiterEvent, fidl::Error> {
7102        let (bytes, _handles) = buf.split_mut();
7103        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7104        debug_assert_eq!(tx_header.tx_id, 0);
7105        match tx_header.ordinal {
7106            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
7107                Ok(StopWaiterEvent::_UnknownEvent { ordinal: tx_header.ordinal })
7108            }
7109            _ => Err(fidl::Error::UnknownOrdinal {
7110                ordinal: tx_header.ordinal,
7111                protocol_name: <StopWaiterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7112            }),
7113        }
7114    }
7115}
7116
7117/// A Stream of incoming requests for fuchsia.archivist.test/StopWaiter.
7118pub struct StopWaiterRequestStream {
7119    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7120    is_terminated: bool,
7121}
7122
7123impl std::marker::Unpin for StopWaiterRequestStream {}
7124
7125impl futures::stream::FusedStream for StopWaiterRequestStream {
7126    fn is_terminated(&self) -> bool {
7127        self.is_terminated
7128    }
7129}
7130
7131impl fidl::endpoints::RequestStream for StopWaiterRequestStream {
7132    type Protocol = StopWaiterMarker;
7133    type ControlHandle = StopWaiterControlHandle;
7134
7135    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
7136        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
7137    }
7138
7139    fn control_handle(&self) -> Self::ControlHandle {
7140        StopWaiterControlHandle { inner: self.inner.clone() }
7141    }
7142
7143    fn into_inner(
7144        self,
7145    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
7146    {
7147        (self.inner, self.is_terminated)
7148    }
7149
7150    fn from_inner(
7151        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7152        is_terminated: bool,
7153    ) -> Self {
7154        Self { inner, is_terminated }
7155    }
7156}
7157
7158impl futures::Stream for StopWaiterRequestStream {
7159    type Item = Result<StopWaiterRequest, fidl::Error>;
7160
7161    fn poll_next(
7162        mut self: std::pin::Pin<&mut Self>,
7163        cx: &mut std::task::Context<'_>,
7164    ) -> std::task::Poll<Option<Self::Item>> {
7165        let this = &mut *self;
7166        if this.inner.check_shutdown(cx) {
7167            this.is_terminated = true;
7168            return std::task::Poll::Ready(None);
7169        }
7170        if this.is_terminated {
7171            panic!("polled StopWaiterRequestStream after completion");
7172        }
7173        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
7174            |bytes, handles| {
7175                match this.inner.channel().read_etc(cx, bytes, handles) {
7176                    std::task::Poll::Ready(Ok(())) => {}
7177                    std::task::Poll::Pending => return std::task::Poll::Pending,
7178                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
7179                        this.is_terminated = true;
7180                        return std::task::Poll::Ready(None);
7181                    }
7182                    std::task::Poll::Ready(Err(e)) => {
7183                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7184                            e.into(),
7185                        ))));
7186                    }
7187                }
7188
7189                // A message has been received from the channel
7190                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7191
7192                std::task::Poll::Ready(Some(match header.ordinal {
7193                    0x12d62812fe8aa263 => {
7194                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7195                        let mut req = fidl::new_empty!(
7196                            fidl::encoding::EmptyPayload,
7197                            fidl::encoding::DefaultFuchsiaResourceDialect
7198                        );
7199                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7200                        let control_handle = StopWaiterControlHandle { inner: this.inner.clone() };
7201                        Ok(StopWaiterRequest::Wait {
7202                            responder: StopWaiterWaitResponder {
7203                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7204                                tx_id: header.tx_id,
7205                            },
7206                        })
7207                    }
7208                    _ if header.tx_id == 0
7209                        && header
7210                            .dynamic_flags()
7211                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
7212                    {
7213                        Ok(StopWaiterRequest::_UnknownMethod {
7214                            ordinal: header.ordinal,
7215                            control_handle: StopWaiterControlHandle { inner: this.inner.clone() },
7216                            method_type: fidl::MethodType::OneWay,
7217                        })
7218                    }
7219                    _ if header
7220                        .dynamic_flags()
7221                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
7222                    {
7223                        this.inner.send_framework_err(
7224                            fidl::encoding::FrameworkErr::UnknownMethod,
7225                            header.tx_id,
7226                            header.ordinal,
7227                            header.dynamic_flags(),
7228                            (bytes, handles),
7229                        )?;
7230                        Ok(StopWaiterRequest::_UnknownMethod {
7231                            ordinal: header.ordinal,
7232                            control_handle: StopWaiterControlHandle { inner: this.inner.clone() },
7233                            method_type: fidl::MethodType::TwoWay,
7234                        })
7235                    }
7236                    _ => Err(fidl::Error::UnknownOrdinal {
7237                        ordinal: header.ordinal,
7238                        protocol_name:
7239                            <StopWaiterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7240                    }),
7241                }))
7242            },
7243        )
7244    }
7245}
7246
7247/// Provides functionality to await on specific stop events on components.
7248#[derive(Debug)]
7249pub enum StopWaiterRequest {
7250    /// Returns when the component this subscription is about stops. This will
7251    /// always resolve once it did for the first time it called more than once.
7252    Wait { responder: StopWaiterWaitResponder },
7253    /// An interaction was received which does not match any known method.
7254    #[non_exhaustive]
7255    _UnknownMethod {
7256        /// Ordinal of the method that was called.
7257        ordinal: u64,
7258        control_handle: StopWaiterControlHandle,
7259        method_type: fidl::MethodType,
7260    },
7261}
7262
7263impl StopWaiterRequest {
7264    #[allow(irrefutable_let_patterns)]
7265    pub fn into_wait(self) -> Option<(StopWaiterWaitResponder)> {
7266        if let StopWaiterRequest::Wait { responder } = self { Some((responder)) } else { None }
7267    }
7268
7269    /// Name of the method defined in FIDL
7270    pub fn method_name(&self) -> &'static str {
7271        match *self {
7272            StopWaiterRequest::Wait { .. } => "wait",
7273            StopWaiterRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
7274                "unknown one-way method"
7275            }
7276            StopWaiterRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
7277                "unknown two-way method"
7278            }
7279        }
7280    }
7281}
7282
7283#[derive(Debug, Clone)]
7284pub struct StopWaiterControlHandle {
7285    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7286}
7287
7288impl fidl::endpoints::ControlHandle for StopWaiterControlHandle {
7289    fn shutdown(&self) {
7290        self.inner.shutdown()
7291    }
7292
7293    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
7294        self.inner.shutdown_with_epitaph(status)
7295    }
7296
7297    fn is_closed(&self) -> bool {
7298        self.inner.channel().is_closed()
7299    }
7300    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
7301        self.inner.channel().on_closed()
7302    }
7303
7304    #[cfg(target_os = "fuchsia")]
7305    fn signal_peer(
7306        &self,
7307        clear_mask: zx::Signals,
7308        set_mask: zx::Signals,
7309    ) -> Result<(), zx_status::Status> {
7310        use fidl::Peered;
7311        self.inner.channel().signal_peer(clear_mask, set_mask)
7312    }
7313}
7314
7315impl StopWaiterControlHandle {}
7316
7317#[must_use = "FIDL methods require a response to be sent"]
7318#[derive(Debug)]
7319pub struct StopWaiterWaitResponder {
7320    control_handle: std::mem::ManuallyDrop<StopWaiterControlHandle>,
7321    tx_id: u32,
7322}
7323
7324/// Set the the channel to be shutdown (see [`StopWaiterControlHandle::shutdown`])
7325/// if the responder is dropped without sending a response, so that the client
7326/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7327impl std::ops::Drop for StopWaiterWaitResponder {
7328    fn drop(&mut self) {
7329        self.control_handle.shutdown();
7330        // Safety: drops once, never accessed again
7331        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7332    }
7333}
7334
7335impl fidl::endpoints::Responder for StopWaiterWaitResponder {
7336    type ControlHandle = StopWaiterControlHandle;
7337
7338    fn control_handle(&self) -> &StopWaiterControlHandle {
7339        &self.control_handle
7340    }
7341
7342    fn drop_without_shutdown(mut self) {
7343        // Safety: drops once, never accessed again due to mem::forget
7344        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7345        // Prevent Drop from running (which would shut down the channel)
7346        std::mem::forget(self);
7347    }
7348}
7349
7350impl StopWaiterWaitResponder {
7351    /// Sends a response to the FIDL transaction.
7352    ///
7353    /// Sets the channel to shutdown if an error occurs.
7354    pub fn send(self) -> Result<(), fidl::Error> {
7355        let _result = self.send_raw();
7356        if _result.is_err() {
7357            self.control_handle.shutdown();
7358        }
7359        self.drop_without_shutdown();
7360        _result
7361    }
7362
7363    /// Similar to "send" but does not shutdown the channel if an error occurs.
7364    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
7365        let _result = self.send_raw();
7366        self.drop_without_shutdown();
7367        _result
7368    }
7369
7370    fn send_raw(&self) -> Result<(), fidl::Error> {
7371        self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
7372            fidl::encoding::Flexible::new(()),
7373            self.tx_id,
7374            0x12d62812fe8aa263,
7375            fidl::encoding::DynamicFlags::FLEXIBLE,
7376        )
7377    }
7378}
7379
7380#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
7381pub struct StopWatcherMarker;
7382
7383impl fidl::endpoints::ProtocolMarker for StopWatcherMarker {
7384    type Proxy = StopWatcherProxy;
7385    type RequestStream = StopWatcherRequestStream;
7386    #[cfg(target_os = "fuchsia")]
7387    type SynchronousProxy = StopWatcherSynchronousProxy;
7388
7389    const DEBUG_NAME: &'static str = "fuchsia.archivist.test.StopWatcher";
7390}
7391impl fidl::endpoints::DiscoverableProtocolMarker for StopWatcherMarker {}
7392
7393pub trait StopWatcherProxyInterface: Send + Sync {
7394    type WatchComponentResponseFut: std::future::Future<
7395            Output = Result<fidl::endpoints::ClientEnd<StopWaiterMarker>, fidl::Error>,
7396        > + Send;
7397    fn r#watch_component(
7398        &self,
7399        moniker: &str,
7400        expected_exit: ExitStatus,
7401    ) -> Self::WatchComponentResponseFut;
7402}
7403#[derive(Debug)]
7404#[cfg(target_os = "fuchsia")]
7405pub struct StopWatcherSynchronousProxy {
7406    client: fidl::client::sync::Client,
7407}
7408
7409#[cfg(target_os = "fuchsia")]
7410impl fidl::endpoints::SynchronousProxy for StopWatcherSynchronousProxy {
7411    type Proxy = StopWatcherProxy;
7412    type Protocol = StopWatcherMarker;
7413
7414    fn from_channel(inner: fidl::Channel) -> Self {
7415        Self::new(inner)
7416    }
7417
7418    fn into_channel(self) -> fidl::Channel {
7419        self.client.into_channel()
7420    }
7421
7422    fn as_channel(&self) -> &fidl::Channel {
7423        self.client.as_channel()
7424    }
7425}
7426
7427#[cfg(target_os = "fuchsia")]
7428impl StopWatcherSynchronousProxy {
7429    pub fn new(channel: fidl::Channel) -> Self {
7430        let protocol_name = <StopWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7431        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
7432    }
7433
7434    pub fn into_channel(self) -> fidl::Channel {
7435        self.client.into_channel()
7436    }
7437
7438    /// Waits until an event arrives and returns it. It is safe for other
7439    /// threads to make concurrent requests while waiting for an event.
7440    pub fn wait_for_event(
7441        &self,
7442        deadline: zx::MonotonicInstant,
7443    ) -> Result<StopWatcherEvent, fidl::Error> {
7444        StopWatcherEvent::decode(self.client.wait_for_event(deadline)?)
7445    }
7446
7447    /// Subscribes to an underlying event stream notifying the server when a
7448    /// component identified by the given moniker stops with the given status.
7449    ///
7450    /// Returns the watcher protocol that can be used to actually get the
7451    /// notification. This is done so that we ensure that the subscription is
7452    /// established before the component could even crash and prevent the client
7453    /// from missing any event.
7454    pub fn r#watch_component(
7455        &self,
7456        mut moniker: &str,
7457        mut expected_exit: ExitStatus,
7458        ___deadline: zx::MonotonicInstant,
7459    ) -> Result<fidl::endpoints::ClientEnd<StopWaiterMarker>, fidl::Error> {
7460        let _response = self.client.send_query::<
7461            StopWatcherWatchComponentRequest,
7462            fidl::encoding::FlexibleType<StopWatcherWatchComponentResponse>,
7463        >(
7464            (moniker, expected_exit,),
7465            0x844f88ddd954e8e,
7466            fidl::encoding::DynamicFlags::FLEXIBLE,
7467            ___deadline,
7468        )?
7469        .into_result::<StopWatcherMarker>("watch_component")?;
7470        Ok(_response.client)
7471    }
7472}
7473
7474#[cfg(target_os = "fuchsia")]
7475impl From<StopWatcherSynchronousProxy> for zx::NullableHandle {
7476    fn from(value: StopWatcherSynchronousProxy) -> Self {
7477        value.into_channel().into()
7478    }
7479}
7480
7481#[cfg(target_os = "fuchsia")]
7482impl From<fidl::Channel> for StopWatcherSynchronousProxy {
7483    fn from(value: fidl::Channel) -> Self {
7484        Self::new(value)
7485    }
7486}
7487
7488#[cfg(target_os = "fuchsia")]
7489impl fidl::endpoints::FromClient for StopWatcherSynchronousProxy {
7490    type Protocol = StopWatcherMarker;
7491
7492    fn from_client(value: fidl::endpoints::ClientEnd<StopWatcherMarker>) -> Self {
7493        Self::new(value.into_channel())
7494    }
7495}
7496
7497#[derive(Debug, Clone)]
7498pub struct StopWatcherProxy {
7499    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
7500}
7501
7502impl fidl::endpoints::Proxy for StopWatcherProxy {
7503    type Protocol = StopWatcherMarker;
7504
7505    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
7506        Self::new(inner)
7507    }
7508
7509    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
7510        self.client.into_channel().map_err(|client| Self { client })
7511    }
7512
7513    fn as_channel(&self) -> &::fidl::AsyncChannel {
7514        self.client.as_channel()
7515    }
7516}
7517
7518impl StopWatcherProxy {
7519    /// Create a new Proxy for fuchsia.archivist.test/StopWatcher.
7520    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
7521        let protocol_name = <StopWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7522        Self { client: fidl::client::Client::new(channel, protocol_name) }
7523    }
7524
7525    /// Get a Stream of events from the remote end of the protocol.
7526    ///
7527    /// # Panics
7528    ///
7529    /// Panics if the event stream was already taken.
7530    pub fn take_event_stream(&self) -> StopWatcherEventStream {
7531        StopWatcherEventStream { event_receiver: self.client.take_event_receiver() }
7532    }
7533
7534    /// Subscribes to an underlying event stream notifying the server when a
7535    /// component identified by the given moniker stops with the given status.
7536    ///
7537    /// Returns the watcher protocol that can be used to actually get the
7538    /// notification. This is done so that we ensure that the subscription is
7539    /// established before the component could even crash and prevent the client
7540    /// from missing any event.
7541    pub fn r#watch_component(
7542        &self,
7543        mut moniker: &str,
7544        mut expected_exit: ExitStatus,
7545    ) -> fidl::client::QueryResponseFut<
7546        fidl::endpoints::ClientEnd<StopWaiterMarker>,
7547        fidl::encoding::DefaultFuchsiaResourceDialect,
7548    > {
7549        StopWatcherProxyInterface::r#watch_component(self, moniker, expected_exit)
7550    }
7551}
7552
7553impl StopWatcherProxyInterface for StopWatcherProxy {
7554    type WatchComponentResponseFut = fidl::client::QueryResponseFut<
7555        fidl::endpoints::ClientEnd<StopWaiterMarker>,
7556        fidl::encoding::DefaultFuchsiaResourceDialect,
7557    >;
7558    fn r#watch_component(
7559        &self,
7560        mut moniker: &str,
7561        mut expected_exit: ExitStatus,
7562    ) -> Self::WatchComponentResponseFut {
7563        fn _decode(
7564            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7565        ) -> Result<fidl::endpoints::ClientEnd<StopWaiterMarker>, fidl::Error> {
7566            let _response = fidl::client::decode_transaction_body::<
7567                fidl::encoding::FlexibleType<StopWatcherWatchComponentResponse>,
7568                fidl::encoding::DefaultFuchsiaResourceDialect,
7569                0x844f88ddd954e8e,
7570            >(_buf?)?
7571            .into_result::<StopWatcherMarker>("watch_component")?;
7572            Ok(_response.client)
7573        }
7574        self.client.send_query_and_decode::<
7575            StopWatcherWatchComponentRequest,
7576            fidl::endpoints::ClientEnd<StopWaiterMarker>,
7577        >(
7578            (moniker, expected_exit,),
7579            0x844f88ddd954e8e,
7580            fidl::encoding::DynamicFlags::FLEXIBLE,
7581            _decode,
7582        )
7583    }
7584}
7585
7586pub struct StopWatcherEventStream {
7587    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
7588}
7589
7590impl std::marker::Unpin for StopWatcherEventStream {}
7591
7592impl futures::stream::FusedStream for StopWatcherEventStream {
7593    fn is_terminated(&self) -> bool {
7594        self.event_receiver.is_terminated()
7595    }
7596}
7597
7598impl futures::Stream for StopWatcherEventStream {
7599    type Item = Result<StopWatcherEvent, fidl::Error>;
7600
7601    fn poll_next(
7602        mut self: std::pin::Pin<&mut Self>,
7603        cx: &mut std::task::Context<'_>,
7604    ) -> std::task::Poll<Option<Self::Item>> {
7605        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
7606            &mut self.event_receiver,
7607            cx
7608        )?) {
7609            Some(buf) => std::task::Poll::Ready(Some(StopWatcherEvent::decode(buf))),
7610            None => std::task::Poll::Ready(None),
7611        }
7612    }
7613}
7614
7615#[derive(Debug)]
7616pub enum StopWatcherEvent {
7617    #[non_exhaustive]
7618    _UnknownEvent {
7619        /// Ordinal of the event that was sent.
7620        ordinal: u64,
7621    },
7622}
7623
7624impl StopWatcherEvent {
7625    /// Decodes a message buffer as a [`StopWatcherEvent`].
7626    fn decode(
7627        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
7628    ) -> Result<StopWatcherEvent, fidl::Error> {
7629        let (bytes, _handles) = buf.split_mut();
7630        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7631        debug_assert_eq!(tx_header.tx_id, 0);
7632        match tx_header.ordinal {
7633            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
7634                Ok(StopWatcherEvent::_UnknownEvent { ordinal: tx_header.ordinal })
7635            }
7636            _ => Err(fidl::Error::UnknownOrdinal {
7637                ordinal: tx_header.ordinal,
7638                protocol_name: <StopWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7639            }),
7640        }
7641    }
7642}
7643
7644/// A Stream of incoming requests for fuchsia.archivist.test/StopWatcher.
7645pub struct StopWatcherRequestStream {
7646    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7647    is_terminated: bool,
7648}
7649
7650impl std::marker::Unpin for StopWatcherRequestStream {}
7651
7652impl futures::stream::FusedStream for StopWatcherRequestStream {
7653    fn is_terminated(&self) -> bool {
7654        self.is_terminated
7655    }
7656}
7657
7658impl fidl::endpoints::RequestStream for StopWatcherRequestStream {
7659    type Protocol = StopWatcherMarker;
7660    type ControlHandle = StopWatcherControlHandle;
7661
7662    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
7663        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
7664    }
7665
7666    fn control_handle(&self) -> Self::ControlHandle {
7667        StopWatcherControlHandle { inner: self.inner.clone() }
7668    }
7669
7670    fn into_inner(
7671        self,
7672    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
7673    {
7674        (self.inner, self.is_terminated)
7675    }
7676
7677    fn from_inner(
7678        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7679        is_terminated: bool,
7680    ) -> Self {
7681        Self { inner, is_terminated }
7682    }
7683}
7684
7685impl futures::Stream for StopWatcherRequestStream {
7686    type Item = Result<StopWatcherRequest, fidl::Error>;
7687
7688    fn poll_next(
7689        mut self: std::pin::Pin<&mut Self>,
7690        cx: &mut std::task::Context<'_>,
7691    ) -> std::task::Poll<Option<Self::Item>> {
7692        let this = &mut *self;
7693        if this.inner.check_shutdown(cx) {
7694            this.is_terminated = true;
7695            return std::task::Poll::Ready(None);
7696        }
7697        if this.is_terminated {
7698            panic!("polled StopWatcherRequestStream after completion");
7699        }
7700        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
7701            |bytes, handles| {
7702                match this.inner.channel().read_etc(cx, bytes, handles) {
7703                    std::task::Poll::Ready(Ok(())) => {}
7704                    std::task::Poll::Pending => return std::task::Poll::Pending,
7705                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
7706                        this.is_terminated = true;
7707                        return std::task::Poll::Ready(None);
7708                    }
7709                    std::task::Poll::Ready(Err(e)) => {
7710                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7711                            e.into(),
7712                        ))));
7713                    }
7714                }
7715
7716                // A message has been received from the channel
7717                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7718
7719                std::task::Poll::Ready(Some(match header.ordinal {
7720                    0x844f88ddd954e8e => {
7721                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7722                        let mut req = fidl::new_empty!(
7723                            StopWatcherWatchComponentRequest,
7724                            fidl::encoding::DefaultFuchsiaResourceDialect
7725                        );
7726                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StopWatcherWatchComponentRequest>(&header, _body_bytes, handles, &mut req)?;
7727                        let control_handle = StopWatcherControlHandle { inner: this.inner.clone() };
7728                        Ok(StopWatcherRequest::WatchComponent {
7729                            moniker: req.moniker,
7730                            expected_exit: req.expected_exit,
7731
7732                            responder: StopWatcherWatchComponentResponder {
7733                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7734                                tx_id: header.tx_id,
7735                            },
7736                        })
7737                    }
7738                    _ if header.tx_id == 0
7739                        && header
7740                            .dynamic_flags()
7741                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
7742                    {
7743                        Ok(StopWatcherRequest::_UnknownMethod {
7744                            ordinal: header.ordinal,
7745                            control_handle: StopWatcherControlHandle { inner: this.inner.clone() },
7746                            method_type: fidl::MethodType::OneWay,
7747                        })
7748                    }
7749                    _ if header
7750                        .dynamic_flags()
7751                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
7752                    {
7753                        this.inner.send_framework_err(
7754                            fidl::encoding::FrameworkErr::UnknownMethod,
7755                            header.tx_id,
7756                            header.ordinal,
7757                            header.dynamic_flags(),
7758                            (bytes, handles),
7759                        )?;
7760                        Ok(StopWatcherRequest::_UnknownMethod {
7761                            ordinal: header.ordinal,
7762                            control_handle: StopWatcherControlHandle { inner: this.inner.clone() },
7763                            method_type: fidl::MethodType::TwoWay,
7764                        })
7765                    }
7766                    _ => Err(fidl::Error::UnknownOrdinal {
7767                        ordinal: header.ordinal,
7768                        protocol_name:
7769                            <StopWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7770                    }),
7771                }))
7772            },
7773        )
7774    }
7775}
7776
7777/// Provides functionality to await on specific stop events on components.
7778#[derive(Debug)]
7779pub enum StopWatcherRequest {
7780    /// Subscribes to an underlying event stream notifying the server when a
7781    /// component identified by the given moniker stops with the given status.
7782    ///
7783    /// Returns the watcher protocol that can be used to actually get the
7784    /// notification. This is done so that we ensure that the subscription is
7785    /// established before the component could even crash and prevent the client
7786    /// from missing any event.
7787    WatchComponent {
7788        moniker: String,
7789        expected_exit: ExitStatus,
7790        responder: StopWatcherWatchComponentResponder,
7791    },
7792    /// An interaction was received which does not match any known method.
7793    #[non_exhaustive]
7794    _UnknownMethod {
7795        /// Ordinal of the method that was called.
7796        ordinal: u64,
7797        control_handle: StopWatcherControlHandle,
7798        method_type: fidl::MethodType,
7799    },
7800}
7801
7802impl StopWatcherRequest {
7803    #[allow(irrefutable_let_patterns)]
7804    pub fn into_watch_component(
7805        self,
7806    ) -> Option<(String, ExitStatus, StopWatcherWatchComponentResponder)> {
7807        if let StopWatcherRequest::WatchComponent { moniker, expected_exit, responder } = self {
7808            Some((moniker, expected_exit, responder))
7809        } else {
7810            None
7811        }
7812    }
7813
7814    /// Name of the method defined in FIDL
7815    pub fn method_name(&self) -> &'static str {
7816        match *self {
7817            StopWatcherRequest::WatchComponent { .. } => "watch_component",
7818            StopWatcherRequest::_UnknownMethod {
7819                method_type: fidl::MethodType::OneWay, ..
7820            } => "unknown one-way method",
7821            StopWatcherRequest::_UnknownMethod {
7822                method_type: fidl::MethodType::TwoWay, ..
7823            } => "unknown two-way method",
7824        }
7825    }
7826}
7827
7828#[derive(Debug, Clone)]
7829pub struct StopWatcherControlHandle {
7830    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7831}
7832
7833impl fidl::endpoints::ControlHandle for StopWatcherControlHandle {
7834    fn shutdown(&self) {
7835        self.inner.shutdown()
7836    }
7837
7838    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
7839        self.inner.shutdown_with_epitaph(status)
7840    }
7841
7842    fn is_closed(&self) -> bool {
7843        self.inner.channel().is_closed()
7844    }
7845    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
7846        self.inner.channel().on_closed()
7847    }
7848
7849    #[cfg(target_os = "fuchsia")]
7850    fn signal_peer(
7851        &self,
7852        clear_mask: zx::Signals,
7853        set_mask: zx::Signals,
7854    ) -> Result<(), zx_status::Status> {
7855        use fidl::Peered;
7856        self.inner.channel().signal_peer(clear_mask, set_mask)
7857    }
7858}
7859
7860impl StopWatcherControlHandle {}
7861
7862#[must_use = "FIDL methods require a response to be sent"]
7863#[derive(Debug)]
7864pub struct StopWatcherWatchComponentResponder {
7865    control_handle: std::mem::ManuallyDrop<StopWatcherControlHandle>,
7866    tx_id: u32,
7867}
7868
7869/// Set the the channel to be shutdown (see [`StopWatcherControlHandle::shutdown`])
7870/// if the responder is dropped without sending a response, so that the client
7871/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7872impl std::ops::Drop for StopWatcherWatchComponentResponder {
7873    fn drop(&mut self) {
7874        self.control_handle.shutdown();
7875        // Safety: drops once, never accessed again
7876        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7877    }
7878}
7879
7880impl fidl::endpoints::Responder for StopWatcherWatchComponentResponder {
7881    type ControlHandle = StopWatcherControlHandle;
7882
7883    fn control_handle(&self) -> &StopWatcherControlHandle {
7884        &self.control_handle
7885    }
7886
7887    fn drop_without_shutdown(mut self) {
7888        // Safety: drops once, never accessed again due to mem::forget
7889        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7890        // Prevent Drop from running (which would shut down the channel)
7891        std::mem::forget(self);
7892    }
7893}
7894
7895impl StopWatcherWatchComponentResponder {
7896    /// Sends a response to the FIDL transaction.
7897    ///
7898    /// Sets the channel to shutdown if an error occurs.
7899    pub fn send(
7900        self,
7901        mut client: fidl::endpoints::ClientEnd<StopWaiterMarker>,
7902    ) -> Result<(), fidl::Error> {
7903        let _result = self.send_raw(client);
7904        if _result.is_err() {
7905            self.control_handle.shutdown();
7906        }
7907        self.drop_without_shutdown();
7908        _result
7909    }
7910
7911    /// Similar to "send" but does not shutdown the channel if an error occurs.
7912    pub fn send_no_shutdown_on_err(
7913        self,
7914        mut client: fidl::endpoints::ClientEnd<StopWaiterMarker>,
7915    ) -> Result<(), fidl::Error> {
7916        let _result = self.send_raw(client);
7917        self.drop_without_shutdown();
7918        _result
7919    }
7920
7921    fn send_raw(
7922        &self,
7923        mut client: fidl::endpoints::ClientEnd<StopWaiterMarker>,
7924    ) -> Result<(), fidl::Error> {
7925        self.control_handle
7926            .inner
7927            .send::<fidl::encoding::FlexibleType<StopWatcherWatchComponentResponse>>(
7928                fidl::encoding::Flexible::new((client,)),
7929                self.tx_id,
7930                0x844f88ddd954e8e,
7931                fidl::encoding::DynamicFlags::FLEXIBLE,
7932            )
7933    }
7934}
7935
7936mod internal {
7937    use super::*;
7938
7939    impl fidl::encoding::ResourceTypeMarker for InspectPuppetCreateInspectorFromEscrowResponse {
7940        type Borrowed<'a> = &'a mut Self;
7941        fn take_or_borrow<'a>(
7942            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
7943        ) -> Self::Borrowed<'a> {
7944            value
7945        }
7946    }
7947
7948    unsafe impl fidl::encoding::TypeMarker for InspectPuppetCreateInspectorFromEscrowResponse {
7949        type Owned = Self;
7950
7951        #[inline(always)]
7952        fn inline_align(_context: fidl::encoding::Context) -> usize {
7953            4
7954        }
7955
7956        #[inline(always)]
7957        fn inline_size(_context: fidl::encoding::Context) -> usize {
7958            8
7959        }
7960    }
7961
7962    unsafe impl
7963        fidl::encoding::Encode<
7964            InspectPuppetCreateInspectorFromEscrowResponse,
7965            fidl::encoding::DefaultFuchsiaResourceDialect,
7966        > for &mut InspectPuppetCreateInspectorFromEscrowResponse
7967    {
7968        #[inline]
7969        unsafe fn encode(
7970            self,
7971            encoder: &mut fidl::encoding::Encoder<
7972                '_,
7973                fidl::encoding::DefaultFuchsiaResourceDialect,
7974            >,
7975            offset: usize,
7976            _depth: fidl::encoding::Depth,
7977        ) -> fidl::Result<()> {
7978            encoder.debug_check_bounds::<InspectPuppetCreateInspectorFromEscrowResponse>(offset);
7979            // Delegate to tuple encoding.
7980            fidl::encoding::Encode::<InspectPuppetCreateInspectorFromEscrowResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
7981                (
7982                    <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<InspectWriterMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.writer),
7983                    <fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 49383> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.data),
7984                ),
7985                encoder, offset, _depth
7986            )
7987        }
7988    }
7989    unsafe impl<
7990        T0: fidl::encoding::Encode<
7991                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<InspectWriterMarker>>,
7992                fidl::encoding::DefaultFuchsiaResourceDialect,
7993            >,
7994        T1: fidl::encoding::Encode<
7995                fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 49383>,
7996                fidl::encoding::DefaultFuchsiaResourceDialect,
7997            >,
7998    >
7999        fidl::encoding::Encode<
8000            InspectPuppetCreateInspectorFromEscrowResponse,
8001            fidl::encoding::DefaultFuchsiaResourceDialect,
8002        > for (T0, T1)
8003    {
8004        #[inline]
8005        unsafe fn encode(
8006            self,
8007            encoder: &mut fidl::encoding::Encoder<
8008                '_,
8009                fidl::encoding::DefaultFuchsiaResourceDialect,
8010            >,
8011            offset: usize,
8012            depth: fidl::encoding::Depth,
8013        ) -> fidl::Result<()> {
8014            encoder.debug_check_bounds::<InspectPuppetCreateInspectorFromEscrowResponse>(offset);
8015            // Zero out padding regions. There's no need to apply masks
8016            // because the unmasked parts will be overwritten by fields.
8017            // Write the fields.
8018            self.0.encode(encoder, offset + 0, depth)?;
8019            self.1.encode(encoder, offset + 4, depth)?;
8020            Ok(())
8021        }
8022    }
8023
8024    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8025        for InspectPuppetCreateInspectorFromEscrowResponse
8026    {
8027        #[inline(always)]
8028        fn new_empty() -> Self {
8029            Self {
8030                writer: fidl::new_empty!(
8031                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<InspectWriterMarker>>,
8032                    fidl::encoding::DefaultFuchsiaResourceDialect
8033                ),
8034                data: fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 49383>, fidl::encoding::DefaultFuchsiaResourceDialect),
8035            }
8036        }
8037
8038        #[inline]
8039        unsafe fn decode(
8040            &mut self,
8041            decoder: &mut fidl::encoding::Decoder<
8042                '_,
8043                fidl::encoding::DefaultFuchsiaResourceDialect,
8044            >,
8045            offset: usize,
8046            _depth: fidl::encoding::Depth,
8047        ) -> fidl::Result<()> {
8048            decoder.debug_check_bounds::<Self>(offset);
8049            // Verify that padding bytes are zero.
8050            fidl::decode!(
8051                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<InspectWriterMarker>>,
8052                fidl::encoding::DefaultFuchsiaResourceDialect,
8053                &mut self.writer,
8054                decoder,
8055                offset + 0,
8056                _depth
8057            )?;
8058            fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 49383>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.data, decoder, offset + 4, _depth)?;
8059            Ok(())
8060        }
8061    }
8062
8063    impl fidl::encoding::ResourceTypeMarker for InspectPuppetCreateInspectorResponse {
8064        type Borrowed<'a> = &'a mut Self;
8065        fn take_or_borrow<'a>(
8066            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8067        ) -> Self::Borrowed<'a> {
8068            value
8069        }
8070    }
8071
8072    unsafe impl fidl::encoding::TypeMarker for InspectPuppetCreateInspectorResponse {
8073        type Owned = Self;
8074
8075        #[inline(always)]
8076        fn inline_align(_context: fidl::encoding::Context) -> usize {
8077            4
8078        }
8079
8080        #[inline(always)]
8081        fn inline_size(_context: fidl::encoding::Context) -> usize {
8082            4
8083        }
8084    }
8085
8086    unsafe impl
8087        fidl::encoding::Encode<
8088            InspectPuppetCreateInspectorResponse,
8089            fidl::encoding::DefaultFuchsiaResourceDialect,
8090        > for &mut InspectPuppetCreateInspectorResponse
8091    {
8092        #[inline]
8093        unsafe fn encode(
8094            self,
8095            encoder: &mut fidl::encoding::Encoder<
8096                '_,
8097                fidl::encoding::DefaultFuchsiaResourceDialect,
8098            >,
8099            offset: usize,
8100            _depth: fidl::encoding::Depth,
8101        ) -> fidl::Result<()> {
8102            encoder.debug_check_bounds::<InspectPuppetCreateInspectorResponse>(offset);
8103            // Delegate to tuple encoding.
8104            fidl::encoding::Encode::<InspectPuppetCreateInspectorResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
8105                (
8106                    <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<InspectWriterMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.writer),
8107                ),
8108                encoder, offset, _depth
8109            )
8110        }
8111    }
8112    unsafe impl<
8113        T0: fidl::encoding::Encode<
8114                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<InspectWriterMarker>>,
8115                fidl::encoding::DefaultFuchsiaResourceDialect,
8116            >,
8117    >
8118        fidl::encoding::Encode<
8119            InspectPuppetCreateInspectorResponse,
8120            fidl::encoding::DefaultFuchsiaResourceDialect,
8121        > for (T0,)
8122    {
8123        #[inline]
8124        unsafe fn encode(
8125            self,
8126            encoder: &mut fidl::encoding::Encoder<
8127                '_,
8128                fidl::encoding::DefaultFuchsiaResourceDialect,
8129            >,
8130            offset: usize,
8131            depth: fidl::encoding::Depth,
8132        ) -> fidl::Result<()> {
8133            encoder.debug_check_bounds::<InspectPuppetCreateInspectorResponse>(offset);
8134            // Zero out padding regions. There's no need to apply masks
8135            // because the unmasked parts will be overwritten by fields.
8136            // Write the fields.
8137            self.0.encode(encoder, offset + 0, depth)?;
8138            Ok(())
8139        }
8140    }
8141
8142    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8143        for InspectPuppetCreateInspectorResponse
8144    {
8145        #[inline(always)]
8146        fn new_empty() -> Self {
8147            Self {
8148                writer: fidl::new_empty!(
8149                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<InspectWriterMarker>>,
8150                    fidl::encoding::DefaultFuchsiaResourceDialect
8151                ),
8152            }
8153        }
8154
8155        #[inline]
8156        unsafe fn decode(
8157            &mut self,
8158            decoder: &mut fidl::encoding::Decoder<
8159                '_,
8160                fidl::encoding::DefaultFuchsiaResourceDialect,
8161            >,
8162            offset: usize,
8163            _depth: fidl::encoding::Depth,
8164        ) -> fidl::Result<()> {
8165            decoder.debug_check_bounds::<Self>(offset);
8166            // Verify that padding bytes are zero.
8167            fidl::decode!(
8168                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<InspectWriterMarker>>,
8169                fidl::encoding::DefaultFuchsiaResourceDialect,
8170                &mut self.writer,
8171                decoder,
8172                offset + 0,
8173                _depth
8174            )?;
8175            Ok(())
8176        }
8177    }
8178
8179    impl fidl::encoding::ResourceTypeMarker for InspectWriterRecordLazyValuesResponse {
8180        type Borrowed<'a> = &'a mut Self;
8181        fn take_or_borrow<'a>(
8182            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8183        ) -> Self::Borrowed<'a> {
8184            value
8185        }
8186    }
8187
8188    unsafe impl fidl::encoding::TypeMarker for InspectWriterRecordLazyValuesResponse {
8189        type Owned = Self;
8190
8191        #[inline(always)]
8192        fn inline_align(_context: fidl::encoding::Context) -> usize {
8193            4
8194        }
8195
8196        #[inline(always)]
8197        fn inline_size(_context: fidl::encoding::Context) -> usize {
8198            4
8199        }
8200    }
8201
8202    unsafe impl
8203        fidl::encoding::Encode<
8204            InspectWriterRecordLazyValuesResponse,
8205            fidl::encoding::DefaultFuchsiaResourceDialect,
8206        > for &mut InspectWriterRecordLazyValuesResponse
8207    {
8208        #[inline]
8209        unsafe fn encode(
8210            self,
8211            encoder: &mut fidl::encoding::Encoder<
8212                '_,
8213                fidl::encoding::DefaultFuchsiaResourceDialect,
8214            >,
8215            offset: usize,
8216            _depth: fidl::encoding::Depth,
8217        ) -> fidl::Result<()> {
8218            encoder.debug_check_bounds::<InspectWriterRecordLazyValuesResponse>(offset);
8219            // Delegate to tuple encoding.
8220            fidl::encoding::Encode::<InspectWriterRecordLazyValuesResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
8221                (
8222                    <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<LazyInspectPuppetMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.client),
8223                ),
8224                encoder, offset, _depth
8225            )
8226        }
8227    }
8228    unsafe impl<
8229        T0: fidl::encoding::Encode<
8230                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<LazyInspectPuppetMarker>>,
8231                fidl::encoding::DefaultFuchsiaResourceDialect,
8232            >,
8233    >
8234        fidl::encoding::Encode<
8235            InspectWriterRecordLazyValuesResponse,
8236            fidl::encoding::DefaultFuchsiaResourceDialect,
8237        > for (T0,)
8238    {
8239        #[inline]
8240        unsafe fn encode(
8241            self,
8242            encoder: &mut fidl::encoding::Encoder<
8243                '_,
8244                fidl::encoding::DefaultFuchsiaResourceDialect,
8245            >,
8246            offset: usize,
8247            depth: fidl::encoding::Depth,
8248        ) -> fidl::Result<()> {
8249            encoder.debug_check_bounds::<InspectWriterRecordLazyValuesResponse>(offset);
8250            // Zero out padding regions. There's no need to apply masks
8251            // because the unmasked parts will be overwritten by fields.
8252            // Write the fields.
8253            self.0.encode(encoder, offset + 0, depth)?;
8254            Ok(())
8255        }
8256    }
8257
8258    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8259        for InspectWriterRecordLazyValuesResponse
8260    {
8261        #[inline(always)]
8262        fn new_empty() -> Self {
8263            Self {
8264                client: fidl::new_empty!(
8265                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<LazyInspectPuppetMarker>>,
8266                    fidl::encoding::DefaultFuchsiaResourceDialect
8267                ),
8268            }
8269        }
8270
8271        #[inline]
8272        unsafe fn decode(
8273            &mut self,
8274            decoder: &mut fidl::encoding::Decoder<
8275                '_,
8276                fidl::encoding::DefaultFuchsiaResourceDialect,
8277            >,
8278            offset: usize,
8279            _depth: fidl::encoding::Depth,
8280        ) -> fidl::Result<()> {
8281            decoder.debug_check_bounds::<Self>(offset);
8282            // Verify that padding bytes are zero.
8283            fidl::decode!(
8284                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<LazyInspectPuppetMarker>>,
8285                fidl::encoding::DefaultFuchsiaResourceDialect,
8286                &mut self.client,
8287                decoder,
8288                offset + 0,
8289                _depth
8290            )?;
8291            Ok(())
8292        }
8293    }
8294
8295    impl fidl::encoding::ResourceTypeMarker for PuppetRecordLazyValuesResponse {
8296        type Borrowed<'a> = &'a mut Self;
8297        fn take_or_borrow<'a>(
8298            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8299        ) -> Self::Borrowed<'a> {
8300            value
8301        }
8302    }
8303
8304    unsafe impl fidl::encoding::TypeMarker for PuppetRecordLazyValuesResponse {
8305        type Owned = Self;
8306
8307        #[inline(always)]
8308        fn inline_align(_context: fidl::encoding::Context) -> usize {
8309            4
8310        }
8311
8312        #[inline(always)]
8313        fn inline_size(_context: fidl::encoding::Context) -> usize {
8314            4
8315        }
8316    }
8317
8318    unsafe impl
8319        fidl::encoding::Encode<
8320            PuppetRecordLazyValuesResponse,
8321            fidl::encoding::DefaultFuchsiaResourceDialect,
8322        > for &mut PuppetRecordLazyValuesResponse
8323    {
8324        #[inline]
8325        unsafe fn encode(
8326            self,
8327            encoder: &mut fidl::encoding::Encoder<
8328                '_,
8329                fidl::encoding::DefaultFuchsiaResourceDialect,
8330            >,
8331            offset: usize,
8332            _depth: fidl::encoding::Depth,
8333        ) -> fidl::Result<()> {
8334            encoder.debug_check_bounds::<PuppetRecordLazyValuesResponse>(offset);
8335            // Delegate to tuple encoding.
8336            fidl::encoding::Encode::<PuppetRecordLazyValuesResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
8337                (
8338                    <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<LazyInspectPuppetMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.client),
8339                ),
8340                encoder, offset, _depth
8341            )
8342        }
8343    }
8344    unsafe impl<
8345        T0: fidl::encoding::Encode<
8346                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<LazyInspectPuppetMarker>>,
8347                fidl::encoding::DefaultFuchsiaResourceDialect,
8348            >,
8349    >
8350        fidl::encoding::Encode<
8351            PuppetRecordLazyValuesResponse,
8352            fidl::encoding::DefaultFuchsiaResourceDialect,
8353        > for (T0,)
8354    {
8355        #[inline]
8356        unsafe fn encode(
8357            self,
8358            encoder: &mut fidl::encoding::Encoder<
8359                '_,
8360                fidl::encoding::DefaultFuchsiaResourceDialect,
8361            >,
8362            offset: usize,
8363            depth: fidl::encoding::Depth,
8364        ) -> fidl::Result<()> {
8365            encoder.debug_check_bounds::<PuppetRecordLazyValuesResponse>(offset);
8366            // Zero out padding regions. There's no need to apply masks
8367            // because the unmasked parts will be overwritten by fields.
8368            // Write the fields.
8369            self.0.encode(encoder, offset + 0, depth)?;
8370            Ok(())
8371        }
8372    }
8373
8374    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8375        for PuppetRecordLazyValuesResponse
8376    {
8377        #[inline(always)]
8378        fn new_empty() -> Self {
8379            Self {
8380                client: fidl::new_empty!(
8381                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<LazyInspectPuppetMarker>>,
8382                    fidl::encoding::DefaultFuchsiaResourceDialect
8383                ),
8384            }
8385        }
8386
8387        #[inline]
8388        unsafe fn decode(
8389            &mut self,
8390            decoder: &mut fidl::encoding::Decoder<
8391                '_,
8392                fidl::encoding::DefaultFuchsiaResourceDialect,
8393            >,
8394            offset: usize,
8395            _depth: fidl::encoding::Depth,
8396        ) -> fidl::Result<()> {
8397            decoder.debug_check_bounds::<Self>(offset);
8398            // Verify that padding bytes are zero.
8399            fidl::decode!(
8400                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<LazyInspectPuppetMarker>>,
8401                fidl::encoding::DefaultFuchsiaResourceDialect,
8402                &mut self.client,
8403                decoder,
8404                offset + 0,
8405                _depth
8406            )?;
8407            Ok(())
8408        }
8409    }
8410
8411    impl fidl::encoding::ResourceTypeMarker for RealmFactoryCreateRealmRequest {
8412        type Borrowed<'a> = &'a mut Self;
8413        fn take_or_borrow<'a>(
8414            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8415        ) -> Self::Borrowed<'a> {
8416            value
8417        }
8418    }
8419
8420    unsafe impl fidl::encoding::TypeMarker for RealmFactoryCreateRealmRequest {
8421        type Owned = Self;
8422
8423        #[inline(always)]
8424        fn inline_align(_context: fidl::encoding::Context) -> usize {
8425            8
8426        }
8427
8428        #[inline(always)]
8429        fn inline_size(_context: fidl::encoding::Context) -> usize {
8430            24
8431        }
8432    }
8433
8434    unsafe impl
8435        fidl::encoding::Encode<
8436            RealmFactoryCreateRealmRequest,
8437            fidl::encoding::DefaultFuchsiaResourceDialect,
8438        > for &mut RealmFactoryCreateRealmRequest
8439    {
8440        #[inline]
8441        unsafe fn encode(
8442            self,
8443            encoder: &mut fidl::encoding::Encoder<
8444                '_,
8445                fidl::encoding::DefaultFuchsiaResourceDialect,
8446            >,
8447            offset: usize,
8448            _depth: fidl::encoding::Depth,
8449        ) -> fidl::Result<()> {
8450            encoder.debug_check_bounds::<RealmFactoryCreateRealmRequest>(offset);
8451            // Delegate to tuple encoding.
8452            fidl::encoding::Encode::<
8453                RealmFactoryCreateRealmRequest,
8454                fidl::encoding::DefaultFuchsiaResourceDialect,
8455            >::encode(
8456                (
8457                    <RealmOptions as fidl::encoding::ValueTypeMarker>::borrow(&self.options),
8458                    <fidl::encoding::Endpoint<
8459                        fidl::endpoints::ServerEnd<fidl_fuchsia_testing_harness::RealmProxy_Marker>,
8460                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
8461                        &mut self.realm_server,
8462                    ),
8463                ),
8464                encoder,
8465                offset,
8466                _depth,
8467            )
8468        }
8469    }
8470    unsafe impl<
8471        T0: fidl::encoding::Encode<RealmOptions, fidl::encoding::DefaultFuchsiaResourceDialect>,
8472        T1: fidl::encoding::Encode<
8473                fidl::encoding::Endpoint<
8474                    fidl::endpoints::ServerEnd<fidl_fuchsia_testing_harness::RealmProxy_Marker>,
8475                >,
8476                fidl::encoding::DefaultFuchsiaResourceDialect,
8477            >,
8478    >
8479        fidl::encoding::Encode<
8480            RealmFactoryCreateRealmRequest,
8481            fidl::encoding::DefaultFuchsiaResourceDialect,
8482        > for (T0, T1)
8483    {
8484        #[inline]
8485        unsafe fn encode(
8486            self,
8487            encoder: &mut fidl::encoding::Encoder<
8488                '_,
8489                fidl::encoding::DefaultFuchsiaResourceDialect,
8490            >,
8491            offset: usize,
8492            depth: fidl::encoding::Depth,
8493        ) -> fidl::Result<()> {
8494            encoder.debug_check_bounds::<RealmFactoryCreateRealmRequest>(offset);
8495            // Zero out padding regions. There's no need to apply masks
8496            // because the unmasked parts will be overwritten by fields.
8497            unsafe {
8498                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
8499                (ptr as *mut u64).write_unaligned(0);
8500            }
8501            // Write the fields.
8502            self.0.encode(encoder, offset + 0, depth)?;
8503            self.1.encode(encoder, offset + 16, depth)?;
8504            Ok(())
8505        }
8506    }
8507
8508    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8509        for RealmFactoryCreateRealmRequest
8510    {
8511        #[inline(always)]
8512        fn new_empty() -> Self {
8513            Self {
8514                options: fidl::new_empty!(
8515                    RealmOptions,
8516                    fidl::encoding::DefaultFuchsiaResourceDialect
8517                ),
8518                realm_server: fidl::new_empty!(
8519                    fidl::encoding::Endpoint<
8520                        fidl::endpoints::ServerEnd<fidl_fuchsia_testing_harness::RealmProxy_Marker>,
8521                    >,
8522                    fidl::encoding::DefaultFuchsiaResourceDialect
8523                ),
8524            }
8525        }
8526
8527        #[inline]
8528        unsafe fn decode(
8529            &mut self,
8530            decoder: &mut fidl::encoding::Decoder<
8531                '_,
8532                fidl::encoding::DefaultFuchsiaResourceDialect,
8533            >,
8534            offset: usize,
8535            _depth: fidl::encoding::Depth,
8536        ) -> fidl::Result<()> {
8537            decoder.debug_check_bounds::<Self>(offset);
8538            // Verify that padding bytes are zero.
8539            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
8540            let padval = unsafe { (ptr as *const u64).read_unaligned() };
8541            let mask = 0xffffffff00000000u64;
8542            let maskedval = padval & mask;
8543            if maskedval != 0 {
8544                return Err(fidl::Error::NonZeroPadding {
8545                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
8546                });
8547            }
8548            fidl::decode!(
8549                RealmOptions,
8550                fidl::encoding::DefaultFuchsiaResourceDialect,
8551                &mut self.options,
8552                decoder,
8553                offset + 0,
8554                _depth
8555            )?;
8556            fidl::decode!(
8557                fidl::encoding::Endpoint<
8558                    fidl::endpoints::ServerEnd<fidl_fuchsia_testing_harness::RealmProxy_Marker>,
8559                >,
8560                fidl::encoding::DefaultFuchsiaResourceDialect,
8561                &mut self.realm_server,
8562                decoder,
8563                offset + 16,
8564                _depth
8565            )?;
8566            Ok(())
8567        }
8568    }
8569
8570    impl fidl::encoding::ResourceTypeMarker for StopWatcherWatchComponentResponse {
8571        type Borrowed<'a> = &'a mut Self;
8572        fn take_or_borrow<'a>(
8573            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8574        ) -> Self::Borrowed<'a> {
8575            value
8576        }
8577    }
8578
8579    unsafe impl fidl::encoding::TypeMarker for StopWatcherWatchComponentResponse {
8580        type Owned = Self;
8581
8582        #[inline(always)]
8583        fn inline_align(_context: fidl::encoding::Context) -> usize {
8584            4
8585        }
8586
8587        #[inline(always)]
8588        fn inline_size(_context: fidl::encoding::Context) -> usize {
8589            4
8590        }
8591    }
8592
8593    unsafe impl
8594        fidl::encoding::Encode<
8595            StopWatcherWatchComponentResponse,
8596            fidl::encoding::DefaultFuchsiaResourceDialect,
8597        > for &mut StopWatcherWatchComponentResponse
8598    {
8599        #[inline]
8600        unsafe fn encode(
8601            self,
8602            encoder: &mut fidl::encoding::Encoder<
8603                '_,
8604                fidl::encoding::DefaultFuchsiaResourceDialect,
8605            >,
8606            offset: usize,
8607            _depth: fidl::encoding::Depth,
8608        ) -> fidl::Result<()> {
8609            encoder.debug_check_bounds::<StopWatcherWatchComponentResponse>(offset);
8610            // Delegate to tuple encoding.
8611            fidl::encoding::Encode::<StopWatcherWatchComponentResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
8612                (
8613                    <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<StopWaiterMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.client),
8614                ),
8615                encoder, offset, _depth
8616            )
8617        }
8618    }
8619    unsafe impl<
8620        T0: fidl::encoding::Encode<
8621                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<StopWaiterMarker>>,
8622                fidl::encoding::DefaultFuchsiaResourceDialect,
8623            >,
8624    >
8625        fidl::encoding::Encode<
8626            StopWatcherWatchComponentResponse,
8627            fidl::encoding::DefaultFuchsiaResourceDialect,
8628        > for (T0,)
8629    {
8630        #[inline]
8631        unsafe fn encode(
8632            self,
8633            encoder: &mut fidl::encoding::Encoder<
8634                '_,
8635                fidl::encoding::DefaultFuchsiaResourceDialect,
8636            >,
8637            offset: usize,
8638            depth: fidl::encoding::Depth,
8639        ) -> fidl::Result<()> {
8640            encoder.debug_check_bounds::<StopWatcherWatchComponentResponse>(offset);
8641            // Zero out padding regions. There's no need to apply masks
8642            // because the unmasked parts will be overwritten by fields.
8643            // Write the fields.
8644            self.0.encode(encoder, offset + 0, depth)?;
8645            Ok(())
8646        }
8647    }
8648
8649    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8650        for StopWatcherWatchComponentResponse
8651    {
8652        #[inline(always)]
8653        fn new_empty() -> Self {
8654            Self {
8655                client: fidl::new_empty!(
8656                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<StopWaiterMarker>>,
8657                    fidl::encoding::DefaultFuchsiaResourceDialect
8658                ),
8659            }
8660        }
8661
8662        #[inline]
8663        unsafe fn decode(
8664            &mut self,
8665            decoder: &mut fidl::encoding::Decoder<
8666                '_,
8667                fidl::encoding::DefaultFuchsiaResourceDialect,
8668            >,
8669            offset: usize,
8670            _depth: fidl::encoding::Depth,
8671        ) -> fidl::Result<()> {
8672            decoder.debug_check_bounds::<Self>(offset);
8673            // Verify that padding bytes are zero.
8674            fidl::decode!(
8675                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<StopWaiterMarker>>,
8676                fidl::encoding::DefaultFuchsiaResourceDialect,
8677                &mut self.client,
8678                decoder,
8679                offset + 0,
8680                _depth
8681            )?;
8682            Ok(())
8683        }
8684    }
8685
8686    impl InspectPuppetCreateInspectorFromEscrowRequest {
8687        #[inline(always)]
8688        fn max_ordinal_present(&self) -> u64 {
8689            if let Some(_) = self.token {
8690                return 1;
8691            }
8692            0
8693        }
8694    }
8695
8696    impl fidl::encoding::ResourceTypeMarker for InspectPuppetCreateInspectorFromEscrowRequest {
8697        type Borrowed<'a> = &'a mut Self;
8698        fn take_or_borrow<'a>(
8699            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8700        ) -> Self::Borrowed<'a> {
8701            value
8702        }
8703    }
8704
8705    unsafe impl fidl::encoding::TypeMarker for InspectPuppetCreateInspectorFromEscrowRequest {
8706        type Owned = Self;
8707
8708        #[inline(always)]
8709        fn inline_align(_context: fidl::encoding::Context) -> usize {
8710            8
8711        }
8712
8713        #[inline(always)]
8714        fn inline_size(_context: fidl::encoding::Context) -> usize {
8715            16
8716        }
8717    }
8718
8719    unsafe impl
8720        fidl::encoding::Encode<
8721            InspectPuppetCreateInspectorFromEscrowRequest,
8722            fidl::encoding::DefaultFuchsiaResourceDialect,
8723        > for &mut InspectPuppetCreateInspectorFromEscrowRequest
8724    {
8725        unsafe fn encode(
8726            self,
8727            encoder: &mut fidl::encoding::Encoder<
8728                '_,
8729                fidl::encoding::DefaultFuchsiaResourceDialect,
8730            >,
8731            offset: usize,
8732            mut depth: fidl::encoding::Depth,
8733        ) -> fidl::Result<()> {
8734            encoder.debug_check_bounds::<InspectPuppetCreateInspectorFromEscrowRequest>(offset);
8735            // Vector header
8736            let max_ordinal: u64 = self.max_ordinal_present();
8737            encoder.write_num(max_ordinal, offset);
8738            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
8739            // Calling encoder.out_of_line_offset(0) is not allowed.
8740            if max_ordinal == 0 {
8741                return Ok(());
8742            }
8743            depth.increment()?;
8744            let envelope_size = 8;
8745            let bytes_len = max_ordinal as usize * envelope_size;
8746            #[allow(unused_variables)]
8747            let offset = encoder.out_of_line_offset(bytes_len);
8748            let mut _prev_end_offset: usize = 0;
8749            if 1 > max_ordinal {
8750                return Ok(());
8751            }
8752
8753            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8754            // are envelope_size bytes.
8755            let cur_offset: usize = (1 - 1) * envelope_size;
8756
8757            // Zero reserved fields.
8758            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8759
8760            // Safety:
8761            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8762            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8763            //   envelope_size bytes, there is always sufficient room.
8764            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_inspect::EscrowToken, fidl::encoding::DefaultFuchsiaResourceDialect>(
8765            self.token.as_mut().map(<fidl_fuchsia_inspect::EscrowToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
8766            encoder, offset + cur_offset, depth
8767        )?;
8768
8769            _prev_end_offset = cur_offset + envelope_size;
8770
8771            Ok(())
8772        }
8773    }
8774
8775    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8776        for InspectPuppetCreateInspectorFromEscrowRequest
8777    {
8778        #[inline(always)]
8779        fn new_empty() -> Self {
8780            Self::default()
8781        }
8782
8783        unsafe fn decode(
8784            &mut self,
8785            decoder: &mut fidl::encoding::Decoder<
8786                '_,
8787                fidl::encoding::DefaultFuchsiaResourceDialect,
8788            >,
8789            offset: usize,
8790            mut depth: fidl::encoding::Depth,
8791        ) -> fidl::Result<()> {
8792            decoder.debug_check_bounds::<Self>(offset);
8793            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
8794                None => return Err(fidl::Error::NotNullable),
8795                Some(len) => len,
8796            };
8797            // Calling decoder.out_of_line_offset(0) is not allowed.
8798            if len == 0 {
8799                return Ok(());
8800            };
8801            depth.increment()?;
8802            let envelope_size = 8;
8803            let bytes_len = len * envelope_size;
8804            let offset = decoder.out_of_line_offset(bytes_len)?;
8805            // Decode the envelope for each type.
8806            let mut _next_ordinal_to_read = 0;
8807            let mut next_offset = offset;
8808            let end_offset = offset + bytes_len;
8809            _next_ordinal_to_read += 1;
8810            if next_offset >= end_offset {
8811                return Ok(());
8812            }
8813
8814            // Decode unknown envelopes for gaps in ordinals.
8815            while _next_ordinal_to_read < 1 {
8816                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8817                _next_ordinal_to_read += 1;
8818                next_offset += envelope_size;
8819            }
8820
8821            let next_out_of_line = decoder.next_out_of_line();
8822            let handles_before = decoder.remaining_handles();
8823            if let Some((inlined, num_bytes, num_handles)) =
8824                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8825            {
8826                let member_inline_size =
8827                    <fidl_fuchsia_inspect::EscrowToken as fidl::encoding::TypeMarker>::inline_size(
8828                        decoder.context,
8829                    );
8830                if inlined != (member_inline_size <= 4) {
8831                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8832                }
8833                let inner_offset;
8834                let mut inner_depth = depth.clone();
8835                if inlined {
8836                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8837                    inner_offset = next_offset;
8838                } else {
8839                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8840                    inner_depth.increment()?;
8841                }
8842                let val_ref = self.token.get_or_insert_with(|| {
8843                    fidl::new_empty!(
8844                        fidl_fuchsia_inspect::EscrowToken,
8845                        fidl::encoding::DefaultFuchsiaResourceDialect
8846                    )
8847                });
8848                fidl::decode!(
8849                    fidl_fuchsia_inspect::EscrowToken,
8850                    fidl::encoding::DefaultFuchsiaResourceDialect,
8851                    val_ref,
8852                    decoder,
8853                    inner_offset,
8854                    inner_depth
8855                )?;
8856                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8857                {
8858                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8859                }
8860                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8861                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8862                }
8863            }
8864
8865            next_offset += envelope_size;
8866
8867            // Decode the remaining unknown envelopes.
8868            while next_offset < end_offset {
8869                _next_ordinal_to_read += 1;
8870                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8871                next_offset += envelope_size;
8872            }
8873
8874            Ok(())
8875        }
8876    }
8877
8878    impl InspectWriterEscrowAndExitResponse {
8879        #[inline(always)]
8880        fn max_ordinal_present(&self) -> u64 {
8881            if let Some(_) = self.token {
8882                return 1;
8883            }
8884            0
8885        }
8886    }
8887
8888    impl fidl::encoding::ResourceTypeMarker for InspectWriterEscrowAndExitResponse {
8889        type Borrowed<'a> = &'a mut Self;
8890        fn take_or_borrow<'a>(
8891            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8892        ) -> Self::Borrowed<'a> {
8893            value
8894        }
8895    }
8896
8897    unsafe impl fidl::encoding::TypeMarker for InspectWriterEscrowAndExitResponse {
8898        type Owned = Self;
8899
8900        #[inline(always)]
8901        fn inline_align(_context: fidl::encoding::Context) -> usize {
8902            8
8903        }
8904
8905        #[inline(always)]
8906        fn inline_size(_context: fidl::encoding::Context) -> usize {
8907            16
8908        }
8909    }
8910
8911    unsafe impl
8912        fidl::encoding::Encode<
8913            InspectWriterEscrowAndExitResponse,
8914            fidl::encoding::DefaultFuchsiaResourceDialect,
8915        > for &mut InspectWriterEscrowAndExitResponse
8916    {
8917        unsafe fn encode(
8918            self,
8919            encoder: &mut fidl::encoding::Encoder<
8920                '_,
8921                fidl::encoding::DefaultFuchsiaResourceDialect,
8922            >,
8923            offset: usize,
8924            mut depth: fidl::encoding::Depth,
8925        ) -> fidl::Result<()> {
8926            encoder.debug_check_bounds::<InspectWriterEscrowAndExitResponse>(offset);
8927            // Vector header
8928            let max_ordinal: u64 = self.max_ordinal_present();
8929            encoder.write_num(max_ordinal, offset);
8930            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
8931            // Calling encoder.out_of_line_offset(0) is not allowed.
8932            if max_ordinal == 0 {
8933                return Ok(());
8934            }
8935            depth.increment()?;
8936            let envelope_size = 8;
8937            let bytes_len = max_ordinal as usize * envelope_size;
8938            #[allow(unused_variables)]
8939            let offset = encoder.out_of_line_offset(bytes_len);
8940            let mut _prev_end_offset: usize = 0;
8941            if 1 > max_ordinal {
8942                return Ok(());
8943            }
8944
8945            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8946            // are envelope_size bytes.
8947            let cur_offset: usize = (1 - 1) * envelope_size;
8948
8949            // Zero reserved fields.
8950            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8951
8952            // Safety:
8953            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8954            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8955            //   envelope_size bytes, there is always sufficient room.
8956            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_inspect::EscrowToken, fidl::encoding::DefaultFuchsiaResourceDialect>(
8957            self.token.as_mut().map(<fidl_fuchsia_inspect::EscrowToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
8958            encoder, offset + cur_offset, depth
8959        )?;
8960
8961            _prev_end_offset = cur_offset + envelope_size;
8962
8963            Ok(())
8964        }
8965    }
8966
8967    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8968        for InspectWriterEscrowAndExitResponse
8969    {
8970        #[inline(always)]
8971        fn new_empty() -> Self {
8972            Self::default()
8973        }
8974
8975        unsafe fn decode(
8976            &mut self,
8977            decoder: &mut fidl::encoding::Decoder<
8978                '_,
8979                fidl::encoding::DefaultFuchsiaResourceDialect,
8980            >,
8981            offset: usize,
8982            mut depth: fidl::encoding::Depth,
8983        ) -> fidl::Result<()> {
8984            decoder.debug_check_bounds::<Self>(offset);
8985            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
8986                None => return Err(fidl::Error::NotNullable),
8987                Some(len) => len,
8988            };
8989            // Calling decoder.out_of_line_offset(0) is not allowed.
8990            if len == 0 {
8991                return Ok(());
8992            };
8993            depth.increment()?;
8994            let envelope_size = 8;
8995            let bytes_len = len * envelope_size;
8996            let offset = decoder.out_of_line_offset(bytes_len)?;
8997            // Decode the envelope for each type.
8998            let mut _next_ordinal_to_read = 0;
8999            let mut next_offset = offset;
9000            let end_offset = offset + bytes_len;
9001            _next_ordinal_to_read += 1;
9002            if next_offset >= end_offset {
9003                return Ok(());
9004            }
9005
9006            // Decode unknown envelopes for gaps in ordinals.
9007            while _next_ordinal_to_read < 1 {
9008                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9009                _next_ordinal_to_read += 1;
9010                next_offset += envelope_size;
9011            }
9012
9013            let next_out_of_line = decoder.next_out_of_line();
9014            let handles_before = decoder.remaining_handles();
9015            if let Some((inlined, num_bytes, num_handles)) =
9016                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9017            {
9018                let member_inline_size =
9019                    <fidl_fuchsia_inspect::EscrowToken as fidl::encoding::TypeMarker>::inline_size(
9020                        decoder.context,
9021                    );
9022                if inlined != (member_inline_size <= 4) {
9023                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9024                }
9025                let inner_offset;
9026                let mut inner_depth = depth.clone();
9027                if inlined {
9028                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9029                    inner_offset = next_offset;
9030                } else {
9031                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9032                    inner_depth.increment()?;
9033                }
9034                let val_ref = self.token.get_or_insert_with(|| {
9035                    fidl::new_empty!(
9036                        fidl_fuchsia_inspect::EscrowToken,
9037                        fidl::encoding::DefaultFuchsiaResourceDialect
9038                    )
9039                });
9040                fidl::decode!(
9041                    fidl_fuchsia_inspect::EscrowToken,
9042                    fidl::encoding::DefaultFuchsiaResourceDialect,
9043                    val_ref,
9044                    decoder,
9045                    inner_offset,
9046                    inner_depth
9047                )?;
9048                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9049                {
9050                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9051                }
9052                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9053                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9054                }
9055            }
9056
9057            next_offset += envelope_size;
9058
9059            // Decode the remaining unknown envelopes.
9060            while next_offset < end_offset {
9061                _next_ordinal_to_read += 1;
9062                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9063                next_offset += envelope_size;
9064            }
9065
9066            Ok(())
9067        }
9068    }
9069}