fidl_fuchsia_debugger/
fidl_fuchsia_debugger.rs

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