Skip to main content

fidl_fuchsia_debugger/
fidl_fuchsia_debugger.rs

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