Skip to main content

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