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