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::NullableHandle {
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
470    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
471        self.inner.shutdown_with_epitaph(status)
472    }
473
474    fn is_closed(&self) -> bool {
475        self.inner.channel().is_closed()
476    }
477    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
478        self.inner.channel().on_closed()
479    }
480
481    #[cfg(target_os = "fuchsia")]
482    fn signal_peer(
483        &self,
484        clear_mask: zx::Signals,
485        set_mask: zx::Signals,
486    ) -> Result<(), zx_status::Status> {
487        use fidl::Peered;
488        self.inner.channel().signal_peer(clear_mask, set_mask)
489    }
490}
491
492impl StarnixVolumeAdminControlHandle {}
493
494#[must_use = "FIDL methods require a response to be sent"]
495#[derive(Debug)]
496pub struct StarnixVolumeAdminDeleteResponder {
497    control_handle: std::mem::ManuallyDrop<StarnixVolumeAdminControlHandle>,
498    tx_id: u32,
499}
500
501/// Set the the channel to be shutdown (see [`StarnixVolumeAdminControlHandle::shutdown`])
502/// if the responder is dropped without sending a response, so that the client
503/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
504impl std::ops::Drop for StarnixVolumeAdminDeleteResponder {
505    fn drop(&mut self) {
506        self.control_handle.shutdown();
507        // Safety: drops once, never accessed again
508        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
509    }
510}
511
512impl fidl::endpoints::Responder for StarnixVolumeAdminDeleteResponder {
513    type ControlHandle = StarnixVolumeAdminControlHandle;
514
515    fn control_handle(&self) -> &StarnixVolumeAdminControlHandle {
516        &self.control_handle
517    }
518
519    fn drop_without_shutdown(mut self) {
520        // Safety: drops once, never accessed again due to mem::forget
521        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
522        // Prevent Drop from running (which would shut down the channel)
523        std::mem::forget(self);
524    }
525}
526
527impl StarnixVolumeAdminDeleteResponder {
528    /// Sends a response to the FIDL transaction.
529    ///
530    /// Sets the channel to shutdown if an error occurs.
531    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
532        let _result = self.send_raw(result);
533        if _result.is_err() {
534            self.control_handle.shutdown();
535        }
536        self.drop_without_shutdown();
537        _result
538    }
539
540    /// Similar to "send" but does not shutdown the channel if an error occurs.
541    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
542        let _result = self.send_raw(result);
543        self.drop_without_shutdown();
544        _result
545    }
546
547    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
548        self.control_handle
549            .inner
550            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
551                result,
552                self.tx_id,
553                0x46fe41ebeb62bb3b,
554                fidl::encoding::DynamicFlags::empty(),
555            )
556    }
557}
558
559#[must_use = "FIDL methods require a response to be sent"]
560#[derive(Debug)]
561pub struct StarnixVolumeAdminGetRootResponder {
562    control_handle: std::mem::ManuallyDrop<StarnixVolumeAdminControlHandle>,
563    tx_id: u32,
564}
565
566/// Set the the channel to be shutdown (see [`StarnixVolumeAdminControlHandle::shutdown`])
567/// if the responder is dropped without sending a response, so that the client
568/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
569impl std::ops::Drop for StarnixVolumeAdminGetRootResponder {
570    fn drop(&mut self) {
571        self.control_handle.shutdown();
572        // Safety: drops once, never accessed again
573        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
574    }
575}
576
577impl fidl::endpoints::Responder for StarnixVolumeAdminGetRootResponder {
578    type ControlHandle = StarnixVolumeAdminControlHandle;
579
580    fn control_handle(&self) -> &StarnixVolumeAdminControlHandle {
581        &self.control_handle
582    }
583
584    fn drop_without_shutdown(mut self) {
585        // Safety: drops once, never accessed again due to mem::forget
586        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
587        // Prevent Drop from running (which would shut down the channel)
588        std::mem::forget(self);
589    }
590}
591
592impl StarnixVolumeAdminGetRootResponder {
593    /// Sends a response to the FIDL transaction.
594    ///
595    /// Sets the channel to shutdown if an error occurs.
596    pub fn send(
597        self,
598        mut result: Result<fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>, i32>,
599    ) -> Result<(), fidl::Error> {
600        let _result = self.send_raw(result);
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(
610        self,
611        mut result: Result<fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>, i32>,
612    ) -> Result<(), fidl::Error> {
613        let _result = self.send_raw(result);
614        self.drop_without_shutdown();
615        _result
616    }
617
618    fn send_raw(
619        &self,
620        mut result: Result<fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>, i32>,
621    ) -> Result<(), fidl::Error> {
622        self.control_handle
623            .inner
624            .send::<fidl::encoding::ResultType<StarnixVolumeAdminGetRootResponse, i32>>(
625                result.map(|root_dir| (root_dir,)),
626                self.tx_id,
627                0x6fc8d53f60ac96a2,
628                fidl::encoding::DynamicFlags::empty(),
629            )
630    }
631}
632
633mod internal {
634    use super::*;
635
636    impl fidl::encoding::ResourceTypeMarker for StarnixVolumeAdminGetRootResponse {
637        type Borrowed<'a> = &'a mut Self;
638        fn take_or_borrow<'a>(
639            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
640        ) -> Self::Borrowed<'a> {
641            value
642        }
643    }
644
645    unsafe impl fidl::encoding::TypeMarker for StarnixVolumeAdminGetRootResponse {
646        type Owned = Self;
647
648        #[inline(always)]
649        fn inline_align(_context: fidl::encoding::Context) -> usize {
650            4
651        }
652
653        #[inline(always)]
654        fn inline_size(_context: fidl::encoding::Context) -> usize {
655            4
656        }
657    }
658
659    unsafe impl
660        fidl::encoding::Encode<
661            StarnixVolumeAdminGetRootResponse,
662            fidl::encoding::DefaultFuchsiaResourceDialect,
663        > for &mut StarnixVolumeAdminGetRootResponse
664    {
665        #[inline]
666        unsafe fn encode(
667            self,
668            encoder: &mut fidl::encoding::Encoder<
669                '_,
670                fidl::encoding::DefaultFuchsiaResourceDialect,
671            >,
672            offset: usize,
673            _depth: fidl::encoding::Depth,
674        ) -> fidl::Result<()> {
675            encoder.debug_check_bounds::<StarnixVolumeAdminGetRootResponse>(offset);
676            // Delegate to tuple encoding.
677            fidl::encoding::Encode::<
678                StarnixVolumeAdminGetRootResponse,
679                fidl::encoding::DefaultFuchsiaResourceDialect,
680            >::encode(
681                (<fidl::encoding::Endpoint<
682                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
683                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
684                    &mut self.root_dir
685                ),),
686                encoder,
687                offset,
688                _depth,
689            )
690        }
691    }
692    unsafe impl<
693        T0: fidl::encoding::Encode<
694                fidl::encoding::Endpoint<
695                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
696                >,
697                fidl::encoding::DefaultFuchsiaResourceDialect,
698            >,
699    >
700        fidl::encoding::Encode<
701            StarnixVolumeAdminGetRootResponse,
702            fidl::encoding::DefaultFuchsiaResourceDialect,
703        > for (T0,)
704    {
705        #[inline]
706        unsafe fn encode(
707            self,
708            encoder: &mut fidl::encoding::Encoder<
709                '_,
710                fidl::encoding::DefaultFuchsiaResourceDialect,
711            >,
712            offset: usize,
713            depth: fidl::encoding::Depth,
714        ) -> fidl::Result<()> {
715            encoder.debug_check_bounds::<StarnixVolumeAdminGetRootResponse>(offset);
716            // Zero out padding regions. There's no need to apply masks
717            // because the unmasked parts will be overwritten by fields.
718            // Write the fields.
719            self.0.encode(encoder, offset + 0, depth)?;
720            Ok(())
721        }
722    }
723
724    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
725        for StarnixVolumeAdminGetRootResponse
726    {
727        #[inline(always)]
728        fn new_empty() -> Self {
729            Self {
730                root_dir: fidl::new_empty!(
731                    fidl::encoding::Endpoint<
732                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
733                    >,
734                    fidl::encoding::DefaultFuchsiaResourceDialect
735                ),
736            }
737        }
738
739        #[inline]
740        unsafe fn decode(
741            &mut self,
742            decoder: &mut fidl::encoding::Decoder<
743                '_,
744                fidl::encoding::DefaultFuchsiaResourceDialect,
745            >,
746            offset: usize,
747            _depth: fidl::encoding::Depth,
748        ) -> fidl::Result<()> {
749            decoder.debug_check_bounds::<Self>(offset);
750            // Verify that padding bytes are zero.
751            fidl::decode!(
752                fidl::encoding::Endpoint<
753                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
754                >,
755                fidl::encoding::DefaultFuchsiaResourceDialect,
756                &mut self.root_dir,
757                decoder,
758                offset + 0,
759                _depth
760            )?;
761            Ok(())
762        }
763    }
764}