fidl_fuchsia_samplertestcontroller/
fidl_fuchsia_samplertestcontroller.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_samplertestcontroller_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
15pub struct SamplerTestControllerMarker;
16
17impl fidl::endpoints::ProtocolMarker for SamplerTestControllerMarker {
18    type Proxy = SamplerTestControllerProxy;
19    type RequestStream = SamplerTestControllerRequestStream;
20    #[cfg(target_os = "fuchsia")]
21    type SynchronousProxy = SamplerTestControllerSynchronousProxy;
22
23    const DEBUG_NAME: &'static str = "fuchsia.samplertestcontroller.SamplerTestController";
24}
25impl fidl::endpoints::DiscoverableProtocolMarker for SamplerTestControllerMarker {}
26pub type SamplerTestControllerWaitForSampleResult = Result<(), SamplingError>;
27
28pub trait SamplerTestControllerProxyInterface: Send + Sync {
29    type IncrementIntResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
30    fn r#increment_int(&self, property_id: u16) -> Self::IncrementIntResponseFut;
31    type SetOptionalResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
32    fn r#set_optional(&self, value: i64) -> Self::SetOptionalResponseFut;
33    type RemoveOptionalResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
34    fn r#remove_optional(&self) -> Self::RemoveOptionalResponseFut;
35    type WaitForSampleResponseFut: std::future::Future<Output = Result<SamplerTestControllerWaitForSampleResult, fidl::Error>>
36        + Send;
37    fn r#wait_for_sample(&self) -> Self::WaitForSampleResponseFut;
38}
39#[derive(Debug)]
40#[cfg(target_os = "fuchsia")]
41pub struct SamplerTestControllerSynchronousProxy {
42    client: fidl::client::sync::Client,
43}
44
45#[cfg(target_os = "fuchsia")]
46impl fidl::endpoints::SynchronousProxy for SamplerTestControllerSynchronousProxy {
47    type Proxy = SamplerTestControllerProxy;
48    type Protocol = SamplerTestControllerMarker;
49
50    fn from_channel(inner: fidl::Channel) -> Self {
51        Self::new(inner)
52    }
53
54    fn into_channel(self) -> fidl::Channel {
55        self.client.into_channel()
56    }
57
58    fn as_channel(&self) -> &fidl::Channel {
59        self.client.as_channel()
60    }
61}
62
63#[cfg(target_os = "fuchsia")]
64impl SamplerTestControllerSynchronousProxy {
65    pub fn new(channel: fidl::Channel) -> Self {
66        let protocol_name =
67            <SamplerTestControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
68        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
69    }
70
71    pub fn into_channel(self) -> fidl::Channel {
72        self.client.into_channel()
73    }
74
75    /// Waits until an event arrives and returns it. It is safe for other
76    /// threads to make concurrent requests while waiting for an event.
77    pub fn wait_for_event(
78        &self,
79        deadline: zx::MonotonicInstant,
80    ) -> Result<SamplerTestControllerEvent, fidl::Error> {
81        SamplerTestControllerEvent::decode(self.client.wait_for_event(deadline)?)
82    }
83
84    pub fn r#increment_int(
85        &self,
86        mut property_id: u16,
87        ___deadline: zx::MonotonicInstant,
88    ) -> Result<(), fidl::Error> {
89        let _response = self
90            .client
91            .send_query::<SamplerTestControllerIncrementIntRequest, fidl::encoding::EmptyPayload>(
92                (property_id,),
93                0x38330ef9d7233f6e,
94                fidl::encoding::DynamicFlags::empty(),
95                ___deadline,
96            )?;
97        Ok(_response)
98    }
99
100    pub fn r#set_optional(
101        &self,
102        mut value: i64,
103        ___deadline: zx::MonotonicInstant,
104    ) -> Result<(), fidl::Error> {
105        let _response = self
106            .client
107            .send_query::<SamplerTestControllerSetOptionalRequest, fidl::encoding::EmptyPayload>(
108                (value,),
109                0x41f2f914c43d92d1,
110                fidl::encoding::DynamicFlags::empty(),
111                ___deadline,
112            )?;
113        Ok(_response)
114    }
115
116    pub fn r#remove_optional(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
117        let _response =
118            self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::EmptyPayload>(
119                (),
120                0x3d2273c482b7014c,
121                fidl::encoding::DynamicFlags::empty(),
122                ___deadline,
123            )?;
124        Ok(_response)
125    }
126
127    pub fn r#wait_for_sample(
128        &self,
129        ___deadline: zx::MonotonicInstant,
130    ) -> Result<SamplerTestControllerWaitForSampleResult, fidl::Error> {
131        let _response = self.client.send_query::<
132            fidl::encoding::EmptyPayload,
133            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, SamplingError>,
134        >(
135            (),
136            0x6edb38cecf8d027b,
137            fidl::encoding::DynamicFlags::empty(),
138            ___deadline,
139        )?;
140        Ok(_response.map(|x| x))
141    }
142}
143
144#[derive(Debug, Clone)]
145pub struct SamplerTestControllerProxy {
146    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
147}
148
149impl fidl::endpoints::Proxy for SamplerTestControllerProxy {
150    type Protocol = SamplerTestControllerMarker;
151
152    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
153        Self::new(inner)
154    }
155
156    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
157        self.client.into_channel().map_err(|client| Self { client })
158    }
159
160    fn as_channel(&self) -> &::fidl::AsyncChannel {
161        self.client.as_channel()
162    }
163}
164
165impl SamplerTestControllerProxy {
166    /// Create a new Proxy for fuchsia.samplertestcontroller/SamplerTestController.
167    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
168        let protocol_name =
169            <SamplerTestControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
170        Self { client: fidl::client::Client::new(channel, protocol_name) }
171    }
172
173    /// Get a Stream of events from the remote end of the protocol.
174    ///
175    /// # Panics
176    ///
177    /// Panics if the event stream was already taken.
178    pub fn take_event_stream(&self) -> SamplerTestControllerEventStream {
179        SamplerTestControllerEventStream { event_receiver: self.client.take_event_receiver() }
180    }
181
182    pub fn r#increment_int(
183        &self,
184        mut property_id: u16,
185    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
186        SamplerTestControllerProxyInterface::r#increment_int(self, property_id)
187    }
188
189    pub fn r#set_optional(
190        &self,
191        mut value: i64,
192    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
193        SamplerTestControllerProxyInterface::r#set_optional(self, value)
194    }
195
196    pub fn r#remove_optional(
197        &self,
198    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
199        SamplerTestControllerProxyInterface::r#remove_optional(self)
200    }
201
202    pub fn r#wait_for_sample(
203        &self,
204    ) -> fidl::client::QueryResponseFut<
205        SamplerTestControllerWaitForSampleResult,
206        fidl::encoding::DefaultFuchsiaResourceDialect,
207    > {
208        SamplerTestControllerProxyInterface::r#wait_for_sample(self)
209    }
210}
211
212impl SamplerTestControllerProxyInterface for SamplerTestControllerProxy {
213    type IncrementIntResponseFut =
214        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
215    fn r#increment_int(&self, mut property_id: u16) -> Self::IncrementIntResponseFut {
216        fn _decode(
217            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
218        ) -> Result<(), fidl::Error> {
219            let _response = fidl::client::decode_transaction_body::<
220                fidl::encoding::EmptyPayload,
221                fidl::encoding::DefaultFuchsiaResourceDialect,
222                0x38330ef9d7233f6e,
223            >(_buf?)?;
224            Ok(_response)
225        }
226        self.client.send_query_and_decode::<SamplerTestControllerIncrementIntRequest, ()>(
227            (property_id,),
228            0x38330ef9d7233f6e,
229            fidl::encoding::DynamicFlags::empty(),
230            _decode,
231        )
232    }
233
234    type SetOptionalResponseFut =
235        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
236    fn r#set_optional(&self, mut value: i64) -> Self::SetOptionalResponseFut {
237        fn _decode(
238            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
239        ) -> Result<(), fidl::Error> {
240            let _response = fidl::client::decode_transaction_body::<
241                fidl::encoding::EmptyPayload,
242                fidl::encoding::DefaultFuchsiaResourceDialect,
243                0x41f2f914c43d92d1,
244            >(_buf?)?;
245            Ok(_response)
246        }
247        self.client.send_query_and_decode::<SamplerTestControllerSetOptionalRequest, ()>(
248            (value,),
249            0x41f2f914c43d92d1,
250            fidl::encoding::DynamicFlags::empty(),
251            _decode,
252        )
253    }
254
255    type RemoveOptionalResponseFut =
256        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
257    fn r#remove_optional(&self) -> Self::RemoveOptionalResponseFut {
258        fn _decode(
259            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
260        ) -> Result<(), fidl::Error> {
261            let _response = fidl::client::decode_transaction_body::<
262                fidl::encoding::EmptyPayload,
263                fidl::encoding::DefaultFuchsiaResourceDialect,
264                0x3d2273c482b7014c,
265            >(_buf?)?;
266            Ok(_response)
267        }
268        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
269            (),
270            0x3d2273c482b7014c,
271            fidl::encoding::DynamicFlags::empty(),
272            _decode,
273        )
274    }
275
276    type WaitForSampleResponseFut = fidl::client::QueryResponseFut<
277        SamplerTestControllerWaitForSampleResult,
278        fidl::encoding::DefaultFuchsiaResourceDialect,
279    >;
280    fn r#wait_for_sample(&self) -> Self::WaitForSampleResponseFut {
281        fn _decode(
282            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
283        ) -> Result<SamplerTestControllerWaitForSampleResult, fidl::Error> {
284            let _response = fidl::client::decode_transaction_body::<
285                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, SamplingError>,
286                fidl::encoding::DefaultFuchsiaResourceDialect,
287                0x6edb38cecf8d027b,
288            >(_buf?)?;
289            Ok(_response.map(|x| x))
290        }
291        self.client.send_query_and_decode::<
292            fidl::encoding::EmptyPayload,
293            SamplerTestControllerWaitForSampleResult,
294        >(
295            (),
296            0x6edb38cecf8d027b,
297            fidl::encoding::DynamicFlags::empty(),
298            _decode,
299        )
300    }
301}
302
303pub struct SamplerTestControllerEventStream {
304    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
305}
306
307impl std::marker::Unpin for SamplerTestControllerEventStream {}
308
309impl futures::stream::FusedStream for SamplerTestControllerEventStream {
310    fn is_terminated(&self) -> bool {
311        self.event_receiver.is_terminated()
312    }
313}
314
315impl futures::Stream for SamplerTestControllerEventStream {
316    type Item = Result<SamplerTestControllerEvent, fidl::Error>;
317
318    fn poll_next(
319        mut self: std::pin::Pin<&mut Self>,
320        cx: &mut std::task::Context<'_>,
321    ) -> std::task::Poll<Option<Self::Item>> {
322        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
323            &mut self.event_receiver,
324            cx
325        )?) {
326            Some(buf) => std::task::Poll::Ready(Some(SamplerTestControllerEvent::decode(buf))),
327            None => std::task::Poll::Ready(None),
328        }
329    }
330}
331
332#[derive(Debug)]
333pub enum SamplerTestControllerEvent {}
334
335impl SamplerTestControllerEvent {
336    /// Decodes a message buffer as a [`SamplerTestControllerEvent`].
337    fn decode(
338        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
339    ) -> Result<SamplerTestControllerEvent, fidl::Error> {
340        let (bytes, _handles) = buf.split_mut();
341        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
342        debug_assert_eq!(tx_header.tx_id, 0);
343        match tx_header.ordinal {
344            _ => Err(fidl::Error::UnknownOrdinal {
345                ordinal: tx_header.ordinal,
346                protocol_name:
347                    <SamplerTestControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
348            }),
349        }
350    }
351}
352
353/// A Stream of incoming requests for fuchsia.samplertestcontroller/SamplerTestController.
354pub struct SamplerTestControllerRequestStream {
355    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
356    is_terminated: bool,
357}
358
359impl std::marker::Unpin for SamplerTestControllerRequestStream {}
360
361impl futures::stream::FusedStream for SamplerTestControllerRequestStream {
362    fn is_terminated(&self) -> bool {
363        self.is_terminated
364    }
365}
366
367impl fidl::endpoints::RequestStream for SamplerTestControllerRequestStream {
368    type Protocol = SamplerTestControllerMarker;
369    type ControlHandle = SamplerTestControllerControlHandle;
370
371    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
372        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
373    }
374
375    fn control_handle(&self) -> Self::ControlHandle {
376        SamplerTestControllerControlHandle { inner: self.inner.clone() }
377    }
378
379    fn into_inner(
380        self,
381    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
382    {
383        (self.inner, self.is_terminated)
384    }
385
386    fn from_inner(
387        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
388        is_terminated: bool,
389    ) -> Self {
390        Self { inner, is_terminated }
391    }
392}
393
394impl futures::Stream for SamplerTestControllerRequestStream {
395    type Item = Result<SamplerTestControllerRequest, fidl::Error>;
396
397    fn poll_next(
398        mut self: std::pin::Pin<&mut Self>,
399        cx: &mut std::task::Context<'_>,
400    ) -> std::task::Poll<Option<Self::Item>> {
401        let this = &mut *self;
402        if this.inner.check_shutdown(cx) {
403            this.is_terminated = true;
404            return std::task::Poll::Ready(None);
405        }
406        if this.is_terminated {
407            panic!("polled SamplerTestControllerRequestStream after completion");
408        }
409        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
410            |bytes, handles| {
411                match this.inner.channel().read_etc(cx, bytes, handles) {
412                    std::task::Poll::Ready(Ok(())) => {}
413                    std::task::Poll::Pending => return std::task::Poll::Pending,
414                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
415                        this.is_terminated = true;
416                        return std::task::Poll::Ready(None);
417                    }
418                    std::task::Poll::Ready(Err(e)) => {
419                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
420                            e.into(),
421                        ))))
422                    }
423                }
424
425                // A message has been received from the channel
426                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
427
428                std::task::Poll::Ready(Some(match header.ordinal {
429                0x38330ef9d7233f6e => {
430                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
431                    let mut req = fidl::new_empty!(SamplerTestControllerIncrementIntRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
432                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SamplerTestControllerIncrementIntRequest>(&header, _body_bytes, handles, &mut req)?;
433                    let control_handle = SamplerTestControllerControlHandle {
434                        inner: this.inner.clone(),
435                    };
436                    Ok(SamplerTestControllerRequest::IncrementInt {property_id: req.property_id,
437
438                        responder: SamplerTestControllerIncrementIntResponder {
439                            control_handle: std::mem::ManuallyDrop::new(control_handle),
440                            tx_id: header.tx_id,
441                        },
442                    })
443                }
444                0x41f2f914c43d92d1 => {
445                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
446                    let mut req = fidl::new_empty!(SamplerTestControllerSetOptionalRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
447                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SamplerTestControllerSetOptionalRequest>(&header, _body_bytes, handles, &mut req)?;
448                    let control_handle = SamplerTestControllerControlHandle {
449                        inner: this.inner.clone(),
450                    };
451                    Ok(SamplerTestControllerRequest::SetOptional {value: req.value,
452
453                        responder: SamplerTestControllerSetOptionalResponder {
454                            control_handle: std::mem::ManuallyDrop::new(control_handle),
455                            tx_id: header.tx_id,
456                        },
457                    })
458                }
459                0x3d2273c482b7014c => {
460                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
461                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
462                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
463                    let control_handle = SamplerTestControllerControlHandle {
464                        inner: this.inner.clone(),
465                    };
466                    Ok(SamplerTestControllerRequest::RemoveOptional {
467                        responder: SamplerTestControllerRemoveOptionalResponder {
468                            control_handle: std::mem::ManuallyDrop::new(control_handle),
469                            tx_id: header.tx_id,
470                        },
471                    })
472                }
473                0x6edb38cecf8d027b => {
474                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
475                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
476                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
477                    let control_handle = SamplerTestControllerControlHandle {
478                        inner: this.inner.clone(),
479                    };
480                    Ok(SamplerTestControllerRequest::WaitForSample {
481                        responder: SamplerTestControllerWaitForSampleResponder {
482                            control_handle: std::mem::ManuallyDrop::new(control_handle),
483                            tx_id: header.tx_id,
484                        },
485                    })
486                }
487                _ => Err(fidl::Error::UnknownOrdinal {
488                    ordinal: header.ordinal,
489                    protocol_name: <SamplerTestControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
490                }),
491            }))
492            },
493        )
494    }
495}
496
497#[derive(Debug)]
498pub enum SamplerTestControllerRequest {
499    IncrementInt { property_id: u16, responder: SamplerTestControllerIncrementIntResponder },
500    SetOptional { value: i64, responder: SamplerTestControllerSetOptionalResponder },
501    RemoveOptional { responder: SamplerTestControllerRemoveOptionalResponder },
502    WaitForSample { responder: SamplerTestControllerWaitForSampleResponder },
503}
504
505impl SamplerTestControllerRequest {
506    #[allow(irrefutable_let_patterns)]
507    pub fn into_increment_int(self) -> Option<(u16, SamplerTestControllerIncrementIntResponder)> {
508        if let SamplerTestControllerRequest::IncrementInt { property_id, responder } = self {
509            Some((property_id, responder))
510        } else {
511            None
512        }
513    }
514
515    #[allow(irrefutable_let_patterns)]
516    pub fn into_set_optional(self) -> Option<(i64, SamplerTestControllerSetOptionalResponder)> {
517        if let SamplerTestControllerRequest::SetOptional { value, responder } = self {
518            Some((value, responder))
519        } else {
520            None
521        }
522    }
523
524    #[allow(irrefutable_let_patterns)]
525    pub fn into_remove_optional(self) -> Option<(SamplerTestControllerRemoveOptionalResponder)> {
526        if let SamplerTestControllerRequest::RemoveOptional { responder } = self {
527            Some((responder))
528        } else {
529            None
530        }
531    }
532
533    #[allow(irrefutable_let_patterns)]
534    pub fn into_wait_for_sample(self) -> Option<(SamplerTestControllerWaitForSampleResponder)> {
535        if let SamplerTestControllerRequest::WaitForSample { responder } = self {
536            Some((responder))
537        } else {
538            None
539        }
540    }
541
542    /// Name of the method defined in FIDL
543    pub fn method_name(&self) -> &'static str {
544        match *self {
545            SamplerTestControllerRequest::IncrementInt { .. } => "increment_int",
546            SamplerTestControllerRequest::SetOptional { .. } => "set_optional",
547            SamplerTestControllerRequest::RemoveOptional { .. } => "remove_optional",
548            SamplerTestControllerRequest::WaitForSample { .. } => "wait_for_sample",
549        }
550    }
551}
552
553#[derive(Debug, Clone)]
554pub struct SamplerTestControllerControlHandle {
555    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
556}
557
558impl fidl::endpoints::ControlHandle for SamplerTestControllerControlHandle {
559    fn shutdown(&self) {
560        self.inner.shutdown()
561    }
562    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
563        self.inner.shutdown_with_epitaph(status)
564    }
565
566    fn is_closed(&self) -> bool {
567        self.inner.channel().is_closed()
568    }
569    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
570        self.inner.channel().on_closed()
571    }
572
573    #[cfg(target_os = "fuchsia")]
574    fn signal_peer(
575        &self,
576        clear_mask: zx::Signals,
577        set_mask: zx::Signals,
578    ) -> Result<(), zx_status::Status> {
579        use fidl::Peered;
580        self.inner.channel().signal_peer(clear_mask, set_mask)
581    }
582}
583
584impl SamplerTestControllerControlHandle {}
585
586#[must_use = "FIDL methods require a response to be sent"]
587#[derive(Debug)]
588pub struct SamplerTestControllerIncrementIntResponder {
589    control_handle: std::mem::ManuallyDrop<SamplerTestControllerControlHandle>,
590    tx_id: u32,
591}
592
593/// Set the the channel to be shutdown (see [`SamplerTestControllerControlHandle::shutdown`])
594/// if the responder is dropped without sending a response, so that the client
595/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
596impl std::ops::Drop for SamplerTestControllerIncrementIntResponder {
597    fn drop(&mut self) {
598        self.control_handle.shutdown();
599        // Safety: drops once, never accessed again
600        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
601    }
602}
603
604impl fidl::endpoints::Responder for SamplerTestControllerIncrementIntResponder {
605    type ControlHandle = SamplerTestControllerControlHandle;
606
607    fn control_handle(&self) -> &SamplerTestControllerControlHandle {
608        &self.control_handle
609    }
610
611    fn drop_without_shutdown(mut self) {
612        // Safety: drops once, never accessed again due to mem::forget
613        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
614        // Prevent Drop from running (which would shut down the channel)
615        std::mem::forget(self);
616    }
617}
618
619impl SamplerTestControllerIncrementIntResponder {
620    /// Sends a response to the FIDL transaction.
621    ///
622    /// Sets the channel to shutdown if an error occurs.
623    pub fn send(self) -> Result<(), fidl::Error> {
624        let _result = self.send_raw();
625        if _result.is_err() {
626            self.control_handle.shutdown();
627        }
628        self.drop_without_shutdown();
629        _result
630    }
631
632    /// Similar to "send" but does not shutdown the channel if an error occurs.
633    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
634        let _result = self.send_raw();
635        self.drop_without_shutdown();
636        _result
637    }
638
639    fn send_raw(&self) -> Result<(), fidl::Error> {
640        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
641            (),
642            self.tx_id,
643            0x38330ef9d7233f6e,
644            fidl::encoding::DynamicFlags::empty(),
645        )
646    }
647}
648
649#[must_use = "FIDL methods require a response to be sent"]
650#[derive(Debug)]
651pub struct SamplerTestControllerSetOptionalResponder {
652    control_handle: std::mem::ManuallyDrop<SamplerTestControllerControlHandle>,
653    tx_id: u32,
654}
655
656/// Set the the channel to be shutdown (see [`SamplerTestControllerControlHandle::shutdown`])
657/// if the responder is dropped without sending a response, so that the client
658/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
659impl std::ops::Drop for SamplerTestControllerSetOptionalResponder {
660    fn drop(&mut self) {
661        self.control_handle.shutdown();
662        // Safety: drops once, never accessed again
663        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
664    }
665}
666
667impl fidl::endpoints::Responder for SamplerTestControllerSetOptionalResponder {
668    type ControlHandle = SamplerTestControllerControlHandle;
669
670    fn control_handle(&self) -> &SamplerTestControllerControlHandle {
671        &self.control_handle
672    }
673
674    fn drop_without_shutdown(mut self) {
675        // Safety: drops once, never accessed again due to mem::forget
676        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
677        // Prevent Drop from running (which would shut down the channel)
678        std::mem::forget(self);
679    }
680}
681
682impl SamplerTestControllerSetOptionalResponder {
683    /// Sends a response to the FIDL transaction.
684    ///
685    /// Sets the channel to shutdown if an error occurs.
686    pub fn send(self) -> Result<(), fidl::Error> {
687        let _result = self.send_raw();
688        if _result.is_err() {
689            self.control_handle.shutdown();
690        }
691        self.drop_without_shutdown();
692        _result
693    }
694
695    /// Similar to "send" but does not shutdown the channel if an error occurs.
696    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
697        let _result = self.send_raw();
698        self.drop_without_shutdown();
699        _result
700    }
701
702    fn send_raw(&self) -> Result<(), fidl::Error> {
703        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
704            (),
705            self.tx_id,
706            0x41f2f914c43d92d1,
707            fidl::encoding::DynamicFlags::empty(),
708        )
709    }
710}
711
712#[must_use = "FIDL methods require a response to be sent"]
713#[derive(Debug)]
714pub struct SamplerTestControllerRemoveOptionalResponder {
715    control_handle: std::mem::ManuallyDrop<SamplerTestControllerControlHandle>,
716    tx_id: u32,
717}
718
719/// Set the the channel to be shutdown (see [`SamplerTestControllerControlHandle::shutdown`])
720/// if the responder is dropped without sending a response, so that the client
721/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
722impl std::ops::Drop for SamplerTestControllerRemoveOptionalResponder {
723    fn drop(&mut self) {
724        self.control_handle.shutdown();
725        // Safety: drops once, never accessed again
726        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
727    }
728}
729
730impl fidl::endpoints::Responder for SamplerTestControllerRemoveOptionalResponder {
731    type ControlHandle = SamplerTestControllerControlHandle;
732
733    fn control_handle(&self) -> &SamplerTestControllerControlHandle {
734        &self.control_handle
735    }
736
737    fn drop_without_shutdown(mut self) {
738        // Safety: drops once, never accessed again due to mem::forget
739        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
740        // Prevent Drop from running (which would shut down the channel)
741        std::mem::forget(self);
742    }
743}
744
745impl SamplerTestControllerRemoveOptionalResponder {
746    /// Sends a response to the FIDL transaction.
747    ///
748    /// Sets the channel to shutdown if an error occurs.
749    pub fn send(self) -> Result<(), fidl::Error> {
750        let _result = self.send_raw();
751        if _result.is_err() {
752            self.control_handle.shutdown();
753        }
754        self.drop_without_shutdown();
755        _result
756    }
757
758    /// Similar to "send" but does not shutdown the channel if an error occurs.
759    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
760        let _result = self.send_raw();
761        self.drop_without_shutdown();
762        _result
763    }
764
765    fn send_raw(&self) -> Result<(), fidl::Error> {
766        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
767            (),
768            self.tx_id,
769            0x3d2273c482b7014c,
770            fidl::encoding::DynamicFlags::empty(),
771        )
772    }
773}
774
775#[must_use = "FIDL methods require a response to be sent"]
776#[derive(Debug)]
777pub struct SamplerTestControllerWaitForSampleResponder {
778    control_handle: std::mem::ManuallyDrop<SamplerTestControllerControlHandle>,
779    tx_id: u32,
780}
781
782/// Set the the channel to be shutdown (see [`SamplerTestControllerControlHandle::shutdown`])
783/// if the responder is dropped without sending a response, so that the client
784/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
785impl std::ops::Drop for SamplerTestControllerWaitForSampleResponder {
786    fn drop(&mut self) {
787        self.control_handle.shutdown();
788        // Safety: drops once, never accessed again
789        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
790    }
791}
792
793impl fidl::endpoints::Responder for SamplerTestControllerWaitForSampleResponder {
794    type ControlHandle = SamplerTestControllerControlHandle;
795
796    fn control_handle(&self) -> &SamplerTestControllerControlHandle {
797        &self.control_handle
798    }
799
800    fn drop_without_shutdown(mut self) {
801        // Safety: drops once, never accessed again due to mem::forget
802        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
803        // Prevent Drop from running (which would shut down the channel)
804        std::mem::forget(self);
805    }
806}
807
808impl SamplerTestControllerWaitForSampleResponder {
809    /// Sends a response to the FIDL transaction.
810    ///
811    /// Sets the channel to shutdown if an error occurs.
812    pub fn send(self, mut result: Result<(), SamplingError>) -> Result<(), fidl::Error> {
813        let _result = self.send_raw(result);
814        if _result.is_err() {
815            self.control_handle.shutdown();
816        }
817        self.drop_without_shutdown();
818        _result
819    }
820
821    /// Similar to "send" but does not shutdown the channel if an error occurs.
822    pub fn send_no_shutdown_on_err(
823        self,
824        mut result: Result<(), SamplingError>,
825    ) -> Result<(), fidl::Error> {
826        let _result = self.send_raw(result);
827        self.drop_without_shutdown();
828        _result
829    }
830
831    fn send_raw(&self, mut result: Result<(), SamplingError>) -> Result<(), fidl::Error> {
832        self.control_handle.inner.send::<fidl::encoding::ResultType<
833            fidl::encoding::EmptyStruct,
834            SamplingError,
835        >>(
836            result,
837            self.tx_id,
838            0x6edb38cecf8d027b,
839            fidl::encoding::DynamicFlags::empty(),
840        )
841    }
842}
843
844mod internal {
845    use super::*;
846}