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