fidl_fuchsia_debugger/
fidl_fuchsia_debugger.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_debugger_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct Agent {
16    pub name: String,
17    pub client_end: fidl::endpoints::ClientEnd<DebugAgentMarker>,
18}
19
20impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for Agent {}
21
22#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
23pub struct AgentIteratorGetNextResponse {
24    pub agents: Vec<Agent>,
25}
26
27impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
28    for AgentIteratorGetNextResponse
29{
30}
31
32#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
33pub struct DebugAgentConnectRequest {
34    pub socket: fidl::Socket,
35}
36
37impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for DebugAgentConnectRequest {}
38
39#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
40pub struct DebugAgentGetAttachedProcessesRequest {
41    pub iterator: fidl::endpoints::ServerEnd<AttachedProcessIteratorMarker>,
42}
43
44impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
45    for DebugAgentGetAttachedProcessesRequest
46{
47}
48
49#[derive(Debug, PartialEq)]
50pub struct DebugAgentGetMinidumpsRequest {
51    pub options: MinidumpOptions,
52    pub iterator: fidl::endpoints::ServerEnd<MinidumpIteratorMarker>,
53}
54
55impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
56    for DebugAgentGetMinidumpsRequest
57{
58}
59
60#[derive(Debug, PartialEq)]
61pub struct DebugAgentGetProcessInfoRequest {
62    pub options: GetProcessInfoOptions,
63    pub iterator: fidl::endpoints::ServerEnd<ProcessInfoIteratorMarker>,
64}
65
66impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
67    for DebugAgentGetProcessInfoRequest
68{
69}
70
71#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
72pub struct LauncherGetAgentsRequest {
73    pub iterator: fidl::endpoints::ServerEnd<AgentIteratorMarker>,
74}
75
76impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for LauncherGetAgentsRequest {}
77
78#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
79pub struct LauncherLaunchRequest {
80    pub agent: fidl::endpoints::ServerEnd<DebugAgentMarker>,
81}
82
83impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for LauncherLaunchRequest {}
84
85#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
86pub struct MinidumpIteratorGetNextResponse {
87    pub minidump: fidl::Vmo,
88}
89
90impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
91    for MinidumpIteratorGetNextResponse
92{
93}
94
95#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
96pub struct AgentIteratorMarker;
97
98impl fidl::endpoints::ProtocolMarker for AgentIteratorMarker {
99    type Proxy = AgentIteratorProxy;
100    type RequestStream = AgentIteratorRequestStream;
101    #[cfg(target_os = "fuchsia")]
102    type SynchronousProxy = AgentIteratorSynchronousProxy;
103
104    const DEBUG_NAME: &'static str = "(anonymous) AgentIterator";
105}
106
107pub trait AgentIteratorProxyInterface: Send + Sync {
108    type GetNextResponseFut: std::future::Future<Output = Result<Vec<Agent>, fidl::Error>> + Send;
109    fn r#get_next(&self) -> Self::GetNextResponseFut;
110}
111#[derive(Debug)]
112#[cfg(target_os = "fuchsia")]
113pub struct AgentIteratorSynchronousProxy {
114    client: fidl::client::sync::Client,
115}
116
117#[cfg(target_os = "fuchsia")]
118impl fidl::endpoints::SynchronousProxy for AgentIteratorSynchronousProxy {
119    type Proxy = AgentIteratorProxy;
120    type Protocol = AgentIteratorMarker;
121
122    fn from_channel(inner: fidl::Channel) -> Self {
123        Self::new(inner)
124    }
125
126    fn into_channel(self) -> fidl::Channel {
127        self.client.into_channel()
128    }
129
130    fn as_channel(&self) -> &fidl::Channel {
131        self.client.as_channel()
132    }
133}
134
135#[cfg(target_os = "fuchsia")]
136impl AgentIteratorSynchronousProxy {
137    pub fn new(channel: fidl::Channel) -> Self {
138        let protocol_name = <AgentIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
139        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
140    }
141
142    pub fn into_channel(self) -> fidl::Channel {
143        self.client.into_channel()
144    }
145
146    /// Waits until an event arrives and returns it. It is safe for other
147    /// threads to make concurrent requests while waiting for an event.
148    pub fn wait_for_event(
149        &self,
150        deadline: zx::MonotonicInstant,
151    ) -> Result<AgentIteratorEvent, fidl::Error> {
152        AgentIteratorEvent::decode(self.client.wait_for_event(deadline)?)
153    }
154
155    pub fn r#get_next(&self, ___deadline: zx::MonotonicInstant) -> Result<Vec<Agent>, fidl::Error> {
156        let _response =
157            self.client.send_query::<fidl::encoding::EmptyPayload, AgentIteratorGetNextResponse>(
158                (),
159                0x40f8adb0c975fa41,
160                fidl::encoding::DynamicFlags::empty(),
161                ___deadline,
162            )?;
163        Ok(_response.agents)
164    }
165}
166
167#[cfg(target_os = "fuchsia")]
168impl From<AgentIteratorSynchronousProxy> for zx::Handle {
169    fn from(value: AgentIteratorSynchronousProxy) -> Self {
170        value.into_channel().into()
171    }
172}
173
174#[cfg(target_os = "fuchsia")]
175impl From<fidl::Channel> for AgentIteratorSynchronousProxy {
176    fn from(value: fidl::Channel) -> Self {
177        Self::new(value)
178    }
179}
180
181#[derive(Debug, Clone)]
182pub struct AgentIteratorProxy {
183    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
184}
185
186impl fidl::endpoints::Proxy for AgentIteratorProxy {
187    type Protocol = AgentIteratorMarker;
188
189    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
190        Self::new(inner)
191    }
192
193    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
194        self.client.into_channel().map_err(|client| Self { client })
195    }
196
197    fn as_channel(&self) -> &::fidl::AsyncChannel {
198        self.client.as_channel()
199    }
200}
201
202impl AgentIteratorProxy {
203    /// Create a new Proxy for fuchsia.debugger/AgentIterator.
204    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
205        let protocol_name = <AgentIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
206        Self { client: fidl::client::Client::new(channel, protocol_name) }
207    }
208
209    /// Get a Stream of events from the remote end of the protocol.
210    ///
211    /// # Panics
212    ///
213    /// Panics if the event stream was already taken.
214    pub fn take_event_stream(&self) -> AgentIteratorEventStream {
215        AgentIteratorEventStream { event_receiver: self.client.take_event_receiver() }
216    }
217
218    pub fn r#get_next(
219        &self,
220    ) -> fidl::client::QueryResponseFut<Vec<Agent>, fidl::encoding::DefaultFuchsiaResourceDialect>
221    {
222        AgentIteratorProxyInterface::r#get_next(self)
223    }
224}
225
226impl AgentIteratorProxyInterface for AgentIteratorProxy {
227    type GetNextResponseFut =
228        fidl::client::QueryResponseFut<Vec<Agent>, fidl::encoding::DefaultFuchsiaResourceDialect>;
229    fn r#get_next(&self) -> Self::GetNextResponseFut {
230        fn _decode(
231            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
232        ) -> Result<Vec<Agent>, fidl::Error> {
233            let _response = fidl::client::decode_transaction_body::<
234                AgentIteratorGetNextResponse,
235                fidl::encoding::DefaultFuchsiaResourceDialect,
236                0x40f8adb0c975fa41,
237            >(_buf?)?;
238            Ok(_response.agents)
239        }
240        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<Agent>>(
241            (),
242            0x40f8adb0c975fa41,
243            fidl::encoding::DynamicFlags::empty(),
244            _decode,
245        )
246    }
247}
248
249pub struct AgentIteratorEventStream {
250    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
251}
252
253impl std::marker::Unpin for AgentIteratorEventStream {}
254
255impl futures::stream::FusedStream for AgentIteratorEventStream {
256    fn is_terminated(&self) -> bool {
257        self.event_receiver.is_terminated()
258    }
259}
260
261impl futures::Stream for AgentIteratorEventStream {
262    type Item = Result<AgentIteratorEvent, fidl::Error>;
263
264    fn poll_next(
265        mut self: std::pin::Pin<&mut Self>,
266        cx: &mut std::task::Context<'_>,
267    ) -> std::task::Poll<Option<Self::Item>> {
268        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
269            &mut self.event_receiver,
270            cx
271        )?) {
272            Some(buf) => std::task::Poll::Ready(Some(AgentIteratorEvent::decode(buf))),
273            None => std::task::Poll::Ready(None),
274        }
275    }
276}
277
278#[derive(Debug)]
279pub enum AgentIteratorEvent {}
280
281impl AgentIteratorEvent {
282    /// Decodes a message buffer as a [`AgentIteratorEvent`].
283    fn decode(
284        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
285    ) -> Result<AgentIteratorEvent, fidl::Error> {
286        let (bytes, _handles) = buf.split_mut();
287        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
288        debug_assert_eq!(tx_header.tx_id, 0);
289        match tx_header.ordinal {
290            _ => Err(fidl::Error::UnknownOrdinal {
291                ordinal: tx_header.ordinal,
292                protocol_name: <AgentIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
293            }),
294        }
295    }
296}
297
298/// A Stream of incoming requests for fuchsia.debugger/AgentIterator.
299pub struct AgentIteratorRequestStream {
300    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
301    is_terminated: bool,
302}
303
304impl std::marker::Unpin for AgentIteratorRequestStream {}
305
306impl futures::stream::FusedStream for AgentIteratorRequestStream {
307    fn is_terminated(&self) -> bool {
308        self.is_terminated
309    }
310}
311
312impl fidl::endpoints::RequestStream for AgentIteratorRequestStream {
313    type Protocol = AgentIteratorMarker;
314    type ControlHandle = AgentIteratorControlHandle;
315
316    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
317        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
318    }
319
320    fn control_handle(&self) -> Self::ControlHandle {
321        AgentIteratorControlHandle { inner: self.inner.clone() }
322    }
323
324    fn into_inner(
325        self,
326    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
327    {
328        (self.inner, self.is_terminated)
329    }
330
331    fn from_inner(
332        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
333        is_terminated: bool,
334    ) -> Self {
335        Self { inner, is_terminated }
336    }
337}
338
339impl futures::Stream for AgentIteratorRequestStream {
340    type Item = Result<AgentIteratorRequest, fidl::Error>;
341
342    fn poll_next(
343        mut self: std::pin::Pin<&mut Self>,
344        cx: &mut std::task::Context<'_>,
345    ) -> std::task::Poll<Option<Self::Item>> {
346        let this = &mut *self;
347        if this.inner.check_shutdown(cx) {
348            this.is_terminated = true;
349            return std::task::Poll::Ready(None);
350        }
351        if this.is_terminated {
352            panic!("polled AgentIteratorRequestStream after completion");
353        }
354        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
355            |bytes, handles| {
356                match this.inner.channel().read_etc(cx, bytes, handles) {
357                    std::task::Poll::Ready(Ok(())) => {}
358                    std::task::Poll::Pending => return std::task::Poll::Pending,
359                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
360                        this.is_terminated = true;
361                        return std::task::Poll::Ready(None);
362                    }
363                    std::task::Poll::Ready(Err(e)) => {
364                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
365                            e.into(),
366                        ))))
367                    }
368                }
369
370                // A message has been received from the channel
371                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
372
373                std::task::Poll::Ready(Some(match header.ordinal {
374                    0x40f8adb0c975fa41 => {
375                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
376                        let mut req = fidl::new_empty!(
377                            fidl::encoding::EmptyPayload,
378                            fidl::encoding::DefaultFuchsiaResourceDialect
379                        );
380                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
381                        let control_handle =
382                            AgentIteratorControlHandle { inner: this.inner.clone() };
383                        Ok(AgentIteratorRequest::GetNext {
384                            responder: AgentIteratorGetNextResponder {
385                                control_handle: std::mem::ManuallyDrop::new(control_handle),
386                                tx_id: header.tx_id,
387                            },
388                        })
389                    }
390                    _ => Err(fidl::Error::UnknownOrdinal {
391                        ordinal: header.ordinal,
392                        protocol_name:
393                            <AgentIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
394                    }),
395                }))
396            },
397        )
398    }
399}
400
401#[derive(Debug)]
402pub enum AgentIteratorRequest {
403    GetNext { responder: AgentIteratorGetNextResponder },
404}
405
406impl AgentIteratorRequest {
407    #[allow(irrefutable_let_patterns)]
408    pub fn into_get_next(self) -> Option<(AgentIteratorGetNextResponder)> {
409        if let AgentIteratorRequest::GetNext { responder } = self {
410            Some((responder))
411        } else {
412            None
413        }
414    }
415
416    /// Name of the method defined in FIDL
417    pub fn method_name(&self) -> &'static str {
418        match *self {
419            AgentIteratorRequest::GetNext { .. } => "get_next",
420        }
421    }
422}
423
424#[derive(Debug, Clone)]
425pub struct AgentIteratorControlHandle {
426    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
427}
428
429impl fidl::endpoints::ControlHandle for AgentIteratorControlHandle {
430    fn shutdown(&self) {
431        self.inner.shutdown()
432    }
433    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
434        self.inner.shutdown_with_epitaph(status)
435    }
436
437    fn is_closed(&self) -> bool {
438        self.inner.channel().is_closed()
439    }
440    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
441        self.inner.channel().on_closed()
442    }
443
444    #[cfg(target_os = "fuchsia")]
445    fn signal_peer(
446        &self,
447        clear_mask: zx::Signals,
448        set_mask: zx::Signals,
449    ) -> Result<(), zx_status::Status> {
450        use fidl::Peered;
451        self.inner.channel().signal_peer(clear_mask, set_mask)
452    }
453}
454
455impl AgentIteratorControlHandle {}
456
457#[must_use = "FIDL methods require a response to be sent"]
458#[derive(Debug)]
459pub struct AgentIteratorGetNextResponder {
460    control_handle: std::mem::ManuallyDrop<AgentIteratorControlHandle>,
461    tx_id: u32,
462}
463
464/// Set the the channel to be shutdown (see [`AgentIteratorControlHandle::shutdown`])
465/// if the responder is dropped without sending a response, so that the client
466/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
467impl std::ops::Drop for AgentIteratorGetNextResponder {
468    fn drop(&mut self) {
469        self.control_handle.shutdown();
470        // Safety: drops once, never accessed again
471        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
472    }
473}
474
475impl fidl::endpoints::Responder for AgentIteratorGetNextResponder {
476    type ControlHandle = AgentIteratorControlHandle;
477
478    fn control_handle(&self) -> &AgentIteratorControlHandle {
479        &self.control_handle
480    }
481
482    fn drop_without_shutdown(mut self) {
483        // Safety: drops once, never accessed again due to mem::forget
484        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
485        // Prevent Drop from running (which would shut down the channel)
486        std::mem::forget(self);
487    }
488}
489
490impl AgentIteratorGetNextResponder {
491    /// Sends a response to the FIDL transaction.
492    ///
493    /// Sets the channel to shutdown if an error occurs.
494    pub fn send(self, mut agents: Vec<Agent>) -> Result<(), fidl::Error> {
495        let _result = self.send_raw(agents);
496        if _result.is_err() {
497            self.control_handle.shutdown();
498        }
499        self.drop_without_shutdown();
500        _result
501    }
502
503    /// Similar to "send" but does not shutdown the channel if an error occurs.
504    pub fn send_no_shutdown_on_err(self, mut agents: Vec<Agent>) -> Result<(), fidl::Error> {
505        let _result = self.send_raw(agents);
506        self.drop_without_shutdown();
507        _result
508    }
509
510    fn send_raw(&self, mut agents: Vec<Agent>) -> Result<(), fidl::Error> {
511        self.control_handle.inner.send::<AgentIteratorGetNextResponse>(
512            (agents.as_mut(),),
513            self.tx_id,
514            0x40f8adb0c975fa41,
515            fidl::encoding::DynamicFlags::empty(),
516        )
517    }
518}
519
520#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
521pub struct AttachedProcessIteratorMarker;
522
523impl fidl::endpoints::ProtocolMarker for AttachedProcessIteratorMarker {
524    type Proxy = AttachedProcessIteratorProxy;
525    type RequestStream = AttachedProcessIteratorRequestStream;
526    #[cfg(target_os = "fuchsia")]
527    type SynchronousProxy = AttachedProcessIteratorSynchronousProxy;
528
529    const DEBUG_NAME: &'static str = "(anonymous) AttachedProcessIterator";
530}
531
532pub trait AttachedProcessIteratorProxyInterface: Send + Sync {
533    type GetNextResponseFut: std::future::Future<Output = Result<Vec<String>, fidl::Error>> + Send;
534    fn r#get_next(&self) -> Self::GetNextResponseFut;
535}
536#[derive(Debug)]
537#[cfg(target_os = "fuchsia")]
538pub struct AttachedProcessIteratorSynchronousProxy {
539    client: fidl::client::sync::Client,
540}
541
542#[cfg(target_os = "fuchsia")]
543impl fidl::endpoints::SynchronousProxy for AttachedProcessIteratorSynchronousProxy {
544    type Proxy = AttachedProcessIteratorProxy;
545    type Protocol = AttachedProcessIteratorMarker;
546
547    fn from_channel(inner: fidl::Channel) -> Self {
548        Self::new(inner)
549    }
550
551    fn into_channel(self) -> fidl::Channel {
552        self.client.into_channel()
553    }
554
555    fn as_channel(&self) -> &fidl::Channel {
556        self.client.as_channel()
557    }
558}
559
560#[cfg(target_os = "fuchsia")]
561impl AttachedProcessIteratorSynchronousProxy {
562    pub fn new(channel: fidl::Channel) -> Self {
563        let protocol_name =
564            <AttachedProcessIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
565        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
566    }
567
568    pub fn into_channel(self) -> fidl::Channel {
569        self.client.into_channel()
570    }
571
572    /// Waits until an event arrives and returns it. It is safe for other
573    /// threads to make concurrent requests while waiting for an event.
574    pub fn wait_for_event(
575        &self,
576        deadline: zx::MonotonicInstant,
577    ) -> Result<AttachedProcessIteratorEvent, fidl::Error> {
578        AttachedProcessIteratorEvent::decode(self.client.wait_for_event(deadline)?)
579    }
580
581    pub fn r#get_next(
582        &self,
583        ___deadline: zx::MonotonicInstant,
584    ) -> Result<Vec<String>, fidl::Error> {
585        let _response = self
586            .client
587            .send_query::<fidl::encoding::EmptyPayload, AttachedProcessIteratorGetNextResponse>(
588                (),
589                0x47ef49b75f6133ab,
590                fidl::encoding::DynamicFlags::empty(),
591                ___deadline,
592            )?;
593        Ok(_response.process_names)
594    }
595}
596
597#[cfg(target_os = "fuchsia")]
598impl From<AttachedProcessIteratorSynchronousProxy> for zx::Handle {
599    fn from(value: AttachedProcessIteratorSynchronousProxy) -> Self {
600        value.into_channel().into()
601    }
602}
603
604#[cfg(target_os = "fuchsia")]
605impl From<fidl::Channel> for AttachedProcessIteratorSynchronousProxy {
606    fn from(value: fidl::Channel) -> Self {
607        Self::new(value)
608    }
609}
610
611#[derive(Debug, Clone)]
612pub struct AttachedProcessIteratorProxy {
613    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
614}
615
616impl fidl::endpoints::Proxy for AttachedProcessIteratorProxy {
617    type Protocol = AttachedProcessIteratorMarker;
618
619    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
620        Self::new(inner)
621    }
622
623    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
624        self.client.into_channel().map_err(|client| Self { client })
625    }
626
627    fn as_channel(&self) -> &::fidl::AsyncChannel {
628        self.client.as_channel()
629    }
630}
631
632impl AttachedProcessIteratorProxy {
633    /// Create a new Proxy for fuchsia.debugger/AttachedProcessIterator.
634    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
635        let protocol_name =
636            <AttachedProcessIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
637        Self { client: fidl::client::Client::new(channel, protocol_name) }
638    }
639
640    /// Get a Stream of events from the remote end of the protocol.
641    ///
642    /// # Panics
643    ///
644    /// Panics if the event stream was already taken.
645    pub fn take_event_stream(&self) -> AttachedProcessIteratorEventStream {
646        AttachedProcessIteratorEventStream { event_receiver: self.client.take_event_receiver() }
647    }
648
649    pub fn r#get_next(
650        &self,
651    ) -> fidl::client::QueryResponseFut<Vec<String>, fidl::encoding::DefaultFuchsiaResourceDialect>
652    {
653        AttachedProcessIteratorProxyInterface::r#get_next(self)
654    }
655}
656
657impl AttachedProcessIteratorProxyInterface for AttachedProcessIteratorProxy {
658    type GetNextResponseFut =
659        fidl::client::QueryResponseFut<Vec<String>, fidl::encoding::DefaultFuchsiaResourceDialect>;
660    fn r#get_next(&self) -> Self::GetNextResponseFut {
661        fn _decode(
662            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
663        ) -> Result<Vec<String>, fidl::Error> {
664            let _response = fidl::client::decode_transaction_body::<
665                AttachedProcessIteratorGetNextResponse,
666                fidl::encoding::DefaultFuchsiaResourceDialect,
667                0x47ef49b75f6133ab,
668            >(_buf?)?;
669            Ok(_response.process_names)
670        }
671        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<String>>(
672            (),
673            0x47ef49b75f6133ab,
674            fidl::encoding::DynamicFlags::empty(),
675            _decode,
676        )
677    }
678}
679
680pub struct AttachedProcessIteratorEventStream {
681    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
682}
683
684impl std::marker::Unpin for AttachedProcessIteratorEventStream {}
685
686impl futures::stream::FusedStream for AttachedProcessIteratorEventStream {
687    fn is_terminated(&self) -> bool {
688        self.event_receiver.is_terminated()
689    }
690}
691
692impl futures::Stream for AttachedProcessIteratorEventStream {
693    type Item = Result<AttachedProcessIteratorEvent, fidl::Error>;
694
695    fn poll_next(
696        mut self: std::pin::Pin<&mut Self>,
697        cx: &mut std::task::Context<'_>,
698    ) -> std::task::Poll<Option<Self::Item>> {
699        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
700            &mut self.event_receiver,
701            cx
702        )?) {
703            Some(buf) => std::task::Poll::Ready(Some(AttachedProcessIteratorEvent::decode(buf))),
704            None => std::task::Poll::Ready(None),
705        }
706    }
707}
708
709#[derive(Debug)]
710pub enum AttachedProcessIteratorEvent {}
711
712impl AttachedProcessIteratorEvent {
713    /// Decodes a message buffer as a [`AttachedProcessIteratorEvent`].
714    fn decode(
715        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
716    ) -> Result<AttachedProcessIteratorEvent, fidl::Error> {
717        let (bytes, _handles) = buf.split_mut();
718        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
719        debug_assert_eq!(tx_header.tx_id, 0);
720        match tx_header.ordinal {
721            _ => Err(fidl::Error::UnknownOrdinal {
722                ordinal: tx_header.ordinal,
723                protocol_name:
724                    <AttachedProcessIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
725            }),
726        }
727    }
728}
729
730/// A Stream of incoming requests for fuchsia.debugger/AttachedProcessIterator.
731pub struct AttachedProcessIteratorRequestStream {
732    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
733    is_terminated: bool,
734}
735
736impl std::marker::Unpin for AttachedProcessIteratorRequestStream {}
737
738impl futures::stream::FusedStream for AttachedProcessIteratorRequestStream {
739    fn is_terminated(&self) -> bool {
740        self.is_terminated
741    }
742}
743
744impl fidl::endpoints::RequestStream for AttachedProcessIteratorRequestStream {
745    type Protocol = AttachedProcessIteratorMarker;
746    type ControlHandle = AttachedProcessIteratorControlHandle;
747
748    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
749        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
750    }
751
752    fn control_handle(&self) -> Self::ControlHandle {
753        AttachedProcessIteratorControlHandle { inner: self.inner.clone() }
754    }
755
756    fn into_inner(
757        self,
758    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
759    {
760        (self.inner, self.is_terminated)
761    }
762
763    fn from_inner(
764        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
765        is_terminated: bool,
766    ) -> Self {
767        Self { inner, is_terminated }
768    }
769}
770
771impl futures::Stream for AttachedProcessIteratorRequestStream {
772    type Item = Result<AttachedProcessIteratorRequest, fidl::Error>;
773
774    fn poll_next(
775        mut self: std::pin::Pin<&mut Self>,
776        cx: &mut std::task::Context<'_>,
777    ) -> std::task::Poll<Option<Self::Item>> {
778        let this = &mut *self;
779        if this.inner.check_shutdown(cx) {
780            this.is_terminated = true;
781            return std::task::Poll::Ready(None);
782        }
783        if this.is_terminated {
784            panic!("polled AttachedProcessIteratorRequestStream after completion");
785        }
786        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
787            |bytes, handles| {
788                match this.inner.channel().read_etc(cx, bytes, handles) {
789                    std::task::Poll::Ready(Ok(())) => {}
790                    std::task::Poll::Pending => return std::task::Poll::Pending,
791                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
792                        this.is_terminated = true;
793                        return std::task::Poll::Ready(None);
794                    }
795                    std::task::Poll::Ready(Err(e)) => {
796                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
797                            e.into(),
798                        ))))
799                    }
800                }
801
802                // A message has been received from the channel
803                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
804
805                std::task::Poll::Ready(Some(match header.ordinal {
806                0x47ef49b75f6133ab => {
807                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
808                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
809                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
810                    let control_handle = AttachedProcessIteratorControlHandle {
811                        inner: this.inner.clone(),
812                    };
813                    Ok(AttachedProcessIteratorRequest::GetNext {
814                        responder: AttachedProcessIteratorGetNextResponder {
815                            control_handle: std::mem::ManuallyDrop::new(control_handle),
816                            tx_id: header.tx_id,
817                        },
818                    })
819                }
820                _ => Err(fidl::Error::UnknownOrdinal {
821                    ordinal: header.ordinal,
822                    protocol_name: <AttachedProcessIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
823                }),
824            }))
825            },
826        )
827    }
828}
829
830#[derive(Debug)]
831pub enum AttachedProcessIteratorRequest {
832    GetNext { responder: AttachedProcessIteratorGetNextResponder },
833}
834
835impl AttachedProcessIteratorRequest {
836    #[allow(irrefutable_let_patterns)]
837    pub fn into_get_next(self) -> Option<(AttachedProcessIteratorGetNextResponder)> {
838        if let AttachedProcessIteratorRequest::GetNext { responder } = self {
839            Some((responder))
840        } else {
841            None
842        }
843    }
844
845    /// Name of the method defined in FIDL
846    pub fn method_name(&self) -> &'static str {
847        match *self {
848            AttachedProcessIteratorRequest::GetNext { .. } => "get_next",
849        }
850    }
851}
852
853#[derive(Debug, Clone)]
854pub struct AttachedProcessIteratorControlHandle {
855    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
856}
857
858impl fidl::endpoints::ControlHandle for AttachedProcessIteratorControlHandle {
859    fn shutdown(&self) {
860        self.inner.shutdown()
861    }
862    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
863        self.inner.shutdown_with_epitaph(status)
864    }
865
866    fn is_closed(&self) -> bool {
867        self.inner.channel().is_closed()
868    }
869    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
870        self.inner.channel().on_closed()
871    }
872
873    #[cfg(target_os = "fuchsia")]
874    fn signal_peer(
875        &self,
876        clear_mask: zx::Signals,
877        set_mask: zx::Signals,
878    ) -> Result<(), zx_status::Status> {
879        use fidl::Peered;
880        self.inner.channel().signal_peer(clear_mask, set_mask)
881    }
882}
883
884impl AttachedProcessIteratorControlHandle {}
885
886#[must_use = "FIDL methods require a response to be sent"]
887#[derive(Debug)]
888pub struct AttachedProcessIteratorGetNextResponder {
889    control_handle: std::mem::ManuallyDrop<AttachedProcessIteratorControlHandle>,
890    tx_id: u32,
891}
892
893/// Set the the channel to be shutdown (see [`AttachedProcessIteratorControlHandle::shutdown`])
894/// if the responder is dropped without sending a response, so that the client
895/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
896impl std::ops::Drop for AttachedProcessIteratorGetNextResponder {
897    fn drop(&mut self) {
898        self.control_handle.shutdown();
899        // Safety: drops once, never accessed again
900        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
901    }
902}
903
904impl fidl::endpoints::Responder for AttachedProcessIteratorGetNextResponder {
905    type ControlHandle = AttachedProcessIteratorControlHandle;
906
907    fn control_handle(&self) -> &AttachedProcessIteratorControlHandle {
908        &self.control_handle
909    }
910
911    fn drop_without_shutdown(mut self) {
912        // Safety: drops once, never accessed again due to mem::forget
913        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
914        // Prevent Drop from running (which would shut down the channel)
915        std::mem::forget(self);
916    }
917}
918
919impl AttachedProcessIteratorGetNextResponder {
920    /// Sends a response to the FIDL transaction.
921    ///
922    /// Sets the channel to shutdown if an error occurs.
923    pub fn send(self, mut process_names: &[String]) -> Result<(), fidl::Error> {
924        let _result = self.send_raw(process_names);
925        if _result.is_err() {
926            self.control_handle.shutdown();
927        }
928        self.drop_without_shutdown();
929        _result
930    }
931
932    /// Similar to "send" but does not shutdown the channel if an error occurs.
933    pub fn send_no_shutdown_on_err(self, mut process_names: &[String]) -> Result<(), fidl::Error> {
934        let _result = self.send_raw(process_names);
935        self.drop_without_shutdown();
936        _result
937    }
938
939    fn send_raw(&self, mut process_names: &[String]) -> Result<(), fidl::Error> {
940        self.control_handle.inner.send::<AttachedProcessIteratorGetNextResponse>(
941            (process_names,),
942            self.tx_id,
943            0x47ef49b75f6133ab,
944            fidl::encoding::DynamicFlags::empty(),
945        )
946    }
947}
948
949#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
950pub struct DebugAgentMarker;
951
952impl fidl::endpoints::ProtocolMarker for DebugAgentMarker {
953    type Proxy = DebugAgentProxy;
954    type RequestStream = DebugAgentRequestStream;
955    #[cfg(target_os = "fuchsia")]
956    type SynchronousProxy = DebugAgentSynchronousProxy;
957
958    const DEBUG_NAME: &'static str = "fuchsia.debugger.DebugAgent";
959}
960impl fidl::endpoints::DiscoverableProtocolMarker for DebugAgentMarker {}
961pub type DebugAgentConnectResult = Result<(), i32>;
962pub type DebugAgentAttachToResult = Result<u32, FilterError>;
963pub type DebugAgentGetProcessInfoResult = Result<(), FilterError>;
964pub type DebugAgentGetMinidumpsResult = Result<(), FilterError>;
965
966pub trait DebugAgentProxyInterface: Send + Sync {
967    type ConnectResponseFut: std::future::Future<Output = Result<DebugAgentConnectResult, fidl::Error>>
968        + Send;
969    fn r#connect(&self, socket: fidl::Socket) -> Self::ConnectResponseFut;
970    fn r#get_attached_processes(
971        &self,
972        iterator: fidl::endpoints::ServerEnd<AttachedProcessIteratorMarker>,
973    ) -> Result<(), fidl::Error>;
974    type AttachToResponseFut: std::future::Future<Output = Result<DebugAgentAttachToResult, fidl::Error>>
975        + Send;
976    fn r#attach_to(
977        &self,
978        pattern: &str,
979        type_: FilterType,
980        options: &FilterOptions,
981    ) -> Self::AttachToResponseFut;
982    type GetProcessInfoResponseFut: std::future::Future<Output = Result<DebugAgentGetProcessInfoResult, fidl::Error>>
983        + Send;
984    fn r#get_process_info(
985        &self,
986        options: &GetProcessInfoOptions,
987        iterator: fidl::endpoints::ServerEnd<ProcessInfoIteratorMarker>,
988    ) -> Self::GetProcessInfoResponseFut;
989    type GetMinidumpsResponseFut: std::future::Future<Output = Result<DebugAgentGetMinidumpsResult, fidl::Error>>
990        + Send;
991    fn r#get_minidumps(
992        &self,
993        options: &MinidumpOptions,
994        iterator: fidl::endpoints::ServerEnd<MinidumpIteratorMarker>,
995    ) -> Self::GetMinidumpsResponseFut;
996}
997#[derive(Debug)]
998#[cfg(target_os = "fuchsia")]
999pub struct DebugAgentSynchronousProxy {
1000    client: fidl::client::sync::Client,
1001}
1002
1003#[cfg(target_os = "fuchsia")]
1004impl fidl::endpoints::SynchronousProxy for DebugAgentSynchronousProxy {
1005    type Proxy = DebugAgentProxy;
1006    type Protocol = DebugAgentMarker;
1007
1008    fn from_channel(inner: fidl::Channel) -> Self {
1009        Self::new(inner)
1010    }
1011
1012    fn into_channel(self) -> fidl::Channel {
1013        self.client.into_channel()
1014    }
1015
1016    fn as_channel(&self) -> &fidl::Channel {
1017        self.client.as_channel()
1018    }
1019}
1020
1021#[cfg(target_os = "fuchsia")]
1022impl DebugAgentSynchronousProxy {
1023    pub fn new(channel: fidl::Channel) -> Self {
1024        let protocol_name = <DebugAgentMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1025        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1026    }
1027
1028    pub fn into_channel(self) -> fidl::Channel {
1029        self.client.into_channel()
1030    }
1031
1032    /// Waits until an event arrives and returns it. It is safe for other
1033    /// threads to make concurrent requests while waiting for an event.
1034    pub fn wait_for_event(
1035        &self,
1036        deadline: zx::MonotonicInstant,
1037    ) -> Result<DebugAgentEvent, fidl::Error> {
1038        DebugAgentEvent::decode(self.client.wait_for_event(deadline)?)
1039    }
1040
1041    /// Hand the DebugAgent a socket that connects it to the debugger. This
1042    /// will return ZX_ERR_ALREADY_BOUND if a connection already exists. When
1043    /// the socket is closed, the DebugAgent will exit.
1044    pub fn r#connect(
1045        &self,
1046        mut socket: fidl::Socket,
1047        ___deadline: zx::MonotonicInstant,
1048    ) -> Result<DebugAgentConnectResult, fidl::Error> {
1049        let _response = self.client.send_query::<
1050            DebugAgentConnectRequest,
1051            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
1052        >(
1053            (socket,),
1054            0x6f81c1e426ddf3f9,
1055            fidl::encoding::DynamicFlags::FLEXIBLE,
1056            ___deadline,
1057        )?
1058        .into_result::<DebugAgentMarker>("connect")?;
1059        Ok(_response.map(|x| x))
1060    }
1061
1062    /// Iterator over all processes that this agent is attached to. Note this is
1063    /// not the same as the set of installed filters, but rather the set of
1064    /// filters that matched and were later successfully attached.
1065    pub fn r#get_attached_processes(
1066        &self,
1067        mut iterator: fidl::endpoints::ServerEnd<AttachedProcessIteratorMarker>,
1068    ) -> Result<(), fidl::Error> {
1069        self.client.send::<DebugAgentGetAttachedProcessesRequest>(
1070            (iterator,),
1071            0x4a07b086a7deda56,
1072            fidl::encoding::DynamicFlags::FLEXIBLE,
1073        )
1074    }
1075
1076    /// Use the given filter to attach to any existing or subsequently created
1077    /// components. This method will return the number of matches that were
1078    /// present at the time of calling this method. All attached processes will
1079    /// be detached when this agent is destroyed.
1080    ///
1081    /// |filter| will be inspected for validity, with corresponding errors
1082    /// returned. If the filter is invalid, no attaches will occur and the
1083    /// filter will not be installed.
1084    ///
1085    /// |num_matches| will contain the number of matches that were found
1086    /// immediately upon filter installation if there was no error, that is, the
1087    /// number of processes immediately within (or recursively in this realm, if
1088    /// the option is specified) this component's corresponding job. Note that
1089    /// filters may be installed _before_ any components are actually resolved
1090    /// and matched, so this number may be 0. This return value may be safely
1091    /// ignored.
1092    ///
1093    /// Invalid filters will return an error, see Filter above for details on
1094    /// how to construct a filter.
1095    pub fn r#attach_to(
1096        &self,
1097        mut pattern: &str,
1098        mut type_: FilterType,
1099        mut options: &FilterOptions,
1100        ___deadline: zx::MonotonicInstant,
1101    ) -> Result<DebugAgentAttachToResult, fidl::Error> {
1102        let _response = self.client.send_query::<
1103            Filter,
1104            fidl::encoding::FlexibleResultType<DebugAgentAttachToResponse, FilterError>,
1105        >(
1106            (pattern, type_, options,),
1107            0x2800c757fe52795f,
1108            fidl::encoding::DynamicFlags::FLEXIBLE,
1109            ___deadline,
1110        )?
1111        .into_result::<DebugAgentMarker>("attach_to")?;
1112        Ok(_response.map(|x| x.num_matches))
1113    }
1114
1115    /// The given server_end of the iterator will iterate over all threads, of
1116    /// all attached processes. The options parameter may be passed to filter
1117    /// the already attached processes and to express interest in what should be
1118    /// yielded by the iterator. Including a filter is recommended if DebugAgent
1119    /// is attached to a large number of processes. Note that this filter will
1120    /// not cause any new processes to be attached and will not be saved after
1121    /// this method returns. It is purely to reduce the bounds of the iterator.
1122    /// The threads will be suspended for the duration of information capture,
1123    /// which could be interrupted by other system processes, see
1124    /// |ProcessInfoIterator| for an example.
1125    pub fn r#get_process_info(
1126        &self,
1127        mut options: &GetProcessInfoOptions,
1128        mut iterator: fidl::endpoints::ServerEnd<ProcessInfoIteratorMarker>,
1129        ___deadline: zx::MonotonicInstant,
1130    ) -> Result<DebugAgentGetProcessInfoResult, fidl::Error> {
1131        let _response = self.client.send_query::<
1132            DebugAgentGetProcessInfoRequest,
1133            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, FilterError>,
1134        >(
1135            (options, iterator,),
1136            0x4daf0a7366bb6d77,
1137            fidl::encoding::DynamicFlags::FLEXIBLE,
1138            ___deadline,
1139        )?
1140        .into_result::<DebugAgentMarker>("get_process_info")?;
1141        Ok(_response.map(|x| x))
1142    }
1143
1144    /// Collect minidumps for all attached processes. |options| may contain a
1145    /// filter to reduce the number of minidumps that are yielded by the
1146    /// iterator.
1147    pub fn r#get_minidumps(
1148        &self,
1149        mut options: &MinidumpOptions,
1150        mut iterator: fidl::endpoints::ServerEnd<MinidumpIteratorMarker>,
1151        ___deadline: zx::MonotonicInstant,
1152    ) -> Result<DebugAgentGetMinidumpsResult, fidl::Error> {
1153        let _response = self.client.send_query::<
1154            DebugAgentGetMinidumpsRequest,
1155            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, FilterError>,
1156        >(
1157            (options, iterator,),
1158            0x4a4693aeecdb7deb,
1159            fidl::encoding::DynamicFlags::FLEXIBLE,
1160            ___deadline,
1161        )?
1162        .into_result::<DebugAgentMarker>("get_minidumps")?;
1163        Ok(_response.map(|x| x))
1164    }
1165}
1166
1167#[cfg(target_os = "fuchsia")]
1168impl From<DebugAgentSynchronousProxy> for zx::Handle {
1169    fn from(value: DebugAgentSynchronousProxy) -> Self {
1170        value.into_channel().into()
1171    }
1172}
1173
1174#[cfg(target_os = "fuchsia")]
1175impl From<fidl::Channel> for DebugAgentSynchronousProxy {
1176    fn from(value: fidl::Channel) -> Self {
1177        Self::new(value)
1178    }
1179}
1180
1181#[derive(Debug, Clone)]
1182pub struct DebugAgentProxy {
1183    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1184}
1185
1186impl fidl::endpoints::Proxy for DebugAgentProxy {
1187    type Protocol = DebugAgentMarker;
1188
1189    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1190        Self::new(inner)
1191    }
1192
1193    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1194        self.client.into_channel().map_err(|client| Self { client })
1195    }
1196
1197    fn as_channel(&self) -> &::fidl::AsyncChannel {
1198        self.client.as_channel()
1199    }
1200}
1201
1202impl DebugAgentProxy {
1203    /// Create a new Proxy for fuchsia.debugger/DebugAgent.
1204    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1205        let protocol_name = <DebugAgentMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1206        Self { client: fidl::client::Client::new(channel, protocol_name) }
1207    }
1208
1209    /// Get a Stream of events from the remote end of the protocol.
1210    ///
1211    /// # Panics
1212    ///
1213    /// Panics if the event stream was already taken.
1214    pub fn take_event_stream(&self) -> DebugAgentEventStream {
1215        DebugAgentEventStream { event_receiver: self.client.take_event_receiver() }
1216    }
1217
1218    /// Hand the DebugAgent a socket that connects it to the debugger. This
1219    /// will return ZX_ERR_ALREADY_BOUND if a connection already exists. When
1220    /// the socket is closed, the DebugAgent will exit.
1221    pub fn r#connect(
1222        &self,
1223        mut socket: fidl::Socket,
1224    ) -> fidl::client::QueryResponseFut<
1225        DebugAgentConnectResult,
1226        fidl::encoding::DefaultFuchsiaResourceDialect,
1227    > {
1228        DebugAgentProxyInterface::r#connect(self, socket)
1229    }
1230
1231    /// Iterator over all processes that this agent is attached to. Note this is
1232    /// not the same as the set of installed filters, but rather the set of
1233    /// filters that matched and were later successfully attached.
1234    pub fn r#get_attached_processes(
1235        &self,
1236        mut iterator: fidl::endpoints::ServerEnd<AttachedProcessIteratorMarker>,
1237    ) -> Result<(), fidl::Error> {
1238        DebugAgentProxyInterface::r#get_attached_processes(self, iterator)
1239    }
1240
1241    /// Use the given filter to attach to any existing or subsequently created
1242    /// components. This method will return the number of matches that were
1243    /// present at the time of calling this method. All attached processes will
1244    /// be detached when this agent is destroyed.
1245    ///
1246    /// |filter| will be inspected for validity, with corresponding errors
1247    /// returned. If the filter is invalid, no attaches will occur and the
1248    /// filter will not be installed.
1249    ///
1250    /// |num_matches| will contain the number of matches that were found
1251    /// immediately upon filter installation if there was no error, that is, the
1252    /// number of processes immediately within (or recursively in this realm, if
1253    /// the option is specified) this component's corresponding job. Note that
1254    /// filters may be installed _before_ any components are actually resolved
1255    /// and matched, so this number may be 0. This return value may be safely
1256    /// ignored.
1257    ///
1258    /// Invalid filters will return an error, see Filter above for details on
1259    /// how to construct a filter.
1260    pub fn r#attach_to(
1261        &self,
1262        mut pattern: &str,
1263        mut type_: FilterType,
1264        mut options: &FilterOptions,
1265    ) -> fidl::client::QueryResponseFut<
1266        DebugAgentAttachToResult,
1267        fidl::encoding::DefaultFuchsiaResourceDialect,
1268    > {
1269        DebugAgentProxyInterface::r#attach_to(self, pattern, type_, options)
1270    }
1271
1272    /// The given server_end of the iterator will iterate over all threads, of
1273    /// all attached processes. The options parameter may be passed to filter
1274    /// the already attached processes and to express interest in what should be
1275    /// yielded by the iterator. Including a filter is recommended if DebugAgent
1276    /// is attached to a large number of processes. Note that this filter will
1277    /// not cause any new processes to be attached and will not be saved after
1278    /// this method returns. It is purely to reduce the bounds of the iterator.
1279    /// The threads will be suspended for the duration of information capture,
1280    /// which could be interrupted by other system processes, see
1281    /// |ProcessInfoIterator| for an example.
1282    pub fn r#get_process_info(
1283        &self,
1284        mut options: &GetProcessInfoOptions,
1285        mut iterator: fidl::endpoints::ServerEnd<ProcessInfoIteratorMarker>,
1286    ) -> fidl::client::QueryResponseFut<
1287        DebugAgentGetProcessInfoResult,
1288        fidl::encoding::DefaultFuchsiaResourceDialect,
1289    > {
1290        DebugAgentProxyInterface::r#get_process_info(self, options, iterator)
1291    }
1292
1293    /// Collect minidumps for all attached processes. |options| may contain a
1294    /// filter to reduce the number of minidumps that are yielded by the
1295    /// iterator.
1296    pub fn r#get_minidumps(
1297        &self,
1298        mut options: &MinidumpOptions,
1299        mut iterator: fidl::endpoints::ServerEnd<MinidumpIteratorMarker>,
1300    ) -> fidl::client::QueryResponseFut<
1301        DebugAgentGetMinidumpsResult,
1302        fidl::encoding::DefaultFuchsiaResourceDialect,
1303    > {
1304        DebugAgentProxyInterface::r#get_minidumps(self, options, iterator)
1305    }
1306}
1307
1308impl DebugAgentProxyInterface for DebugAgentProxy {
1309    type ConnectResponseFut = fidl::client::QueryResponseFut<
1310        DebugAgentConnectResult,
1311        fidl::encoding::DefaultFuchsiaResourceDialect,
1312    >;
1313    fn r#connect(&self, mut socket: fidl::Socket) -> Self::ConnectResponseFut {
1314        fn _decode(
1315            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1316        ) -> Result<DebugAgentConnectResult, fidl::Error> {
1317            let _response = fidl::client::decode_transaction_body::<
1318                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
1319                fidl::encoding::DefaultFuchsiaResourceDialect,
1320                0x6f81c1e426ddf3f9,
1321            >(_buf?)?
1322            .into_result::<DebugAgentMarker>("connect")?;
1323            Ok(_response.map(|x| x))
1324        }
1325        self.client.send_query_and_decode::<DebugAgentConnectRequest, DebugAgentConnectResult>(
1326            (socket,),
1327            0x6f81c1e426ddf3f9,
1328            fidl::encoding::DynamicFlags::FLEXIBLE,
1329            _decode,
1330        )
1331    }
1332
1333    fn r#get_attached_processes(
1334        &self,
1335        mut iterator: fidl::endpoints::ServerEnd<AttachedProcessIteratorMarker>,
1336    ) -> Result<(), fidl::Error> {
1337        self.client.send::<DebugAgentGetAttachedProcessesRequest>(
1338            (iterator,),
1339            0x4a07b086a7deda56,
1340            fidl::encoding::DynamicFlags::FLEXIBLE,
1341        )
1342    }
1343
1344    type AttachToResponseFut = fidl::client::QueryResponseFut<
1345        DebugAgentAttachToResult,
1346        fidl::encoding::DefaultFuchsiaResourceDialect,
1347    >;
1348    fn r#attach_to(
1349        &self,
1350        mut pattern: &str,
1351        mut type_: FilterType,
1352        mut options: &FilterOptions,
1353    ) -> Self::AttachToResponseFut {
1354        fn _decode(
1355            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1356        ) -> Result<DebugAgentAttachToResult, fidl::Error> {
1357            let _response = fidl::client::decode_transaction_body::<
1358                fidl::encoding::FlexibleResultType<DebugAgentAttachToResponse, FilterError>,
1359                fidl::encoding::DefaultFuchsiaResourceDialect,
1360                0x2800c757fe52795f,
1361            >(_buf?)?
1362            .into_result::<DebugAgentMarker>("attach_to")?;
1363            Ok(_response.map(|x| x.num_matches))
1364        }
1365        self.client.send_query_and_decode::<Filter, DebugAgentAttachToResult>(
1366            (pattern, type_, options),
1367            0x2800c757fe52795f,
1368            fidl::encoding::DynamicFlags::FLEXIBLE,
1369            _decode,
1370        )
1371    }
1372
1373    type GetProcessInfoResponseFut = fidl::client::QueryResponseFut<
1374        DebugAgentGetProcessInfoResult,
1375        fidl::encoding::DefaultFuchsiaResourceDialect,
1376    >;
1377    fn r#get_process_info(
1378        &self,
1379        mut options: &GetProcessInfoOptions,
1380        mut iterator: fidl::endpoints::ServerEnd<ProcessInfoIteratorMarker>,
1381    ) -> Self::GetProcessInfoResponseFut {
1382        fn _decode(
1383            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1384        ) -> Result<DebugAgentGetProcessInfoResult, fidl::Error> {
1385            let _response = fidl::client::decode_transaction_body::<
1386                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, FilterError>,
1387                fidl::encoding::DefaultFuchsiaResourceDialect,
1388                0x4daf0a7366bb6d77,
1389            >(_buf?)?
1390            .into_result::<DebugAgentMarker>("get_process_info")?;
1391            Ok(_response.map(|x| x))
1392        }
1393        self.client.send_query_and_decode::<
1394            DebugAgentGetProcessInfoRequest,
1395            DebugAgentGetProcessInfoResult,
1396        >(
1397            (options, iterator,),
1398            0x4daf0a7366bb6d77,
1399            fidl::encoding::DynamicFlags::FLEXIBLE,
1400            _decode,
1401        )
1402    }
1403
1404    type GetMinidumpsResponseFut = fidl::client::QueryResponseFut<
1405        DebugAgentGetMinidumpsResult,
1406        fidl::encoding::DefaultFuchsiaResourceDialect,
1407    >;
1408    fn r#get_minidumps(
1409        &self,
1410        mut options: &MinidumpOptions,
1411        mut iterator: fidl::endpoints::ServerEnd<MinidumpIteratorMarker>,
1412    ) -> Self::GetMinidumpsResponseFut {
1413        fn _decode(
1414            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1415        ) -> Result<DebugAgentGetMinidumpsResult, fidl::Error> {
1416            let _response = fidl::client::decode_transaction_body::<
1417                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, FilterError>,
1418                fidl::encoding::DefaultFuchsiaResourceDialect,
1419                0x4a4693aeecdb7deb,
1420            >(_buf?)?
1421            .into_result::<DebugAgentMarker>("get_minidumps")?;
1422            Ok(_response.map(|x| x))
1423        }
1424        self.client
1425            .send_query_and_decode::<DebugAgentGetMinidumpsRequest, DebugAgentGetMinidumpsResult>(
1426                (options, iterator),
1427                0x4a4693aeecdb7deb,
1428                fidl::encoding::DynamicFlags::FLEXIBLE,
1429                _decode,
1430            )
1431    }
1432}
1433
1434pub struct DebugAgentEventStream {
1435    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1436}
1437
1438impl std::marker::Unpin for DebugAgentEventStream {}
1439
1440impl futures::stream::FusedStream for DebugAgentEventStream {
1441    fn is_terminated(&self) -> bool {
1442        self.event_receiver.is_terminated()
1443    }
1444}
1445
1446impl futures::Stream for DebugAgentEventStream {
1447    type Item = Result<DebugAgentEvent, fidl::Error>;
1448
1449    fn poll_next(
1450        mut self: std::pin::Pin<&mut Self>,
1451        cx: &mut std::task::Context<'_>,
1452    ) -> std::task::Poll<Option<Self::Item>> {
1453        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1454            &mut self.event_receiver,
1455            cx
1456        )?) {
1457            Some(buf) => std::task::Poll::Ready(Some(DebugAgentEvent::decode(buf))),
1458            None => std::task::Poll::Ready(None),
1459        }
1460    }
1461}
1462
1463#[derive(Debug)]
1464pub enum DebugAgentEvent {
1465    OnFatalException {
1466        payload: DebugAgentOnFatalExceptionRequest,
1467    },
1468    #[non_exhaustive]
1469    _UnknownEvent {
1470        /// Ordinal of the event that was sent.
1471        ordinal: u64,
1472    },
1473}
1474
1475impl DebugAgentEvent {
1476    #[allow(irrefutable_let_patterns)]
1477    pub fn into_on_fatal_exception(self) -> Option<DebugAgentOnFatalExceptionRequest> {
1478        if let DebugAgentEvent::OnFatalException { payload } = self {
1479            Some((payload))
1480        } else {
1481            None
1482        }
1483    }
1484
1485    /// Decodes a message buffer as a [`DebugAgentEvent`].
1486    fn decode(
1487        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1488    ) -> Result<DebugAgentEvent, fidl::Error> {
1489        let (bytes, _handles) = buf.split_mut();
1490        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1491        debug_assert_eq!(tx_header.tx_id, 0);
1492        match tx_header.ordinal {
1493            0x254b534a4790d114 => {
1494                let mut out = fidl::new_empty!(
1495                    DebugAgentOnFatalExceptionRequest,
1496                    fidl::encoding::DefaultFuchsiaResourceDialect
1497                );
1498                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DebugAgentOnFatalExceptionRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
1499                Ok((DebugAgentEvent::OnFatalException { payload: out }))
1500            }
1501            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1502                Ok(DebugAgentEvent::_UnknownEvent { ordinal: tx_header.ordinal })
1503            }
1504            _ => Err(fidl::Error::UnknownOrdinal {
1505                ordinal: tx_header.ordinal,
1506                protocol_name: <DebugAgentMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1507            }),
1508        }
1509    }
1510}
1511
1512/// A Stream of incoming requests for fuchsia.debugger/DebugAgent.
1513pub struct DebugAgentRequestStream {
1514    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1515    is_terminated: bool,
1516}
1517
1518impl std::marker::Unpin for DebugAgentRequestStream {}
1519
1520impl futures::stream::FusedStream for DebugAgentRequestStream {
1521    fn is_terminated(&self) -> bool {
1522        self.is_terminated
1523    }
1524}
1525
1526impl fidl::endpoints::RequestStream for DebugAgentRequestStream {
1527    type Protocol = DebugAgentMarker;
1528    type ControlHandle = DebugAgentControlHandle;
1529
1530    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1531        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1532    }
1533
1534    fn control_handle(&self) -> Self::ControlHandle {
1535        DebugAgentControlHandle { inner: self.inner.clone() }
1536    }
1537
1538    fn into_inner(
1539        self,
1540    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1541    {
1542        (self.inner, self.is_terminated)
1543    }
1544
1545    fn from_inner(
1546        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1547        is_terminated: bool,
1548    ) -> Self {
1549        Self { inner, is_terminated }
1550    }
1551}
1552
1553impl futures::Stream for DebugAgentRequestStream {
1554    type Item = Result<DebugAgentRequest, fidl::Error>;
1555
1556    fn poll_next(
1557        mut self: std::pin::Pin<&mut Self>,
1558        cx: &mut std::task::Context<'_>,
1559    ) -> std::task::Poll<Option<Self::Item>> {
1560        let this = &mut *self;
1561        if this.inner.check_shutdown(cx) {
1562            this.is_terminated = true;
1563            return std::task::Poll::Ready(None);
1564        }
1565        if this.is_terminated {
1566            panic!("polled DebugAgentRequestStream after completion");
1567        }
1568        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1569            |bytes, handles| {
1570                match this.inner.channel().read_etc(cx, bytes, handles) {
1571                    std::task::Poll::Ready(Ok(())) => {}
1572                    std::task::Poll::Pending => return std::task::Poll::Pending,
1573                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1574                        this.is_terminated = true;
1575                        return std::task::Poll::Ready(None);
1576                    }
1577                    std::task::Poll::Ready(Err(e)) => {
1578                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1579                            e.into(),
1580                        ))))
1581                    }
1582                }
1583
1584                // A message has been received from the channel
1585                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1586
1587                std::task::Poll::Ready(Some(match header.ordinal {
1588                    0x6f81c1e426ddf3f9 => {
1589                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1590                        let mut req = fidl::new_empty!(
1591                            DebugAgentConnectRequest,
1592                            fidl::encoding::DefaultFuchsiaResourceDialect
1593                        );
1594                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DebugAgentConnectRequest>(&header, _body_bytes, handles, &mut req)?;
1595                        let control_handle = DebugAgentControlHandle { inner: this.inner.clone() };
1596                        Ok(DebugAgentRequest::Connect {
1597                            socket: req.socket,
1598
1599                            responder: DebugAgentConnectResponder {
1600                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1601                                tx_id: header.tx_id,
1602                            },
1603                        })
1604                    }
1605                    0x4a07b086a7deda56 => {
1606                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1607                        let mut req = fidl::new_empty!(
1608                            DebugAgentGetAttachedProcessesRequest,
1609                            fidl::encoding::DefaultFuchsiaResourceDialect
1610                        );
1611                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DebugAgentGetAttachedProcessesRequest>(&header, _body_bytes, handles, &mut req)?;
1612                        let control_handle = DebugAgentControlHandle { inner: this.inner.clone() };
1613                        Ok(DebugAgentRequest::GetAttachedProcesses {
1614                            iterator: req.iterator,
1615
1616                            control_handle,
1617                        })
1618                    }
1619                    0x2800c757fe52795f => {
1620                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1621                        let mut req =
1622                            fidl::new_empty!(Filter, fidl::encoding::DefaultFuchsiaResourceDialect);
1623                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Filter>(&header, _body_bytes, handles, &mut req)?;
1624                        let control_handle = DebugAgentControlHandle { inner: this.inner.clone() };
1625                        Ok(DebugAgentRequest::AttachTo {
1626                            pattern: req.pattern,
1627                            type_: req.type_,
1628                            options: req.options,
1629
1630                            responder: DebugAgentAttachToResponder {
1631                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1632                                tx_id: header.tx_id,
1633                            },
1634                        })
1635                    }
1636                    0x4daf0a7366bb6d77 => {
1637                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1638                        let mut req = fidl::new_empty!(
1639                            DebugAgentGetProcessInfoRequest,
1640                            fidl::encoding::DefaultFuchsiaResourceDialect
1641                        );
1642                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DebugAgentGetProcessInfoRequest>(&header, _body_bytes, handles, &mut req)?;
1643                        let control_handle = DebugAgentControlHandle { inner: this.inner.clone() };
1644                        Ok(DebugAgentRequest::GetProcessInfo {
1645                            options: req.options,
1646                            iterator: req.iterator,
1647
1648                            responder: DebugAgentGetProcessInfoResponder {
1649                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1650                                tx_id: header.tx_id,
1651                            },
1652                        })
1653                    }
1654                    0x4a4693aeecdb7deb => {
1655                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1656                        let mut req = fidl::new_empty!(
1657                            DebugAgentGetMinidumpsRequest,
1658                            fidl::encoding::DefaultFuchsiaResourceDialect
1659                        );
1660                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DebugAgentGetMinidumpsRequest>(&header, _body_bytes, handles, &mut req)?;
1661                        let control_handle = DebugAgentControlHandle { inner: this.inner.clone() };
1662                        Ok(DebugAgentRequest::GetMinidumps {
1663                            options: req.options,
1664                            iterator: req.iterator,
1665
1666                            responder: DebugAgentGetMinidumpsResponder {
1667                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1668                                tx_id: header.tx_id,
1669                            },
1670                        })
1671                    }
1672                    _ if header.tx_id == 0
1673                        && header
1674                            .dynamic_flags()
1675                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1676                    {
1677                        Ok(DebugAgentRequest::_UnknownMethod {
1678                            ordinal: header.ordinal,
1679                            control_handle: DebugAgentControlHandle { inner: this.inner.clone() },
1680                            method_type: fidl::MethodType::OneWay,
1681                        })
1682                    }
1683                    _ if header
1684                        .dynamic_flags()
1685                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1686                    {
1687                        this.inner.send_framework_err(
1688                            fidl::encoding::FrameworkErr::UnknownMethod,
1689                            header.tx_id,
1690                            header.ordinal,
1691                            header.dynamic_flags(),
1692                            (bytes, handles),
1693                        )?;
1694                        Ok(DebugAgentRequest::_UnknownMethod {
1695                            ordinal: header.ordinal,
1696                            control_handle: DebugAgentControlHandle { inner: this.inner.clone() },
1697                            method_type: fidl::MethodType::TwoWay,
1698                        })
1699                    }
1700                    _ => Err(fidl::Error::UnknownOrdinal {
1701                        ordinal: header.ordinal,
1702                        protocol_name:
1703                            <DebugAgentMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1704                    }),
1705                }))
1706            },
1707        )
1708    }
1709}
1710
1711#[derive(Debug)]
1712pub enum DebugAgentRequest {
1713    /// Hand the DebugAgent a socket that connects it to the debugger. This
1714    /// will return ZX_ERR_ALREADY_BOUND if a connection already exists. When
1715    /// the socket is closed, the DebugAgent will exit.
1716    Connect { socket: fidl::Socket, responder: DebugAgentConnectResponder },
1717    /// Iterator over all processes that this agent is attached to. Note this is
1718    /// not the same as the set of installed filters, but rather the set of
1719    /// filters that matched and were later successfully attached.
1720    GetAttachedProcesses {
1721        iterator: fidl::endpoints::ServerEnd<AttachedProcessIteratorMarker>,
1722        control_handle: DebugAgentControlHandle,
1723    },
1724    /// Use the given filter to attach to any existing or subsequently created
1725    /// components. This method will return the number of matches that were
1726    /// present at the time of calling this method. All attached processes will
1727    /// be detached when this agent is destroyed.
1728    ///
1729    /// |filter| will be inspected for validity, with corresponding errors
1730    /// returned. If the filter is invalid, no attaches will occur and the
1731    /// filter will not be installed.
1732    ///
1733    /// |num_matches| will contain the number of matches that were found
1734    /// immediately upon filter installation if there was no error, that is, the
1735    /// number of processes immediately within (or recursively in this realm, if
1736    /// the option is specified) this component's corresponding job. Note that
1737    /// filters may be installed _before_ any components are actually resolved
1738    /// and matched, so this number may be 0. This return value may be safely
1739    /// ignored.
1740    ///
1741    /// Invalid filters will return an error, see Filter above for details on
1742    /// how to construct a filter.
1743    AttachTo {
1744        pattern: String,
1745        type_: FilterType,
1746        options: FilterOptions,
1747        responder: DebugAgentAttachToResponder,
1748    },
1749    /// The given server_end of the iterator will iterate over all threads, of
1750    /// all attached processes. The options parameter may be passed to filter
1751    /// the already attached processes and to express interest in what should be
1752    /// yielded by the iterator. Including a filter is recommended if DebugAgent
1753    /// is attached to a large number of processes. Note that this filter will
1754    /// not cause any new processes to be attached and will not be saved after
1755    /// this method returns. It is purely to reduce the bounds of the iterator.
1756    /// The threads will be suspended for the duration of information capture,
1757    /// which could be interrupted by other system processes, see
1758    /// |ProcessInfoIterator| for an example.
1759    GetProcessInfo {
1760        options: GetProcessInfoOptions,
1761        iterator: fidl::endpoints::ServerEnd<ProcessInfoIteratorMarker>,
1762        responder: DebugAgentGetProcessInfoResponder,
1763    },
1764    /// Collect minidumps for all attached processes. |options| may contain a
1765    /// filter to reduce the number of minidumps that are yielded by the
1766    /// iterator.
1767    GetMinidumps {
1768        options: MinidumpOptions,
1769        iterator: fidl::endpoints::ServerEnd<MinidumpIteratorMarker>,
1770        responder: DebugAgentGetMinidumpsResponder,
1771    },
1772    /// An interaction was received which does not match any known method.
1773    #[non_exhaustive]
1774    _UnknownMethod {
1775        /// Ordinal of the method that was called.
1776        ordinal: u64,
1777        control_handle: DebugAgentControlHandle,
1778        method_type: fidl::MethodType,
1779    },
1780}
1781
1782impl DebugAgentRequest {
1783    #[allow(irrefutable_let_patterns)]
1784    pub fn into_connect(self) -> Option<(fidl::Socket, DebugAgentConnectResponder)> {
1785        if let DebugAgentRequest::Connect { socket, responder } = self {
1786            Some((socket, responder))
1787        } else {
1788            None
1789        }
1790    }
1791
1792    #[allow(irrefutable_let_patterns)]
1793    pub fn into_get_attached_processes(
1794        self,
1795    ) -> Option<(fidl::endpoints::ServerEnd<AttachedProcessIteratorMarker>, DebugAgentControlHandle)>
1796    {
1797        if let DebugAgentRequest::GetAttachedProcesses { iterator, control_handle } = self {
1798            Some((iterator, control_handle))
1799        } else {
1800            None
1801        }
1802    }
1803
1804    #[allow(irrefutable_let_patterns)]
1805    pub fn into_attach_to(
1806        self,
1807    ) -> Option<(String, FilterType, FilterOptions, DebugAgentAttachToResponder)> {
1808        if let DebugAgentRequest::AttachTo { pattern, type_, options, responder } = self {
1809            Some((pattern, type_, options, responder))
1810        } else {
1811            None
1812        }
1813    }
1814
1815    #[allow(irrefutable_let_patterns)]
1816    pub fn into_get_process_info(
1817        self,
1818    ) -> Option<(
1819        GetProcessInfoOptions,
1820        fidl::endpoints::ServerEnd<ProcessInfoIteratorMarker>,
1821        DebugAgentGetProcessInfoResponder,
1822    )> {
1823        if let DebugAgentRequest::GetProcessInfo { options, iterator, responder } = self {
1824            Some((options, iterator, responder))
1825        } else {
1826            None
1827        }
1828    }
1829
1830    #[allow(irrefutable_let_patterns)]
1831    pub fn into_get_minidumps(
1832        self,
1833    ) -> Option<(
1834        MinidumpOptions,
1835        fidl::endpoints::ServerEnd<MinidumpIteratorMarker>,
1836        DebugAgentGetMinidumpsResponder,
1837    )> {
1838        if let DebugAgentRequest::GetMinidumps { options, iterator, responder } = self {
1839            Some((options, iterator, responder))
1840        } else {
1841            None
1842        }
1843    }
1844
1845    /// Name of the method defined in FIDL
1846    pub fn method_name(&self) -> &'static str {
1847        match *self {
1848            DebugAgentRequest::Connect { .. } => "connect",
1849            DebugAgentRequest::GetAttachedProcesses { .. } => "get_attached_processes",
1850            DebugAgentRequest::AttachTo { .. } => "attach_to",
1851            DebugAgentRequest::GetProcessInfo { .. } => "get_process_info",
1852            DebugAgentRequest::GetMinidumps { .. } => "get_minidumps",
1853            DebugAgentRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
1854                "unknown one-way method"
1855            }
1856            DebugAgentRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
1857                "unknown two-way method"
1858            }
1859        }
1860    }
1861}
1862
1863#[derive(Debug, Clone)]
1864pub struct DebugAgentControlHandle {
1865    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1866}
1867
1868impl fidl::endpoints::ControlHandle for DebugAgentControlHandle {
1869    fn shutdown(&self) {
1870        self.inner.shutdown()
1871    }
1872    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1873        self.inner.shutdown_with_epitaph(status)
1874    }
1875
1876    fn is_closed(&self) -> bool {
1877        self.inner.channel().is_closed()
1878    }
1879    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1880        self.inner.channel().on_closed()
1881    }
1882
1883    #[cfg(target_os = "fuchsia")]
1884    fn signal_peer(
1885        &self,
1886        clear_mask: zx::Signals,
1887        set_mask: zx::Signals,
1888    ) -> Result<(), zx_status::Status> {
1889        use fidl::Peered;
1890        self.inner.channel().signal_peer(clear_mask, set_mask)
1891    }
1892}
1893
1894impl DebugAgentControlHandle {
1895    pub fn send_on_fatal_exception(
1896        &self,
1897        mut payload: &DebugAgentOnFatalExceptionRequest,
1898    ) -> Result<(), fidl::Error> {
1899        self.inner.send::<DebugAgentOnFatalExceptionRequest>(
1900            payload,
1901            0,
1902            0x254b534a4790d114,
1903            fidl::encoding::DynamicFlags::FLEXIBLE,
1904        )
1905    }
1906}
1907
1908#[must_use = "FIDL methods require a response to be sent"]
1909#[derive(Debug)]
1910pub struct DebugAgentConnectResponder {
1911    control_handle: std::mem::ManuallyDrop<DebugAgentControlHandle>,
1912    tx_id: u32,
1913}
1914
1915/// Set the the channel to be shutdown (see [`DebugAgentControlHandle::shutdown`])
1916/// if the responder is dropped without sending a response, so that the client
1917/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1918impl std::ops::Drop for DebugAgentConnectResponder {
1919    fn drop(&mut self) {
1920        self.control_handle.shutdown();
1921        // Safety: drops once, never accessed again
1922        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1923    }
1924}
1925
1926impl fidl::endpoints::Responder for DebugAgentConnectResponder {
1927    type ControlHandle = DebugAgentControlHandle;
1928
1929    fn control_handle(&self) -> &DebugAgentControlHandle {
1930        &self.control_handle
1931    }
1932
1933    fn drop_without_shutdown(mut self) {
1934        // Safety: drops once, never accessed again due to mem::forget
1935        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1936        // Prevent Drop from running (which would shut down the channel)
1937        std::mem::forget(self);
1938    }
1939}
1940
1941impl DebugAgentConnectResponder {
1942    /// Sends a response to the FIDL transaction.
1943    ///
1944    /// Sets the channel to shutdown if an error occurs.
1945    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1946        let _result = self.send_raw(result);
1947        if _result.is_err() {
1948            self.control_handle.shutdown();
1949        }
1950        self.drop_without_shutdown();
1951        _result
1952    }
1953
1954    /// Similar to "send" but does not shutdown the channel if an error occurs.
1955    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1956        let _result = self.send_raw(result);
1957        self.drop_without_shutdown();
1958        _result
1959    }
1960
1961    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1962        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1963            fidl::encoding::EmptyStruct,
1964            i32,
1965        >>(
1966            fidl::encoding::FlexibleResult::new(result),
1967            self.tx_id,
1968            0x6f81c1e426ddf3f9,
1969            fidl::encoding::DynamicFlags::FLEXIBLE,
1970        )
1971    }
1972}
1973
1974#[must_use = "FIDL methods require a response to be sent"]
1975#[derive(Debug)]
1976pub struct DebugAgentAttachToResponder {
1977    control_handle: std::mem::ManuallyDrop<DebugAgentControlHandle>,
1978    tx_id: u32,
1979}
1980
1981/// Set the the channel to be shutdown (see [`DebugAgentControlHandle::shutdown`])
1982/// if the responder is dropped without sending a response, so that the client
1983/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1984impl std::ops::Drop for DebugAgentAttachToResponder {
1985    fn drop(&mut self) {
1986        self.control_handle.shutdown();
1987        // Safety: drops once, never accessed again
1988        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1989    }
1990}
1991
1992impl fidl::endpoints::Responder for DebugAgentAttachToResponder {
1993    type ControlHandle = DebugAgentControlHandle;
1994
1995    fn control_handle(&self) -> &DebugAgentControlHandle {
1996        &self.control_handle
1997    }
1998
1999    fn drop_without_shutdown(mut self) {
2000        // Safety: drops once, never accessed again due to mem::forget
2001        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2002        // Prevent Drop from running (which would shut down the channel)
2003        std::mem::forget(self);
2004    }
2005}
2006
2007impl DebugAgentAttachToResponder {
2008    /// Sends a response to the FIDL transaction.
2009    ///
2010    /// Sets the channel to shutdown if an error occurs.
2011    pub fn send(self, mut result: Result<u32, FilterError>) -> Result<(), fidl::Error> {
2012        let _result = self.send_raw(result);
2013        if _result.is_err() {
2014            self.control_handle.shutdown();
2015        }
2016        self.drop_without_shutdown();
2017        _result
2018    }
2019
2020    /// Similar to "send" but does not shutdown the channel if an error occurs.
2021    pub fn send_no_shutdown_on_err(
2022        self,
2023        mut result: Result<u32, FilterError>,
2024    ) -> Result<(), fidl::Error> {
2025        let _result = self.send_raw(result);
2026        self.drop_without_shutdown();
2027        _result
2028    }
2029
2030    fn send_raw(&self, mut result: Result<u32, FilterError>) -> Result<(), fidl::Error> {
2031        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
2032            DebugAgentAttachToResponse,
2033            FilterError,
2034        >>(
2035            fidl::encoding::FlexibleResult::new(result.map(|num_matches| (num_matches,))),
2036            self.tx_id,
2037            0x2800c757fe52795f,
2038            fidl::encoding::DynamicFlags::FLEXIBLE,
2039        )
2040    }
2041}
2042
2043#[must_use = "FIDL methods require a response to be sent"]
2044#[derive(Debug)]
2045pub struct DebugAgentGetProcessInfoResponder {
2046    control_handle: std::mem::ManuallyDrop<DebugAgentControlHandle>,
2047    tx_id: u32,
2048}
2049
2050/// Set the the channel to be shutdown (see [`DebugAgentControlHandle::shutdown`])
2051/// if the responder is dropped without sending a response, so that the client
2052/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2053impl std::ops::Drop for DebugAgentGetProcessInfoResponder {
2054    fn drop(&mut self) {
2055        self.control_handle.shutdown();
2056        // Safety: drops once, never accessed again
2057        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2058    }
2059}
2060
2061impl fidl::endpoints::Responder for DebugAgentGetProcessInfoResponder {
2062    type ControlHandle = DebugAgentControlHandle;
2063
2064    fn control_handle(&self) -> &DebugAgentControlHandle {
2065        &self.control_handle
2066    }
2067
2068    fn drop_without_shutdown(mut self) {
2069        // Safety: drops once, never accessed again due to mem::forget
2070        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2071        // Prevent Drop from running (which would shut down the channel)
2072        std::mem::forget(self);
2073    }
2074}
2075
2076impl DebugAgentGetProcessInfoResponder {
2077    /// Sends a response to the FIDL transaction.
2078    ///
2079    /// Sets the channel to shutdown if an error occurs.
2080    pub fn send(self, mut result: Result<(), FilterError>) -> Result<(), fidl::Error> {
2081        let _result = self.send_raw(result);
2082        if _result.is_err() {
2083            self.control_handle.shutdown();
2084        }
2085        self.drop_without_shutdown();
2086        _result
2087    }
2088
2089    /// Similar to "send" but does not shutdown the channel if an error occurs.
2090    pub fn send_no_shutdown_on_err(
2091        self,
2092        mut result: Result<(), FilterError>,
2093    ) -> Result<(), fidl::Error> {
2094        let _result = self.send_raw(result);
2095        self.drop_without_shutdown();
2096        _result
2097    }
2098
2099    fn send_raw(&self, mut result: Result<(), FilterError>) -> Result<(), fidl::Error> {
2100        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
2101            fidl::encoding::EmptyStruct,
2102            FilterError,
2103        >>(
2104            fidl::encoding::FlexibleResult::new(result),
2105            self.tx_id,
2106            0x4daf0a7366bb6d77,
2107            fidl::encoding::DynamicFlags::FLEXIBLE,
2108        )
2109    }
2110}
2111
2112#[must_use = "FIDL methods require a response to be sent"]
2113#[derive(Debug)]
2114pub struct DebugAgentGetMinidumpsResponder {
2115    control_handle: std::mem::ManuallyDrop<DebugAgentControlHandle>,
2116    tx_id: u32,
2117}
2118
2119/// Set the the channel to be shutdown (see [`DebugAgentControlHandle::shutdown`])
2120/// if the responder is dropped without sending a response, so that the client
2121/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2122impl std::ops::Drop for DebugAgentGetMinidumpsResponder {
2123    fn drop(&mut self) {
2124        self.control_handle.shutdown();
2125        // Safety: drops once, never accessed again
2126        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2127    }
2128}
2129
2130impl fidl::endpoints::Responder for DebugAgentGetMinidumpsResponder {
2131    type ControlHandle = DebugAgentControlHandle;
2132
2133    fn control_handle(&self) -> &DebugAgentControlHandle {
2134        &self.control_handle
2135    }
2136
2137    fn drop_without_shutdown(mut self) {
2138        // Safety: drops once, never accessed again due to mem::forget
2139        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2140        // Prevent Drop from running (which would shut down the channel)
2141        std::mem::forget(self);
2142    }
2143}
2144
2145impl DebugAgentGetMinidumpsResponder {
2146    /// Sends a response to the FIDL transaction.
2147    ///
2148    /// Sets the channel to shutdown if an error occurs.
2149    pub fn send(self, mut result: Result<(), FilterError>) -> Result<(), fidl::Error> {
2150        let _result = self.send_raw(result);
2151        if _result.is_err() {
2152            self.control_handle.shutdown();
2153        }
2154        self.drop_without_shutdown();
2155        _result
2156    }
2157
2158    /// Similar to "send" but does not shutdown the channel if an error occurs.
2159    pub fn send_no_shutdown_on_err(
2160        self,
2161        mut result: Result<(), FilterError>,
2162    ) -> Result<(), fidl::Error> {
2163        let _result = self.send_raw(result);
2164        self.drop_without_shutdown();
2165        _result
2166    }
2167
2168    fn send_raw(&self, mut result: Result<(), FilterError>) -> Result<(), fidl::Error> {
2169        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
2170            fidl::encoding::EmptyStruct,
2171            FilterError,
2172        >>(
2173            fidl::encoding::FlexibleResult::new(result),
2174            self.tx_id,
2175            0x4a4693aeecdb7deb,
2176            fidl::encoding::DynamicFlags::FLEXIBLE,
2177        )
2178    }
2179}
2180
2181#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2182pub struct LauncherMarker;
2183
2184impl fidl::endpoints::ProtocolMarker for LauncherMarker {
2185    type Proxy = LauncherProxy;
2186    type RequestStream = LauncherRequestStream;
2187    #[cfg(target_os = "fuchsia")]
2188    type SynchronousProxy = LauncherSynchronousProxy;
2189
2190    const DEBUG_NAME: &'static str = "fuchsia.debugger.Launcher";
2191}
2192impl fidl::endpoints::DiscoverableProtocolMarker for LauncherMarker {}
2193pub type LauncherLaunchResult = Result<(), i32>;
2194
2195pub trait LauncherProxyInterface: Send + Sync {
2196    type LaunchResponseFut: std::future::Future<Output = Result<LauncherLaunchResult, fidl::Error>>
2197        + Send;
2198    fn r#launch(
2199        &self,
2200        agent: fidl::endpoints::ServerEnd<DebugAgentMarker>,
2201    ) -> Self::LaunchResponseFut;
2202    fn r#get_agents(
2203        &self,
2204        iterator: fidl::endpoints::ServerEnd<AgentIteratorMarker>,
2205    ) -> Result<(), fidl::Error>;
2206}
2207#[derive(Debug)]
2208#[cfg(target_os = "fuchsia")]
2209pub struct LauncherSynchronousProxy {
2210    client: fidl::client::sync::Client,
2211}
2212
2213#[cfg(target_os = "fuchsia")]
2214impl fidl::endpoints::SynchronousProxy for LauncherSynchronousProxy {
2215    type Proxy = LauncherProxy;
2216    type Protocol = LauncherMarker;
2217
2218    fn from_channel(inner: fidl::Channel) -> Self {
2219        Self::new(inner)
2220    }
2221
2222    fn into_channel(self) -> fidl::Channel {
2223        self.client.into_channel()
2224    }
2225
2226    fn as_channel(&self) -> &fidl::Channel {
2227        self.client.as_channel()
2228    }
2229}
2230
2231#[cfg(target_os = "fuchsia")]
2232impl LauncherSynchronousProxy {
2233    pub fn new(channel: fidl::Channel) -> Self {
2234        let protocol_name = <LauncherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2235        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2236    }
2237
2238    pub fn into_channel(self) -> fidl::Channel {
2239        self.client.into_channel()
2240    }
2241
2242    /// Waits until an event arrives and returns it. It is safe for other
2243    /// threads to make concurrent requests while waiting for an event.
2244    pub fn wait_for_event(
2245        &self,
2246        deadline: zx::MonotonicInstant,
2247    ) -> Result<LauncherEvent, fidl::Error> {
2248        LauncherEvent::decode(self.client.wait_for_event(deadline)?)
2249    }
2250
2251    /// Launch a new instance of DebugAgent listening on |agent|. The DebugAgent
2252    /// will exit upon closing the corresponding client_end of this channel.
2253    /// Clients must not close the channel until the debugging session is
2254    /// completed.
2255    pub fn r#launch(
2256        &self,
2257        mut agent: fidl::endpoints::ServerEnd<DebugAgentMarker>,
2258        ___deadline: zx::MonotonicInstant,
2259    ) -> Result<LauncherLaunchResult, fidl::Error> {
2260        let _response = self.client.send_query::<
2261            LauncherLaunchRequest,
2262            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
2263        >(
2264            (agent,),
2265            0x54420f44e79e5c0e,
2266            fidl::encoding::DynamicFlags::FLEXIBLE,
2267            ___deadline,
2268        )?
2269        .into_result::<LauncherMarker>("launch")?;
2270        Ok(_response.map(|x| x))
2271    }
2272
2273    /// Iterator over all DebugAgent instances.
2274    pub fn r#get_agents(
2275        &self,
2276        mut iterator: fidl::endpoints::ServerEnd<AgentIteratorMarker>,
2277    ) -> Result<(), fidl::Error> {
2278        self.client.send::<LauncherGetAgentsRequest>(
2279            (iterator,),
2280            0x4e6a35bfa35ee8f4,
2281            fidl::encoding::DynamicFlags::FLEXIBLE,
2282        )
2283    }
2284}
2285
2286#[cfg(target_os = "fuchsia")]
2287impl From<LauncherSynchronousProxy> for zx::Handle {
2288    fn from(value: LauncherSynchronousProxy) -> Self {
2289        value.into_channel().into()
2290    }
2291}
2292
2293#[cfg(target_os = "fuchsia")]
2294impl From<fidl::Channel> for LauncherSynchronousProxy {
2295    fn from(value: fidl::Channel) -> Self {
2296        Self::new(value)
2297    }
2298}
2299
2300#[derive(Debug, Clone)]
2301pub struct LauncherProxy {
2302    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2303}
2304
2305impl fidl::endpoints::Proxy for LauncherProxy {
2306    type Protocol = LauncherMarker;
2307
2308    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2309        Self::new(inner)
2310    }
2311
2312    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2313        self.client.into_channel().map_err(|client| Self { client })
2314    }
2315
2316    fn as_channel(&self) -> &::fidl::AsyncChannel {
2317        self.client.as_channel()
2318    }
2319}
2320
2321impl LauncherProxy {
2322    /// Create a new Proxy for fuchsia.debugger/Launcher.
2323    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2324        let protocol_name = <LauncherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2325        Self { client: fidl::client::Client::new(channel, protocol_name) }
2326    }
2327
2328    /// Get a Stream of events from the remote end of the protocol.
2329    ///
2330    /// # Panics
2331    ///
2332    /// Panics if the event stream was already taken.
2333    pub fn take_event_stream(&self) -> LauncherEventStream {
2334        LauncherEventStream { event_receiver: self.client.take_event_receiver() }
2335    }
2336
2337    /// Launch a new instance of DebugAgent listening on |agent|. The DebugAgent
2338    /// will exit upon closing the corresponding client_end of this channel.
2339    /// Clients must not close the channel until the debugging session is
2340    /// completed.
2341    pub fn r#launch(
2342        &self,
2343        mut agent: fidl::endpoints::ServerEnd<DebugAgentMarker>,
2344    ) -> fidl::client::QueryResponseFut<
2345        LauncherLaunchResult,
2346        fidl::encoding::DefaultFuchsiaResourceDialect,
2347    > {
2348        LauncherProxyInterface::r#launch(self, agent)
2349    }
2350
2351    /// Iterator over all DebugAgent instances.
2352    pub fn r#get_agents(
2353        &self,
2354        mut iterator: fidl::endpoints::ServerEnd<AgentIteratorMarker>,
2355    ) -> Result<(), fidl::Error> {
2356        LauncherProxyInterface::r#get_agents(self, iterator)
2357    }
2358}
2359
2360impl LauncherProxyInterface for LauncherProxy {
2361    type LaunchResponseFut = fidl::client::QueryResponseFut<
2362        LauncherLaunchResult,
2363        fidl::encoding::DefaultFuchsiaResourceDialect,
2364    >;
2365    fn r#launch(
2366        &self,
2367        mut agent: fidl::endpoints::ServerEnd<DebugAgentMarker>,
2368    ) -> Self::LaunchResponseFut {
2369        fn _decode(
2370            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2371        ) -> Result<LauncherLaunchResult, fidl::Error> {
2372            let _response = fidl::client::decode_transaction_body::<
2373                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
2374                fidl::encoding::DefaultFuchsiaResourceDialect,
2375                0x54420f44e79e5c0e,
2376            >(_buf?)?
2377            .into_result::<LauncherMarker>("launch")?;
2378            Ok(_response.map(|x| x))
2379        }
2380        self.client.send_query_and_decode::<LauncherLaunchRequest, LauncherLaunchResult>(
2381            (agent,),
2382            0x54420f44e79e5c0e,
2383            fidl::encoding::DynamicFlags::FLEXIBLE,
2384            _decode,
2385        )
2386    }
2387
2388    fn r#get_agents(
2389        &self,
2390        mut iterator: fidl::endpoints::ServerEnd<AgentIteratorMarker>,
2391    ) -> Result<(), fidl::Error> {
2392        self.client.send::<LauncherGetAgentsRequest>(
2393            (iterator,),
2394            0x4e6a35bfa35ee8f4,
2395            fidl::encoding::DynamicFlags::FLEXIBLE,
2396        )
2397    }
2398}
2399
2400pub struct LauncherEventStream {
2401    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2402}
2403
2404impl std::marker::Unpin for LauncherEventStream {}
2405
2406impl futures::stream::FusedStream for LauncherEventStream {
2407    fn is_terminated(&self) -> bool {
2408        self.event_receiver.is_terminated()
2409    }
2410}
2411
2412impl futures::Stream for LauncherEventStream {
2413    type Item = Result<LauncherEvent, fidl::Error>;
2414
2415    fn poll_next(
2416        mut self: std::pin::Pin<&mut Self>,
2417        cx: &mut std::task::Context<'_>,
2418    ) -> std::task::Poll<Option<Self::Item>> {
2419        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2420            &mut self.event_receiver,
2421            cx
2422        )?) {
2423            Some(buf) => std::task::Poll::Ready(Some(LauncherEvent::decode(buf))),
2424            None => std::task::Poll::Ready(None),
2425        }
2426    }
2427}
2428
2429#[derive(Debug)]
2430pub enum LauncherEvent {
2431    #[non_exhaustive]
2432    _UnknownEvent {
2433        /// Ordinal of the event that was sent.
2434        ordinal: u64,
2435    },
2436}
2437
2438impl LauncherEvent {
2439    /// Decodes a message buffer as a [`LauncherEvent`].
2440    fn decode(
2441        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2442    ) -> Result<LauncherEvent, fidl::Error> {
2443        let (bytes, _handles) = buf.split_mut();
2444        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2445        debug_assert_eq!(tx_header.tx_id, 0);
2446        match tx_header.ordinal {
2447            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
2448                Ok(LauncherEvent::_UnknownEvent { ordinal: tx_header.ordinal })
2449            }
2450            _ => Err(fidl::Error::UnknownOrdinal {
2451                ordinal: tx_header.ordinal,
2452                protocol_name: <LauncherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2453            }),
2454        }
2455    }
2456}
2457
2458/// A Stream of incoming requests for fuchsia.debugger/Launcher.
2459pub struct LauncherRequestStream {
2460    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2461    is_terminated: bool,
2462}
2463
2464impl std::marker::Unpin for LauncherRequestStream {}
2465
2466impl futures::stream::FusedStream for LauncherRequestStream {
2467    fn is_terminated(&self) -> bool {
2468        self.is_terminated
2469    }
2470}
2471
2472impl fidl::endpoints::RequestStream for LauncherRequestStream {
2473    type Protocol = LauncherMarker;
2474    type ControlHandle = LauncherControlHandle;
2475
2476    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2477        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2478    }
2479
2480    fn control_handle(&self) -> Self::ControlHandle {
2481        LauncherControlHandle { inner: self.inner.clone() }
2482    }
2483
2484    fn into_inner(
2485        self,
2486    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2487    {
2488        (self.inner, self.is_terminated)
2489    }
2490
2491    fn from_inner(
2492        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2493        is_terminated: bool,
2494    ) -> Self {
2495        Self { inner, is_terminated }
2496    }
2497}
2498
2499impl futures::Stream for LauncherRequestStream {
2500    type Item = Result<LauncherRequest, fidl::Error>;
2501
2502    fn poll_next(
2503        mut self: std::pin::Pin<&mut Self>,
2504        cx: &mut std::task::Context<'_>,
2505    ) -> std::task::Poll<Option<Self::Item>> {
2506        let this = &mut *self;
2507        if this.inner.check_shutdown(cx) {
2508            this.is_terminated = true;
2509            return std::task::Poll::Ready(None);
2510        }
2511        if this.is_terminated {
2512            panic!("polled LauncherRequestStream after completion");
2513        }
2514        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2515            |bytes, handles| {
2516                match this.inner.channel().read_etc(cx, bytes, handles) {
2517                    std::task::Poll::Ready(Ok(())) => {}
2518                    std::task::Poll::Pending => return std::task::Poll::Pending,
2519                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2520                        this.is_terminated = true;
2521                        return std::task::Poll::Ready(None);
2522                    }
2523                    std::task::Poll::Ready(Err(e)) => {
2524                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2525                            e.into(),
2526                        ))))
2527                    }
2528                }
2529
2530                // A message has been received from the channel
2531                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2532
2533                std::task::Poll::Ready(Some(match header.ordinal {
2534                    0x54420f44e79e5c0e => {
2535                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2536                        let mut req = fidl::new_empty!(
2537                            LauncherLaunchRequest,
2538                            fidl::encoding::DefaultFuchsiaResourceDialect
2539                        );
2540                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LauncherLaunchRequest>(&header, _body_bytes, handles, &mut req)?;
2541                        let control_handle = LauncherControlHandle { inner: this.inner.clone() };
2542                        Ok(LauncherRequest::Launch {
2543                            agent: req.agent,
2544
2545                            responder: LauncherLaunchResponder {
2546                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2547                                tx_id: header.tx_id,
2548                            },
2549                        })
2550                    }
2551                    0x4e6a35bfa35ee8f4 => {
2552                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2553                        let mut req = fidl::new_empty!(
2554                            LauncherGetAgentsRequest,
2555                            fidl::encoding::DefaultFuchsiaResourceDialect
2556                        );
2557                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LauncherGetAgentsRequest>(&header, _body_bytes, handles, &mut req)?;
2558                        let control_handle = LauncherControlHandle { inner: this.inner.clone() };
2559                        Ok(LauncherRequest::GetAgents { iterator: req.iterator, control_handle })
2560                    }
2561                    _ if header.tx_id == 0
2562                        && header
2563                            .dynamic_flags()
2564                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
2565                    {
2566                        Ok(LauncherRequest::_UnknownMethod {
2567                            ordinal: header.ordinal,
2568                            control_handle: LauncherControlHandle { inner: this.inner.clone() },
2569                            method_type: fidl::MethodType::OneWay,
2570                        })
2571                    }
2572                    _ if header
2573                        .dynamic_flags()
2574                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
2575                    {
2576                        this.inner.send_framework_err(
2577                            fidl::encoding::FrameworkErr::UnknownMethod,
2578                            header.tx_id,
2579                            header.ordinal,
2580                            header.dynamic_flags(),
2581                            (bytes, handles),
2582                        )?;
2583                        Ok(LauncherRequest::_UnknownMethod {
2584                            ordinal: header.ordinal,
2585                            control_handle: LauncherControlHandle { inner: this.inner.clone() },
2586                            method_type: fidl::MethodType::TwoWay,
2587                        })
2588                    }
2589                    _ => Err(fidl::Error::UnknownOrdinal {
2590                        ordinal: header.ordinal,
2591                        protocol_name:
2592                            <LauncherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2593                    }),
2594                }))
2595            },
2596        )
2597    }
2598}
2599
2600#[derive(Debug)]
2601pub enum LauncherRequest {
2602    /// Launch a new instance of DebugAgent listening on |agent|. The DebugAgent
2603    /// will exit upon closing the corresponding client_end of this channel.
2604    /// Clients must not close the channel until the debugging session is
2605    /// completed.
2606    Launch {
2607        agent: fidl::endpoints::ServerEnd<DebugAgentMarker>,
2608        responder: LauncherLaunchResponder,
2609    },
2610    /// Iterator over all DebugAgent instances.
2611    GetAgents {
2612        iterator: fidl::endpoints::ServerEnd<AgentIteratorMarker>,
2613        control_handle: LauncherControlHandle,
2614    },
2615    /// An interaction was received which does not match any known method.
2616    #[non_exhaustive]
2617    _UnknownMethod {
2618        /// Ordinal of the method that was called.
2619        ordinal: u64,
2620        control_handle: LauncherControlHandle,
2621        method_type: fidl::MethodType,
2622    },
2623}
2624
2625impl LauncherRequest {
2626    #[allow(irrefutable_let_patterns)]
2627    pub fn into_launch(
2628        self,
2629    ) -> Option<(fidl::endpoints::ServerEnd<DebugAgentMarker>, LauncherLaunchResponder)> {
2630        if let LauncherRequest::Launch { agent, responder } = self {
2631            Some((agent, responder))
2632        } else {
2633            None
2634        }
2635    }
2636
2637    #[allow(irrefutable_let_patterns)]
2638    pub fn into_get_agents(
2639        self,
2640    ) -> Option<(fidl::endpoints::ServerEnd<AgentIteratorMarker>, LauncherControlHandle)> {
2641        if let LauncherRequest::GetAgents { iterator, control_handle } = self {
2642            Some((iterator, control_handle))
2643        } else {
2644            None
2645        }
2646    }
2647
2648    /// Name of the method defined in FIDL
2649    pub fn method_name(&self) -> &'static str {
2650        match *self {
2651            LauncherRequest::Launch { .. } => "launch",
2652            LauncherRequest::GetAgents { .. } => "get_agents",
2653            LauncherRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
2654                "unknown one-way method"
2655            }
2656            LauncherRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
2657                "unknown two-way method"
2658            }
2659        }
2660    }
2661}
2662
2663#[derive(Debug, Clone)]
2664pub struct LauncherControlHandle {
2665    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2666}
2667
2668impl fidl::endpoints::ControlHandle for LauncherControlHandle {
2669    fn shutdown(&self) {
2670        self.inner.shutdown()
2671    }
2672    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2673        self.inner.shutdown_with_epitaph(status)
2674    }
2675
2676    fn is_closed(&self) -> bool {
2677        self.inner.channel().is_closed()
2678    }
2679    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2680        self.inner.channel().on_closed()
2681    }
2682
2683    #[cfg(target_os = "fuchsia")]
2684    fn signal_peer(
2685        &self,
2686        clear_mask: zx::Signals,
2687        set_mask: zx::Signals,
2688    ) -> Result<(), zx_status::Status> {
2689        use fidl::Peered;
2690        self.inner.channel().signal_peer(clear_mask, set_mask)
2691    }
2692}
2693
2694impl LauncherControlHandle {}
2695
2696#[must_use = "FIDL methods require a response to be sent"]
2697#[derive(Debug)]
2698pub struct LauncherLaunchResponder {
2699    control_handle: std::mem::ManuallyDrop<LauncherControlHandle>,
2700    tx_id: u32,
2701}
2702
2703/// Set the the channel to be shutdown (see [`LauncherControlHandle::shutdown`])
2704/// if the responder is dropped without sending a response, so that the client
2705/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2706impl std::ops::Drop for LauncherLaunchResponder {
2707    fn drop(&mut self) {
2708        self.control_handle.shutdown();
2709        // Safety: drops once, never accessed again
2710        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2711    }
2712}
2713
2714impl fidl::endpoints::Responder for LauncherLaunchResponder {
2715    type ControlHandle = LauncherControlHandle;
2716
2717    fn control_handle(&self) -> &LauncherControlHandle {
2718        &self.control_handle
2719    }
2720
2721    fn drop_without_shutdown(mut self) {
2722        // Safety: drops once, never accessed again due to mem::forget
2723        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2724        // Prevent Drop from running (which would shut down the channel)
2725        std::mem::forget(self);
2726    }
2727}
2728
2729impl LauncherLaunchResponder {
2730    /// Sends a response to the FIDL transaction.
2731    ///
2732    /// Sets the channel to shutdown if an error occurs.
2733    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2734        let _result = self.send_raw(result);
2735        if _result.is_err() {
2736            self.control_handle.shutdown();
2737        }
2738        self.drop_without_shutdown();
2739        _result
2740    }
2741
2742    /// Similar to "send" but does not shutdown the channel if an error occurs.
2743    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2744        let _result = self.send_raw(result);
2745        self.drop_without_shutdown();
2746        _result
2747    }
2748
2749    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2750        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
2751            fidl::encoding::EmptyStruct,
2752            i32,
2753        >>(
2754            fidl::encoding::FlexibleResult::new(result),
2755            self.tx_id,
2756            0x54420f44e79e5c0e,
2757            fidl::encoding::DynamicFlags::FLEXIBLE,
2758        )
2759    }
2760}
2761
2762#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2763pub struct MinidumpIteratorMarker;
2764
2765impl fidl::endpoints::ProtocolMarker for MinidumpIteratorMarker {
2766    type Proxy = MinidumpIteratorProxy;
2767    type RequestStream = MinidumpIteratorRequestStream;
2768    #[cfg(target_os = "fuchsia")]
2769    type SynchronousProxy = MinidumpIteratorSynchronousProxy;
2770
2771    const DEBUG_NAME: &'static str = "(anonymous) MinidumpIterator";
2772}
2773pub type MinidumpIteratorGetNextResult = Result<fidl::Vmo, MinidumpError>;
2774
2775pub trait MinidumpIteratorProxyInterface: Send + Sync {
2776    type GetNextResponseFut: std::future::Future<Output = Result<MinidumpIteratorGetNextResult, fidl::Error>>
2777        + Send;
2778    fn r#get_next(&self) -> Self::GetNextResponseFut;
2779}
2780#[derive(Debug)]
2781#[cfg(target_os = "fuchsia")]
2782pub struct MinidumpIteratorSynchronousProxy {
2783    client: fidl::client::sync::Client,
2784}
2785
2786#[cfg(target_os = "fuchsia")]
2787impl fidl::endpoints::SynchronousProxy for MinidumpIteratorSynchronousProxy {
2788    type Proxy = MinidumpIteratorProxy;
2789    type Protocol = MinidumpIteratorMarker;
2790
2791    fn from_channel(inner: fidl::Channel) -> Self {
2792        Self::new(inner)
2793    }
2794
2795    fn into_channel(self) -> fidl::Channel {
2796        self.client.into_channel()
2797    }
2798
2799    fn as_channel(&self) -> &fidl::Channel {
2800        self.client.as_channel()
2801    }
2802}
2803
2804#[cfg(target_os = "fuchsia")]
2805impl MinidumpIteratorSynchronousProxy {
2806    pub fn new(channel: fidl::Channel) -> Self {
2807        let protocol_name = <MinidumpIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2808        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2809    }
2810
2811    pub fn into_channel(self) -> fidl::Channel {
2812        self.client.into_channel()
2813    }
2814
2815    /// Waits until an event arrives and returns it. It is safe for other
2816    /// threads to make concurrent requests while waiting for an event.
2817    pub fn wait_for_event(
2818        &self,
2819        deadline: zx::MonotonicInstant,
2820    ) -> Result<MinidumpIteratorEvent, fidl::Error> {
2821        MinidumpIteratorEvent::decode(self.client.wait_for_event(deadline)?)
2822    }
2823
2824    pub fn r#get_next(
2825        &self,
2826        ___deadline: zx::MonotonicInstant,
2827    ) -> Result<MinidumpIteratorGetNextResult, fidl::Error> {
2828        let _response =
2829            self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::ResultType<
2830                MinidumpIteratorGetNextResponse,
2831                MinidumpError,
2832            >>(
2833                (),
2834                0x3db055b61b8482dc,
2835                fidl::encoding::DynamicFlags::empty(),
2836                ___deadline,
2837            )?;
2838        Ok(_response.map(|x| x.minidump))
2839    }
2840}
2841
2842#[cfg(target_os = "fuchsia")]
2843impl From<MinidumpIteratorSynchronousProxy> for zx::Handle {
2844    fn from(value: MinidumpIteratorSynchronousProxy) -> Self {
2845        value.into_channel().into()
2846    }
2847}
2848
2849#[cfg(target_os = "fuchsia")]
2850impl From<fidl::Channel> for MinidumpIteratorSynchronousProxy {
2851    fn from(value: fidl::Channel) -> Self {
2852        Self::new(value)
2853    }
2854}
2855
2856#[derive(Debug, Clone)]
2857pub struct MinidumpIteratorProxy {
2858    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2859}
2860
2861impl fidl::endpoints::Proxy for MinidumpIteratorProxy {
2862    type Protocol = MinidumpIteratorMarker;
2863
2864    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2865        Self::new(inner)
2866    }
2867
2868    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2869        self.client.into_channel().map_err(|client| Self { client })
2870    }
2871
2872    fn as_channel(&self) -> &::fidl::AsyncChannel {
2873        self.client.as_channel()
2874    }
2875}
2876
2877impl MinidumpIteratorProxy {
2878    /// Create a new Proxy for fuchsia.debugger/MinidumpIterator.
2879    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2880        let protocol_name = <MinidumpIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2881        Self { client: fidl::client::Client::new(channel, protocol_name) }
2882    }
2883
2884    /// Get a Stream of events from the remote end of the protocol.
2885    ///
2886    /// # Panics
2887    ///
2888    /// Panics if the event stream was already taken.
2889    pub fn take_event_stream(&self) -> MinidumpIteratorEventStream {
2890        MinidumpIteratorEventStream { event_receiver: self.client.take_event_receiver() }
2891    }
2892
2893    pub fn r#get_next(
2894        &self,
2895    ) -> fidl::client::QueryResponseFut<
2896        MinidumpIteratorGetNextResult,
2897        fidl::encoding::DefaultFuchsiaResourceDialect,
2898    > {
2899        MinidumpIteratorProxyInterface::r#get_next(self)
2900    }
2901}
2902
2903impl MinidumpIteratorProxyInterface for MinidumpIteratorProxy {
2904    type GetNextResponseFut = fidl::client::QueryResponseFut<
2905        MinidumpIteratorGetNextResult,
2906        fidl::encoding::DefaultFuchsiaResourceDialect,
2907    >;
2908    fn r#get_next(&self) -> Self::GetNextResponseFut {
2909        fn _decode(
2910            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2911        ) -> Result<MinidumpIteratorGetNextResult, fidl::Error> {
2912            let _response = fidl::client::decode_transaction_body::<
2913                fidl::encoding::ResultType<MinidumpIteratorGetNextResponse, MinidumpError>,
2914                fidl::encoding::DefaultFuchsiaResourceDialect,
2915                0x3db055b61b8482dc,
2916            >(_buf?)?;
2917            Ok(_response.map(|x| x.minidump))
2918        }
2919        self.client
2920            .send_query_and_decode::<fidl::encoding::EmptyPayload, MinidumpIteratorGetNextResult>(
2921                (),
2922                0x3db055b61b8482dc,
2923                fidl::encoding::DynamicFlags::empty(),
2924                _decode,
2925            )
2926    }
2927}
2928
2929pub struct MinidumpIteratorEventStream {
2930    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2931}
2932
2933impl std::marker::Unpin for MinidumpIteratorEventStream {}
2934
2935impl futures::stream::FusedStream for MinidumpIteratorEventStream {
2936    fn is_terminated(&self) -> bool {
2937        self.event_receiver.is_terminated()
2938    }
2939}
2940
2941impl futures::Stream for MinidumpIteratorEventStream {
2942    type Item = Result<MinidumpIteratorEvent, fidl::Error>;
2943
2944    fn poll_next(
2945        mut self: std::pin::Pin<&mut Self>,
2946        cx: &mut std::task::Context<'_>,
2947    ) -> std::task::Poll<Option<Self::Item>> {
2948        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2949            &mut self.event_receiver,
2950            cx
2951        )?) {
2952            Some(buf) => std::task::Poll::Ready(Some(MinidumpIteratorEvent::decode(buf))),
2953            None => std::task::Poll::Ready(None),
2954        }
2955    }
2956}
2957
2958#[derive(Debug)]
2959pub enum MinidumpIteratorEvent {}
2960
2961impl MinidumpIteratorEvent {
2962    /// Decodes a message buffer as a [`MinidumpIteratorEvent`].
2963    fn decode(
2964        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2965    ) -> Result<MinidumpIteratorEvent, fidl::Error> {
2966        let (bytes, _handles) = buf.split_mut();
2967        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2968        debug_assert_eq!(tx_header.tx_id, 0);
2969        match tx_header.ordinal {
2970            _ => Err(fidl::Error::UnknownOrdinal {
2971                ordinal: tx_header.ordinal,
2972                protocol_name:
2973                    <MinidumpIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2974            }),
2975        }
2976    }
2977}
2978
2979/// A Stream of incoming requests for fuchsia.debugger/MinidumpIterator.
2980pub struct MinidumpIteratorRequestStream {
2981    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2982    is_terminated: bool,
2983}
2984
2985impl std::marker::Unpin for MinidumpIteratorRequestStream {}
2986
2987impl futures::stream::FusedStream for MinidumpIteratorRequestStream {
2988    fn is_terminated(&self) -> bool {
2989        self.is_terminated
2990    }
2991}
2992
2993impl fidl::endpoints::RequestStream for MinidumpIteratorRequestStream {
2994    type Protocol = MinidumpIteratorMarker;
2995    type ControlHandle = MinidumpIteratorControlHandle;
2996
2997    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2998        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2999    }
3000
3001    fn control_handle(&self) -> Self::ControlHandle {
3002        MinidumpIteratorControlHandle { inner: self.inner.clone() }
3003    }
3004
3005    fn into_inner(
3006        self,
3007    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3008    {
3009        (self.inner, self.is_terminated)
3010    }
3011
3012    fn from_inner(
3013        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3014        is_terminated: bool,
3015    ) -> Self {
3016        Self { inner, is_terminated }
3017    }
3018}
3019
3020impl futures::Stream for MinidumpIteratorRequestStream {
3021    type Item = Result<MinidumpIteratorRequest, fidl::Error>;
3022
3023    fn poll_next(
3024        mut self: std::pin::Pin<&mut Self>,
3025        cx: &mut std::task::Context<'_>,
3026    ) -> std::task::Poll<Option<Self::Item>> {
3027        let this = &mut *self;
3028        if this.inner.check_shutdown(cx) {
3029            this.is_terminated = true;
3030            return std::task::Poll::Ready(None);
3031        }
3032        if this.is_terminated {
3033            panic!("polled MinidumpIteratorRequestStream after completion");
3034        }
3035        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3036            |bytes, handles| {
3037                match this.inner.channel().read_etc(cx, bytes, handles) {
3038                    std::task::Poll::Ready(Ok(())) => {}
3039                    std::task::Poll::Pending => return std::task::Poll::Pending,
3040                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3041                        this.is_terminated = true;
3042                        return std::task::Poll::Ready(None);
3043                    }
3044                    std::task::Poll::Ready(Err(e)) => {
3045                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3046                            e.into(),
3047                        ))))
3048                    }
3049                }
3050
3051                // A message has been received from the channel
3052                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3053
3054                std::task::Poll::Ready(Some(match header.ordinal {
3055                    0x3db055b61b8482dc => {
3056                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3057                        let mut req = fidl::new_empty!(
3058                            fidl::encoding::EmptyPayload,
3059                            fidl::encoding::DefaultFuchsiaResourceDialect
3060                        );
3061                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3062                        let control_handle =
3063                            MinidumpIteratorControlHandle { inner: this.inner.clone() };
3064                        Ok(MinidumpIteratorRequest::GetNext {
3065                            responder: MinidumpIteratorGetNextResponder {
3066                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3067                                tx_id: header.tx_id,
3068                            },
3069                        })
3070                    }
3071                    _ => Err(fidl::Error::UnknownOrdinal {
3072                        ordinal: header.ordinal,
3073                        protocol_name:
3074                            <MinidumpIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3075                    }),
3076                }))
3077            },
3078        )
3079    }
3080}
3081
3082/// An iterator that collects and returns a minidump for a set of processes. An
3083/// empty VMO will be returned when there are no more processes.
3084#[derive(Debug)]
3085pub enum MinidumpIteratorRequest {
3086    GetNext { responder: MinidumpIteratorGetNextResponder },
3087}
3088
3089impl MinidumpIteratorRequest {
3090    #[allow(irrefutable_let_patterns)]
3091    pub fn into_get_next(self) -> Option<(MinidumpIteratorGetNextResponder)> {
3092        if let MinidumpIteratorRequest::GetNext { responder } = self {
3093            Some((responder))
3094        } else {
3095            None
3096        }
3097    }
3098
3099    /// Name of the method defined in FIDL
3100    pub fn method_name(&self) -> &'static str {
3101        match *self {
3102            MinidumpIteratorRequest::GetNext { .. } => "get_next",
3103        }
3104    }
3105}
3106
3107#[derive(Debug, Clone)]
3108pub struct MinidumpIteratorControlHandle {
3109    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3110}
3111
3112impl fidl::endpoints::ControlHandle for MinidumpIteratorControlHandle {
3113    fn shutdown(&self) {
3114        self.inner.shutdown()
3115    }
3116    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3117        self.inner.shutdown_with_epitaph(status)
3118    }
3119
3120    fn is_closed(&self) -> bool {
3121        self.inner.channel().is_closed()
3122    }
3123    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3124        self.inner.channel().on_closed()
3125    }
3126
3127    #[cfg(target_os = "fuchsia")]
3128    fn signal_peer(
3129        &self,
3130        clear_mask: zx::Signals,
3131        set_mask: zx::Signals,
3132    ) -> Result<(), zx_status::Status> {
3133        use fidl::Peered;
3134        self.inner.channel().signal_peer(clear_mask, set_mask)
3135    }
3136}
3137
3138impl MinidumpIteratorControlHandle {}
3139
3140#[must_use = "FIDL methods require a response to be sent"]
3141#[derive(Debug)]
3142pub struct MinidumpIteratorGetNextResponder {
3143    control_handle: std::mem::ManuallyDrop<MinidumpIteratorControlHandle>,
3144    tx_id: u32,
3145}
3146
3147/// Set the the channel to be shutdown (see [`MinidumpIteratorControlHandle::shutdown`])
3148/// if the responder is dropped without sending a response, so that the client
3149/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3150impl std::ops::Drop for MinidumpIteratorGetNextResponder {
3151    fn drop(&mut self) {
3152        self.control_handle.shutdown();
3153        // Safety: drops once, never accessed again
3154        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3155    }
3156}
3157
3158impl fidl::endpoints::Responder for MinidumpIteratorGetNextResponder {
3159    type ControlHandle = MinidumpIteratorControlHandle;
3160
3161    fn control_handle(&self) -> &MinidumpIteratorControlHandle {
3162        &self.control_handle
3163    }
3164
3165    fn drop_without_shutdown(mut self) {
3166        // Safety: drops once, never accessed again due to mem::forget
3167        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3168        // Prevent Drop from running (which would shut down the channel)
3169        std::mem::forget(self);
3170    }
3171}
3172
3173impl MinidumpIteratorGetNextResponder {
3174    /// Sends a response to the FIDL transaction.
3175    ///
3176    /// Sets the channel to shutdown if an error occurs.
3177    pub fn send(self, mut result: Result<fidl::Vmo, MinidumpError>) -> Result<(), fidl::Error> {
3178        let _result = self.send_raw(result);
3179        if _result.is_err() {
3180            self.control_handle.shutdown();
3181        }
3182        self.drop_without_shutdown();
3183        _result
3184    }
3185
3186    /// Similar to "send" but does not shutdown the channel if an error occurs.
3187    pub fn send_no_shutdown_on_err(
3188        self,
3189        mut result: Result<fidl::Vmo, MinidumpError>,
3190    ) -> Result<(), fidl::Error> {
3191        let _result = self.send_raw(result);
3192        self.drop_without_shutdown();
3193        _result
3194    }
3195
3196    fn send_raw(&self, mut result: Result<fidl::Vmo, MinidumpError>) -> Result<(), fidl::Error> {
3197        self.control_handle.inner.send::<fidl::encoding::ResultType<
3198            MinidumpIteratorGetNextResponse,
3199            MinidumpError,
3200        >>(
3201            result.map(|minidump| (minidump,)),
3202            self.tx_id,
3203            0x3db055b61b8482dc,
3204            fidl::encoding::DynamicFlags::empty(),
3205        )
3206    }
3207}
3208
3209#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3210pub struct ProcessInfoIteratorMarker;
3211
3212impl fidl::endpoints::ProtocolMarker for ProcessInfoIteratorMarker {
3213    type Proxy = ProcessInfoIteratorProxy;
3214    type RequestStream = ProcessInfoIteratorRequestStream;
3215    #[cfg(target_os = "fuchsia")]
3216    type SynchronousProxy = ProcessInfoIteratorSynchronousProxy;
3217
3218    const DEBUG_NAME: &'static str = "(anonymous) ProcessInfoIterator";
3219}
3220pub type ProcessInfoIteratorGetNextResult = Result<Vec<ProcessInfo>, ProcessInfoError>;
3221
3222pub trait ProcessInfoIteratorProxyInterface: Send + Sync {
3223    type GetNextResponseFut: std::future::Future<Output = Result<ProcessInfoIteratorGetNextResult, fidl::Error>>
3224        + Send;
3225    fn r#get_next(&self) -> Self::GetNextResponseFut;
3226}
3227#[derive(Debug)]
3228#[cfg(target_os = "fuchsia")]
3229pub struct ProcessInfoIteratorSynchronousProxy {
3230    client: fidl::client::sync::Client,
3231}
3232
3233#[cfg(target_os = "fuchsia")]
3234impl fidl::endpoints::SynchronousProxy for ProcessInfoIteratorSynchronousProxy {
3235    type Proxy = ProcessInfoIteratorProxy;
3236    type Protocol = ProcessInfoIteratorMarker;
3237
3238    fn from_channel(inner: fidl::Channel) -> Self {
3239        Self::new(inner)
3240    }
3241
3242    fn into_channel(self) -> fidl::Channel {
3243        self.client.into_channel()
3244    }
3245
3246    fn as_channel(&self) -> &fidl::Channel {
3247        self.client.as_channel()
3248    }
3249}
3250
3251#[cfg(target_os = "fuchsia")]
3252impl ProcessInfoIteratorSynchronousProxy {
3253    pub fn new(channel: fidl::Channel) -> Self {
3254        let protocol_name =
3255            <ProcessInfoIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3256        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
3257    }
3258
3259    pub fn into_channel(self) -> fidl::Channel {
3260        self.client.into_channel()
3261    }
3262
3263    /// Waits until an event arrives and returns it. It is safe for other
3264    /// threads to make concurrent requests while waiting for an event.
3265    pub fn wait_for_event(
3266        &self,
3267        deadline: zx::MonotonicInstant,
3268    ) -> Result<ProcessInfoIteratorEvent, fidl::Error> {
3269        ProcessInfoIteratorEvent::decode(self.client.wait_for_event(deadline)?)
3270    }
3271
3272    /// Collects information about the next attached thread. There is no
3273    /// guarantee of order of processes, but all threads from a given process
3274    /// will be iterated before another process's threads.
3275    pub fn r#get_next(
3276        &self,
3277        ___deadline: zx::MonotonicInstant,
3278    ) -> Result<ProcessInfoIteratorGetNextResult, fidl::Error> {
3279        let _response =
3280            self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::ResultType<
3281                ProcessInfoIteratorGetNextResponse,
3282                ProcessInfoError,
3283            >>(
3284                (),
3285                0x527e289fe635bcc,
3286                fidl::encoding::DynamicFlags::empty(),
3287                ___deadline,
3288            )?;
3289        Ok(_response.map(|x| x.info))
3290    }
3291}
3292
3293#[cfg(target_os = "fuchsia")]
3294impl From<ProcessInfoIteratorSynchronousProxy> for zx::Handle {
3295    fn from(value: ProcessInfoIteratorSynchronousProxy) -> Self {
3296        value.into_channel().into()
3297    }
3298}
3299
3300#[cfg(target_os = "fuchsia")]
3301impl From<fidl::Channel> for ProcessInfoIteratorSynchronousProxy {
3302    fn from(value: fidl::Channel) -> Self {
3303        Self::new(value)
3304    }
3305}
3306
3307#[derive(Debug, Clone)]
3308pub struct ProcessInfoIteratorProxy {
3309    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3310}
3311
3312impl fidl::endpoints::Proxy for ProcessInfoIteratorProxy {
3313    type Protocol = ProcessInfoIteratorMarker;
3314
3315    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3316        Self::new(inner)
3317    }
3318
3319    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3320        self.client.into_channel().map_err(|client| Self { client })
3321    }
3322
3323    fn as_channel(&self) -> &::fidl::AsyncChannel {
3324        self.client.as_channel()
3325    }
3326}
3327
3328impl ProcessInfoIteratorProxy {
3329    /// Create a new Proxy for fuchsia.debugger/ProcessInfoIterator.
3330    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3331        let protocol_name =
3332            <ProcessInfoIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3333        Self { client: fidl::client::Client::new(channel, protocol_name) }
3334    }
3335
3336    /// Get a Stream of events from the remote end of the protocol.
3337    ///
3338    /// # Panics
3339    ///
3340    /// Panics if the event stream was already taken.
3341    pub fn take_event_stream(&self) -> ProcessInfoIteratorEventStream {
3342        ProcessInfoIteratorEventStream { event_receiver: self.client.take_event_receiver() }
3343    }
3344
3345    /// Collects information about the next attached thread. There is no
3346    /// guarantee of order of processes, but all threads from a given process
3347    /// will be iterated before another process's threads.
3348    pub fn r#get_next(
3349        &self,
3350    ) -> fidl::client::QueryResponseFut<
3351        ProcessInfoIteratorGetNextResult,
3352        fidl::encoding::DefaultFuchsiaResourceDialect,
3353    > {
3354        ProcessInfoIteratorProxyInterface::r#get_next(self)
3355    }
3356}
3357
3358impl ProcessInfoIteratorProxyInterface for ProcessInfoIteratorProxy {
3359    type GetNextResponseFut = fidl::client::QueryResponseFut<
3360        ProcessInfoIteratorGetNextResult,
3361        fidl::encoding::DefaultFuchsiaResourceDialect,
3362    >;
3363    fn r#get_next(&self) -> Self::GetNextResponseFut {
3364        fn _decode(
3365            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3366        ) -> Result<ProcessInfoIteratorGetNextResult, fidl::Error> {
3367            let _response = fidl::client::decode_transaction_body::<
3368                fidl::encoding::ResultType<ProcessInfoIteratorGetNextResponse, ProcessInfoError>,
3369                fidl::encoding::DefaultFuchsiaResourceDialect,
3370                0x527e289fe635bcc,
3371            >(_buf?)?;
3372            Ok(_response.map(|x| x.info))
3373        }
3374        self.client.send_query_and_decode::<
3375            fidl::encoding::EmptyPayload,
3376            ProcessInfoIteratorGetNextResult,
3377        >(
3378            (),
3379            0x527e289fe635bcc,
3380            fidl::encoding::DynamicFlags::empty(),
3381            _decode,
3382        )
3383    }
3384}
3385
3386pub struct ProcessInfoIteratorEventStream {
3387    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3388}
3389
3390impl std::marker::Unpin for ProcessInfoIteratorEventStream {}
3391
3392impl futures::stream::FusedStream for ProcessInfoIteratorEventStream {
3393    fn is_terminated(&self) -> bool {
3394        self.event_receiver.is_terminated()
3395    }
3396}
3397
3398impl futures::Stream for ProcessInfoIteratorEventStream {
3399    type Item = Result<ProcessInfoIteratorEvent, fidl::Error>;
3400
3401    fn poll_next(
3402        mut self: std::pin::Pin<&mut Self>,
3403        cx: &mut std::task::Context<'_>,
3404    ) -> std::task::Poll<Option<Self::Item>> {
3405        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3406            &mut self.event_receiver,
3407            cx
3408        )?) {
3409            Some(buf) => std::task::Poll::Ready(Some(ProcessInfoIteratorEvent::decode(buf))),
3410            None => std::task::Poll::Ready(None),
3411        }
3412    }
3413}
3414
3415#[derive(Debug)]
3416pub enum ProcessInfoIteratorEvent {}
3417
3418impl ProcessInfoIteratorEvent {
3419    /// Decodes a message buffer as a [`ProcessInfoIteratorEvent`].
3420    fn decode(
3421        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3422    ) -> Result<ProcessInfoIteratorEvent, fidl::Error> {
3423        let (bytes, _handles) = buf.split_mut();
3424        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3425        debug_assert_eq!(tx_header.tx_id, 0);
3426        match tx_header.ordinal {
3427            _ => Err(fidl::Error::UnknownOrdinal {
3428                ordinal: tx_header.ordinal,
3429                protocol_name:
3430                    <ProcessInfoIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3431            }),
3432        }
3433    }
3434}
3435
3436/// A Stream of incoming requests for fuchsia.debugger/ProcessInfoIterator.
3437pub struct ProcessInfoIteratorRequestStream {
3438    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3439    is_terminated: bool,
3440}
3441
3442impl std::marker::Unpin for ProcessInfoIteratorRequestStream {}
3443
3444impl futures::stream::FusedStream for ProcessInfoIteratorRequestStream {
3445    fn is_terminated(&self) -> bool {
3446        self.is_terminated
3447    }
3448}
3449
3450impl fidl::endpoints::RequestStream for ProcessInfoIteratorRequestStream {
3451    type Protocol = ProcessInfoIteratorMarker;
3452    type ControlHandle = ProcessInfoIteratorControlHandle;
3453
3454    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3455        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3456    }
3457
3458    fn control_handle(&self) -> Self::ControlHandle {
3459        ProcessInfoIteratorControlHandle { inner: self.inner.clone() }
3460    }
3461
3462    fn into_inner(
3463        self,
3464    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3465    {
3466        (self.inner, self.is_terminated)
3467    }
3468
3469    fn from_inner(
3470        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3471        is_terminated: bool,
3472    ) -> Self {
3473        Self { inner, is_terminated }
3474    }
3475}
3476
3477impl futures::Stream for ProcessInfoIteratorRequestStream {
3478    type Item = Result<ProcessInfoIteratorRequest, fidl::Error>;
3479
3480    fn poll_next(
3481        mut self: std::pin::Pin<&mut Self>,
3482        cx: &mut std::task::Context<'_>,
3483    ) -> std::task::Poll<Option<Self::Item>> {
3484        let this = &mut *self;
3485        if this.inner.check_shutdown(cx) {
3486            this.is_terminated = true;
3487            return std::task::Poll::Ready(None);
3488        }
3489        if this.is_terminated {
3490            panic!("polled ProcessInfoIteratorRequestStream after completion");
3491        }
3492        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3493            |bytes, handles| {
3494                match this.inner.channel().read_etc(cx, bytes, handles) {
3495                    std::task::Poll::Ready(Ok(())) => {}
3496                    std::task::Poll::Pending => return std::task::Poll::Pending,
3497                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3498                        this.is_terminated = true;
3499                        return std::task::Poll::Ready(None);
3500                    }
3501                    std::task::Poll::Ready(Err(e)) => {
3502                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3503                            e.into(),
3504                        ))))
3505                    }
3506                }
3507
3508                // A message has been received from the channel
3509                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3510
3511                std::task::Poll::Ready(Some(match header.ordinal {
3512                0x527e289fe635bcc => {
3513                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3514                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
3515                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3516                    let control_handle = ProcessInfoIteratorControlHandle {
3517                        inner: this.inner.clone(),
3518                    };
3519                    Ok(ProcessInfoIteratorRequest::GetNext {
3520                        responder: ProcessInfoIteratorGetNextResponder {
3521                            control_handle: std::mem::ManuallyDrop::new(control_handle),
3522                            tx_id: header.tx_id,
3523                        },
3524                    })
3525                }
3526                _ => Err(fidl::Error::UnknownOrdinal {
3527                    ordinal: header.ordinal,
3528                    protocol_name: <ProcessInfoIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3529                }),
3530            }))
3531            },
3532        )
3533    }
3534}
3535
3536/// Collects details from all threads of all attached processes. The exact
3537/// details that are yielded from the iterator are controlled via
3538/// ThreadDetailsInterest passed to |GetProcessInfo|. The iterator will yield an
3539/// empty vector after all attached process' threads have been iterated. It is
3540/// an error if there are no processes supplied to this iterator, which could be
3541/// from too restrictive of a filter passed to |GetProcessInfo| or DebugAgent is
3542/// not attached to anything.
3543///
3544/// This iteration is inherently racy, there is no way for DebugAgent to prevent
3545/// other system entities from causing a process or thread to disappear while we
3546/// are traversing them, so it's possible for this iterator to return errors
3547/// when those threads or processes have been destroyed. These are not fatal
3548/// errors, but can happen multiple times in one iteration.
3549///
3550/// For example, take this process structure, and assume DebugAgent is attached
3551/// to everything:
3552///
3553/// pr: "process-1" 1234
3554///   t: "pr1234-t1" 1
3555///   t: "pr1234-t2" 2
3556/// pr: "process-2" 2345
3557///   t: "pr2345-t1" 3
3558///
3559/// If "process-1" is killed after "pr1234-t1" is yielded, but before
3560/// "pr1234-t2" is yielded, a THREAD_GONE error will be returned on the next
3561/// |GetNext| call. Calling |GetNext| again will yield "pr2345-t1".
3562#[derive(Debug)]
3563pub enum ProcessInfoIteratorRequest {
3564    /// Collects information about the next attached thread. There is no
3565    /// guarantee of order of processes, but all threads from a given process
3566    /// will be iterated before another process's threads.
3567    GetNext { responder: ProcessInfoIteratorGetNextResponder },
3568}
3569
3570impl ProcessInfoIteratorRequest {
3571    #[allow(irrefutable_let_patterns)]
3572    pub fn into_get_next(self) -> Option<(ProcessInfoIteratorGetNextResponder)> {
3573        if let ProcessInfoIteratorRequest::GetNext { responder } = self {
3574            Some((responder))
3575        } else {
3576            None
3577        }
3578    }
3579
3580    /// Name of the method defined in FIDL
3581    pub fn method_name(&self) -> &'static str {
3582        match *self {
3583            ProcessInfoIteratorRequest::GetNext { .. } => "get_next",
3584        }
3585    }
3586}
3587
3588#[derive(Debug, Clone)]
3589pub struct ProcessInfoIteratorControlHandle {
3590    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3591}
3592
3593impl fidl::endpoints::ControlHandle for ProcessInfoIteratorControlHandle {
3594    fn shutdown(&self) {
3595        self.inner.shutdown()
3596    }
3597    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3598        self.inner.shutdown_with_epitaph(status)
3599    }
3600
3601    fn is_closed(&self) -> bool {
3602        self.inner.channel().is_closed()
3603    }
3604    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3605        self.inner.channel().on_closed()
3606    }
3607
3608    #[cfg(target_os = "fuchsia")]
3609    fn signal_peer(
3610        &self,
3611        clear_mask: zx::Signals,
3612        set_mask: zx::Signals,
3613    ) -> Result<(), zx_status::Status> {
3614        use fidl::Peered;
3615        self.inner.channel().signal_peer(clear_mask, set_mask)
3616    }
3617}
3618
3619impl ProcessInfoIteratorControlHandle {}
3620
3621#[must_use = "FIDL methods require a response to be sent"]
3622#[derive(Debug)]
3623pub struct ProcessInfoIteratorGetNextResponder {
3624    control_handle: std::mem::ManuallyDrop<ProcessInfoIteratorControlHandle>,
3625    tx_id: u32,
3626}
3627
3628/// Set the the channel to be shutdown (see [`ProcessInfoIteratorControlHandle::shutdown`])
3629/// if the responder is dropped without sending a response, so that the client
3630/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3631impl std::ops::Drop for ProcessInfoIteratorGetNextResponder {
3632    fn drop(&mut self) {
3633        self.control_handle.shutdown();
3634        // Safety: drops once, never accessed again
3635        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3636    }
3637}
3638
3639impl fidl::endpoints::Responder for ProcessInfoIteratorGetNextResponder {
3640    type ControlHandle = ProcessInfoIteratorControlHandle;
3641
3642    fn control_handle(&self) -> &ProcessInfoIteratorControlHandle {
3643        &self.control_handle
3644    }
3645
3646    fn drop_without_shutdown(mut self) {
3647        // Safety: drops once, never accessed again due to mem::forget
3648        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3649        // Prevent Drop from running (which would shut down the channel)
3650        std::mem::forget(self);
3651    }
3652}
3653
3654impl ProcessInfoIteratorGetNextResponder {
3655    /// Sends a response to the FIDL transaction.
3656    ///
3657    /// Sets the channel to shutdown if an error occurs.
3658    pub fn send(
3659        self,
3660        mut result: Result<&[ProcessInfo], ProcessInfoError>,
3661    ) -> Result<(), fidl::Error> {
3662        let _result = self.send_raw(result);
3663        if _result.is_err() {
3664            self.control_handle.shutdown();
3665        }
3666        self.drop_without_shutdown();
3667        _result
3668    }
3669
3670    /// Similar to "send" but does not shutdown the channel if an error occurs.
3671    pub fn send_no_shutdown_on_err(
3672        self,
3673        mut result: Result<&[ProcessInfo], ProcessInfoError>,
3674    ) -> Result<(), fidl::Error> {
3675        let _result = self.send_raw(result);
3676        self.drop_without_shutdown();
3677        _result
3678    }
3679
3680    fn send_raw(
3681        &self,
3682        mut result: Result<&[ProcessInfo], ProcessInfoError>,
3683    ) -> Result<(), fidl::Error> {
3684        self.control_handle.inner.send::<fidl::encoding::ResultType<
3685            ProcessInfoIteratorGetNextResponse,
3686            ProcessInfoError,
3687        >>(
3688            result.map(|info| (info,)),
3689            self.tx_id,
3690            0x527e289fe635bcc,
3691            fidl::encoding::DynamicFlags::empty(),
3692        )
3693    }
3694}
3695
3696mod internal {
3697    use super::*;
3698
3699    impl fidl::encoding::ResourceTypeMarker for Agent {
3700        type Borrowed<'a> = &'a mut Self;
3701        fn take_or_borrow<'a>(
3702            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3703        ) -> Self::Borrowed<'a> {
3704            value
3705        }
3706    }
3707
3708    unsafe impl fidl::encoding::TypeMarker for Agent {
3709        type Owned = Self;
3710
3711        #[inline(always)]
3712        fn inline_align(_context: fidl::encoding::Context) -> usize {
3713            8
3714        }
3715
3716        #[inline(always)]
3717        fn inline_size(_context: fidl::encoding::Context) -> usize {
3718            24
3719        }
3720    }
3721
3722    unsafe impl fidl::encoding::Encode<Agent, fidl::encoding::DefaultFuchsiaResourceDialect>
3723        for &mut Agent
3724    {
3725        #[inline]
3726        unsafe fn encode(
3727            self,
3728            encoder: &mut fidl::encoding::Encoder<
3729                '_,
3730                fidl::encoding::DefaultFuchsiaResourceDialect,
3731            >,
3732            offset: usize,
3733            _depth: fidl::encoding::Depth,
3734        ) -> fidl::Result<()> {
3735            encoder.debug_check_bounds::<Agent>(offset);
3736            // Delegate to tuple encoding.
3737            fidl::encoding::Encode::<Agent, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
3738                (
3739                    <fidl::encoding::BoundedString<1024> as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
3740                    <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<DebugAgentMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.client_end),
3741                ),
3742                encoder, offset, _depth
3743            )
3744        }
3745    }
3746    unsafe impl<
3747            T0: fidl::encoding::Encode<
3748                fidl::encoding::BoundedString<1024>,
3749                fidl::encoding::DefaultFuchsiaResourceDialect,
3750            >,
3751            T1: fidl::encoding::Encode<
3752                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<DebugAgentMarker>>,
3753                fidl::encoding::DefaultFuchsiaResourceDialect,
3754            >,
3755        > fidl::encoding::Encode<Agent, fidl::encoding::DefaultFuchsiaResourceDialect>
3756        for (T0, T1)
3757    {
3758        #[inline]
3759        unsafe fn encode(
3760            self,
3761            encoder: &mut fidl::encoding::Encoder<
3762                '_,
3763                fidl::encoding::DefaultFuchsiaResourceDialect,
3764            >,
3765            offset: usize,
3766            depth: fidl::encoding::Depth,
3767        ) -> fidl::Result<()> {
3768            encoder.debug_check_bounds::<Agent>(offset);
3769            // Zero out padding regions. There's no need to apply masks
3770            // because the unmasked parts will be overwritten by fields.
3771            unsafe {
3772                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
3773                (ptr as *mut u64).write_unaligned(0);
3774            }
3775            // Write the fields.
3776            self.0.encode(encoder, offset + 0, depth)?;
3777            self.1.encode(encoder, offset + 16, depth)?;
3778            Ok(())
3779        }
3780    }
3781
3782    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for Agent {
3783        #[inline(always)]
3784        fn new_empty() -> Self {
3785            Self {
3786                name: fidl::new_empty!(
3787                    fidl::encoding::BoundedString<1024>,
3788                    fidl::encoding::DefaultFuchsiaResourceDialect
3789                ),
3790                client_end: fidl::new_empty!(
3791                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<DebugAgentMarker>>,
3792                    fidl::encoding::DefaultFuchsiaResourceDialect
3793                ),
3794            }
3795        }
3796
3797        #[inline]
3798        unsafe fn decode(
3799            &mut self,
3800            decoder: &mut fidl::encoding::Decoder<
3801                '_,
3802                fidl::encoding::DefaultFuchsiaResourceDialect,
3803            >,
3804            offset: usize,
3805            _depth: fidl::encoding::Depth,
3806        ) -> fidl::Result<()> {
3807            decoder.debug_check_bounds::<Self>(offset);
3808            // Verify that padding bytes are zero.
3809            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
3810            let padval = unsafe { (ptr as *const u64).read_unaligned() };
3811            let mask = 0xffffffff00000000u64;
3812            let maskedval = padval & mask;
3813            if maskedval != 0 {
3814                return Err(fidl::Error::NonZeroPadding {
3815                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
3816                });
3817            }
3818            fidl::decode!(
3819                fidl::encoding::BoundedString<1024>,
3820                fidl::encoding::DefaultFuchsiaResourceDialect,
3821                &mut self.name,
3822                decoder,
3823                offset + 0,
3824                _depth
3825            )?;
3826            fidl::decode!(
3827                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<DebugAgentMarker>>,
3828                fidl::encoding::DefaultFuchsiaResourceDialect,
3829                &mut self.client_end,
3830                decoder,
3831                offset + 16,
3832                _depth
3833            )?;
3834            Ok(())
3835        }
3836    }
3837
3838    impl fidl::encoding::ResourceTypeMarker for AgentIteratorGetNextResponse {
3839        type Borrowed<'a> = &'a mut Self;
3840        fn take_or_borrow<'a>(
3841            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3842        ) -> Self::Borrowed<'a> {
3843            value
3844        }
3845    }
3846
3847    unsafe impl fidl::encoding::TypeMarker for AgentIteratorGetNextResponse {
3848        type Owned = Self;
3849
3850        #[inline(always)]
3851        fn inline_align(_context: fidl::encoding::Context) -> usize {
3852            8
3853        }
3854
3855        #[inline(always)]
3856        fn inline_size(_context: fidl::encoding::Context) -> usize {
3857            16
3858        }
3859    }
3860
3861    unsafe impl
3862        fidl::encoding::Encode<
3863            AgentIteratorGetNextResponse,
3864            fidl::encoding::DefaultFuchsiaResourceDialect,
3865        > for &mut AgentIteratorGetNextResponse
3866    {
3867        #[inline]
3868        unsafe fn encode(
3869            self,
3870            encoder: &mut fidl::encoding::Encoder<
3871                '_,
3872                fidl::encoding::DefaultFuchsiaResourceDialect,
3873            >,
3874            offset: usize,
3875            _depth: fidl::encoding::Depth,
3876        ) -> fidl::Result<()> {
3877            encoder.debug_check_bounds::<AgentIteratorGetNextResponse>(offset);
3878            // Delegate to tuple encoding.
3879            fidl::encoding::Encode::<AgentIteratorGetNextResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
3880                (
3881                    <fidl::encoding::UnboundedVector<Agent> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.agents),
3882                ),
3883                encoder, offset, _depth
3884            )
3885        }
3886    }
3887    unsafe impl<
3888            T0: fidl::encoding::Encode<
3889                fidl::encoding::UnboundedVector<Agent>,
3890                fidl::encoding::DefaultFuchsiaResourceDialect,
3891            >,
3892        >
3893        fidl::encoding::Encode<
3894            AgentIteratorGetNextResponse,
3895            fidl::encoding::DefaultFuchsiaResourceDialect,
3896        > for (T0,)
3897    {
3898        #[inline]
3899        unsafe fn encode(
3900            self,
3901            encoder: &mut fidl::encoding::Encoder<
3902                '_,
3903                fidl::encoding::DefaultFuchsiaResourceDialect,
3904            >,
3905            offset: usize,
3906            depth: fidl::encoding::Depth,
3907        ) -> fidl::Result<()> {
3908            encoder.debug_check_bounds::<AgentIteratorGetNextResponse>(offset);
3909            // Zero out padding regions. There's no need to apply masks
3910            // because the unmasked parts will be overwritten by fields.
3911            // Write the fields.
3912            self.0.encode(encoder, offset + 0, depth)?;
3913            Ok(())
3914        }
3915    }
3916
3917    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3918        for AgentIteratorGetNextResponse
3919    {
3920        #[inline(always)]
3921        fn new_empty() -> Self {
3922            Self {
3923                agents: fidl::new_empty!(
3924                    fidl::encoding::UnboundedVector<Agent>,
3925                    fidl::encoding::DefaultFuchsiaResourceDialect
3926                ),
3927            }
3928        }
3929
3930        #[inline]
3931        unsafe fn decode(
3932            &mut self,
3933            decoder: &mut fidl::encoding::Decoder<
3934                '_,
3935                fidl::encoding::DefaultFuchsiaResourceDialect,
3936            >,
3937            offset: usize,
3938            _depth: fidl::encoding::Depth,
3939        ) -> fidl::Result<()> {
3940            decoder.debug_check_bounds::<Self>(offset);
3941            // Verify that padding bytes are zero.
3942            fidl::decode!(
3943                fidl::encoding::UnboundedVector<Agent>,
3944                fidl::encoding::DefaultFuchsiaResourceDialect,
3945                &mut self.agents,
3946                decoder,
3947                offset + 0,
3948                _depth
3949            )?;
3950            Ok(())
3951        }
3952    }
3953
3954    impl fidl::encoding::ResourceTypeMarker for DebugAgentConnectRequest {
3955        type Borrowed<'a> = &'a mut Self;
3956        fn take_or_borrow<'a>(
3957            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3958        ) -> Self::Borrowed<'a> {
3959            value
3960        }
3961    }
3962
3963    unsafe impl fidl::encoding::TypeMarker for DebugAgentConnectRequest {
3964        type Owned = Self;
3965
3966        #[inline(always)]
3967        fn inline_align(_context: fidl::encoding::Context) -> usize {
3968            4
3969        }
3970
3971        #[inline(always)]
3972        fn inline_size(_context: fidl::encoding::Context) -> usize {
3973            4
3974        }
3975    }
3976
3977    unsafe impl
3978        fidl::encoding::Encode<
3979            DebugAgentConnectRequest,
3980            fidl::encoding::DefaultFuchsiaResourceDialect,
3981        > for &mut DebugAgentConnectRequest
3982    {
3983        #[inline]
3984        unsafe fn encode(
3985            self,
3986            encoder: &mut fidl::encoding::Encoder<
3987                '_,
3988                fidl::encoding::DefaultFuchsiaResourceDialect,
3989            >,
3990            offset: usize,
3991            _depth: fidl::encoding::Depth,
3992        ) -> fidl::Result<()> {
3993            encoder.debug_check_bounds::<DebugAgentConnectRequest>(offset);
3994            // Delegate to tuple encoding.
3995            fidl::encoding::Encode::<
3996                DebugAgentConnectRequest,
3997                fidl::encoding::DefaultFuchsiaResourceDialect,
3998            >::encode(
3999                (<fidl::encoding::HandleType<
4000                    fidl::Socket,
4001                    { fidl::ObjectType::SOCKET.into_raw() },
4002                    2147483648,
4003                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
4004                    &mut self.socket
4005                ),),
4006                encoder,
4007                offset,
4008                _depth,
4009            )
4010        }
4011    }
4012    unsafe impl<
4013            T0: fidl::encoding::Encode<
4014                fidl::encoding::HandleType<
4015                    fidl::Socket,
4016                    { fidl::ObjectType::SOCKET.into_raw() },
4017                    2147483648,
4018                >,
4019                fidl::encoding::DefaultFuchsiaResourceDialect,
4020            >,
4021        >
4022        fidl::encoding::Encode<
4023            DebugAgentConnectRequest,
4024            fidl::encoding::DefaultFuchsiaResourceDialect,
4025        > for (T0,)
4026    {
4027        #[inline]
4028        unsafe fn encode(
4029            self,
4030            encoder: &mut fidl::encoding::Encoder<
4031                '_,
4032                fidl::encoding::DefaultFuchsiaResourceDialect,
4033            >,
4034            offset: usize,
4035            depth: fidl::encoding::Depth,
4036        ) -> fidl::Result<()> {
4037            encoder.debug_check_bounds::<DebugAgentConnectRequest>(offset);
4038            // Zero out padding regions. There's no need to apply masks
4039            // because the unmasked parts will be overwritten by fields.
4040            // Write the fields.
4041            self.0.encode(encoder, offset + 0, depth)?;
4042            Ok(())
4043        }
4044    }
4045
4046    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4047        for DebugAgentConnectRequest
4048    {
4049        #[inline(always)]
4050        fn new_empty() -> Self {
4051            Self {
4052                socket: fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
4053            }
4054        }
4055
4056        #[inline]
4057        unsafe fn decode(
4058            &mut self,
4059            decoder: &mut fidl::encoding::Decoder<
4060                '_,
4061                fidl::encoding::DefaultFuchsiaResourceDialect,
4062            >,
4063            offset: usize,
4064            _depth: fidl::encoding::Depth,
4065        ) -> fidl::Result<()> {
4066            decoder.debug_check_bounds::<Self>(offset);
4067            // Verify that padding bytes are zero.
4068            fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.socket, decoder, offset + 0, _depth)?;
4069            Ok(())
4070        }
4071    }
4072
4073    impl fidl::encoding::ResourceTypeMarker for DebugAgentGetAttachedProcessesRequest {
4074        type Borrowed<'a> = &'a mut Self;
4075        fn take_or_borrow<'a>(
4076            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4077        ) -> Self::Borrowed<'a> {
4078            value
4079        }
4080    }
4081
4082    unsafe impl fidl::encoding::TypeMarker for DebugAgentGetAttachedProcessesRequest {
4083        type Owned = Self;
4084
4085        #[inline(always)]
4086        fn inline_align(_context: fidl::encoding::Context) -> usize {
4087            4
4088        }
4089
4090        #[inline(always)]
4091        fn inline_size(_context: fidl::encoding::Context) -> usize {
4092            4
4093        }
4094    }
4095
4096    unsafe impl
4097        fidl::encoding::Encode<
4098            DebugAgentGetAttachedProcessesRequest,
4099            fidl::encoding::DefaultFuchsiaResourceDialect,
4100        > for &mut DebugAgentGetAttachedProcessesRequest
4101    {
4102        #[inline]
4103        unsafe fn encode(
4104            self,
4105            encoder: &mut fidl::encoding::Encoder<
4106                '_,
4107                fidl::encoding::DefaultFuchsiaResourceDialect,
4108            >,
4109            offset: usize,
4110            _depth: fidl::encoding::Depth,
4111        ) -> fidl::Result<()> {
4112            encoder.debug_check_bounds::<DebugAgentGetAttachedProcessesRequest>(offset);
4113            // Delegate to tuple encoding.
4114            fidl::encoding::Encode::<
4115                DebugAgentGetAttachedProcessesRequest,
4116                fidl::encoding::DefaultFuchsiaResourceDialect,
4117            >::encode(
4118                (<fidl::encoding::Endpoint<
4119                    fidl::endpoints::ServerEnd<AttachedProcessIteratorMarker>,
4120                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
4121                    &mut self.iterator
4122                ),),
4123                encoder,
4124                offset,
4125                _depth,
4126            )
4127        }
4128    }
4129    unsafe impl<
4130            T0: fidl::encoding::Encode<
4131                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AttachedProcessIteratorMarker>>,
4132                fidl::encoding::DefaultFuchsiaResourceDialect,
4133            >,
4134        >
4135        fidl::encoding::Encode<
4136            DebugAgentGetAttachedProcessesRequest,
4137            fidl::encoding::DefaultFuchsiaResourceDialect,
4138        > for (T0,)
4139    {
4140        #[inline]
4141        unsafe fn encode(
4142            self,
4143            encoder: &mut fidl::encoding::Encoder<
4144                '_,
4145                fidl::encoding::DefaultFuchsiaResourceDialect,
4146            >,
4147            offset: usize,
4148            depth: fidl::encoding::Depth,
4149        ) -> fidl::Result<()> {
4150            encoder.debug_check_bounds::<DebugAgentGetAttachedProcessesRequest>(offset);
4151            // Zero out padding regions. There's no need to apply masks
4152            // because the unmasked parts will be overwritten by fields.
4153            // Write the fields.
4154            self.0.encode(encoder, offset + 0, depth)?;
4155            Ok(())
4156        }
4157    }
4158
4159    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4160        for DebugAgentGetAttachedProcessesRequest
4161    {
4162        #[inline(always)]
4163        fn new_empty() -> Self {
4164            Self {
4165                iterator: fidl::new_empty!(
4166                    fidl::encoding::Endpoint<
4167                        fidl::endpoints::ServerEnd<AttachedProcessIteratorMarker>,
4168                    >,
4169                    fidl::encoding::DefaultFuchsiaResourceDialect
4170                ),
4171            }
4172        }
4173
4174        #[inline]
4175        unsafe fn decode(
4176            &mut self,
4177            decoder: &mut fidl::encoding::Decoder<
4178                '_,
4179                fidl::encoding::DefaultFuchsiaResourceDialect,
4180            >,
4181            offset: usize,
4182            _depth: fidl::encoding::Depth,
4183        ) -> fidl::Result<()> {
4184            decoder.debug_check_bounds::<Self>(offset);
4185            // Verify that padding bytes are zero.
4186            fidl::decode!(
4187                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AttachedProcessIteratorMarker>>,
4188                fidl::encoding::DefaultFuchsiaResourceDialect,
4189                &mut self.iterator,
4190                decoder,
4191                offset + 0,
4192                _depth
4193            )?;
4194            Ok(())
4195        }
4196    }
4197
4198    impl fidl::encoding::ResourceTypeMarker for DebugAgentGetMinidumpsRequest {
4199        type Borrowed<'a> = &'a mut Self;
4200        fn take_or_borrow<'a>(
4201            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4202        ) -> Self::Borrowed<'a> {
4203            value
4204        }
4205    }
4206
4207    unsafe impl fidl::encoding::TypeMarker for DebugAgentGetMinidumpsRequest {
4208        type Owned = Self;
4209
4210        #[inline(always)]
4211        fn inline_align(_context: fidl::encoding::Context) -> usize {
4212            8
4213        }
4214
4215        #[inline(always)]
4216        fn inline_size(_context: fidl::encoding::Context) -> usize {
4217            24
4218        }
4219    }
4220
4221    unsafe impl
4222        fidl::encoding::Encode<
4223            DebugAgentGetMinidumpsRequest,
4224            fidl::encoding::DefaultFuchsiaResourceDialect,
4225        > for &mut DebugAgentGetMinidumpsRequest
4226    {
4227        #[inline]
4228        unsafe fn encode(
4229            self,
4230            encoder: &mut fidl::encoding::Encoder<
4231                '_,
4232                fidl::encoding::DefaultFuchsiaResourceDialect,
4233            >,
4234            offset: usize,
4235            _depth: fidl::encoding::Depth,
4236        ) -> fidl::Result<()> {
4237            encoder.debug_check_bounds::<DebugAgentGetMinidumpsRequest>(offset);
4238            // Delegate to tuple encoding.
4239            fidl::encoding::Encode::<DebugAgentGetMinidumpsRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
4240                (
4241                    <MinidumpOptions as fidl::encoding::ValueTypeMarker>::borrow(&self.options),
4242                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MinidumpIteratorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.iterator),
4243                ),
4244                encoder, offset, _depth
4245            )
4246        }
4247    }
4248    unsafe impl<
4249            T0: fidl::encoding::Encode<MinidumpOptions, fidl::encoding::DefaultFuchsiaResourceDialect>,
4250            T1: fidl::encoding::Encode<
4251                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MinidumpIteratorMarker>>,
4252                fidl::encoding::DefaultFuchsiaResourceDialect,
4253            >,
4254        >
4255        fidl::encoding::Encode<
4256            DebugAgentGetMinidumpsRequest,
4257            fidl::encoding::DefaultFuchsiaResourceDialect,
4258        > for (T0, T1)
4259    {
4260        #[inline]
4261        unsafe fn encode(
4262            self,
4263            encoder: &mut fidl::encoding::Encoder<
4264                '_,
4265                fidl::encoding::DefaultFuchsiaResourceDialect,
4266            >,
4267            offset: usize,
4268            depth: fidl::encoding::Depth,
4269        ) -> fidl::Result<()> {
4270            encoder.debug_check_bounds::<DebugAgentGetMinidumpsRequest>(offset);
4271            // Zero out padding regions. There's no need to apply masks
4272            // because the unmasked parts will be overwritten by fields.
4273            unsafe {
4274                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
4275                (ptr as *mut u64).write_unaligned(0);
4276            }
4277            // Write the fields.
4278            self.0.encode(encoder, offset + 0, depth)?;
4279            self.1.encode(encoder, offset + 16, depth)?;
4280            Ok(())
4281        }
4282    }
4283
4284    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4285        for DebugAgentGetMinidumpsRequest
4286    {
4287        #[inline(always)]
4288        fn new_empty() -> Self {
4289            Self {
4290                options: fidl::new_empty!(
4291                    MinidumpOptions,
4292                    fidl::encoding::DefaultFuchsiaResourceDialect
4293                ),
4294                iterator: fidl::new_empty!(
4295                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MinidumpIteratorMarker>>,
4296                    fidl::encoding::DefaultFuchsiaResourceDialect
4297                ),
4298            }
4299        }
4300
4301        #[inline]
4302        unsafe fn decode(
4303            &mut self,
4304            decoder: &mut fidl::encoding::Decoder<
4305                '_,
4306                fidl::encoding::DefaultFuchsiaResourceDialect,
4307            >,
4308            offset: usize,
4309            _depth: fidl::encoding::Depth,
4310        ) -> fidl::Result<()> {
4311            decoder.debug_check_bounds::<Self>(offset);
4312            // Verify that padding bytes are zero.
4313            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
4314            let padval = unsafe { (ptr as *const u64).read_unaligned() };
4315            let mask = 0xffffffff00000000u64;
4316            let maskedval = padval & mask;
4317            if maskedval != 0 {
4318                return Err(fidl::Error::NonZeroPadding {
4319                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
4320                });
4321            }
4322            fidl::decode!(
4323                MinidumpOptions,
4324                fidl::encoding::DefaultFuchsiaResourceDialect,
4325                &mut self.options,
4326                decoder,
4327                offset + 0,
4328                _depth
4329            )?;
4330            fidl::decode!(
4331                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MinidumpIteratorMarker>>,
4332                fidl::encoding::DefaultFuchsiaResourceDialect,
4333                &mut self.iterator,
4334                decoder,
4335                offset + 16,
4336                _depth
4337            )?;
4338            Ok(())
4339        }
4340    }
4341
4342    impl fidl::encoding::ResourceTypeMarker for DebugAgentGetProcessInfoRequest {
4343        type Borrowed<'a> = &'a mut Self;
4344        fn take_or_borrow<'a>(
4345            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4346        ) -> Self::Borrowed<'a> {
4347            value
4348        }
4349    }
4350
4351    unsafe impl fidl::encoding::TypeMarker for DebugAgentGetProcessInfoRequest {
4352        type Owned = Self;
4353
4354        #[inline(always)]
4355        fn inline_align(_context: fidl::encoding::Context) -> usize {
4356            8
4357        }
4358
4359        #[inline(always)]
4360        fn inline_size(_context: fidl::encoding::Context) -> usize {
4361            24
4362        }
4363    }
4364
4365    unsafe impl
4366        fidl::encoding::Encode<
4367            DebugAgentGetProcessInfoRequest,
4368            fidl::encoding::DefaultFuchsiaResourceDialect,
4369        > for &mut DebugAgentGetProcessInfoRequest
4370    {
4371        #[inline]
4372        unsafe fn encode(
4373            self,
4374            encoder: &mut fidl::encoding::Encoder<
4375                '_,
4376                fidl::encoding::DefaultFuchsiaResourceDialect,
4377            >,
4378            offset: usize,
4379            _depth: fidl::encoding::Depth,
4380        ) -> fidl::Result<()> {
4381            encoder.debug_check_bounds::<DebugAgentGetProcessInfoRequest>(offset);
4382            // Delegate to tuple encoding.
4383            fidl::encoding::Encode::<DebugAgentGetProcessInfoRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
4384                (
4385                    <GetProcessInfoOptions as fidl::encoding::ValueTypeMarker>::borrow(&self.options),
4386                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ProcessInfoIteratorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.iterator),
4387                ),
4388                encoder, offset, _depth
4389            )
4390        }
4391    }
4392    unsafe impl<
4393            T0: fidl::encoding::Encode<
4394                GetProcessInfoOptions,
4395                fidl::encoding::DefaultFuchsiaResourceDialect,
4396            >,
4397            T1: fidl::encoding::Encode<
4398                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ProcessInfoIteratorMarker>>,
4399                fidl::encoding::DefaultFuchsiaResourceDialect,
4400            >,
4401        >
4402        fidl::encoding::Encode<
4403            DebugAgentGetProcessInfoRequest,
4404            fidl::encoding::DefaultFuchsiaResourceDialect,
4405        > for (T0, T1)
4406    {
4407        #[inline]
4408        unsafe fn encode(
4409            self,
4410            encoder: &mut fidl::encoding::Encoder<
4411                '_,
4412                fidl::encoding::DefaultFuchsiaResourceDialect,
4413            >,
4414            offset: usize,
4415            depth: fidl::encoding::Depth,
4416        ) -> fidl::Result<()> {
4417            encoder.debug_check_bounds::<DebugAgentGetProcessInfoRequest>(offset);
4418            // Zero out padding regions. There's no need to apply masks
4419            // because the unmasked parts will be overwritten by fields.
4420            unsafe {
4421                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
4422                (ptr as *mut u64).write_unaligned(0);
4423            }
4424            // Write the fields.
4425            self.0.encode(encoder, offset + 0, depth)?;
4426            self.1.encode(encoder, offset + 16, depth)?;
4427            Ok(())
4428        }
4429    }
4430
4431    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4432        for DebugAgentGetProcessInfoRequest
4433    {
4434        #[inline(always)]
4435        fn new_empty() -> Self {
4436            Self {
4437                options: fidl::new_empty!(
4438                    GetProcessInfoOptions,
4439                    fidl::encoding::DefaultFuchsiaResourceDialect
4440                ),
4441                iterator: fidl::new_empty!(
4442                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ProcessInfoIteratorMarker>>,
4443                    fidl::encoding::DefaultFuchsiaResourceDialect
4444                ),
4445            }
4446        }
4447
4448        #[inline]
4449        unsafe fn decode(
4450            &mut self,
4451            decoder: &mut fidl::encoding::Decoder<
4452                '_,
4453                fidl::encoding::DefaultFuchsiaResourceDialect,
4454            >,
4455            offset: usize,
4456            _depth: fidl::encoding::Depth,
4457        ) -> fidl::Result<()> {
4458            decoder.debug_check_bounds::<Self>(offset);
4459            // Verify that padding bytes are zero.
4460            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
4461            let padval = unsafe { (ptr as *const u64).read_unaligned() };
4462            let mask = 0xffffffff00000000u64;
4463            let maskedval = padval & mask;
4464            if maskedval != 0 {
4465                return Err(fidl::Error::NonZeroPadding {
4466                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
4467                });
4468            }
4469            fidl::decode!(
4470                GetProcessInfoOptions,
4471                fidl::encoding::DefaultFuchsiaResourceDialect,
4472                &mut self.options,
4473                decoder,
4474                offset + 0,
4475                _depth
4476            )?;
4477            fidl::decode!(
4478                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ProcessInfoIteratorMarker>>,
4479                fidl::encoding::DefaultFuchsiaResourceDialect,
4480                &mut self.iterator,
4481                decoder,
4482                offset + 16,
4483                _depth
4484            )?;
4485            Ok(())
4486        }
4487    }
4488
4489    impl fidl::encoding::ResourceTypeMarker for LauncherGetAgentsRequest {
4490        type Borrowed<'a> = &'a mut Self;
4491        fn take_or_borrow<'a>(
4492            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4493        ) -> Self::Borrowed<'a> {
4494            value
4495        }
4496    }
4497
4498    unsafe impl fidl::encoding::TypeMarker for LauncherGetAgentsRequest {
4499        type Owned = Self;
4500
4501        #[inline(always)]
4502        fn inline_align(_context: fidl::encoding::Context) -> usize {
4503            4
4504        }
4505
4506        #[inline(always)]
4507        fn inline_size(_context: fidl::encoding::Context) -> usize {
4508            4
4509        }
4510    }
4511
4512    unsafe impl
4513        fidl::encoding::Encode<
4514            LauncherGetAgentsRequest,
4515            fidl::encoding::DefaultFuchsiaResourceDialect,
4516        > for &mut LauncherGetAgentsRequest
4517    {
4518        #[inline]
4519        unsafe fn encode(
4520            self,
4521            encoder: &mut fidl::encoding::Encoder<
4522                '_,
4523                fidl::encoding::DefaultFuchsiaResourceDialect,
4524            >,
4525            offset: usize,
4526            _depth: fidl::encoding::Depth,
4527        ) -> fidl::Result<()> {
4528            encoder.debug_check_bounds::<LauncherGetAgentsRequest>(offset);
4529            // Delegate to tuple encoding.
4530            fidl::encoding::Encode::<LauncherGetAgentsRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
4531                (
4532                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AgentIteratorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.iterator),
4533                ),
4534                encoder, offset, _depth
4535            )
4536        }
4537    }
4538    unsafe impl<
4539            T0: fidl::encoding::Encode<
4540                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AgentIteratorMarker>>,
4541                fidl::encoding::DefaultFuchsiaResourceDialect,
4542            >,
4543        >
4544        fidl::encoding::Encode<
4545            LauncherGetAgentsRequest,
4546            fidl::encoding::DefaultFuchsiaResourceDialect,
4547        > for (T0,)
4548    {
4549        #[inline]
4550        unsafe fn encode(
4551            self,
4552            encoder: &mut fidl::encoding::Encoder<
4553                '_,
4554                fidl::encoding::DefaultFuchsiaResourceDialect,
4555            >,
4556            offset: usize,
4557            depth: fidl::encoding::Depth,
4558        ) -> fidl::Result<()> {
4559            encoder.debug_check_bounds::<LauncherGetAgentsRequest>(offset);
4560            // Zero out padding regions. There's no need to apply masks
4561            // because the unmasked parts will be overwritten by fields.
4562            // Write the fields.
4563            self.0.encode(encoder, offset + 0, depth)?;
4564            Ok(())
4565        }
4566    }
4567
4568    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4569        for LauncherGetAgentsRequest
4570    {
4571        #[inline(always)]
4572        fn new_empty() -> Self {
4573            Self {
4574                iterator: fidl::new_empty!(
4575                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AgentIteratorMarker>>,
4576                    fidl::encoding::DefaultFuchsiaResourceDialect
4577                ),
4578            }
4579        }
4580
4581        #[inline]
4582        unsafe fn decode(
4583            &mut self,
4584            decoder: &mut fidl::encoding::Decoder<
4585                '_,
4586                fidl::encoding::DefaultFuchsiaResourceDialect,
4587            >,
4588            offset: usize,
4589            _depth: fidl::encoding::Depth,
4590        ) -> fidl::Result<()> {
4591            decoder.debug_check_bounds::<Self>(offset);
4592            // Verify that padding bytes are zero.
4593            fidl::decode!(
4594                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AgentIteratorMarker>>,
4595                fidl::encoding::DefaultFuchsiaResourceDialect,
4596                &mut self.iterator,
4597                decoder,
4598                offset + 0,
4599                _depth
4600            )?;
4601            Ok(())
4602        }
4603    }
4604
4605    impl fidl::encoding::ResourceTypeMarker for LauncherLaunchRequest {
4606        type Borrowed<'a> = &'a mut Self;
4607        fn take_or_borrow<'a>(
4608            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4609        ) -> Self::Borrowed<'a> {
4610            value
4611        }
4612    }
4613
4614    unsafe impl fidl::encoding::TypeMarker for LauncherLaunchRequest {
4615        type Owned = Self;
4616
4617        #[inline(always)]
4618        fn inline_align(_context: fidl::encoding::Context) -> usize {
4619            4
4620        }
4621
4622        #[inline(always)]
4623        fn inline_size(_context: fidl::encoding::Context) -> usize {
4624            4
4625        }
4626    }
4627
4628    unsafe impl
4629        fidl::encoding::Encode<LauncherLaunchRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
4630        for &mut LauncherLaunchRequest
4631    {
4632        #[inline]
4633        unsafe fn encode(
4634            self,
4635            encoder: &mut fidl::encoding::Encoder<
4636                '_,
4637                fidl::encoding::DefaultFuchsiaResourceDialect,
4638            >,
4639            offset: usize,
4640            _depth: fidl::encoding::Depth,
4641        ) -> fidl::Result<()> {
4642            encoder.debug_check_bounds::<LauncherLaunchRequest>(offset);
4643            // Delegate to tuple encoding.
4644            fidl::encoding::Encode::<LauncherLaunchRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
4645                (
4646                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DebugAgentMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.agent),
4647                ),
4648                encoder, offset, _depth
4649            )
4650        }
4651    }
4652    unsafe impl<
4653            T0: fidl::encoding::Encode<
4654                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DebugAgentMarker>>,
4655                fidl::encoding::DefaultFuchsiaResourceDialect,
4656            >,
4657        >
4658        fidl::encoding::Encode<LauncherLaunchRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
4659        for (T0,)
4660    {
4661        #[inline]
4662        unsafe fn encode(
4663            self,
4664            encoder: &mut fidl::encoding::Encoder<
4665                '_,
4666                fidl::encoding::DefaultFuchsiaResourceDialect,
4667            >,
4668            offset: usize,
4669            depth: fidl::encoding::Depth,
4670        ) -> fidl::Result<()> {
4671            encoder.debug_check_bounds::<LauncherLaunchRequest>(offset);
4672            // Zero out padding regions. There's no need to apply masks
4673            // because the unmasked parts will be overwritten by fields.
4674            // Write the fields.
4675            self.0.encode(encoder, offset + 0, depth)?;
4676            Ok(())
4677        }
4678    }
4679
4680    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4681        for LauncherLaunchRequest
4682    {
4683        #[inline(always)]
4684        fn new_empty() -> Self {
4685            Self {
4686                agent: fidl::new_empty!(
4687                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DebugAgentMarker>>,
4688                    fidl::encoding::DefaultFuchsiaResourceDialect
4689                ),
4690            }
4691        }
4692
4693        #[inline]
4694        unsafe fn decode(
4695            &mut self,
4696            decoder: &mut fidl::encoding::Decoder<
4697                '_,
4698                fidl::encoding::DefaultFuchsiaResourceDialect,
4699            >,
4700            offset: usize,
4701            _depth: fidl::encoding::Depth,
4702        ) -> fidl::Result<()> {
4703            decoder.debug_check_bounds::<Self>(offset);
4704            // Verify that padding bytes are zero.
4705            fidl::decode!(
4706                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DebugAgentMarker>>,
4707                fidl::encoding::DefaultFuchsiaResourceDialect,
4708                &mut self.agent,
4709                decoder,
4710                offset + 0,
4711                _depth
4712            )?;
4713            Ok(())
4714        }
4715    }
4716
4717    impl fidl::encoding::ResourceTypeMarker for MinidumpIteratorGetNextResponse {
4718        type Borrowed<'a> = &'a mut Self;
4719        fn take_or_borrow<'a>(
4720            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4721        ) -> Self::Borrowed<'a> {
4722            value
4723        }
4724    }
4725
4726    unsafe impl fidl::encoding::TypeMarker for MinidumpIteratorGetNextResponse {
4727        type Owned = Self;
4728
4729        #[inline(always)]
4730        fn inline_align(_context: fidl::encoding::Context) -> usize {
4731            4
4732        }
4733
4734        #[inline(always)]
4735        fn inline_size(_context: fidl::encoding::Context) -> usize {
4736            4
4737        }
4738    }
4739
4740    unsafe impl
4741        fidl::encoding::Encode<
4742            MinidumpIteratorGetNextResponse,
4743            fidl::encoding::DefaultFuchsiaResourceDialect,
4744        > for &mut MinidumpIteratorGetNextResponse
4745    {
4746        #[inline]
4747        unsafe fn encode(
4748            self,
4749            encoder: &mut fidl::encoding::Encoder<
4750                '_,
4751                fidl::encoding::DefaultFuchsiaResourceDialect,
4752            >,
4753            offset: usize,
4754            _depth: fidl::encoding::Depth,
4755        ) -> fidl::Result<()> {
4756            encoder.debug_check_bounds::<MinidumpIteratorGetNextResponse>(offset);
4757            // Delegate to tuple encoding.
4758            fidl::encoding::Encode::<
4759                MinidumpIteratorGetNextResponse,
4760                fidl::encoding::DefaultFuchsiaResourceDialect,
4761            >::encode(
4762                (<fidl::encoding::HandleType<
4763                    fidl::Vmo,
4764                    { fidl::ObjectType::VMO.into_raw() },
4765                    2147483648,
4766                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
4767                    &mut self.minidump
4768                ),),
4769                encoder,
4770                offset,
4771                _depth,
4772            )
4773        }
4774    }
4775    unsafe impl<
4776            T0: fidl::encoding::Encode<
4777                fidl::encoding::HandleType<
4778                    fidl::Vmo,
4779                    { fidl::ObjectType::VMO.into_raw() },
4780                    2147483648,
4781                >,
4782                fidl::encoding::DefaultFuchsiaResourceDialect,
4783            >,
4784        >
4785        fidl::encoding::Encode<
4786            MinidumpIteratorGetNextResponse,
4787            fidl::encoding::DefaultFuchsiaResourceDialect,
4788        > for (T0,)
4789    {
4790        #[inline]
4791        unsafe fn encode(
4792            self,
4793            encoder: &mut fidl::encoding::Encoder<
4794                '_,
4795                fidl::encoding::DefaultFuchsiaResourceDialect,
4796            >,
4797            offset: usize,
4798            depth: fidl::encoding::Depth,
4799        ) -> fidl::Result<()> {
4800            encoder.debug_check_bounds::<MinidumpIteratorGetNextResponse>(offset);
4801            // Zero out padding regions. There's no need to apply masks
4802            // because the unmasked parts will be overwritten by fields.
4803            // Write the fields.
4804            self.0.encode(encoder, offset + 0, depth)?;
4805            Ok(())
4806        }
4807    }
4808
4809    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4810        for MinidumpIteratorGetNextResponse
4811    {
4812        #[inline(always)]
4813        fn new_empty() -> Self {
4814            Self {
4815                minidump: fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
4816            }
4817        }
4818
4819        #[inline]
4820        unsafe fn decode(
4821            &mut self,
4822            decoder: &mut fidl::encoding::Decoder<
4823                '_,
4824                fidl::encoding::DefaultFuchsiaResourceDialect,
4825            >,
4826            offset: usize,
4827            _depth: fidl::encoding::Depth,
4828        ) -> fidl::Result<()> {
4829            decoder.debug_check_bounds::<Self>(offset);
4830            // Verify that padding bytes are zero.
4831            fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.minidump, decoder, offset + 0, _depth)?;
4832            Ok(())
4833        }
4834    }
4835}