Skip to main content

fidl_fuchsia_test_debug/
fidl_fuchsia_test_debug.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_test_debug__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct DebugDataProcessorAddDebugVmosRequest {
16    pub vmos: Vec<DebugVmo>,
17}
18
19impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
20    for DebugDataProcessorAddDebugVmosRequest
21{
22}
23
24#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
25pub struct DebugDataProcessorSetDirectoryRequest {
26    pub directory: fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
27}
28
29impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
30    for DebugDataProcessorSetDirectoryRequest
31{
32}
33
34/// Container for a single VMO that is ready to be processed.
35#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
36pub struct DebugVmo {
37    pub vmo: fidl::Vmo,
38    pub data_sink: String,
39    pub test_url: String,
40}
41
42impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for DebugVmo {}
43
44#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
45pub struct DebugDataProcessorMarker;
46
47impl fidl::endpoints::ProtocolMarker for DebugDataProcessorMarker {
48    type Proxy = DebugDataProcessorProxy;
49    type RequestStream = DebugDataProcessorRequestStream;
50    #[cfg(target_os = "fuchsia")]
51    type SynchronousProxy = DebugDataProcessorSynchronousProxy;
52
53    const DEBUG_NAME: &'static str = "fuchsia.test.debug.DebugDataProcessor";
54}
55impl fidl::endpoints::DiscoverableProtocolMarker for DebugDataProcessorMarker {}
56
57pub trait DebugDataProcessorProxyInterface: Send + Sync {
58    fn r#set_directory(
59        &self,
60        directory: fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
61    ) -> Result<(), fidl::Error>;
62    type AddDebugVmosResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
63    fn r#add_debug_vmos(&self, vmos: Vec<DebugVmo>) -> Self::AddDebugVmosResponseFut;
64    type FinishResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
65    fn r#finish(&self) -> Self::FinishResponseFut;
66}
67#[derive(Debug)]
68#[cfg(target_os = "fuchsia")]
69pub struct DebugDataProcessorSynchronousProxy {
70    client: fidl::client::sync::Client,
71}
72
73#[cfg(target_os = "fuchsia")]
74impl fidl::endpoints::SynchronousProxy for DebugDataProcessorSynchronousProxy {
75    type Proxy = DebugDataProcessorProxy;
76    type Protocol = DebugDataProcessorMarker;
77
78    fn from_channel(inner: fidl::Channel) -> Self {
79        Self::new(inner)
80    }
81
82    fn into_channel(self) -> fidl::Channel {
83        self.client.into_channel()
84    }
85
86    fn as_channel(&self) -> &fidl::Channel {
87        self.client.as_channel()
88    }
89}
90
91#[cfg(target_os = "fuchsia")]
92impl DebugDataProcessorSynchronousProxy {
93    pub fn new(channel: fidl::Channel) -> Self {
94        Self { client: fidl::client::sync::Client::new(channel) }
95    }
96
97    pub fn into_channel(self) -> fidl::Channel {
98        self.client.into_channel()
99    }
100
101    /// Waits until an event arrives and returns it. It is safe for other
102    /// threads to make concurrent requests while waiting for an event.
103    pub fn wait_for_event(
104        &self,
105        deadline: zx::MonotonicInstant,
106    ) -> Result<DebugDataProcessorEvent, fidl::Error> {
107        DebugDataProcessorEvent::decode(
108            self.client.wait_for_event::<DebugDataProcessorMarker>(deadline)?,
109        )
110    }
111
112    /// Set the directory to store results in. This must be called first.
113    /// Note that we currently provide a directory as coverage tools pull profile
114    /// information off the device using a specific, topology dependent location
115    /// in the /tmp filesystem. Once these tools are updated, we can update this
116    /// protocol free of this constraint.
117    pub fn r#set_directory(
118        &self,
119        mut directory: fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
120    ) -> Result<(), fidl::Error> {
121        self.client.send::<DebugDataProcessorSetDirectoryRequest>(
122            (directory,),
123            0x3010ac21cf0b4c79,
124            fidl::encoding::DynamicFlags::empty(),
125        )
126    }
127
128    /// Add more VMOs to process. The VMOs are expected to be ready to process.
129    pub fn r#add_debug_vmos(
130        &self,
131        mut vmos: Vec<DebugVmo>,
132        ___deadline: zx::MonotonicInstant,
133    ) -> Result<(), fidl::Error> {
134        let _response = self.client.send_query::<
135            DebugDataProcessorAddDebugVmosRequest,
136            fidl::encoding::EmptyPayload,
137            DebugDataProcessorMarker,
138        >(
139            (vmos.as_mut(),),
140            0x48b3d3070f48199b,
141            fidl::encoding::DynamicFlags::empty(),
142            ___deadline,
143        )?;
144        Ok(_response)
145    }
146
147    /// Indicates all VMOs have been sent. This method returns when all processing
148    /// is complete, after which the client may observe the results in the directory
149    /// passed via NewProcessor.
150    pub fn r#finish(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
151        let _response = self.client.send_query::<
152            fidl::encoding::EmptyPayload,
153            fidl::encoding::EmptyPayload,
154            DebugDataProcessorMarker,
155        >(
156            (),
157            0x2bc6016f91bdf3a7,
158            fidl::encoding::DynamicFlags::empty(),
159            ___deadline,
160        )?;
161        Ok(_response)
162    }
163}
164
165#[cfg(target_os = "fuchsia")]
166impl From<DebugDataProcessorSynchronousProxy> for zx::NullableHandle {
167    fn from(value: DebugDataProcessorSynchronousProxy) -> Self {
168        value.into_channel().into()
169    }
170}
171
172#[cfg(target_os = "fuchsia")]
173impl From<fidl::Channel> for DebugDataProcessorSynchronousProxy {
174    fn from(value: fidl::Channel) -> Self {
175        Self::new(value)
176    }
177}
178
179#[cfg(target_os = "fuchsia")]
180impl fidl::endpoints::FromClient for DebugDataProcessorSynchronousProxy {
181    type Protocol = DebugDataProcessorMarker;
182
183    fn from_client(value: fidl::endpoints::ClientEnd<DebugDataProcessorMarker>) -> Self {
184        Self::new(value.into_channel())
185    }
186}
187
188#[derive(Debug, Clone)]
189pub struct DebugDataProcessorProxy {
190    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
191}
192
193impl fidl::endpoints::Proxy for DebugDataProcessorProxy {
194    type Protocol = DebugDataProcessorMarker;
195
196    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
197        Self::new(inner)
198    }
199
200    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
201        self.client.into_channel().map_err(|client| Self { client })
202    }
203
204    fn as_channel(&self) -> &::fidl::AsyncChannel {
205        self.client.as_channel()
206    }
207}
208
209impl DebugDataProcessorProxy {
210    /// Create a new Proxy for fuchsia.test.debug/DebugDataProcessor.
211    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
212        let protocol_name =
213            <DebugDataProcessorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
214        Self { client: fidl::client::Client::new(channel, protocol_name) }
215    }
216
217    /// Get a Stream of events from the remote end of the protocol.
218    ///
219    /// # Panics
220    ///
221    /// Panics if the event stream was already taken.
222    pub fn take_event_stream(&self) -> DebugDataProcessorEventStream {
223        DebugDataProcessorEventStream { event_receiver: self.client.take_event_receiver() }
224    }
225
226    /// Set the directory to store results in. This must be called first.
227    /// Note that we currently provide a directory as coverage tools pull profile
228    /// information off the device using a specific, topology dependent location
229    /// in the /tmp filesystem. Once these tools are updated, we can update this
230    /// protocol free of this constraint.
231    pub fn r#set_directory(
232        &self,
233        mut directory: fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
234    ) -> Result<(), fidl::Error> {
235        DebugDataProcessorProxyInterface::r#set_directory(self, directory)
236    }
237
238    /// Add more VMOs to process. The VMOs are expected to be ready to process.
239    pub fn r#add_debug_vmos(
240        &self,
241        mut vmos: Vec<DebugVmo>,
242    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
243        DebugDataProcessorProxyInterface::r#add_debug_vmos(self, vmos)
244    }
245
246    /// Indicates all VMOs have been sent. This method returns when all processing
247    /// is complete, after which the client may observe the results in the directory
248    /// passed via NewProcessor.
249    pub fn r#finish(
250        &self,
251    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
252        DebugDataProcessorProxyInterface::r#finish(self)
253    }
254}
255
256impl DebugDataProcessorProxyInterface for DebugDataProcessorProxy {
257    fn r#set_directory(
258        &self,
259        mut directory: fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
260    ) -> Result<(), fidl::Error> {
261        self.client.send::<DebugDataProcessorSetDirectoryRequest>(
262            (directory,),
263            0x3010ac21cf0b4c79,
264            fidl::encoding::DynamicFlags::empty(),
265        )
266    }
267
268    type AddDebugVmosResponseFut =
269        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
270    fn r#add_debug_vmos(&self, mut vmos: Vec<DebugVmo>) -> Self::AddDebugVmosResponseFut {
271        fn _decode(
272            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
273        ) -> Result<(), fidl::Error> {
274            let _response = fidl::client::decode_transaction_body::<
275                fidl::encoding::EmptyPayload,
276                fidl::encoding::DefaultFuchsiaResourceDialect,
277                0x48b3d3070f48199b,
278            >(_buf?)?;
279            Ok(_response)
280        }
281        self.client.send_query_and_decode::<DebugDataProcessorAddDebugVmosRequest, ()>(
282            (vmos.as_mut(),),
283            0x48b3d3070f48199b,
284            fidl::encoding::DynamicFlags::empty(),
285            _decode,
286        )
287    }
288
289    type FinishResponseFut =
290        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
291    fn r#finish(&self) -> Self::FinishResponseFut {
292        fn _decode(
293            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
294        ) -> Result<(), fidl::Error> {
295            let _response = fidl::client::decode_transaction_body::<
296                fidl::encoding::EmptyPayload,
297                fidl::encoding::DefaultFuchsiaResourceDialect,
298                0x2bc6016f91bdf3a7,
299            >(_buf?)?;
300            Ok(_response)
301        }
302        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
303            (),
304            0x2bc6016f91bdf3a7,
305            fidl::encoding::DynamicFlags::empty(),
306            _decode,
307        )
308    }
309}
310
311pub struct DebugDataProcessorEventStream {
312    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
313}
314
315impl std::marker::Unpin for DebugDataProcessorEventStream {}
316
317impl futures::stream::FusedStream for DebugDataProcessorEventStream {
318    fn is_terminated(&self) -> bool {
319        self.event_receiver.is_terminated()
320    }
321}
322
323impl futures::Stream for DebugDataProcessorEventStream {
324    type Item = Result<DebugDataProcessorEvent, fidl::Error>;
325
326    fn poll_next(
327        mut self: std::pin::Pin<&mut Self>,
328        cx: &mut std::task::Context<'_>,
329    ) -> std::task::Poll<Option<Self::Item>> {
330        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
331            &mut self.event_receiver,
332            cx
333        )?) {
334            Some(buf) => std::task::Poll::Ready(Some(DebugDataProcessorEvent::decode(buf))),
335            None => std::task::Poll::Ready(None),
336        }
337    }
338}
339
340#[derive(Debug)]
341pub enum DebugDataProcessorEvent {}
342
343impl DebugDataProcessorEvent {
344    /// Decodes a message buffer as a [`DebugDataProcessorEvent`].
345    fn decode(
346        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
347    ) -> Result<DebugDataProcessorEvent, fidl::Error> {
348        let (bytes, _handles) = buf.split_mut();
349        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
350        debug_assert_eq!(tx_header.tx_id, 0);
351        match tx_header.ordinal {
352            _ => Err(fidl::Error::UnknownOrdinal {
353                ordinal: tx_header.ordinal,
354                protocol_name:
355                    <DebugDataProcessorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
356            }),
357        }
358    }
359}
360
361/// A Stream of incoming requests for fuchsia.test.debug/DebugDataProcessor.
362pub struct DebugDataProcessorRequestStream {
363    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
364    is_terminated: bool,
365}
366
367impl std::marker::Unpin for DebugDataProcessorRequestStream {}
368
369impl futures::stream::FusedStream for DebugDataProcessorRequestStream {
370    fn is_terminated(&self) -> bool {
371        self.is_terminated
372    }
373}
374
375impl fidl::endpoints::RequestStream for DebugDataProcessorRequestStream {
376    type Protocol = DebugDataProcessorMarker;
377    type ControlHandle = DebugDataProcessorControlHandle;
378
379    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
380        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
381    }
382
383    fn control_handle(&self) -> Self::ControlHandle {
384        DebugDataProcessorControlHandle { inner: self.inner.clone() }
385    }
386
387    fn into_inner(
388        self,
389    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
390    {
391        (self.inner, self.is_terminated)
392    }
393
394    fn from_inner(
395        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
396        is_terminated: bool,
397    ) -> Self {
398        Self { inner, is_terminated }
399    }
400}
401
402impl futures::Stream for DebugDataProcessorRequestStream {
403    type Item = Result<DebugDataProcessorRequest, fidl::Error>;
404
405    fn poll_next(
406        mut self: std::pin::Pin<&mut Self>,
407        cx: &mut std::task::Context<'_>,
408    ) -> std::task::Poll<Option<Self::Item>> {
409        let this = &mut *self;
410        if this.inner.check_shutdown(cx) {
411            this.is_terminated = true;
412            return std::task::Poll::Ready(None);
413        }
414        if this.is_terminated {
415            panic!("polled DebugDataProcessorRequestStream after completion");
416        }
417        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
418            |bytes, handles| {
419                match this.inner.channel().read_etc(cx, bytes, handles) {
420                    std::task::Poll::Ready(Ok(())) => {}
421                    std::task::Poll::Pending => return std::task::Poll::Pending,
422                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
423                        this.is_terminated = true;
424                        return std::task::Poll::Ready(None);
425                    }
426                    std::task::Poll::Ready(Err(e)) => {
427                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
428                            e.into(),
429                        ))));
430                    }
431                }
432
433                // A message has been received from the channel
434                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
435
436                std::task::Poll::Ready(Some(match header.ordinal {
437                0x3010ac21cf0b4c79 => {
438                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
439                    let mut req = fidl::new_empty!(DebugDataProcessorSetDirectoryRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
440                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DebugDataProcessorSetDirectoryRequest>(&header, _body_bytes, handles, &mut req)?;
441                    let control_handle = DebugDataProcessorControlHandle {
442                        inner: this.inner.clone(),
443                    };
444                    Ok(DebugDataProcessorRequest::SetDirectory {directory: req.directory,
445
446                        control_handle,
447                    })
448                }
449                0x48b3d3070f48199b => {
450                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
451                    let mut req = fidl::new_empty!(DebugDataProcessorAddDebugVmosRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
452                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DebugDataProcessorAddDebugVmosRequest>(&header, _body_bytes, handles, &mut req)?;
453                    let control_handle = DebugDataProcessorControlHandle {
454                        inner: this.inner.clone(),
455                    };
456                    Ok(DebugDataProcessorRequest::AddDebugVmos {vmos: req.vmos,
457
458                        responder: DebugDataProcessorAddDebugVmosResponder {
459                            control_handle: std::mem::ManuallyDrop::new(control_handle),
460                            tx_id: header.tx_id,
461                        },
462                    })
463                }
464                0x2bc6016f91bdf3a7 => {
465                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
466                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
467                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
468                    let control_handle = DebugDataProcessorControlHandle {
469                        inner: this.inner.clone(),
470                    };
471                    Ok(DebugDataProcessorRequest::Finish {
472                        responder: DebugDataProcessorFinishResponder {
473                            control_handle: std::mem::ManuallyDrop::new(control_handle),
474                            tx_id: header.tx_id,
475                        },
476                    })
477                }
478                _ => Err(fidl::Error::UnknownOrdinal {
479                    ordinal: header.ordinal,
480                    protocol_name: <DebugDataProcessorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
481                }),
482            }))
483            },
484        )
485    }
486}
487
488/// A test-manager internal protocol used for communicating between the debug data
489/// component, which implements `fuchsia.debugdata.Publisher`, and the component that
490/// actually processes the VMOs passed to `fuchsia.debugdata.Publisher`.
491/// In the future, this protocol may be moved to the SDK, to enable "pluggable" VMO
492/// processing, or removed entirely if VMO processing is moved to the host.
493#[derive(Debug)]
494pub enum DebugDataProcessorRequest {
495    /// Set the directory to store results in. This must be called first.
496    /// Note that we currently provide a directory as coverage tools pull profile
497    /// information off the device using a specific, topology dependent location
498    /// in the /tmp filesystem. Once these tools are updated, we can update this
499    /// protocol free of this constraint.
500    SetDirectory {
501        directory: fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
502        control_handle: DebugDataProcessorControlHandle,
503    },
504    /// Add more VMOs to process. The VMOs are expected to be ready to process.
505    AddDebugVmos { vmos: Vec<DebugVmo>, responder: DebugDataProcessorAddDebugVmosResponder },
506    /// Indicates all VMOs have been sent. This method returns when all processing
507    /// is complete, after which the client may observe the results in the directory
508    /// passed via NewProcessor.
509    Finish { responder: DebugDataProcessorFinishResponder },
510}
511
512impl DebugDataProcessorRequest {
513    #[allow(irrefutable_let_patterns)]
514    pub fn into_set_directory(
515        self,
516    ) -> Option<(
517        fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
518        DebugDataProcessorControlHandle,
519    )> {
520        if let DebugDataProcessorRequest::SetDirectory { directory, control_handle } = self {
521            Some((directory, control_handle))
522        } else {
523            None
524        }
525    }
526
527    #[allow(irrefutable_let_patterns)]
528    pub fn into_add_debug_vmos(
529        self,
530    ) -> Option<(Vec<DebugVmo>, DebugDataProcessorAddDebugVmosResponder)> {
531        if let DebugDataProcessorRequest::AddDebugVmos { vmos, responder } = self {
532            Some((vmos, responder))
533        } else {
534            None
535        }
536    }
537
538    #[allow(irrefutable_let_patterns)]
539    pub fn into_finish(self) -> Option<(DebugDataProcessorFinishResponder)> {
540        if let DebugDataProcessorRequest::Finish { responder } = self {
541            Some((responder))
542        } else {
543            None
544        }
545    }
546
547    /// Name of the method defined in FIDL
548    pub fn method_name(&self) -> &'static str {
549        match *self {
550            DebugDataProcessorRequest::SetDirectory { .. } => "set_directory",
551            DebugDataProcessorRequest::AddDebugVmos { .. } => "add_debug_vmos",
552            DebugDataProcessorRequest::Finish { .. } => "finish",
553        }
554    }
555}
556
557#[derive(Debug, Clone)]
558pub struct DebugDataProcessorControlHandle {
559    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
560}
561
562impl fidl::endpoints::ControlHandle for DebugDataProcessorControlHandle {
563    fn shutdown(&self) {
564        self.inner.shutdown()
565    }
566
567    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
568        self.inner.shutdown_with_epitaph(status)
569    }
570
571    fn is_closed(&self) -> bool {
572        self.inner.channel().is_closed()
573    }
574    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
575        self.inner.channel().on_closed()
576    }
577
578    #[cfg(target_os = "fuchsia")]
579    fn signal_peer(
580        &self,
581        clear_mask: zx::Signals,
582        set_mask: zx::Signals,
583    ) -> Result<(), zx_status::Status> {
584        use fidl::Peered;
585        self.inner.channel().signal_peer(clear_mask, set_mask)
586    }
587}
588
589impl DebugDataProcessorControlHandle {}
590
591#[must_use = "FIDL methods require a response to be sent"]
592#[derive(Debug)]
593pub struct DebugDataProcessorAddDebugVmosResponder {
594    control_handle: std::mem::ManuallyDrop<DebugDataProcessorControlHandle>,
595    tx_id: u32,
596}
597
598/// Set the the channel to be shutdown (see [`DebugDataProcessorControlHandle::shutdown`])
599/// if the responder is dropped without sending a response, so that the client
600/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
601impl std::ops::Drop for DebugDataProcessorAddDebugVmosResponder {
602    fn drop(&mut self) {
603        self.control_handle.shutdown();
604        // Safety: drops once, never accessed again
605        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
606    }
607}
608
609impl fidl::endpoints::Responder for DebugDataProcessorAddDebugVmosResponder {
610    type ControlHandle = DebugDataProcessorControlHandle;
611
612    fn control_handle(&self) -> &DebugDataProcessorControlHandle {
613        &self.control_handle
614    }
615
616    fn drop_without_shutdown(mut self) {
617        // Safety: drops once, never accessed again due to mem::forget
618        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
619        // Prevent Drop from running (which would shut down the channel)
620        std::mem::forget(self);
621    }
622}
623
624impl DebugDataProcessorAddDebugVmosResponder {
625    /// Sends a response to the FIDL transaction.
626    ///
627    /// Sets the channel to shutdown if an error occurs.
628    pub fn send(self) -> Result<(), fidl::Error> {
629        let _result = self.send_raw();
630        if _result.is_err() {
631            self.control_handle.shutdown();
632        }
633        self.drop_without_shutdown();
634        _result
635    }
636
637    /// Similar to "send" but does not shutdown the channel if an error occurs.
638    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
639        let _result = self.send_raw();
640        self.drop_without_shutdown();
641        _result
642    }
643
644    fn send_raw(&self) -> Result<(), fidl::Error> {
645        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
646            (),
647            self.tx_id,
648            0x48b3d3070f48199b,
649            fidl::encoding::DynamicFlags::empty(),
650        )
651    }
652}
653
654#[must_use = "FIDL methods require a response to be sent"]
655#[derive(Debug)]
656pub struct DebugDataProcessorFinishResponder {
657    control_handle: std::mem::ManuallyDrop<DebugDataProcessorControlHandle>,
658    tx_id: u32,
659}
660
661/// Set the the channel to be shutdown (see [`DebugDataProcessorControlHandle::shutdown`])
662/// if the responder is dropped without sending a response, so that the client
663/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
664impl std::ops::Drop for DebugDataProcessorFinishResponder {
665    fn drop(&mut self) {
666        self.control_handle.shutdown();
667        // Safety: drops once, never accessed again
668        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
669    }
670}
671
672impl fidl::endpoints::Responder for DebugDataProcessorFinishResponder {
673    type ControlHandle = DebugDataProcessorControlHandle;
674
675    fn control_handle(&self) -> &DebugDataProcessorControlHandle {
676        &self.control_handle
677    }
678
679    fn drop_without_shutdown(mut self) {
680        // Safety: drops once, never accessed again due to mem::forget
681        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
682        // Prevent Drop from running (which would shut down the channel)
683        std::mem::forget(self);
684    }
685}
686
687impl DebugDataProcessorFinishResponder {
688    /// Sends a response to the FIDL transaction.
689    ///
690    /// Sets the channel to shutdown if an error occurs.
691    pub fn send(self) -> Result<(), fidl::Error> {
692        let _result = self.send_raw();
693        if _result.is_err() {
694            self.control_handle.shutdown();
695        }
696        self.drop_without_shutdown();
697        _result
698    }
699
700    /// Similar to "send" but does not shutdown the channel if an error occurs.
701    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
702        let _result = self.send_raw();
703        self.drop_without_shutdown();
704        _result
705    }
706
707    fn send_raw(&self) -> Result<(), fidl::Error> {
708        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
709            (),
710            self.tx_id,
711            0x2bc6016f91bdf3a7,
712            fidl::encoding::DynamicFlags::empty(),
713        )
714    }
715}
716
717mod internal {
718    use super::*;
719
720    impl fidl::encoding::ResourceTypeMarker for DebugDataProcessorAddDebugVmosRequest {
721        type Borrowed<'a> = &'a mut Self;
722        fn take_or_borrow<'a>(
723            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
724        ) -> Self::Borrowed<'a> {
725            value
726        }
727    }
728
729    unsafe impl fidl::encoding::TypeMarker for DebugDataProcessorAddDebugVmosRequest {
730        type Owned = Self;
731
732        #[inline(always)]
733        fn inline_align(_context: fidl::encoding::Context) -> usize {
734            8
735        }
736
737        #[inline(always)]
738        fn inline_size(_context: fidl::encoding::Context) -> usize {
739            16
740        }
741    }
742
743    unsafe impl
744        fidl::encoding::Encode<
745            DebugDataProcessorAddDebugVmosRequest,
746            fidl::encoding::DefaultFuchsiaResourceDialect,
747        > for &mut DebugDataProcessorAddDebugVmosRequest
748    {
749        #[inline]
750        unsafe fn encode(
751            self,
752            encoder: &mut fidl::encoding::Encoder<
753                '_,
754                fidl::encoding::DefaultFuchsiaResourceDialect,
755            >,
756            offset: usize,
757            _depth: fidl::encoding::Depth,
758        ) -> fidl::Result<()> {
759            encoder.debug_check_bounds::<DebugDataProcessorAddDebugVmosRequest>(offset);
760            // Delegate to tuple encoding.
761            fidl::encoding::Encode::<DebugDataProcessorAddDebugVmosRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
762                (
763                    <fidl::encoding::UnboundedVector<DebugVmo> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.vmos),
764                ),
765                encoder, offset, _depth
766            )
767        }
768    }
769    unsafe impl<
770        T0: fidl::encoding::Encode<
771                fidl::encoding::UnboundedVector<DebugVmo>,
772                fidl::encoding::DefaultFuchsiaResourceDialect,
773            >,
774    >
775        fidl::encoding::Encode<
776            DebugDataProcessorAddDebugVmosRequest,
777            fidl::encoding::DefaultFuchsiaResourceDialect,
778        > for (T0,)
779    {
780        #[inline]
781        unsafe fn encode(
782            self,
783            encoder: &mut fidl::encoding::Encoder<
784                '_,
785                fidl::encoding::DefaultFuchsiaResourceDialect,
786            >,
787            offset: usize,
788            depth: fidl::encoding::Depth,
789        ) -> fidl::Result<()> {
790            encoder.debug_check_bounds::<DebugDataProcessorAddDebugVmosRequest>(offset);
791            // Zero out padding regions. There's no need to apply masks
792            // because the unmasked parts will be overwritten by fields.
793            // Write the fields.
794            self.0.encode(encoder, offset + 0, depth)?;
795            Ok(())
796        }
797    }
798
799    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
800        for DebugDataProcessorAddDebugVmosRequest
801    {
802        #[inline(always)]
803        fn new_empty() -> Self {
804            Self {
805                vmos: fidl::new_empty!(
806                    fidl::encoding::UnboundedVector<DebugVmo>,
807                    fidl::encoding::DefaultFuchsiaResourceDialect
808                ),
809            }
810        }
811
812        #[inline]
813        unsafe fn decode(
814            &mut self,
815            decoder: &mut fidl::encoding::Decoder<
816                '_,
817                fidl::encoding::DefaultFuchsiaResourceDialect,
818            >,
819            offset: usize,
820            _depth: fidl::encoding::Depth,
821        ) -> fidl::Result<()> {
822            decoder.debug_check_bounds::<Self>(offset);
823            // Verify that padding bytes are zero.
824            fidl::decode!(
825                fidl::encoding::UnboundedVector<DebugVmo>,
826                fidl::encoding::DefaultFuchsiaResourceDialect,
827                &mut self.vmos,
828                decoder,
829                offset + 0,
830                _depth
831            )?;
832            Ok(())
833        }
834    }
835
836    impl fidl::encoding::ResourceTypeMarker for DebugDataProcessorSetDirectoryRequest {
837        type Borrowed<'a> = &'a mut Self;
838        fn take_or_borrow<'a>(
839            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
840        ) -> Self::Borrowed<'a> {
841            value
842        }
843    }
844
845    unsafe impl fidl::encoding::TypeMarker for DebugDataProcessorSetDirectoryRequest {
846        type Owned = Self;
847
848        #[inline(always)]
849        fn inline_align(_context: fidl::encoding::Context) -> usize {
850            4
851        }
852
853        #[inline(always)]
854        fn inline_size(_context: fidl::encoding::Context) -> usize {
855            4
856        }
857    }
858
859    unsafe impl
860        fidl::encoding::Encode<
861            DebugDataProcessorSetDirectoryRequest,
862            fidl::encoding::DefaultFuchsiaResourceDialect,
863        > for &mut DebugDataProcessorSetDirectoryRequest
864    {
865        #[inline]
866        unsafe fn encode(
867            self,
868            encoder: &mut fidl::encoding::Encoder<
869                '_,
870                fidl::encoding::DefaultFuchsiaResourceDialect,
871            >,
872            offset: usize,
873            _depth: fidl::encoding::Depth,
874        ) -> fidl::Result<()> {
875            encoder.debug_check_bounds::<DebugDataProcessorSetDirectoryRequest>(offset);
876            // Delegate to tuple encoding.
877            fidl::encoding::Encode::<
878                DebugDataProcessorSetDirectoryRequest,
879                fidl::encoding::DefaultFuchsiaResourceDialect,
880            >::encode(
881                (<fidl::encoding::Endpoint<
882                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
883                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
884                    &mut self.directory
885                ),),
886                encoder,
887                offset,
888                _depth,
889            )
890        }
891    }
892    unsafe impl<
893        T0: fidl::encoding::Encode<
894                fidl::encoding::Endpoint<
895                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
896                >,
897                fidl::encoding::DefaultFuchsiaResourceDialect,
898            >,
899    >
900        fidl::encoding::Encode<
901            DebugDataProcessorSetDirectoryRequest,
902            fidl::encoding::DefaultFuchsiaResourceDialect,
903        > for (T0,)
904    {
905        #[inline]
906        unsafe fn encode(
907            self,
908            encoder: &mut fidl::encoding::Encoder<
909                '_,
910                fidl::encoding::DefaultFuchsiaResourceDialect,
911            >,
912            offset: usize,
913            depth: fidl::encoding::Depth,
914        ) -> fidl::Result<()> {
915            encoder.debug_check_bounds::<DebugDataProcessorSetDirectoryRequest>(offset);
916            // Zero out padding regions. There's no need to apply masks
917            // because the unmasked parts will be overwritten by fields.
918            // Write the fields.
919            self.0.encode(encoder, offset + 0, depth)?;
920            Ok(())
921        }
922    }
923
924    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
925        for DebugDataProcessorSetDirectoryRequest
926    {
927        #[inline(always)]
928        fn new_empty() -> Self {
929            Self {
930                directory: fidl::new_empty!(
931                    fidl::encoding::Endpoint<
932                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
933                    >,
934                    fidl::encoding::DefaultFuchsiaResourceDialect
935                ),
936            }
937        }
938
939        #[inline]
940        unsafe fn decode(
941            &mut self,
942            decoder: &mut fidl::encoding::Decoder<
943                '_,
944                fidl::encoding::DefaultFuchsiaResourceDialect,
945            >,
946            offset: usize,
947            _depth: fidl::encoding::Depth,
948        ) -> fidl::Result<()> {
949            decoder.debug_check_bounds::<Self>(offset);
950            // Verify that padding bytes are zero.
951            fidl::decode!(
952                fidl::encoding::Endpoint<
953                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
954                >,
955                fidl::encoding::DefaultFuchsiaResourceDialect,
956                &mut self.directory,
957                decoder,
958                offset + 0,
959                _depth
960            )?;
961            Ok(())
962        }
963    }
964
965    impl fidl::encoding::ResourceTypeMarker for DebugVmo {
966        type Borrowed<'a> = &'a mut Self;
967        fn take_or_borrow<'a>(
968            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
969        ) -> Self::Borrowed<'a> {
970            value
971        }
972    }
973
974    unsafe impl fidl::encoding::TypeMarker for DebugVmo {
975        type Owned = Self;
976
977        #[inline(always)]
978        fn inline_align(_context: fidl::encoding::Context) -> usize {
979            8
980        }
981
982        #[inline(always)]
983        fn inline_size(_context: fidl::encoding::Context) -> usize {
984            40
985        }
986    }
987
988    unsafe impl fidl::encoding::Encode<DebugVmo, fidl::encoding::DefaultFuchsiaResourceDialect>
989        for &mut DebugVmo
990    {
991        #[inline]
992        unsafe fn encode(
993            self,
994            encoder: &mut fidl::encoding::Encoder<
995                '_,
996                fidl::encoding::DefaultFuchsiaResourceDialect,
997            >,
998            offset: usize,
999            _depth: fidl::encoding::Depth,
1000        ) -> fidl::Result<()> {
1001            encoder.debug_check_bounds::<DebugVmo>(offset);
1002            // Delegate to tuple encoding.
1003            fidl::encoding::Encode::<DebugVmo, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
1004                (
1005                    <fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.vmo),
1006                    <fidl::encoding::BoundedString<1024> as fidl::encoding::ValueTypeMarker>::borrow(&self.data_sink),
1007                    <fidl::encoding::BoundedString<1024> as fidl::encoding::ValueTypeMarker>::borrow(&self.test_url),
1008                ),
1009                encoder, offset, _depth
1010            )
1011        }
1012    }
1013    unsafe impl<
1014        T0: fidl::encoding::Encode<
1015                fidl::encoding::HandleType<
1016                    fidl::Vmo,
1017                    { fidl::ObjectType::VMO.into_raw() },
1018                    2147483648,
1019                >,
1020                fidl::encoding::DefaultFuchsiaResourceDialect,
1021            >,
1022        T1: fidl::encoding::Encode<
1023                fidl::encoding::BoundedString<1024>,
1024                fidl::encoding::DefaultFuchsiaResourceDialect,
1025            >,
1026        T2: fidl::encoding::Encode<
1027                fidl::encoding::BoundedString<1024>,
1028                fidl::encoding::DefaultFuchsiaResourceDialect,
1029            >,
1030    > fidl::encoding::Encode<DebugVmo, fidl::encoding::DefaultFuchsiaResourceDialect>
1031        for (T0, T1, T2)
1032    {
1033        #[inline]
1034        unsafe fn encode(
1035            self,
1036            encoder: &mut fidl::encoding::Encoder<
1037                '_,
1038                fidl::encoding::DefaultFuchsiaResourceDialect,
1039            >,
1040            offset: usize,
1041            depth: fidl::encoding::Depth,
1042        ) -> fidl::Result<()> {
1043            encoder.debug_check_bounds::<DebugVmo>(offset);
1044            // Zero out padding regions. There's no need to apply masks
1045            // because the unmasked parts will be overwritten by fields.
1046            unsafe {
1047                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
1048                (ptr as *mut u64).write_unaligned(0);
1049            }
1050            // Write the fields.
1051            self.0.encode(encoder, offset + 0, depth)?;
1052            self.1.encode(encoder, offset + 8, depth)?;
1053            self.2.encode(encoder, offset + 24, depth)?;
1054            Ok(())
1055        }
1056    }
1057
1058    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for DebugVmo {
1059        #[inline(always)]
1060        fn new_empty() -> Self {
1061            Self {
1062                vmo: fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
1063                data_sink: fidl::new_empty!(
1064                    fidl::encoding::BoundedString<1024>,
1065                    fidl::encoding::DefaultFuchsiaResourceDialect
1066                ),
1067                test_url: fidl::new_empty!(
1068                    fidl::encoding::BoundedString<1024>,
1069                    fidl::encoding::DefaultFuchsiaResourceDialect
1070                ),
1071            }
1072        }
1073
1074        #[inline]
1075        unsafe fn decode(
1076            &mut self,
1077            decoder: &mut fidl::encoding::Decoder<
1078                '_,
1079                fidl::encoding::DefaultFuchsiaResourceDialect,
1080            >,
1081            offset: usize,
1082            _depth: fidl::encoding::Depth,
1083        ) -> fidl::Result<()> {
1084            decoder.debug_check_bounds::<Self>(offset);
1085            // Verify that padding bytes are zero.
1086            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
1087            let padval = unsafe { (ptr as *const u64).read_unaligned() };
1088            let mask = 0xffffffff00000000u64;
1089            let maskedval = padval & mask;
1090            if maskedval != 0 {
1091                return Err(fidl::Error::NonZeroPadding {
1092                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
1093                });
1094            }
1095            fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.vmo, decoder, offset + 0, _depth)?;
1096            fidl::decode!(
1097                fidl::encoding::BoundedString<1024>,
1098                fidl::encoding::DefaultFuchsiaResourceDialect,
1099                &mut self.data_sink,
1100                decoder,
1101                offset + 8,
1102                _depth
1103            )?;
1104            fidl::decode!(
1105                fidl::encoding::BoundedString<1024>,
1106                fidl::encoding::DefaultFuchsiaResourceDialect,
1107                &mut self.test_url,
1108                decoder,
1109                offset + 24,
1110                _depth
1111            )?;
1112            Ok(())
1113        }
1114    }
1115}