fidl_fuchsia_debugger/
fidl_fuchsia_debugger.rs

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