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