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