Skip to main content

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