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