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