Skip to main content

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