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