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