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