fidl_fuchsia_hardware_ramdisk/
fidl_fuchsia_hardware_ramdisk.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 _};
10use futures::future::{self, MaybeDone, TryFutureExt};
11use zx_status;
12
13/// Matches the value of ZBI_PARTITION_GUID_LEN.
14pub const GUID_LEN: u32 = 16;
15
16pub const MAX_NAME_LENGTH: u32 = 32;
17
18bitflags! {
19    #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
20    pub struct RamdiskFlag: u32 {
21        /// Identifies if requests which are sent ot the ramdisk while it is
22        /// considered "asleep" should be processed when the ramdisk wakes
23        /// up. If this flag is not set, those requests are failed
24        /// immediately.
25        const RESUME_ON_WAKE = 1;
26        /// If set, blocks written after the last flush are filled with an
27        /// indeterminate value when waking after sleeping.
28        const DISCARD_NOT_FLUSHED_ON_WAKE = 2;
29        /// If set, blocks written after the last flush are filled at
30        /// random rather than all blocks.  This can be used to simulate
31        /// out-of-order writes.
32        const DISCARD_RANDOM = 4;
33    }
34}
35
36impl RamdiskFlag {
37    #[deprecated = "Strict bits should not use `has_unknown_bits`"]
38    #[inline(always)]
39    pub fn has_unknown_bits(&self) -> bool {
40        false
41    }
42
43    #[deprecated = "Strict bits should not use `get_unknown_bits`"]
44    #[inline(always)]
45    pub fn get_unknown_bits(&self) -> u32 {
46        0
47    }
48}
49
50#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
51#[repr(C)]
52pub struct BlockWriteCounts {
53    pub received: u64,
54    pub successful: u64,
55    pub failed: u64,
56}
57
58impl fidl::Persistable for BlockWriteCounts {}
59
60#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
61pub struct ControllerCreateResponse {
62    pub outgoing: fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
63    pub lifeline: fidl::EventPair,
64}
65
66impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ControllerCreateResponse {}
67
68/// An array of bytes interpreted as a GUID. Wrapped in a struct to
69/// allow optional GUIDs.
70#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
71#[repr(C)]
72pub struct Guid {
73    pub value: [u8; 16],
74}
75
76impl fidl::Persistable for Guid {}
77
78#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
79pub struct RamdiskControllerCreateFromVmoRequest {
80    pub vmo: fidl::Vmo,
81}
82
83impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
84    for RamdiskControllerCreateFromVmoRequest
85{
86}
87
88#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
89pub struct RamdiskControllerCreateFromVmoWithParamsRequest {
90    pub vmo: fidl::Vmo,
91    pub block_size: u64,
92    pub type_guid: Option<Box<Guid>>,
93}
94
95impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
96    for RamdiskControllerCreateFromVmoWithParamsRequest
97{
98}
99
100#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
101pub struct RamdiskControllerCreateRequest {
102    pub block_size: u64,
103    pub block_count: u64,
104    pub type_guid: Option<Box<Guid>>,
105}
106
107impl fidl::Persistable for RamdiskControllerCreateRequest {}
108
109#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
110pub struct RamdiskControllerCreateFromVmoWithParamsResponse {
111    pub name: Option<String>,
112}
113
114impl fidl::Persistable for RamdiskControllerCreateFromVmoWithParamsResponse {}
115
116#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
117pub struct RamdiskControllerCreateFromVmoResponse {
118    pub name: Option<String>,
119}
120
121impl fidl::Persistable for RamdiskControllerCreateFromVmoResponse {}
122
123#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
124pub struct RamdiskControllerCreateResponse {
125    pub name: Option<String>,
126}
127
128impl fidl::Persistable for RamdiskControllerCreateResponse {}
129
130#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
131#[repr(C)]
132pub struct RamdiskGetBlockCountsResponse {
133    /// Counters for the number of write requests since the last call to either
134    /// "SleepAfter" or "Wake". All units are in individual blocks.
135    pub counts: BlockWriteCounts,
136}
137
138impl fidl::Persistable for RamdiskGetBlockCountsResponse {}
139
140#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
141pub struct RamdiskSetFlagsRequest {
142    pub flags: RamdiskFlag,
143}
144
145impl fidl::Persistable for RamdiskSetFlagsRequest {}
146
147#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
148#[repr(C)]
149pub struct RamdiskSleepAfterRequest {
150    pub count: u64,
151}
152
153impl fidl::Persistable for RamdiskSleepAfterRequest {}
154
155/// Options for creating a ram-disk.  Some combinations are invalid and will
156/// result in ZX_ERR_INVALID_ARGS.
157#[derive(Debug, Default, PartialEq)]
158pub struct Options {
159    /// If unspecified, the system page size is used.
160    pub block_size: Option<u32>,
161    /// If unspecified, will be deduced from `vmo`.
162    pub block_count: Option<u64>,
163    /// Optional type GUID returned in the fuchsia.hardware.block.partition.Partition protocol.
164    pub type_guid: Option<Guid>,
165    /// If unspecified, a VMO will be created, in which case `block_count` must be specified.
166    pub vmo: Option<fidl::Vmo>,
167    /// If true, expose fuchsia.hardware.block.volume.Service for the ramdisk.
168    pub publish: Option<bool>,
169    #[doc(hidden)]
170    pub __source_breaking: fidl::marker::SourceBreaking,
171}
172
173impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for Options {}
174
175#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
176pub struct ControllerMarker;
177
178impl fidl::endpoints::ProtocolMarker for ControllerMarker {
179    type Proxy = ControllerProxy;
180    type RequestStream = ControllerRequestStream;
181    #[cfg(target_os = "fuchsia")]
182    type SynchronousProxy = ControllerSynchronousProxy;
183
184    const DEBUG_NAME: &'static str = "(anonymous) Controller";
185}
186pub type ControllerCreateResult =
187    Result<(fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>, fidl::EventPair), i32>;
188
189pub trait ControllerProxyInterface: Send + Sync {
190    type CreateResponseFut: std::future::Future<Output = Result<ControllerCreateResult, fidl::Error>>
191        + Send;
192    fn r#create(&self, payload: Options) -> Self::CreateResponseFut;
193}
194#[derive(Debug)]
195#[cfg(target_os = "fuchsia")]
196pub struct ControllerSynchronousProxy {
197    client: fidl::client::sync::Client,
198}
199
200#[cfg(target_os = "fuchsia")]
201impl fidl::endpoints::SynchronousProxy for ControllerSynchronousProxy {
202    type Proxy = ControllerProxy;
203    type Protocol = ControllerMarker;
204
205    fn from_channel(inner: fidl::Channel) -> Self {
206        Self::new(inner)
207    }
208
209    fn into_channel(self) -> fidl::Channel {
210        self.client.into_channel()
211    }
212
213    fn as_channel(&self) -> &fidl::Channel {
214        self.client.as_channel()
215    }
216}
217
218#[cfg(target_os = "fuchsia")]
219impl ControllerSynchronousProxy {
220    pub fn new(channel: fidl::Channel) -> Self {
221        let protocol_name = <ControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
222        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
223    }
224
225    pub fn into_channel(self) -> fidl::Channel {
226        self.client.into_channel()
227    }
228
229    /// Waits until an event arrives and returns it. It is safe for other
230    /// threads to make concurrent requests while waiting for an event.
231    pub fn wait_for_event(
232        &self,
233        deadline: zx::MonotonicInstant,
234    ) -> Result<ControllerEvent, fidl::Error> {
235        ControllerEvent::decode(self.client.wait_for_event(deadline)?)
236    }
237
238    /// Initializes a new Ramdisk instance with the specified options.  Returns an outgoing
239    /// directory for the ramdisk which will export the Ramdisk and
240    /// fuchsia.hardware.block.volume.Volume protocols.
241    pub fn r#create(
242        &self,
243        mut payload: Options,
244        ___deadline: zx::MonotonicInstant,
245    ) -> Result<ControllerCreateResult, fidl::Error> {
246        let _response = self
247            .client
248            .send_query::<Options, fidl::encoding::ResultType<ControllerCreateResponse, i32>>(
249                &mut payload,
250                0x70c20e8a741fecb8,
251                fidl::encoding::DynamicFlags::empty(),
252                ___deadline,
253            )?;
254        Ok(_response.map(|x| (x.outgoing, x.lifeline)))
255    }
256}
257
258#[derive(Debug, Clone)]
259pub struct ControllerProxy {
260    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
261}
262
263impl fidl::endpoints::Proxy for ControllerProxy {
264    type Protocol = ControllerMarker;
265
266    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
267        Self::new(inner)
268    }
269
270    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
271        self.client.into_channel().map_err(|client| Self { client })
272    }
273
274    fn as_channel(&self) -> &::fidl::AsyncChannel {
275        self.client.as_channel()
276    }
277}
278
279impl ControllerProxy {
280    /// Create a new Proxy for fuchsia.hardware.ramdisk/Controller.
281    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
282        let protocol_name = <ControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
283        Self { client: fidl::client::Client::new(channel, protocol_name) }
284    }
285
286    /// Get a Stream of events from the remote end of the protocol.
287    ///
288    /// # Panics
289    ///
290    /// Panics if the event stream was already taken.
291    pub fn take_event_stream(&self) -> ControllerEventStream {
292        ControllerEventStream { event_receiver: self.client.take_event_receiver() }
293    }
294
295    /// Initializes a new Ramdisk instance with the specified options.  Returns an outgoing
296    /// directory for the ramdisk which will export the Ramdisk and
297    /// fuchsia.hardware.block.volume.Volume protocols.
298    pub fn r#create(
299        &self,
300        mut payload: Options,
301    ) -> fidl::client::QueryResponseFut<
302        ControllerCreateResult,
303        fidl::encoding::DefaultFuchsiaResourceDialect,
304    > {
305        ControllerProxyInterface::r#create(self, payload)
306    }
307}
308
309impl ControllerProxyInterface for ControllerProxy {
310    type CreateResponseFut = fidl::client::QueryResponseFut<
311        ControllerCreateResult,
312        fidl::encoding::DefaultFuchsiaResourceDialect,
313    >;
314    fn r#create(&self, mut payload: Options) -> Self::CreateResponseFut {
315        fn _decode(
316            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
317        ) -> Result<ControllerCreateResult, fidl::Error> {
318            let _response = fidl::client::decode_transaction_body::<
319                fidl::encoding::ResultType<ControllerCreateResponse, i32>,
320                fidl::encoding::DefaultFuchsiaResourceDialect,
321                0x70c20e8a741fecb8,
322            >(_buf?)?;
323            Ok(_response.map(|x| (x.outgoing, x.lifeline)))
324        }
325        self.client.send_query_and_decode::<Options, ControllerCreateResult>(
326            &mut payload,
327            0x70c20e8a741fecb8,
328            fidl::encoding::DynamicFlags::empty(),
329            _decode,
330        )
331    }
332}
333
334pub struct ControllerEventStream {
335    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
336}
337
338impl std::marker::Unpin for ControllerEventStream {}
339
340impl futures::stream::FusedStream for ControllerEventStream {
341    fn is_terminated(&self) -> bool {
342        self.event_receiver.is_terminated()
343    }
344}
345
346impl futures::Stream for ControllerEventStream {
347    type Item = Result<ControllerEvent, fidl::Error>;
348
349    fn poll_next(
350        mut self: std::pin::Pin<&mut Self>,
351        cx: &mut std::task::Context<'_>,
352    ) -> std::task::Poll<Option<Self::Item>> {
353        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
354            &mut self.event_receiver,
355            cx
356        )?) {
357            Some(buf) => std::task::Poll::Ready(Some(ControllerEvent::decode(buf))),
358            None => std::task::Poll::Ready(None),
359        }
360    }
361}
362
363#[derive(Debug)]
364pub enum ControllerEvent {
365    #[non_exhaustive]
366    _UnknownEvent {
367        /// Ordinal of the event that was sent.
368        ordinal: u64,
369    },
370}
371
372impl ControllerEvent {
373    /// Decodes a message buffer as a [`ControllerEvent`].
374    fn decode(
375        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
376    ) -> Result<ControllerEvent, fidl::Error> {
377        let (bytes, _handles) = buf.split_mut();
378        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
379        debug_assert_eq!(tx_header.tx_id, 0);
380        match tx_header.ordinal {
381            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
382                Ok(ControllerEvent::_UnknownEvent { ordinal: tx_header.ordinal })
383            }
384            _ => Err(fidl::Error::UnknownOrdinal {
385                ordinal: tx_header.ordinal,
386                protocol_name: <ControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
387            }),
388        }
389    }
390}
391
392/// A Stream of incoming requests for fuchsia.hardware.ramdisk/Controller.
393pub struct ControllerRequestStream {
394    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
395    is_terminated: bool,
396}
397
398impl std::marker::Unpin for ControllerRequestStream {}
399
400impl futures::stream::FusedStream for ControllerRequestStream {
401    fn is_terminated(&self) -> bool {
402        self.is_terminated
403    }
404}
405
406impl fidl::endpoints::RequestStream for ControllerRequestStream {
407    type Protocol = ControllerMarker;
408    type ControlHandle = ControllerControlHandle;
409
410    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
411        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
412    }
413
414    fn control_handle(&self) -> Self::ControlHandle {
415        ControllerControlHandle { inner: self.inner.clone() }
416    }
417
418    fn into_inner(
419        self,
420    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
421    {
422        (self.inner, self.is_terminated)
423    }
424
425    fn from_inner(
426        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
427        is_terminated: bool,
428    ) -> Self {
429        Self { inner, is_terminated }
430    }
431}
432
433impl futures::Stream for ControllerRequestStream {
434    type Item = Result<ControllerRequest, fidl::Error>;
435
436    fn poll_next(
437        mut self: std::pin::Pin<&mut Self>,
438        cx: &mut std::task::Context<'_>,
439    ) -> std::task::Poll<Option<Self::Item>> {
440        let this = &mut *self;
441        if this.inner.check_shutdown(cx) {
442            this.is_terminated = true;
443            return std::task::Poll::Ready(None);
444        }
445        if this.is_terminated {
446            panic!("polled ControllerRequestStream after completion");
447        }
448        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
449            |bytes, handles| {
450                match this.inner.channel().read_etc(cx, bytes, handles) {
451                    std::task::Poll::Ready(Ok(())) => {}
452                    std::task::Poll::Pending => return std::task::Poll::Pending,
453                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
454                        this.is_terminated = true;
455                        return std::task::Poll::Ready(None);
456                    }
457                    std::task::Poll::Ready(Err(e)) => {
458                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
459                            e.into(),
460                        ))))
461                    }
462                }
463
464                // A message has been received from the channel
465                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
466
467                std::task::Poll::Ready(Some(match header.ordinal {
468                    0x70c20e8a741fecb8 => {
469                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
470                        let mut req = fidl::new_empty!(
471                            Options,
472                            fidl::encoding::DefaultFuchsiaResourceDialect
473                        );
474                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Options>(&header, _body_bytes, handles, &mut req)?;
475                        let control_handle = ControllerControlHandle { inner: this.inner.clone() };
476                        Ok(ControllerRequest::Create {
477                            payload: req,
478                            responder: ControllerCreateResponder {
479                                control_handle: std::mem::ManuallyDrop::new(control_handle),
480                                tx_id: header.tx_id,
481                            },
482                        })
483                    }
484                    _ if header.tx_id == 0
485                        && header
486                            .dynamic_flags()
487                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
488                    {
489                        Ok(ControllerRequest::_UnknownMethod {
490                            ordinal: header.ordinal,
491                            control_handle: ControllerControlHandle { inner: this.inner.clone() },
492                            method_type: fidl::MethodType::OneWay,
493                        })
494                    }
495                    _ if header
496                        .dynamic_flags()
497                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
498                    {
499                        this.inner.send_framework_err(
500                            fidl::encoding::FrameworkErr::UnknownMethod,
501                            header.tx_id,
502                            header.ordinal,
503                            header.dynamic_flags(),
504                            (bytes, handles),
505                        )?;
506                        Ok(ControllerRequest::_UnknownMethod {
507                            ordinal: header.ordinal,
508                            control_handle: ControllerControlHandle { inner: this.inner.clone() },
509                            method_type: fidl::MethodType::TwoWay,
510                        })
511                    }
512                    _ => Err(fidl::Error::UnknownOrdinal {
513                        ordinal: header.ordinal,
514                        protocol_name:
515                            <ControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
516                    }),
517                }))
518            },
519        )
520    }
521}
522
523#[derive(Debug)]
524pub enum ControllerRequest {
525    /// Initializes a new Ramdisk instance with the specified options.  Returns an outgoing
526    /// directory for the ramdisk which will export the Ramdisk and
527    /// fuchsia.hardware.block.volume.Volume protocols.
528    Create { payload: Options, responder: ControllerCreateResponder },
529    /// An interaction was received which does not match any known method.
530    #[non_exhaustive]
531    _UnknownMethod {
532        /// Ordinal of the method that was called.
533        ordinal: u64,
534        control_handle: ControllerControlHandle,
535        method_type: fidl::MethodType,
536    },
537}
538
539impl ControllerRequest {
540    #[allow(irrefutable_let_patterns)]
541    pub fn into_create(self) -> Option<(Options, ControllerCreateResponder)> {
542        if let ControllerRequest::Create { payload, responder } = self {
543            Some((payload, responder))
544        } else {
545            None
546        }
547    }
548
549    /// Name of the method defined in FIDL
550    pub fn method_name(&self) -> &'static str {
551        match *self {
552            ControllerRequest::Create { .. } => "create",
553            ControllerRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
554                "unknown one-way method"
555            }
556            ControllerRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
557                "unknown two-way method"
558            }
559        }
560    }
561}
562
563#[derive(Debug, Clone)]
564pub struct ControllerControlHandle {
565    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
566}
567
568impl fidl::endpoints::ControlHandle for ControllerControlHandle {
569    fn shutdown(&self) {
570        self.inner.shutdown()
571    }
572    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
573        self.inner.shutdown_with_epitaph(status)
574    }
575
576    fn is_closed(&self) -> bool {
577        self.inner.channel().is_closed()
578    }
579    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
580        self.inner.channel().on_closed()
581    }
582
583    #[cfg(target_os = "fuchsia")]
584    fn signal_peer(
585        &self,
586        clear_mask: zx::Signals,
587        set_mask: zx::Signals,
588    ) -> Result<(), zx_status::Status> {
589        use fidl::Peered;
590        self.inner.channel().signal_peer(clear_mask, set_mask)
591    }
592}
593
594impl ControllerControlHandle {}
595
596#[must_use = "FIDL methods require a response to be sent"]
597#[derive(Debug)]
598pub struct ControllerCreateResponder {
599    control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
600    tx_id: u32,
601}
602
603/// Set the the channel to be shutdown (see [`ControllerControlHandle::shutdown`])
604/// if the responder is dropped without sending a response, so that the client
605/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
606impl std::ops::Drop for ControllerCreateResponder {
607    fn drop(&mut self) {
608        self.control_handle.shutdown();
609        // Safety: drops once, never accessed again
610        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
611    }
612}
613
614impl fidl::endpoints::Responder for ControllerCreateResponder {
615    type ControlHandle = ControllerControlHandle;
616
617    fn control_handle(&self) -> &ControllerControlHandle {
618        &self.control_handle
619    }
620
621    fn drop_without_shutdown(mut self) {
622        // Safety: drops once, never accessed again due to mem::forget
623        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
624        // Prevent Drop from running (which would shut down the channel)
625        std::mem::forget(self);
626    }
627}
628
629impl ControllerCreateResponder {
630    /// Sends a response to the FIDL transaction.
631    ///
632    /// Sets the channel to shutdown if an error occurs.
633    pub fn send(
634        self,
635        mut result: Result<
636            (fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>, fidl::EventPair),
637            i32,
638        >,
639    ) -> Result<(), fidl::Error> {
640        let _result = self.send_raw(result);
641        if _result.is_err() {
642            self.control_handle.shutdown();
643        }
644        self.drop_without_shutdown();
645        _result
646    }
647
648    /// Similar to "send" but does not shutdown the channel if an error occurs.
649    pub fn send_no_shutdown_on_err(
650        self,
651        mut result: Result<
652            (fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>, fidl::EventPair),
653            i32,
654        >,
655    ) -> Result<(), fidl::Error> {
656        let _result = self.send_raw(result);
657        self.drop_without_shutdown();
658        _result
659    }
660
661    fn send_raw(
662        &self,
663        mut result: Result<
664            (fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>, fidl::EventPair),
665            i32,
666        >,
667    ) -> Result<(), fidl::Error> {
668        self.control_handle.inner.send::<fidl::encoding::ResultType<ControllerCreateResponse, i32>>(
669            result,
670            self.tx_id,
671            0x70c20e8a741fecb8,
672            fidl::encoding::DynamicFlags::empty(),
673        )
674    }
675}
676
677#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
678pub struct RamdiskMarker;
679
680impl fidl::endpoints::ProtocolMarker for RamdiskMarker {
681    type Proxy = RamdiskProxy;
682    type RequestStream = RamdiskRequestStream;
683    #[cfg(target_os = "fuchsia")]
684    type SynchronousProxy = RamdiskSynchronousProxy;
685
686    const DEBUG_NAME: &'static str = "fuchsia.hardware.ramdisk.Ramdisk";
687}
688impl fidl::endpoints::DiscoverableProtocolMarker for RamdiskMarker {}
689
690pub trait RamdiskProxyInterface: Send + Sync {
691    type SetFlagsResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
692    fn r#set_flags(&self, flags: RamdiskFlag) -> Self::SetFlagsResponseFut;
693    type WakeResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
694    fn r#wake(&self) -> Self::WakeResponseFut;
695    type SleepAfterResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
696    fn r#sleep_after(&self, count: u64) -> Self::SleepAfterResponseFut;
697    type GetBlockCountsResponseFut: std::future::Future<Output = Result<BlockWriteCounts, fidl::Error>>
698        + Send;
699    fn r#get_block_counts(&self) -> Self::GetBlockCountsResponseFut;
700}
701#[derive(Debug)]
702#[cfg(target_os = "fuchsia")]
703pub struct RamdiskSynchronousProxy {
704    client: fidl::client::sync::Client,
705}
706
707#[cfg(target_os = "fuchsia")]
708impl fidl::endpoints::SynchronousProxy for RamdiskSynchronousProxy {
709    type Proxy = RamdiskProxy;
710    type Protocol = RamdiskMarker;
711
712    fn from_channel(inner: fidl::Channel) -> Self {
713        Self::new(inner)
714    }
715
716    fn into_channel(self) -> fidl::Channel {
717        self.client.into_channel()
718    }
719
720    fn as_channel(&self) -> &fidl::Channel {
721        self.client.as_channel()
722    }
723}
724
725#[cfg(target_os = "fuchsia")]
726impl RamdiskSynchronousProxy {
727    pub fn new(channel: fidl::Channel) -> Self {
728        let protocol_name = <RamdiskMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
729        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
730    }
731
732    pub fn into_channel(self) -> fidl::Channel {
733        self.client.into_channel()
734    }
735
736    /// Waits until an event arrives and returns it. It is safe for other
737    /// threads to make concurrent requests while waiting for an event.
738    pub fn wait_for_event(
739        &self,
740        deadline: zx::MonotonicInstant,
741    ) -> Result<RamdiskEvent, fidl::Error> {
742        RamdiskEvent::decode(self.client.wait_for_event(deadline)?)
743    }
744
745    /// Sets any of the `RAMDISK_FLAG_*` flags.
746    pub fn r#set_flags(
747        &self,
748        mut flags: RamdiskFlag,
749        ___deadline: zx::MonotonicInstant,
750    ) -> Result<(), fidl::Error> {
751        let _response =
752            self.client.send_query::<RamdiskSetFlagsRequest, fidl::encoding::EmptyPayload>(
753                (flags,),
754                0x1ac23f463dc2c8de,
755                fidl::encoding::DynamicFlags::empty(),
756                ___deadline,
757            )?;
758        Ok(_response)
759    }
760
761    /// Wakes a ramdisk, if it was sleeping.
762    ///
763    /// Resets the block counts being stored by the ramdisk.
764    pub fn r#wake(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
765        let _response =
766            self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::EmptyPayload>(
767                (),
768                0x1b2142ad9617bde4,
769                fidl::encoding::DynamicFlags::empty(),
770                ___deadline,
771            )?;
772        Ok(_response)
773    }
774
775    /// Causes the ramdisk to sleep after `count` blocks are written successfully.
776    /// After `count` blocks are written, requests either wait for the ramdisk to
777    /// be awoken (if RESUME_ON_WAKE has been set), or begin failing immediately.
778    ///
779    /// Resets the block counts being stored by the ramdisk.
780    pub fn r#sleep_after(
781        &self,
782        mut count: u64,
783        ___deadline: zx::MonotonicInstant,
784    ) -> Result<(), fidl::Error> {
785        let _response =
786            self.client.send_query::<RamdiskSleepAfterRequest, fidl::encoding::EmptyPayload>(
787                (count,),
788                0x38cafa087fbc1195,
789                fidl::encoding::DynamicFlags::empty(),
790                ___deadline,
791            )?;
792        Ok(_response)
793    }
794
795    /// Returns the number of write requests since the last call to either
796    /// "SleepAfter" or "Wake".
797    pub fn r#get_block_counts(
798        &self,
799        ___deadline: zx::MonotonicInstant,
800    ) -> Result<BlockWriteCounts, fidl::Error> {
801        let _response =
802            self.client.send_query::<fidl::encoding::EmptyPayload, RamdiskGetBlockCountsResponse>(
803                (),
804                0x346b0058ac937682,
805                fidl::encoding::DynamicFlags::empty(),
806                ___deadline,
807            )?;
808        Ok(_response.counts)
809    }
810}
811
812#[derive(Debug, Clone)]
813pub struct RamdiskProxy {
814    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
815}
816
817impl fidl::endpoints::Proxy for RamdiskProxy {
818    type Protocol = RamdiskMarker;
819
820    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
821        Self::new(inner)
822    }
823
824    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
825        self.client.into_channel().map_err(|client| Self { client })
826    }
827
828    fn as_channel(&self) -> &::fidl::AsyncChannel {
829        self.client.as_channel()
830    }
831}
832
833impl RamdiskProxy {
834    /// Create a new Proxy for fuchsia.hardware.ramdisk/Ramdisk.
835    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
836        let protocol_name = <RamdiskMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
837        Self { client: fidl::client::Client::new(channel, protocol_name) }
838    }
839
840    /// Get a Stream of events from the remote end of the protocol.
841    ///
842    /// # Panics
843    ///
844    /// Panics if the event stream was already taken.
845    pub fn take_event_stream(&self) -> RamdiskEventStream {
846        RamdiskEventStream { event_receiver: self.client.take_event_receiver() }
847    }
848
849    /// Sets any of the `RAMDISK_FLAG_*` flags.
850    pub fn r#set_flags(
851        &self,
852        mut flags: RamdiskFlag,
853    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
854        RamdiskProxyInterface::r#set_flags(self, flags)
855    }
856
857    /// Wakes a ramdisk, if it was sleeping.
858    ///
859    /// Resets the block counts being stored by the ramdisk.
860    pub fn r#wake(
861        &self,
862    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
863        RamdiskProxyInterface::r#wake(self)
864    }
865
866    /// Causes the ramdisk to sleep after `count` blocks are written successfully.
867    /// After `count` blocks are written, requests either wait for the ramdisk to
868    /// be awoken (if RESUME_ON_WAKE has been set), or begin failing immediately.
869    ///
870    /// Resets the block counts being stored by the ramdisk.
871    pub fn r#sleep_after(
872        &self,
873        mut count: u64,
874    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
875        RamdiskProxyInterface::r#sleep_after(self, count)
876    }
877
878    /// Returns the number of write requests since the last call to either
879    /// "SleepAfter" or "Wake".
880    pub fn r#get_block_counts(
881        &self,
882    ) -> fidl::client::QueryResponseFut<
883        BlockWriteCounts,
884        fidl::encoding::DefaultFuchsiaResourceDialect,
885    > {
886        RamdiskProxyInterface::r#get_block_counts(self)
887    }
888}
889
890impl RamdiskProxyInterface for RamdiskProxy {
891    type SetFlagsResponseFut =
892        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
893    fn r#set_flags(&self, mut flags: RamdiskFlag) -> Self::SetFlagsResponseFut {
894        fn _decode(
895            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
896        ) -> Result<(), fidl::Error> {
897            let _response = fidl::client::decode_transaction_body::<
898                fidl::encoding::EmptyPayload,
899                fidl::encoding::DefaultFuchsiaResourceDialect,
900                0x1ac23f463dc2c8de,
901            >(_buf?)?;
902            Ok(_response)
903        }
904        self.client.send_query_and_decode::<RamdiskSetFlagsRequest, ()>(
905            (flags,),
906            0x1ac23f463dc2c8de,
907            fidl::encoding::DynamicFlags::empty(),
908            _decode,
909        )
910    }
911
912    type WakeResponseFut =
913        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
914    fn r#wake(&self) -> Self::WakeResponseFut {
915        fn _decode(
916            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
917        ) -> Result<(), fidl::Error> {
918            let _response = fidl::client::decode_transaction_body::<
919                fidl::encoding::EmptyPayload,
920                fidl::encoding::DefaultFuchsiaResourceDialect,
921                0x1b2142ad9617bde4,
922            >(_buf?)?;
923            Ok(_response)
924        }
925        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
926            (),
927            0x1b2142ad9617bde4,
928            fidl::encoding::DynamicFlags::empty(),
929            _decode,
930        )
931    }
932
933    type SleepAfterResponseFut =
934        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
935    fn r#sleep_after(&self, mut count: u64) -> Self::SleepAfterResponseFut {
936        fn _decode(
937            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
938        ) -> Result<(), fidl::Error> {
939            let _response = fidl::client::decode_transaction_body::<
940                fidl::encoding::EmptyPayload,
941                fidl::encoding::DefaultFuchsiaResourceDialect,
942                0x38cafa087fbc1195,
943            >(_buf?)?;
944            Ok(_response)
945        }
946        self.client.send_query_and_decode::<RamdiskSleepAfterRequest, ()>(
947            (count,),
948            0x38cafa087fbc1195,
949            fidl::encoding::DynamicFlags::empty(),
950            _decode,
951        )
952    }
953
954    type GetBlockCountsResponseFut = fidl::client::QueryResponseFut<
955        BlockWriteCounts,
956        fidl::encoding::DefaultFuchsiaResourceDialect,
957    >;
958    fn r#get_block_counts(&self) -> Self::GetBlockCountsResponseFut {
959        fn _decode(
960            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
961        ) -> Result<BlockWriteCounts, fidl::Error> {
962            let _response = fidl::client::decode_transaction_body::<
963                RamdiskGetBlockCountsResponse,
964                fidl::encoding::DefaultFuchsiaResourceDialect,
965                0x346b0058ac937682,
966            >(_buf?)?;
967            Ok(_response.counts)
968        }
969        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, BlockWriteCounts>(
970            (),
971            0x346b0058ac937682,
972            fidl::encoding::DynamicFlags::empty(),
973            _decode,
974        )
975    }
976}
977
978pub struct RamdiskEventStream {
979    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
980}
981
982impl std::marker::Unpin for RamdiskEventStream {}
983
984impl futures::stream::FusedStream for RamdiskEventStream {
985    fn is_terminated(&self) -> bool {
986        self.event_receiver.is_terminated()
987    }
988}
989
990impl futures::Stream for RamdiskEventStream {
991    type Item = Result<RamdiskEvent, fidl::Error>;
992
993    fn poll_next(
994        mut self: std::pin::Pin<&mut Self>,
995        cx: &mut std::task::Context<'_>,
996    ) -> std::task::Poll<Option<Self::Item>> {
997        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
998            &mut self.event_receiver,
999            cx
1000        )?) {
1001            Some(buf) => std::task::Poll::Ready(Some(RamdiskEvent::decode(buf))),
1002            None => std::task::Poll::Ready(None),
1003        }
1004    }
1005}
1006
1007#[derive(Debug)]
1008pub enum RamdiskEvent {}
1009
1010impl RamdiskEvent {
1011    /// Decodes a message buffer as a [`RamdiskEvent`].
1012    fn decode(
1013        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1014    ) -> Result<RamdiskEvent, fidl::Error> {
1015        let (bytes, _handles) = buf.split_mut();
1016        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1017        debug_assert_eq!(tx_header.tx_id, 0);
1018        match tx_header.ordinal {
1019            _ => Err(fidl::Error::UnknownOrdinal {
1020                ordinal: tx_header.ordinal,
1021                protocol_name: <RamdiskMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1022            }),
1023        }
1024    }
1025}
1026
1027/// A Stream of incoming requests for fuchsia.hardware.ramdisk/Ramdisk.
1028pub struct RamdiskRequestStream {
1029    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1030    is_terminated: bool,
1031}
1032
1033impl std::marker::Unpin for RamdiskRequestStream {}
1034
1035impl futures::stream::FusedStream for RamdiskRequestStream {
1036    fn is_terminated(&self) -> bool {
1037        self.is_terminated
1038    }
1039}
1040
1041impl fidl::endpoints::RequestStream for RamdiskRequestStream {
1042    type Protocol = RamdiskMarker;
1043    type ControlHandle = RamdiskControlHandle;
1044
1045    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1046        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1047    }
1048
1049    fn control_handle(&self) -> Self::ControlHandle {
1050        RamdiskControlHandle { inner: self.inner.clone() }
1051    }
1052
1053    fn into_inner(
1054        self,
1055    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1056    {
1057        (self.inner, self.is_terminated)
1058    }
1059
1060    fn from_inner(
1061        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1062        is_terminated: bool,
1063    ) -> Self {
1064        Self { inner, is_terminated }
1065    }
1066}
1067
1068impl futures::Stream for RamdiskRequestStream {
1069    type Item = Result<RamdiskRequest, fidl::Error>;
1070
1071    fn poll_next(
1072        mut self: std::pin::Pin<&mut Self>,
1073        cx: &mut std::task::Context<'_>,
1074    ) -> std::task::Poll<Option<Self::Item>> {
1075        let this = &mut *self;
1076        if this.inner.check_shutdown(cx) {
1077            this.is_terminated = true;
1078            return std::task::Poll::Ready(None);
1079        }
1080        if this.is_terminated {
1081            panic!("polled RamdiskRequestStream after completion");
1082        }
1083        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1084            |bytes, handles| {
1085                match this.inner.channel().read_etc(cx, bytes, handles) {
1086                    std::task::Poll::Ready(Ok(())) => {}
1087                    std::task::Poll::Pending => return std::task::Poll::Pending,
1088                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1089                        this.is_terminated = true;
1090                        return std::task::Poll::Ready(None);
1091                    }
1092                    std::task::Poll::Ready(Err(e)) => {
1093                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1094                            e.into(),
1095                        ))))
1096                    }
1097                }
1098
1099                // A message has been received from the channel
1100                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1101
1102                std::task::Poll::Ready(Some(match header.ordinal {
1103                    0x1ac23f463dc2c8de => {
1104                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1105                        let mut req = fidl::new_empty!(
1106                            RamdiskSetFlagsRequest,
1107                            fidl::encoding::DefaultFuchsiaResourceDialect
1108                        );
1109                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RamdiskSetFlagsRequest>(&header, _body_bytes, handles, &mut req)?;
1110                        let control_handle = RamdiskControlHandle { inner: this.inner.clone() };
1111                        Ok(RamdiskRequest::SetFlags {
1112                            flags: req.flags,
1113
1114                            responder: RamdiskSetFlagsResponder {
1115                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1116                                tx_id: header.tx_id,
1117                            },
1118                        })
1119                    }
1120                    0x1b2142ad9617bde4 => {
1121                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1122                        let mut req = fidl::new_empty!(
1123                            fidl::encoding::EmptyPayload,
1124                            fidl::encoding::DefaultFuchsiaResourceDialect
1125                        );
1126                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1127                        let control_handle = RamdiskControlHandle { inner: this.inner.clone() };
1128                        Ok(RamdiskRequest::Wake {
1129                            responder: RamdiskWakeResponder {
1130                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1131                                tx_id: header.tx_id,
1132                            },
1133                        })
1134                    }
1135                    0x38cafa087fbc1195 => {
1136                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1137                        let mut req = fidl::new_empty!(
1138                            RamdiskSleepAfterRequest,
1139                            fidl::encoding::DefaultFuchsiaResourceDialect
1140                        );
1141                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RamdiskSleepAfterRequest>(&header, _body_bytes, handles, &mut req)?;
1142                        let control_handle = RamdiskControlHandle { inner: this.inner.clone() };
1143                        Ok(RamdiskRequest::SleepAfter {
1144                            count: req.count,
1145
1146                            responder: RamdiskSleepAfterResponder {
1147                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1148                                tx_id: header.tx_id,
1149                            },
1150                        })
1151                    }
1152                    0x346b0058ac937682 => {
1153                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1154                        let mut req = fidl::new_empty!(
1155                            fidl::encoding::EmptyPayload,
1156                            fidl::encoding::DefaultFuchsiaResourceDialect
1157                        );
1158                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1159                        let control_handle = RamdiskControlHandle { inner: this.inner.clone() };
1160                        Ok(RamdiskRequest::GetBlockCounts {
1161                            responder: RamdiskGetBlockCountsResponder {
1162                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1163                                tx_id: header.tx_id,
1164                            },
1165                        })
1166                    }
1167                    _ => Err(fidl::Error::UnknownOrdinal {
1168                        ordinal: header.ordinal,
1169                        protocol_name:
1170                            <RamdiskMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1171                    }),
1172                }))
1173            },
1174        )
1175    }
1176}
1177
1178/// The protocol for interacting with a instance of a ramdisk.
1179#[derive(Debug)]
1180pub enum RamdiskRequest {
1181    /// Sets any of the `RAMDISK_FLAG_*` flags.
1182    SetFlags { flags: RamdiskFlag, responder: RamdiskSetFlagsResponder },
1183    /// Wakes a ramdisk, if it was sleeping.
1184    ///
1185    /// Resets the block counts being stored by the ramdisk.
1186    Wake { responder: RamdiskWakeResponder },
1187    /// Causes the ramdisk to sleep after `count` blocks are written successfully.
1188    /// After `count` blocks are written, requests either wait for the ramdisk to
1189    /// be awoken (if RESUME_ON_WAKE has been set), or begin failing immediately.
1190    ///
1191    /// Resets the block counts being stored by the ramdisk.
1192    SleepAfter { count: u64, responder: RamdiskSleepAfterResponder },
1193    /// Returns the number of write requests since the last call to either
1194    /// "SleepAfter" or "Wake".
1195    GetBlockCounts { responder: RamdiskGetBlockCountsResponder },
1196}
1197
1198impl RamdiskRequest {
1199    #[allow(irrefutable_let_patterns)]
1200    pub fn into_set_flags(self) -> Option<(RamdiskFlag, RamdiskSetFlagsResponder)> {
1201        if let RamdiskRequest::SetFlags { flags, responder } = self {
1202            Some((flags, responder))
1203        } else {
1204            None
1205        }
1206    }
1207
1208    #[allow(irrefutable_let_patterns)]
1209    pub fn into_wake(self) -> Option<(RamdiskWakeResponder)> {
1210        if let RamdiskRequest::Wake { responder } = self {
1211            Some((responder))
1212        } else {
1213            None
1214        }
1215    }
1216
1217    #[allow(irrefutable_let_patterns)]
1218    pub fn into_sleep_after(self) -> Option<(u64, RamdiskSleepAfterResponder)> {
1219        if let RamdiskRequest::SleepAfter { count, responder } = self {
1220            Some((count, responder))
1221        } else {
1222            None
1223        }
1224    }
1225
1226    #[allow(irrefutable_let_patterns)]
1227    pub fn into_get_block_counts(self) -> Option<(RamdiskGetBlockCountsResponder)> {
1228        if let RamdiskRequest::GetBlockCounts { responder } = self {
1229            Some((responder))
1230        } else {
1231            None
1232        }
1233    }
1234
1235    /// Name of the method defined in FIDL
1236    pub fn method_name(&self) -> &'static str {
1237        match *self {
1238            RamdiskRequest::SetFlags { .. } => "set_flags",
1239            RamdiskRequest::Wake { .. } => "wake",
1240            RamdiskRequest::SleepAfter { .. } => "sleep_after",
1241            RamdiskRequest::GetBlockCounts { .. } => "get_block_counts",
1242        }
1243    }
1244}
1245
1246#[derive(Debug, Clone)]
1247pub struct RamdiskControlHandle {
1248    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1249}
1250
1251impl fidl::endpoints::ControlHandle for RamdiskControlHandle {
1252    fn shutdown(&self) {
1253        self.inner.shutdown()
1254    }
1255    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1256        self.inner.shutdown_with_epitaph(status)
1257    }
1258
1259    fn is_closed(&self) -> bool {
1260        self.inner.channel().is_closed()
1261    }
1262    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1263        self.inner.channel().on_closed()
1264    }
1265
1266    #[cfg(target_os = "fuchsia")]
1267    fn signal_peer(
1268        &self,
1269        clear_mask: zx::Signals,
1270        set_mask: zx::Signals,
1271    ) -> Result<(), zx_status::Status> {
1272        use fidl::Peered;
1273        self.inner.channel().signal_peer(clear_mask, set_mask)
1274    }
1275}
1276
1277impl RamdiskControlHandle {}
1278
1279#[must_use = "FIDL methods require a response to be sent"]
1280#[derive(Debug)]
1281pub struct RamdiskSetFlagsResponder {
1282    control_handle: std::mem::ManuallyDrop<RamdiskControlHandle>,
1283    tx_id: u32,
1284}
1285
1286/// Set the the channel to be shutdown (see [`RamdiskControlHandle::shutdown`])
1287/// if the responder is dropped without sending a response, so that the client
1288/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1289impl std::ops::Drop for RamdiskSetFlagsResponder {
1290    fn drop(&mut self) {
1291        self.control_handle.shutdown();
1292        // Safety: drops once, never accessed again
1293        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1294    }
1295}
1296
1297impl fidl::endpoints::Responder for RamdiskSetFlagsResponder {
1298    type ControlHandle = RamdiskControlHandle;
1299
1300    fn control_handle(&self) -> &RamdiskControlHandle {
1301        &self.control_handle
1302    }
1303
1304    fn drop_without_shutdown(mut self) {
1305        // Safety: drops once, never accessed again due to mem::forget
1306        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1307        // Prevent Drop from running (which would shut down the channel)
1308        std::mem::forget(self);
1309    }
1310}
1311
1312impl RamdiskSetFlagsResponder {
1313    /// Sends a response to the FIDL transaction.
1314    ///
1315    /// Sets the channel to shutdown if an error occurs.
1316    pub fn send(self) -> Result<(), fidl::Error> {
1317        let _result = self.send_raw();
1318        if _result.is_err() {
1319            self.control_handle.shutdown();
1320        }
1321        self.drop_without_shutdown();
1322        _result
1323    }
1324
1325    /// Similar to "send" but does not shutdown the channel if an error occurs.
1326    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1327        let _result = self.send_raw();
1328        self.drop_without_shutdown();
1329        _result
1330    }
1331
1332    fn send_raw(&self) -> Result<(), fidl::Error> {
1333        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
1334            (),
1335            self.tx_id,
1336            0x1ac23f463dc2c8de,
1337            fidl::encoding::DynamicFlags::empty(),
1338        )
1339    }
1340}
1341
1342#[must_use = "FIDL methods require a response to be sent"]
1343#[derive(Debug)]
1344pub struct RamdiskWakeResponder {
1345    control_handle: std::mem::ManuallyDrop<RamdiskControlHandle>,
1346    tx_id: u32,
1347}
1348
1349/// Set the the channel to be shutdown (see [`RamdiskControlHandle::shutdown`])
1350/// if the responder is dropped without sending a response, so that the client
1351/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1352impl std::ops::Drop for RamdiskWakeResponder {
1353    fn drop(&mut self) {
1354        self.control_handle.shutdown();
1355        // Safety: drops once, never accessed again
1356        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1357    }
1358}
1359
1360impl fidl::endpoints::Responder for RamdiskWakeResponder {
1361    type ControlHandle = RamdiskControlHandle;
1362
1363    fn control_handle(&self) -> &RamdiskControlHandle {
1364        &self.control_handle
1365    }
1366
1367    fn drop_without_shutdown(mut self) {
1368        // Safety: drops once, never accessed again due to mem::forget
1369        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1370        // Prevent Drop from running (which would shut down the channel)
1371        std::mem::forget(self);
1372    }
1373}
1374
1375impl RamdiskWakeResponder {
1376    /// Sends a response to the FIDL transaction.
1377    ///
1378    /// Sets the channel to shutdown if an error occurs.
1379    pub fn send(self) -> Result<(), fidl::Error> {
1380        let _result = self.send_raw();
1381        if _result.is_err() {
1382            self.control_handle.shutdown();
1383        }
1384        self.drop_without_shutdown();
1385        _result
1386    }
1387
1388    /// Similar to "send" but does not shutdown the channel if an error occurs.
1389    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1390        let _result = self.send_raw();
1391        self.drop_without_shutdown();
1392        _result
1393    }
1394
1395    fn send_raw(&self) -> Result<(), fidl::Error> {
1396        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
1397            (),
1398            self.tx_id,
1399            0x1b2142ad9617bde4,
1400            fidl::encoding::DynamicFlags::empty(),
1401        )
1402    }
1403}
1404
1405#[must_use = "FIDL methods require a response to be sent"]
1406#[derive(Debug)]
1407pub struct RamdiskSleepAfterResponder {
1408    control_handle: std::mem::ManuallyDrop<RamdiskControlHandle>,
1409    tx_id: u32,
1410}
1411
1412/// Set the the channel to be shutdown (see [`RamdiskControlHandle::shutdown`])
1413/// if the responder is dropped without sending a response, so that the client
1414/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1415impl std::ops::Drop for RamdiskSleepAfterResponder {
1416    fn drop(&mut self) {
1417        self.control_handle.shutdown();
1418        // Safety: drops once, never accessed again
1419        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1420    }
1421}
1422
1423impl fidl::endpoints::Responder for RamdiskSleepAfterResponder {
1424    type ControlHandle = RamdiskControlHandle;
1425
1426    fn control_handle(&self) -> &RamdiskControlHandle {
1427        &self.control_handle
1428    }
1429
1430    fn drop_without_shutdown(mut self) {
1431        // Safety: drops once, never accessed again due to mem::forget
1432        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1433        // Prevent Drop from running (which would shut down the channel)
1434        std::mem::forget(self);
1435    }
1436}
1437
1438impl RamdiskSleepAfterResponder {
1439    /// Sends a response to the FIDL transaction.
1440    ///
1441    /// Sets the channel to shutdown if an error occurs.
1442    pub fn send(self) -> Result<(), fidl::Error> {
1443        let _result = self.send_raw();
1444        if _result.is_err() {
1445            self.control_handle.shutdown();
1446        }
1447        self.drop_without_shutdown();
1448        _result
1449    }
1450
1451    /// Similar to "send" but does not shutdown the channel if an error occurs.
1452    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1453        let _result = self.send_raw();
1454        self.drop_without_shutdown();
1455        _result
1456    }
1457
1458    fn send_raw(&self) -> Result<(), fidl::Error> {
1459        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
1460            (),
1461            self.tx_id,
1462            0x38cafa087fbc1195,
1463            fidl::encoding::DynamicFlags::empty(),
1464        )
1465    }
1466}
1467
1468#[must_use = "FIDL methods require a response to be sent"]
1469#[derive(Debug)]
1470pub struct RamdiskGetBlockCountsResponder {
1471    control_handle: std::mem::ManuallyDrop<RamdiskControlHandle>,
1472    tx_id: u32,
1473}
1474
1475/// Set the the channel to be shutdown (see [`RamdiskControlHandle::shutdown`])
1476/// if the responder is dropped without sending a response, so that the client
1477/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1478impl std::ops::Drop for RamdiskGetBlockCountsResponder {
1479    fn drop(&mut self) {
1480        self.control_handle.shutdown();
1481        // Safety: drops once, never accessed again
1482        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1483    }
1484}
1485
1486impl fidl::endpoints::Responder for RamdiskGetBlockCountsResponder {
1487    type ControlHandle = RamdiskControlHandle;
1488
1489    fn control_handle(&self) -> &RamdiskControlHandle {
1490        &self.control_handle
1491    }
1492
1493    fn drop_without_shutdown(mut self) {
1494        // Safety: drops once, never accessed again due to mem::forget
1495        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1496        // Prevent Drop from running (which would shut down the channel)
1497        std::mem::forget(self);
1498    }
1499}
1500
1501impl RamdiskGetBlockCountsResponder {
1502    /// Sends a response to the FIDL transaction.
1503    ///
1504    /// Sets the channel to shutdown if an error occurs.
1505    pub fn send(self, mut counts: &BlockWriteCounts) -> Result<(), fidl::Error> {
1506        let _result = self.send_raw(counts);
1507        if _result.is_err() {
1508            self.control_handle.shutdown();
1509        }
1510        self.drop_without_shutdown();
1511        _result
1512    }
1513
1514    /// Similar to "send" but does not shutdown the channel if an error occurs.
1515    pub fn send_no_shutdown_on_err(self, mut counts: &BlockWriteCounts) -> Result<(), fidl::Error> {
1516        let _result = self.send_raw(counts);
1517        self.drop_without_shutdown();
1518        _result
1519    }
1520
1521    fn send_raw(&self, mut counts: &BlockWriteCounts) -> Result<(), fidl::Error> {
1522        self.control_handle.inner.send::<RamdiskGetBlockCountsResponse>(
1523            (counts,),
1524            self.tx_id,
1525            0x346b0058ac937682,
1526            fidl::encoding::DynamicFlags::empty(),
1527        )
1528    }
1529}
1530
1531#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1532pub struct RamdiskControllerMarker;
1533
1534impl fidl::endpoints::ProtocolMarker for RamdiskControllerMarker {
1535    type Proxy = RamdiskControllerProxy;
1536    type RequestStream = RamdiskControllerRequestStream;
1537    #[cfg(target_os = "fuchsia")]
1538    type SynchronousProxy = RamdiskControllerSynchronousProxy;
1539
1540    const DEBUG_NAME: &'static str = "(anonymous) RamdiskController";
1541}
1542pub type RamdiskControllerCreateResult = Result<Option<String>, i32>;
1543pub type RamdiskControllerCreateFromVmoResult = Result<Option<String>, i32>;
1544pub type RamdiskControllerCreateFromVmoWithParamsResult = Result<Option<String>, i32>;
1545
1546pub trait RamdiskControllerProxyInterface: Send + Sync {
1547    type CreateResponseFut: std::future::Future<Output = Result<RamdiskControllerCreateResult, fidl::Error>>
1548        + Send;
1549    fn r#create(
1550        &self,
1551        block_size: u64,
1552        block_count: u64,
1553        type_guid: Option<&Guid>,
1554    ) -> Self::CreateResponseFut;
1555    type CreateFromVmoResponseFut: std::future::Future<Output = Result<RamdiskControllerCreateFromVmoResult, fidl::Error>>
1556        + Send;
1557    fn r#create_from_vmo(&self, vmo: fidl::Vmo) -> Self::CreateFromVmoResponseFut;
1558    type CreateFromVmoWithParamsResponseFut: std::future::Future<
1559            Output = Result<RamdiskControllerCreateFromVmoWithParamsResult, fidl::Error>,
1560        > + Send;
1561    fn r#create_from_vmo_with_params(
1562        &self,
1563        vmo: fidl::Vmo,
1564        block_size: u64,
1565        type_guid: Option<&Guid>,
1566    ) -> Self::CreateFromVmoWithParamsResponseFut;
1567}
1568#[derive(Debug)]
1569#[cfg(target_os = "fuchsia")]
1570pub struct RamdiskControllerSynchronousProxy {
1571    client: fidl::client::sync::Client,
1572}
1573
1574#[cfg(target_os = "fuchsia")]
1575impl fidl::endpoints::SynchronousProxy for RamdiskControllerSynchronousProxy {
1576    type Proxy = RamdiskControllerProxy;
1577    type Protocol = RamdiskControllerMarker;
1578
1579    fn from_channel(inner: fidl::Channel) -> Self {
1580        Self::new(inner)
1581    }
1582
1583    fn into_channel(self) -> fidl::Channel {
1584        self.client.into_channel()
1585    }
1586
1587    fn as_channel(&self) -> &fidl::Channel {
1588        self.client.as_channel()
1589    }
1590}
1591
1592#[cfg(target_os = "fuchsia")]
1593impl RamdiskControllerSynchronousProxy {
1594    pub fn new(channel: fidl::Channel) -> Self {
1595        let protocol_name =
1596            <RamdiskControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1597        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1598    }
1599
1600    pub fn into_channel(self) -> fidl::Channel {
1601        self.client.into_channel()
1602    }
1603
1604    /// Waits until an event arrives and returns it. It is safe for other
1605    /// threads to make concurrent requests while waiting for an event.
1606    pub fn wait_for_event(
1607        &self,
1608        deadline: zx::MonotonicInstant,
1609    ) -> Result<RamdiskControllerEvent, fidl::Error> {
1610        RamdiskControllerEvent::decode(self.client.wait_for_event(deadline)?)
1611    }
1612
1613    /// Initializes a new Ramdisk instance with the provided block size and block count.
1614    /// Takes an optional `type_guid`, which may be queried from the ramdisk instance.
1615    pub fn r#create(
1616        &self,
1617        mut block_size: u64,
1618        mut block_count: u64,
1619        mut type_guid: Option<&Guid>,
1620        ___deadline: zx::MonotonicInstant,
1621    ) -> Result<RamdiskControllerCreateResult, fidl::Error> {
1622        let _response = self.client.send_query::<
1623            RamdiskControllerCreateRequest,
1624            fidl::encoding::ResultType<RamdiskControllerCreateResponse, i32>,
1625        >(
1626            (block_size, block_count, type_guid,),
1627            0x21cd800cc5ff7c3f,
1628            fidl::encoding::DynamicFlags::empty(),
1629            ___deadline,
1630        )?;
1631        Ok(_response.map(|x| x.name))
1632    }
1633
1634    /// Initializes a new Ramdisk instance from a VMO. Uses a block size of `PAGE_SIZE`,
1635    /// and derives the block count from the size of the VMO.
1636    pub fn r#create_from_vmo(
1637        &self,
1638        mut vmo: fidl::Vmo,
1639        ___deadline: zx::MonotonicInstant,
1640    ) -> Result<RamdiskControllerCreateFromVmoResult, fidl::Error> {
1641        let _response = self.client.send_query::<
1642            RamdiskControllerCreateFromVmoRequest,
1643            fidl::encoding::ResultType<RamdiskControllerCreateFromVmoResponse, i32>,
1644        >(
1645            (vmo,),
1646            0x5d37434da8f680b4,
1647            fidl::encoding::DynamicFlags::empty(),
1648            ___deadline,
1649        )?;
1650        Ok(_response.map(|x| x.name))
1651    }
1652
1653    /// Same as CreateFromVmo, but with the given `block_size` and optional `type_guid`. If
1654    /// `block_size` is zero, `PAGE_SIZE` will be used as `block_size`.
1655    pub fn r#create_from_vmo_with_params(
1656        &self,
1657        mut vmo: fidl::Vmo,
1658        mut block_size: u64,
1659        mut type_guid: Option<&Guid>,
1660        ___deadline: zx::MonotonicInstant,
1661    ) -> Result<RamdiskControllerCreateFromVmoWithParamsResult, fidl::Error> {
1662        let _response = self.client.send_query::<
1663            RamdiskControllerCreateFromVmoWithParamsRequest,
1664            fidl::encoding::ResultType<RamdiskControllerCreateFromVmoWithParamsResponse, i32>,
1665        >(
1666            (vmo, block_size, type_guid,),
1667            0x776dd021e9e6677e,
1668            fidl::encoding::DynamicFlags::empty(),
1669            ___deadline,
1670        )?;
1671        Ok(_response.map(|x| x.name))
1672    }
1673}
1674
1675#[derive(Debug, Clone)]
1676pub struct RamdiskControllerProxy {
1677    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1678}
1679
1680impl fidl::endpoints::Proxy for RamdiskControllerProxy {
1681    type Protocol = RamdiskControllerMarker;
1682
1683    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1684        Self::new(inner)
1685    }
1686
1687    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1688        self.client.into_channel().map_err(|client| Self { client })
1689    }
1690
1691    fn as_channel(&self) -> &::fidl::AsyncChannel {
1692        self.client.as_channel()
1693    }
1694}
1695
1696impl RamdiskControllerProxy {
1697    /// Create a new Proxy for fuchsia.hardware.ramdisk/RamdiskController.
1698    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1699        let protocol_name =
1700            <RamdiskControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1701        Self { client: fidl::client::Client::new(channel, protocol_name) }
1702    }
1703
1704    /// Get a Stream of events from the remote end of the protocol.
1705    ///
1706    /// # Panics
1707    ///
1708    /// Panics if the event stream was already taken.
1709    pub fn take_event_stream(&self) -> RamdiskControllerEventStream {
1710        RamdiskControllerEventStream { event_receiver: self.client.take_event_receiver() }
1711    }
1712
1713    /// Initializes a new Ramdisk instance with the provided block size and block count.
1714    /// Takes an optional `type_guid`, which may be queried from the ramdisk instance.
1715    pub fn r#create(
1716        &self,
1717        mut block_size: u64,
1718        mut block_count: u64,
1719        mut type_guid: Option<&Guid>,
1720    ) -> fidl::client::QueryResponseFut<
1721        RamdiskControllerCreateResult,
1722        fidl::encoding::DefaultFuchsiaResourceDialect,
1723    > {
1724        RamdiskControllerProxyInterface::r#create(self, block_size, block_count, type_guid)
1725    }
1726
1727    /// Initializes a new Ramdisk instance from a VMO. Uses a block size of `PAGE_SIZE`,
1728    /// and derives the block count from the size of the VMO.
1729    pub fn r#create_from_vmo(
1730        &self,
1731        mut vmo: fidl::Vmo,
1732    ) -> fidl::client::QueryResponseFut<
1733        RamdiskControllerCreateFromVmoResult,
1734        fidl::encoding::DefaultFuchsiaResourceDialect,
1735    > {
1736        RamdiskControllerProxyInterface::r#create_from_vmo(self, vmo)
1737    }
1738
1739    /// Same as CreateFromVmo, but with the given `block_size` and optional `type_guid`. If
1740    /// `block_size` is zero, `PAGE_SIZE` will be used as `block_size`.
1741    pub fn r#create_from_vmo_with_params(
1742        &self,
1743        mut vmo: fidl::Vmo,
1744        mut block_size: u64,
1745        mut type_guid: Option<&Guid>,
1746    ) -> fidl::client::QueryResponseFut<
1747        RamdiskControllerCreateFromVmoWithParamsResult,
1748        fidl::encoding::DefaultFuchsiaResourceDialect,
1749    > {
1750        RamdiskControllerProxyInterface::r#create_from_vmo_with_params(
1751            self, vmo, block_size, type_guid,
1752        )
1753    }
1754}
1755
1756impl RamdiskControllerProxyInterface for RamdiskControllerProxy {
1757    type CreateResponseFut = fidl::client::QueryResponseFut<
1758        RamdiskControllerCreateResult,
1759        fidl::encoding::DefaultFuchsiaResourceDialect,
1760    >;
1761    fn r#create(
1762        &self,
1763        mut block_size: u64,
1764        mut block_count: u64,
1765        mut type_guid: Option<&Guid>,
1766    ) -> Self::CreateResponseFut {
1767        fn _decode(
1768            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1769        ) -> Result<RamdiskControllerCreateResult, fidl::Error> {
1770            let _response = fidl::client::decode_transaction_body::<
1771                fidl::encoding::ResultType<RamdiskControllerCreateResponse, i32>,
1772                fidl::encoding::DefaultFuchsiaResourceDialect,
1773                0x21cd800cc5ff7c3f,
1774            >(_buf?)?;
1775            Ok(_response.map(|x| x.name))
1776        }
1777        self.client
1778            .send_query_and_decode::<RamdiskControllerCreateRequest, RamdiskControllerCreateResult>(
1779                (block_size, block_count, type_guid),
1780                0x21cd800cc5ff7c3f,
1781                fidl::encoding::DynamicFlags::empty(),
1782                _decode,
1783            )
1784    }
1785
1786    type CreateFromVmoResponseFut = fidl::client::QueryResponseFut<
1787        RamdiskControllerCreateFromVmoResult,
1788        fidl::encoding::DefaultFuchsiaResourceDialect,
1789    >;
1790    fn r#create_from_vmo(&self, mut vmo: fidl::Vmo) -> Self::CreateFromVmoResponseFut {
1791        fn _decode(
1792            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1793        ) -> Result<RamdiskControllerCreateFromVmoResult, fidl::Error> {
1794            let _response = fidl::client::decode_transaction_body::<
1795                fidl::encoding::ResultType<RamdiskControllerCreateFromVmoResponse, i32>,
1796                fidl::encoding::DefaultFuchsiaResourceDialect,
1797                0x5d37434da8f680b4,
1798            >(_buf?)?;
1799            Ok(_response.map(|x| x.name))
1800        }
1801        self.client.send_query_and_decode::<
1802            RamdiskControllerCreateFromVmoRequest,
1803            RamdiskControllerCreateFromVmoResult,
1804        >(
1805            (vmo,),
1806            0x5d37434da8f680b4,
1807            fidl::encoding::DynamicFlags::empty(),
1808            _decode,
1809        )
1810    }
1811
1812    type CreateFromVmoWithParamsResponseFut = fidl::client::QueryResponseFut<
1813        RamdiskControllerCreateFromVmoWithParamsResult,
1814        fidl::encoding::DefaultFuchsiaResourceDialect,
1815    >;
1816    fn r#create_from_vmo_with_params(
1817        &self,
1818        mut vmo: fidl::Vmo,
1819        mut block_size: u64,
1820        mut type_guid: Option<&Guid>,
1821    ) -> Self::CreateFromVmoWithParamsResponseFut {
1822        fn _decode(
1823            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1824        ) -> Result<RamdiskControllerCreateFromVmoWithParamsResult, fidl::Error> {
1825            let _response = fidl::client::decode_transaction_body::<
1826                fidl::encoding::ResultType<RamdiskControllerCreateFromVmoWithParamsResponse, i32>,
1827                fidl::encoding::DefaultFuchsiaResourceDialect,
1828                0x776dd021e9e6677e,
1829            >(_buf?)?;
1830            Ok(_response.map(|x| x.name))
1831        }
1832        self.client.send_query_and_decode::<
1833            RamdiskControllerCreateFromVmoWithParamsRequest,
1834            RamdiskControllerCreateFromVmoWithParamsResult,
1835        >(
1836            (vmo, block_size, type_guid,),
1837            0x776dd021e9e6677e,
1838            fidl::encoding::DynamicFlags::empty(),
1839            _decode,
1840        )
1841    }
1842}
1843
1844pub struct RamdiskControllerEventStream {
1845    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1846}
1847
1848impl std::marker::Unpin for RamdiskControllerEventStream {}
1849
1850impl futures::stream::FusedStream for RamdiskControllerEventStream {
1851    fn is_terminated(&self) -> bool {
1852        self.event_receiver.is_terminated()
1853    }
1854}
1855
1856impl futures::Stream for RamdiskControllerEventStream {
1857    type Item = Result<RamdiskControllerEvent, fidl::Error>;
1858
1859    fn poll_next(
1860        mut self: std::pin::Pin<&mut Self>,
1861        cx: &mut std::task::Context<'_>,
1862    ) -> std::task::Poll<Option<Self::Item>> {
1863        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1864            &mut self.event_receiver,
1865            cx
1866        )?) {
1867            Some(buf) => std::task::Poll::Ready(Some(RamdiskControllerEvent::decode(buf))),
1868            None => std::task::Poll::Ready(None),
1869        }
1870    }
1871}
1872
1873#[derive(Debug)]
1874pub enum RamdiskControllerEvent {}
1875
1876impl RamdiskControllerEvent {
1877    /// Decodes a message buffer as a [`RamdiskControllerEvent`].
1878    fn decode(
1879        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1880    ) -> Result<RamdiskControllerEvent, fidl::Error> {
1881        let (bytes, _handles) = buf.split_mut();
1882        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1883        debug_assert_eq!(tx_header.tx_id, 0);
1884        match tx_header.ordinal {
1885            _ => Err(fidl::Error::UnknownOrdinal {
1886                ordinal: tx_header.ordinal,
1887                protocol_name:
1888                    <RamdiskControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1889            }),
1890        }
1891    }
1892}
1893
1894/// A Stream of incoming requests for fuchsia.hardware.ramdisk/RamdiskController.
1895pub struct RamdiskControllerRequestStream {
1896    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1897    is_terminated: bool,
1898}
1899
1900impl std::marker::Unpin for RamdiskControllerRequestStream {}
1901
1902impl futures::stream::FusedStream for RamdiskControllerRequestStream {
1903    fn is_terminated(&self) -> bool {
1904        self.is_terminated
1905    }
1906}
1907
1908impl fidl::endpoints::RequestStream for RamdiskControllerRequestStream {
1909    type Protocol = RamdiskControllerMarker;
1910    type ControlHandle = RamdiskControllerControlHandle;
1911
1912    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1913        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1914    }
1915
1916    fn control_handle(&self) -> Self::ControlHandle {
1917        RamdiskControllerControlHandle { inner: self.inner.clone() }
1918    }
1919
1920    fn into_inner(
1921        self,
1922    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1923    {
1924        (self.inner, self.is_terminated)
1925    }
1926
1927    fn from_inner(
1928        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1929        is_terminated: bool,
1930    ) -> Self {
1931        Self { inner, is_terminated }
1932    }
1933}
1934
1935impl futures::Stream for RamdiskControllerRequestStream {
1936    type Item = Result<RamdiskControllerRequest, fidl::Error>;
1937
1938    fn poll_next(
1939        mut self: std::pin::Pin<&mut Self>,
1940        cx: &mut std::task::Context<'_>,
1941    ) -> std::task::Poll<Option<Self::Item>> {
1942        let this = &mut *self;
1943        if this.inner.check_shutdown(cx) {
1944            this.is_terminated = true;
1945            return std::task::Poll::Ready(None);
1946        }
1947        if this.is_terminated {
1948            panic!("polled RamdiskControllerRequestStream after completion");
1949        }
1950        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1951            |bytes, handles| {
1952                match this.inner.channel().read_etc(cx, bytes, handles) {
1953                    std::task::Poll::Ready(Ok(())) => {}
1954                    std::task::Poll::Pending => return std::task::Poll::Pending,
1955                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1956                        this.is_terminated = true;
1957                        return std::task::Poll::Ready(None);
1958                    }
1959                    std::task::Poll::Ready(Err(e)) => {
1960                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1961                            e.into(),
1962                        ))))
1963                    }
1964                }
1965
1966                // A message has been received from the channel
1967                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1968
1969                std::task::Poll::Ready(Some(match header.ordinal {
1970                    0x21cd800cc5ff7c3f => {
1971                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1972                        let mut req = fidl::new_empty!(
1973                            RamdiskControllerCreateRequest,
1974                            fidl::encoding::DefaultFuchsiaResourceDialect
1975                        );
1976                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RamdiskControllerCreateRequest>(&header, _body_bytes, handles, &mut req)?;
1977                        let control_handle =
1978                            RamdiskControllerControlHandle { inner: this.inner.clone() };
1979                        Ok(RamdiskControllerRequest::Create {
1980                            block_size: req.block_size,
1981                            block_count: req.block_count,
1982                            type_guid: req.type_guid,
1983
1984                            responder: RamdiskControllerCreateResponder {
1985                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1986                                tx_id: header.tx_id,
1987                            },
1988                        })
1989                    }
1990                    0x5d37434da8f680b4 => {
1991                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1992                        let mut req = fidl::new_empty!(
1993                            RamdiskControllerCreateFromVmoRequest,
1994                            fidl::encoding::DefaultFuchsiaResourceDialect
1995                        );
1996                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RamdiskControllerCreateFromVmoRequest>(&header, _body_bytes, handles, &mut req)?;
1997                        let control_handle =
1998                            RamdiskControllerControlHandle { inner: this.inner.clone() };
1999                        Ok(RamdiskControllerRequest::CreateFromVmo {
2000                            vmo: req.vmo,
2001
2002                            responder: RamdiskControllerCreateFromVmoResponder {
2003                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2004                                tx_id: header.tx_id,
2005                            },
2006                        })
2007                    }
2008                    0x776dd021e9e6677e => {
2009                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2010                        let mut req = fidl::new_empty!(
2011                            RamdiskControllerCreateFromVmoWithParamsRequest,
2012                            fidl::encoding::DefaultFuchsiaResourceDialect
2013                        );
2014                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RamdiskControllerCreateFromVmoWithParamsRequest>(&header, _body_bytes, handles, &mut req)?;
2015                        let control_handle =
2016                            RamdiskControllerControlHandle { inner: this.inner.clone() };
2017                        Ok(RamdiskControllerRequest::CreateFromVmoWithParams {
2018                            vmo: req.vmo,
2019                            block_size: req.block_size,
2020                            type_guid: req.type_guid,
2021
2022                            responder: RamdiskControllerCreateFromVmoWithParamsResponder {
2023                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2024                                tx_id: header.tx_id,
2025                            },
2026                        })
2027                    }
2028                    _ => Err(fidl::Error::UnknownOrdinal {
2029                        ordinal: header.ordinal,
2030                        protocol_name:
2031                            <RamdiskControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2032                    }),
2033                }))
2034            },
2035        )
2036    }
2037}
2038
2039#[derive(Debug)]
2040pub enum RamdiskControllerRequest {
2041    /// Initializes a new Ramdisk instance with the provided block size and block count.
2042    /// Takes an optional `type_guid`, which may be queried from the ramdisk instance.
2043    Create {
2044        block_size: u64,
2045        block_count: u64,
2046        type_guid: Option<Box<Guid>>,
2047        responder: RamdiskControllerCreateResponder,
2048    },
2049    /// Initializes a new Ramdisk instance from a VMO. Uses a block size of `PAGE_SIZE`,
2050    /// and derives the block count from the size of the VMO.
2051    CreateFromVmo { vmo: fidl::Vmo, responder: RamdiskControllerCreateFromVmoResponder },
2052    /// Same as CreateFromVmo, but with the given `block_size` and optional `type_guid`. If
2053    /// `block_size` is zero, `PAGE_SIZE` will be used as `block_size`.
2054    CreateFromVmoWithParams {
2055        vmo: fidl::Vmo,
2056        block_size: u64,
2057        type_guid: Option<Box<Guid>>,
2058        responder: RamdiskControllerCreateFromVmoWithParamsResponder,
2059    },
2060}
2061
2062impl RamdiskControllerRequest {
2063    #[allow(irrefutable_let_patterns)]
2064    pub fn into_create(
2065        self,
2066    ) -> Option<(u64, u64, Option<Box<Guid>>, RamdiskControllerCreateResponder)> {
2067        if let RamdiskControllerRequest::Create { block_size, block_count, type_guid, responder } =
2068            self
2069        {
2070            Some((block_size, block_count, type_guid, responder))
2071        } else {
2072            None
2073        }
2074    }
2075
2076    #[allow(irrefutable_let_patterns)]
2077    pub fn into_create_from_vmo(
2078        self,
2079    ) -> Option<(fidl::Vmo, RamdiskControllerCreateFromVmoResponder)> {
2080        if let RamdiskControllerRequest::CreateFromVmo { vmo, responder } = self {
2081            Some((vmo, responder))
2082        } else {
2083            None
2084        }
2085    }
2086
2087    #[allow(irrefutable_let_patterns)]
2088    pub fn into_create_from_vmo_with_params(
2089        self,
2090    ) -> Option<(
2091        fidl::Vmo,
2092        u64,
2093        Option<Box<Guid>>,
2094        RamdiskControllerCreateFromVmoWithParamsResponder,
2095    )> {
2096        if let RamdiskControllerRequest::CreateFromVmoWithParams {
2097            vmo,
2098            block_size,
2099            type_guid,
2100            responder,
2101        } = self
2102        {
2103            Some((vmo, block_size, type_guid, responder))
2104        } else {
2105            None
2106        }
2107    }
2108
2109    /// Name of the method defined in FIDL
2110    pub fn method_name(&self) -> &'static str {
2111        match *self {
2112            RamdiskControllerRequest::Create { .. } => "create",
2113            RamdiskControllerRequest::CreateFromVmo { .. } => "create_from_vmo",
2114            RamdiskControllerRequest::CreateFromVmoWithParams { .. } => {
2115                "create_from_vmo_with_params"
2116            }
2117        }
2118    }
2119}
2120
2121#[derive(Debug, Clone)]
2122pub struct RamdiskControllerControlHandle {
2123    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2124}
2125
2126impl fidl::endpoints::ControlHandle for RamdiskControllerControlHandle {
2127    fn shutdown(&self) {
2128        self.inner.shutdown()
2129    }
2130    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2131        self.inner.shutdown_with_epitaph(status)
2132    }
2133
2134    fn is_closed(&self) -> bool {
2135        self.inner.channel().is_closed()
2136    }
2137    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2138        self.inner.channel().on_closed()
2139    }
2140
2141    #[cfg(target_os = "fuchsia")]
2142    fn signal_peer(
2143        &self,
2144        clear_mask: zx::Signals,
2145        set_mask: zx::Signals,
2146    ) -> Result<(), zx_status::Status> {
2147        use fidl::Peered;
2148        self.inner.channel().signal_peer(clear_mask, set_mask)
2149    }
2150}
2151
2152impl RamdiskControllerControlHandle {}
2153
2154#[must_use = "FIDL methods require a response to be sent"]
2155#[derive(Debug)]
2156pub struct RamdiskControllerCreateResponder {
2157    control_handle: std::mem::ManuallyDrop<RamdiskControllerControlHandle>,
2158    tx_id: u32,
2159}
2160
2161/// Set the the channel to be shutdown (see [`RamdiskControllerControlHandle::shutdown`])
2162/// if the responder is dropped without sending a response, so that the client
2163/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2164impl std::ops::Drop for RamdiskControllerCreateResponder {
2165    fn drop(&mut self) {
2166        self.control_handle.shutdown();
2167        // Safety: drops once, never accessed again
2168        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2169    }
2170}
2171
2172impl fidl::endpoints::Responder for RamdiskControllerCreateResponder {
2173    type ControlHandle = RamdiskControllerControlHandle;
2174
2175    fn control_handle(&self) -> &RamdiskControllerControlHandle {
2176        &self.control_handle
2177    }
2178
2179    fn drop_without_shutdown(mut self) {
2180        // Safety: drops once, never accessed again due to mem::forget
2181        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2182        // Prevent Drop from running (which would shut down the channel)
2183        std::mem::forget(self);
2184    }
2185}
2186
2187impl RamdiskControllerCreateResponder {
2188    /// Sends a response to the FIDL transaction.
2189    ///
2190    /// Sets the channel to shutdown if an error occurs.
2191    pub fn send(self, mut result: Result<Option<&str>, i32>) -> Result<(), fidl::Error> {
2192        let _result = self.send_raw(result);
2193        if _result.is_err() {
2194            self.control_handle.shutdown();
2195        }
2196        self.drop_without_shutdown();
2197        _result
2198    }
2199
2200    /// Similar to "send" but does not shutdown the channel if an error occurs.
2201    pub fn send_no_shutdown_on_err(
2202        self,
2203        mut result: Result<Option<&str>, i32>,
2204    ) -> Result<(), fidl::Error> {
2205        let _result = self.send_raw(result);
2206        self.drop_without_shutdown();
2207        _result
2208    }
2209
2210    fn send_raw(&self, mut result: Result<Option<&str>, i32>) -> Result<(), fidl::Error> {
2211        self.control_handle
2212            .inner
2213            .send::<fidl::encoding::ResultType<RamdiskControllerCreateResponse, i32>>(
2214                result.map(|name| (name,)),
2215                self.tx_id,
2216                0x21cd800cc5ff7c3f,
2217                fidl::encoding::DynamicFlags::empty(),
2218            )
2219    }
2220}
2221
2222#[must_use = "FIDL methods require a response to be sent"]
2223#[derive(Debug)]
2224pub struct RamdiskControllerCreateFromVmoResponder {
2225    control_handle: std::mem::ManuallyDrop<RamdiskControllerControlHandle>,
2226    tx_id: u32,
2227}
2228
2229/// Set the the channel to be shutdown (see [`RamdiskControllerControlHandle::shutdown`])
2230/// if the responder is dropped without sending a response, so that the client
2231/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2232impl std::ops::Drop for RamdiskControllerCreateFromVmoResponder {
2233    fn drop(&mut self) {
2234        self.control_handle.shutdown();
2235        // Safety: drops once, never accessed again
2236        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2237    }
2238}
2239
2240impl fidl::endpoints::Responder for RamdiskControllerCreateFromVmoResponder {
2241    type ControlHandle = RamdiskControllerControlHandle;
2242
2243    fn control_handle(&self) -> &RamdiskControllerControlHandle {
2244        &self.control_handle
2245    }
2246
2247    fn drop_without_shutdown(mut self) {
2248        // Safety: drops once, never accessed again due to mem::forget
2249        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2250        // Prevent Drop from running (which would shut down the channel)
2251        std::mem::forget(self);
2252    }
2253}
2254
2255impl RamdiskControllerCreateFromVmoResponder {
2256    /// Sends a response to the FIDL transaction.
2257    ///
2258    /// Sets the channel to shutdown if an error occurs.
2259    pub fn send(self, mut result: Result<Option<&str>, i32>) -> Result<(), fidl::Error> {
2260        let _result = self.send_raw(result);
2261        if _result.is_err() {
2262            self.control_handle.shutdown();
2263        }
2264        self.drop_without_shutdown();
2265        _result
2266    }
2267
2268    /// Similar to "send" but does not shutdown the channel if an error occurs.
2269    pub fn send_no_shutdown_on_err(
2270        self,
2271        mut result: Result<Option<&str>, i32>,
2272    ) -> Result<(), fidl::Error> {
2273        let _result = self.send_raw(result);
2274        self.drop_without_shutdown();
2275        _result
2276    }
2277
2278    fn send_raw(&self, mut result: Result<Option<&str>, i32>) -> Result<(), fidl::Error> {
2279        self.control_handle.inner.send::<fidl::encoding::ResultType<
2280            RamdiskControllerCreateFromVmoResponse,
2281            i32,
2282        >>(
2283            result.map(|name| (name,)),
2284            self.tx_id,
2285            0x5d37434da8f680b4,
2286            fidl::encoding::DynamicFlags::empty(),
2287        )
2288    }
2289}
2290
2291#[must_use = "FIDL methods require a response to be sent"]
2292#[derive(Debug)]
2293pub struct RamdiskControllerCreateFromVmoWithParamsResponder {
2294    control_handle: std::mem::ManuallyDrop<RamdiskControllerControlHandle>,
2295    tx_id: u32,
2296}
2297
2298/// Set the the channel to be shutdown (see [`RamdiskControllerControlHandle::shutdown`])
2299/// if the responder is dropped without sending a response, so that the client
2300/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2301impl std::ops::Drop for RamdiskControllerCreateFromVmoWithParamsResponder {
2302    fn drop(&mut self) {
2303        self.control_handle.shutdown();
2304        // Safety: drops once, never accessed again
2305        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2306    }
2307}
2308
2309impl fidl::endpoints::Responder for RamdiskControllerCreateFromVmoWithParamsResponder {
2310    type ControlHandle = RamdiskControllerControlHandle;
2311
2312    fn control_handle(&self) -> &RamdiskControllerControlHandle {
2313        &self.control_handle
2314    }
2315
2316    fn drop_without_shutdown(mut self) {
2317        // Safety: drops once, never accessed again due to mem::forget
2318        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2319        // Prevent Drop from running (which would shut down the channel)
2320        std::mem::forget(self);
2321    }
2322}
2323
2324impl RamdiskControllerCreateFromVmoWithParamsResponder {
2325    /// Sends a response to the FIDL transaction.
2326    ///
2327    /// Sets the channel to shutdown if an error occurs.
2328    pub fn send(self, mut result: Result<Option<&str>, i32>) -> Result<(), fidl::Error> {
2329        let _result = self.send_raw(result);
2330        if _result.is_err() {
2331            self.control_handle.shutdown();
2332        }
2333        self.drop_without_shutdown();
2334        _result
2335    }
2336
2337    /// Similar to "send" but does not shutdown the channel if an error occurs.
2338    pub fn send_no_shutdown_on_err(
2339        self,
2340        mut result: Result<Option<&str>, i32>,
2341    ) -> Result<(), fidl::Error> {
2342        let _result = self.send_raw(result);
2343        self.drop_without_shutdown();
2344        _result
2345    }
2346
2347    fn send_raw(&self, mut result: Result<Option<&str>, i32>) -> Result<(), fidl::Error> {
2348        self.control_handle.inner.send::<fidl::encoding::ResultType<
2349            RamdiskControllerCreateFromVmoWithParamsResponse,
2350            i32,
2351        >>(
2352            result.map(|name| (name,)),
2353            self.tx_id,
2354            0x776dd021e9e6677e,
2355            fidl::encoding::DynamicFlags::empty(),
2356        )
2357    }
2358}
2359
2360#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2361pub struct ServiceMarker;
2362
2363#[cfg(target_os = "fuchsia")]
2364impl fidl::endpoints::ServiceMarker for ServiceMarker {
2365    type Proxy = ServiceProxy;
2366    type Request = ServiceRequest;
2367    const SERVICE_NAME: &'static str = "fuchsia.hardware.ramdisk.Service";
2368}
2369
2370/// A request for one of the member protocols of Service.
2371///
2372/// The v2 ramdisk driver will expose this service.
2373#[cfg(target_os = "fuchsia")]
2374pub enum ServiceRequest {
2375    Controller(ControllerRequestStream),
2376}
2377
2378#[cfg(target_os = "fuchsia")]
2379impl fidl::endpoints::ServiceRequest for ServiceRequest {
2380    type Service = ServiceMarker;
2381
2382    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
2383        match name {
2384            "controller" => Self::Controller(
2385                <ControllerRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
2386            ),
2387            _ => panic!("no such member protocol name for service Service"),
2388        }
2389    }
2390
2391    fn member_names() -> &'static [&'static str] {
2392        &["controller"]
2393    }
2394}
2395/// The v2 ramdisk driver will expose this service.
2396#[cfg(target_os = "fuchsia")]
2397pub struct ServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
2398
2399#[cfg(target_os = "fuchsia")]
2400impl fidl::endpoints::ServiceProxy for ServiceProxy {
2401    type Service = ServiceMarker;
2402
2403    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
2404        Self(opener)
2405    }
2406}
2407
2408#[cfg(target_os = "fuchsia")]
2409impl ServiceProxy {
2410    pub fn connect_to_controller(&self) -> Result<ControllerProxy, fidl::Error> {
2411        let (proxy, server_end) = fidl::endpoints::create_proxy::<ControllerMarker>();
2412        self.connect_channel_to_controller(server_end)?;
2413        Ok(proxy)
2414    }
2415
2416    /// Like `connect_to_controller`, but returns a sync proxy.
2417    /// See [`Self::connect_to_controller`] for more details.
2418    pub fn connect_to_controller_sync(&self) -> Result<ControllerSynchronousProxy, fidl::Error> {
2419        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<ControllerMarker>();
2420        self.connect_channel_to_controller(server_end)?;
2421        Ok(proxy)
2422    }
2423
2424    /// Like `connect_to_controller`, but accepts a server end.
2425    /// See [`Self::connect_to_controller`] for more details.
2426    pub fn connect_channel_to_controller(
2427        &self,
2428        server_end: fidl::endpoints::ServerEnd<ControllerMarker>,
2429    ) -> Result<(), fidl::Error> {
2430        self.0.open_member("controller", server_end.into_channel())
2431    }
2432
2433    pub fn instance_name(&self) -> &str {
2434        self.0.instance_name()
2435    }
2436}
2437
2438mod internal {
2439    use super::*;
2440    unsafe impl fidl::encoding::TypeMarker for RamdiskFlag {
2441        type Owned = Self;
2442
2443        #[inline(always)]
2444        fn inline_align(_context: fidl::encoding::Context) -> usize {
2445            4
2446        }
2447
2448        #[inline(always)]
2449        fn inline_size(_context: fidl::encoding::Context) -> usize {
2450            4
2451        }
2452    }
2453
2454    impl fidl::encoding::ValueTypeMarker for RamdiskFlag {
2455        type Borrowed<'a> = Self;
2456        #[inline(always)]
2457        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2458            *value
2459        }
2460    }
2461
2462    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for RamdiskFlag {
2463        #[inline]
2464        unsafe fn encode(
2465            self,
2466            encoder: &mut fidl::encoding::Encoder<'_, D>,
2467            offset: usize,
2468            _depth: fidl::encoding::Depth,
2469        ) -> fidl::Result<()> {
2470            encoder.debug_check_bounds::<Self>(offset);
2471            if self.bits() & Self::all().bits() != self.bits() {
2472                return Err(fidl::Error::InvalidBitsValue);
2473            }
2474            encoder.write_num(self.bits(), offset);
2475            Ok(())
2476        }
2477    }
2478
2479    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for RamdiskFlag {
2480        #[inline(always)]
2481        fn new_empty() -> Self {
2482            Self::empty()
2483        }
2484
2485        #[inline]
2486        unsafe fn decode(
2487            &mut self,
2488            decoder: &mut fidl::encoding::Decoder<'_, D>,
2489            offset: usize,
2490            _depth: fidl::encoding::Depth,
2491        ) -> fidl::Result<()> {
2492            decoder.debug_check_bounds::<Self>(offset);
2493            let prim = decoder.read_num::<u32>(offset);
2494            *self = Self::from_bits(prim).ok_or(fidl::Error::InvalidBitsValue)?;
2495            Ok(())
2496        }
2497    }
2498
2499    impl fidl::encoding::ValueTypeMarker for BlockWriteCounts {
2500        type Borrowed<'a> = &'a Self;
2501        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2502            value
2503        }
2504    }
2505
2506    unsafe impl fidl::encoding::TypeMarker for BlockWriteCounts {
2507        type Owned = Self;
2508
2509        #[inline(always)]
2510        fn inline_align(_context: fidl::encoding::Context) -> usize {
2511            8
2512        }
2513
2514        #[inline(always)]
2515        fn inline_size(_context: fidl::encoding::Context) -> usize {
2516            24
2517        }
2518        #[inline(always)]
2519        fn encode_is_copy() -> bool {
2520            true
2521        }
2522
2523        #[inline(always)]
2524        fn decode_is_copy() -> bool {
2525            true
2526        }
2527    }
2528
2529    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<BlockWriteCounts, D>
2530        for &BlockWriteCounts
2531    {
2532        #[inline]
2533        unsafe fn encode(
2534            self,
2535            encoder: &mut fidl::encoding::Encoder<'_, D>,
2536            offset: usize,
2537            _depth: fidl::encoding::Depth,
2538        ) -> fidl::Result<()> {
2539            encoder.debug_check_bounds::<BlockWriteCounts>(offset);
2540            unsafe {
2541                // Copy the object into the buffer.
2542                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2543                (buf_ptr as *mut BlockWriteCounts)
2544                    .write_unaligned((self as *const BlockWriteCounts).read());
2545                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
2546                // done second because the memcpy will write garbage to these bytes.
2547            }
2548            Ok(())
2549        }
2550    }
2551    unsafe impl<
2552            D: fidl::encoding::ResourceDialect,
2553            T0: fidl::encoding::Encode<u64, D>,
2554            T1: fidl::encoding::Encode<u64, D>,
2555            T2: fidl::encoding::Encode<u64, D>,
2556        > fidl::encoding::Encode<BlockWriteCounts, D> for (T0, T1, T2)
2557    {
2558        #[inline]
2559        unsafe fn encode(
2560            self,
2561            encoder: &mut fidl::encoding::Encoder<'_, D>,
2562            offset: usize,
2563            depth: fidl::encoding::Depth,
2564        ) -> fidl::Result<()> {
2565            encoder.debug_check_bounds::<BlockWriteCounts>(offset);
2566            // Zero out padding regions. There's no need to apply masks
2567            // because the unmasked parts will be overwritten by fields.
2568            // Write the fields.
2569            self.0.encode(encoder, offset + 0, depth)?;
2570            self.1.encode(encoder, offset + 8, depth)?;
2571            self.2.encode(encoder, offset + 16, depth)?;
2572            Ok(())
2573        }
2574    }
2575
2576    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BlockWriteCounts {
2577        #[inline(always)]
2578        fn new_empty() -> Self {
2579            Self {
2580                received: fidl::new_empty!(u64, D),
2581                successful: fidl::new_empty!(u64, D),
2582                failed: fidl::new_empty!(u64, D),
2583            }
2584        }
2585
2586        #[inline]
2587        unsafe fn decode(
2588            &mut self,
2589            decoder: &mut fidl::encoding::Decoder<'_, D>,
2590            offset: usize,
2591            _depth: fidl::encoding::Depth,
2592        ) -> fidl::Result<()> {
2593            decoder.debug_check_bounds::<Self>(offset);
2594            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2595            // Verify that padding bytes are zero.
2596            // Copy from the buffer into the object.
2597            unsafe {
2598                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 24);
2599            }
2600            Ok(())
2601        }
2602    }
2603
2604    impl fidl::encoding::ResourceTypeMarker for ControllerCreateResponse {
2605        type Borrowed<'a> = &'a mut Self;
2606        fn take_or_borrow<'a>(
2607            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2608        ) -> Self::Borrowed<'a> {
2609            value
2610        }
2611    }
2612
2613    unsafe impl fidl::encoding::TypeMarker for ControllerCreateResponse {
2614        type Owned = Self;
2615
2616        #[inline(always)]
2617        fn inline_align(_context: fidl::encoding::Context) -> usize {
2618            4
2619        }
2620
2621        #[inline(always)]
2622        fn inline_size(_context: fidl::encoding::Context) -> usize {
2623            8
2624        }
2625    }
2626
2627    unsafe impl
2628        fidl::encoding::Encode<
2629            ControllerCreateResponse,
2630            fidl::encoding::DefaultFuchsiaResourceDialect,
2631        > for &mut ControllerCreateResponse
2632    {
2633        #[inline]
2634        unsafe fn encode(
2635            self,
2636            encoder: &mut fidl::encoding::Encoder<
2637                '_,
2638                fidl::encoding::DefaultFuchsiaResourceDialect,
2639            >,
2640            offset: usize,
2641            _depth: fidl::encoding::Depth,
2642        ) -> fidl::Result<()> {
2643            encoder.debug_check_bounds::<ControllerCreateResponse>(offset);
2644            // Delegate to tuple encoding.
2645            fidl::encoding::Encode::<
2646                ControllerCreateResponse,
2647                fidl::encoding::DefaultFuchsiaResourceDialect,
2648            >::encode(
2649                (
2650                    <fidl::encoding::Endpoint<
2651                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
2652                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2653                        &mut self.outgoing
2654                    ),
2655                    <fidl::encoding::HandleType<
2656                        fidl::EventPair,
2657                        { fidl::ObjectType::EVENTPAIR.into_raw() },
2658                        2147483648,
2659                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2660                        &mut self.lifeline
2661                    ),
2662                ),
2663                encoder,
2664                offset,
2665                _depth,
2666            )
2667        }
2668    }
2669    unsafe impl<
2670            T0: fidl::encoding::Encode<
2671                fidl::encoding::Endpoint<
2672                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
2673                >,
2674                fidl::encoding::DefaultFuchsiaResourceDialect,
2675            >,
2676            T1: fidl::encoding::Encode<
2677                fidl::encoding::HandleType<
2678                    fidl::EventPair,
2679                    { fidl::ObjectType::EVENTPAIR.into_raw() },
2680                    2147483648,
2681                >,
2682                fidl::encoding::DefaultFuchsiaResourceDialect,
2683            >,
2684        >
2685        fidl::encoding::Encode<
2686            ControllerCreateResponse,
2687            fidl::encoding::DefaultFuchsiaResourceDialect,
2688        > for (T0, T1)
2689    {
2690        #[inline]
2691        unsafe fn encode(
2692            self,
2693            encoder: &mut fidl::encoding::Encoder<
2694                '_,
2695                fidl::encoding::DefaultFuchsiaResourceDialect,
2696            >,
2697            offset: usize,
2698            depth: fidl::encoding::Depth,
2699        ) -> fidl::Result<()> {
2700            encoder.debug_check_bounds::<ControllerCreateResponse>(offset);
2701            // Zero out padding regions. There's no need to apply masks
2702            // because the unmasked parts will be overwritten by fields.
2703            // Write the fields.
2704            self.0.encode(encoder, offset + 0, depth)?;
2705            self.1.encode(encoder, offset + 4, depth)?;
2706            Ok(())
2707        }
2708    }
2709
2710    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2711        for ControllerCreateResponse
2712    {
2713        #[inline(always)]
2714        fn new_empty() -> Self {
2715            Self {
2716                outgoing: fidl::new_empty!(
2717                    fidl::encoding::Endpoint<
2718                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
2719                    >,
2720                    fidl::encoding::DefaultFuchsiaResourceDialect
2721                ),
2722                lifeline: fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
2723            }
2724        }
2725
2726        #[inline]
2727        unsafe fn decode(
2728            &mut self,
2729            decoder: &mut fidl::encoding::Decoder<
2730                '_,
2731                fidl::encoding::DefaultFuchsiaResourceDialect,
2732            >,
2733            offset: usize,
2734            _depth: fidl::encoding::Depth,
2735        ) -> fidl::Result<()> {
2736            decoder.debug_check_bounds::<Self>(offset);
2737            // Verify that padding bytes are zero.
2738            fidl::decode!(
2739                fidl::encoding::Endpoint<
2740                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
2741                >,
2742                fidl::encoding::DefaultFuchsiaResourceDialect,
2743                &mut self.outgoing,
2744                decoder,
2745                offset + 0,
2746                _depth
2747            )?;
2748            fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.lifeline, decoder, offset + 4, _depth)?;
2749            Ok(())
2750        }
2751    }
2752
2753    impl fidl::encoding::ValueTypeMarker for Guid {
2754        type Borrowed<'a> = &'a Self;
2755        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2756            value
2757        }
2758    }
2759
2760    unsafe impl fidl::encoding::TypeMarker for Guid {
2761        type Owned = Self;
2762
2763        #[inline(always)]
2764        fn inline_align(_context: fidl::encoding::Context) -> usize {
2765            1
2766        }
2767
2768        #[inline(always)]
2769        fn inline_size(_context: fidl::encoding::Context) -> usize {
2770            16
2771        }
2772        #[inline(always)]
2773        fn encode_is_copy() -> bool {
2774            true
2775        }
2776
2777        #[inline(always)]
2778        fn decode_is_copy() -> bool {
2779            true
2780        }
2781    }
2782
2783    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Guid, D> for &Guid {
2784        #[inline]
2785        unsafe fn encode(
2786            self,
2787            encoder: &mut fidl::encoding::Encoder<'_, D>,
2788            offset: usize,
2789            _depth: fidl::encoding::Depth,
2790        ) -> fidl::Result<()> {
2791            encoder.debug_check_bounds::<Guid>(offset);
2792            unsafe {
2793                // Copy the object into the buffer.
2794                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2795                (buf_ptr as *mut Guid).write_unaligned((self as *const Guid).read());
2796                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
2797                // done second because the memcpy will write garbage to these bytes.
2798            }
2799            Ok(())
2800        }
2801    }
2802    unsafe impl<
2803            D: fidl::encoding::ResourceDialect,
2804            T0: fidl::encoding::Encode<fidl::encoding::Array<u8, 16>, D>,
2805        > fidl::encoding::Encode<Guid, D> for (T0,)
2806    {
2807        #[inline]
2808        unsafe fn encode(
2809            self,
2810            encoder: &mut fidl::encoding::Encoder<'_, D>,
2811            offset: usize,
2812            depth: fidl::encoding::Depth,
2813        ) -> fidl::Result<()> {
2814            encoder.debug_check_bounds::<Guid>(offset);
2815            // Zero out padding regions. There's no need to apply masks
2816            // because the unmasked parts will be overwritten by fields.
2817            // Write the fields.
2818            self.0.encode(encoder, offset + 0, depth)?;
2819            Ok(())
2820        }
2821    }
2822
2823    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Guid {
2824        #[inline(always)]
2825        fn new_empty() -> Self {
2826            Self { value: fidl::new_empty!(fidl::encoding::Array<u8, 16>, D) }
2827        }
2828
2829        #[inline]
2830        unsafe fn decode(
2831            &mut self,
2832            decoder: &mut fidl::encoding::Decoder<'_, D>,
2833            offset: usize,
2834            _depth: fidl::encoding::Depth,
2835        ) -> fidl::Result<()> {
2836            decoder.debug_check_bounds::<Self>(offset);
2837            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2838            // Verify that padding bytes are zero.
2839            // Copy from the buffer into the object.
2840            unsafe {
2841                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
2842            }
2843            Ok(())
2844        }
2845    }
2846
2847    impl fidl::encoding::ResourceTypeMarker for RamdiskControllerCreateFromVmoRequest {
2848        type Borrowed<'a> = &'a mut Self;
2849        fn take_or_borrow<'a>(
2850            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2851        ) -> Self::Borrowed<'a> {
2852            value
2853        }
2854    }
2855
2856    unsafe impl fidl::encoding::TypeMarker for RamdiskControllerCreateFromVmoRequest {
2857        type Owned = Self;
2858
2859        #[inline(always)]
2860        fn inline_align(_context: fidl::encoding::Context) -> usize {
2861            4
2862        }
2863
2864        #[inline(always)]
2865        fn inline_size(_context: fidl::encoding::Context) -> usize {
2866            4
2867        }
2868    }
2869
2870    unsafe impl
2871        fidl::encoding::Encode<
2872            RamdiskControllerCreateFromVmoRequest,
2873            fidl::encoding::DefaultFuchsiaResourceDialect,
2874        > for &mut RamdiskControllerCreateFromVmoRequest
2875    {
2876        #[inline]
2877        unsafe fn encode(
2878            self,
2879            encoder: &mut fidl::encoding::Encoder<
2880                '_,
2881                fidl::encoding::DefaultFuchsiaResourceDialect,
2882            >,
2883            offset: usize,
2884            _depth: fidl::encoding::Depth,
2885        ) -> fidl::Result<()> {
2886            encoder.debug_check_bounds::<RamdiskControllerCreateFromVmoRequest>(offset);
2887            // Delegate to tuple encoding.
2888            fidl::encoding::Encode::<
2889                RamdiskControllerCreateFromVmoRequest,
2890                fidl::encoding::DefaultFuchsiaResourceDialect,
2891            >::encode(
2892                (<fidl::encoding::HandleType<
2893                    fidl::Vmo,
2894                    { fidl::ObjectType::VMO.into_raw() },
2895                    2147483648,
2896                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2897                    &mut self.vmo
2898                ),),
2899                encoder,
2900                offset,
2901                _depth,
2902            )
2903        }
2904    }
2905    unsafe impl<
2906            T0: fidl::encoding::Encode<
2907                fidl::encoding::HandleType<
2908                    fidl::Vmo,
2909                    { fidl::ObjectType::VMO.into_raw() },
2910                    2147483648,
2911                >,
2912                fidl::encoding::DefaultFuchsiaResourceDialect,
2913            >,
2914        >
2915        fidl::encoding::Encode<
2916            RamdiskControllerCreateFromVmoRequest,
2917            fidl::encoding::DefaultFuchsiaResourceDialect,
2918        > for (T0,)
2919    {
2920        #[inline]
2921        unsafe fn encode(
2922            self,
2923            encoder: &mut fidl::encoding::Encoder<
2924                '_,
2925                fidl::encoding::DefaultFuchsiaResourceDialect,
2926            >,
2927            offset: usize,
2928            depth: fidl::encoding::Depth,
2929        ) -> fidl::Result<()> {
2930            encoder.debug_check_bounds::<RamdiskControllerCreateFromVmoRequest>(offset);
2931            // Zero out padding regions. There's no need to apply masks
2932            // because the unmasked parts will be overwritten by fields.
2933            // Write the fields.
2934            self.0.encode(encoder, offset + 0, depth)?;
2935            Ok(())
2936        }
2937    }
2938
2939    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2940        for RamdiskControllerCreateFromVmoRequest
2941    {
2942        #[inline(always)]
2943        fn new_empty() -> Self {
2944            Self {
2945                vmo: fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
2946            }
2947        }
2948
2949        #[inline]
2950        unsafe fn decode(
2951            &mut self,
2952            decoder: &mut fidl::encoding::Decoder<
2953                '_,
2954                fidl::encoding::DefaultFuchsiaResourceDialect,
2955            >,
2956            offset: usize,
2957            _depth: fidl::encoding::Depth,
2958        ) -> fidl::Result<()> {
2959            decoder.debug_check_bounds::<Self>(offset);
2960            // Verify that padding bytes are zero.
2961            fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.vmo, decoder, offset + 0, _depth)?;
2962            Ok(())
2963        }
2964    }
2965
2966    impl fidl::encoding::ResourceTypeMarker for RamdiskControllerCreateFromVmoWithParamsRequest {
2967        type Borrowed<'a> = &'a mut Self;
2968        fn take_or_borrow<'a>(
2969            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2970        ) -> Self::Borrowed<'a> {
2971            value
2972        }
2973    }
2974
2975    unsafe impl fidl::encoding::TypeMarker for RamdiskControllerCreateFromVmoWithParamsRequest {
2976        type Owned = Self;
2977
2978        #[inline(always)]
2979        fn inline_align(_context: fidl::encoding::Context) -> usize {
2980            8
2981        }
2982
2983        #[inline(always)]
2984        fn inline_size(_context: fidl::encoding::Context) -> usize {
2985            24
2986        }
2987    }
2988
2989    unsafe impl
2990        fidl::encoding::Encode<
2991            RamdiskControllerCreateFromVmoWithParamsRequest,
2992            fidl::encoding::DefaultFuchsiaResourceDialect,
2993        > for &mut RamdiskControllerCreateFromVmoWithParamsRequest
2994    {
2995        #[inline]
2996        unsafe fn encode(
2997            self,
2998            encoder: &mut fidl::encoding::Encoder<
2999                '_,
3000                fidl::encoding::DefaultFuchsiaResourceDialect,
3001            >,
3002            offset: usize,
3003            _depth: fidl::encoding::Depth,
3004        ) -> fidl::Result<()> {
3005            encoder.debug_check_bounds::<RamdiskControllerCreateFromVmoWithParamsRequest>(offset);
3006            // Delegate to tuple encoding.
3007            fidl::encoding::Encode::<
3008                RamdiskControllerCreateFromVmoWithParamsRequest,
3009                fidl::encoding::DefaultFuchsiaResourceDialect,
3010            >::encode(
3011                (
3012                    <fidl::encoding::HandleType<
3013                        fidl::Vmo,
3014                        { fidl::ObjectType::VMO.into_raw() },
3015                        2147483648,
3016                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
3017                        &mut self.vmo
3018                    ),
3019                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.block_size),
3020                    <fidl::encoding::Boxed<Guid> as fidl::encoding::ValueTypeMarker>::borrow(
3021                        &self.type_guid,
3022                    ),
3023                ),
3024                encoder,
3025                offset,
3026                _depth,
3027            )
3028        }
3029    }
3030    unsafe impl<
3031            T0: fidl::encoding::Encode<
3032                fidl::encoding::HandleType<
3033                    fidl::Vmo,
3034                    { fidl::ObjectType::VMO.into_raw() },
3035                    2147483648,
3036                >,
3037                fidl::encoding::DefaultFuchsiaResourceDialect,
3038            >,
3039            T1: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
3040            T2: fidl::encoding::Encode<
3041                fidl::encoding::Boxed<Guid>,
3042                fidl::encoding::DefaultFuchsiaResourceDialect,
3043            >,
3044        >
3045        fidl::encoding::Encode<
3046            RamdiskControllerCreateFromVmoWithParamsRequest,
3047            fidl::encoding::DefaultFuchsiaResourceDialect,
3048        > for (T0, T1, T2)
3049    {
3050        #[inline]
3051        unsafe fn encode(
3052            self,
3053            encoder: &mut fidl::encoding::Encoder<
3054                '_,
3055                fidl::encoding::DefaultFuchsiaResourceDialect,
3056            >,
3057            offset: usize,
3058            depth: fidl::encoding::Depth,
3059        ) -> fidl::Result<()> {
3060            encoder.debug_check_bounds::<RamdiskControllerCreateFromVmoWithParamsRequest>(offset);
3061            // Zero out padding regions. There's no need to apply masks
3062            // because the unmasked parts will be overwritten by fields.
3063            unsafe {
3064                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
3065                (ptr as *mut u64).write_unaligned(0);
3066            }
3067            // Write the fields.
3068            self.0.encode(encoder, offset + 0, depth)?;
3069            self.1.encode(encoder, offset + 8, depth)?;
3070            self.2.encode(encoder, offset + 16, depth)?;
3071            Ok(())
3072        }
3073    }
3074
3075    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3076        for RamdiskControllerCreateFromVmoWithParamsRequest
3077    {
3078        #[inline(always)]
3079        fn new_empty() -> Self {
3080            Self {
3081                vmo: fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
3082                block_size: fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect),
3083                type_guid: fidl::new_empty!(
3084                    fidl::encoding::Boxed<Guid>,
3085                    fidl::encoding::DefaultFuchsiaResourceDialect
3086                ),
3087            }
3088        }
3089
3090        #[inline]
3091        unsafe fn decode(
3092            &mut self,
3093            decoder: &mut fidl::encoding::Decoder<
3094                '_,
3095                fidl::encoding::DefaultFuchsiaResourceDialect,
3096            >,
3097            offset: usize,
3098            _depth: fidl::encoding::Depth,
3099        ) -> fidl::Result<()> {
3100            decoder.debug_check_bounds::<Self>(offset);
3101            // Verify that padding bytes are zero.
3102            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
3103            let padval = unsafe { (ptr as *const u64).read_unaligned() };
3104            let mask = 0xffffffff00000000u64;
3105            let maskedval = padval & mask;
3106            if maskedval != 0 {
3107                return Err(fidl::Error::NonZeroPadding {
3108                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
3109                });
3110            }
3111            fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.vmo, decoder, offset + 0, _depth)?;
3112            fidl::decode!(
3113                u64,
3114                fidl::encoding::DefaultFuchsiaResourceDialect,
3115                &mut self.block_size,
3116                decoder,
3117                offset + 8,
3118                _depth
3119            )?;
3120            fidl::decode!(
3121                fidl::encoding::Boxed<Guid>,
3122                fidl::encoding::DefaultFuchsiaResourceDialect,
3123                &mut self.type_guid,
3124                decoder,
3125                offset + 16,
3126                _depth
3127            )?;
3128            Ok(())
3129        }
3130    }
3131
3132    impl fidl::encoding::ValueTypeMarker for RamdiskControllerCreateRequest {
3133        type Borrowed<'a> = &'a Self;
3134        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3135            value
3136        }
3137    }
3138
3139    unsafe impl fidl::encoding::TypeMarker for RamdiskControllerCreateRequest {
3140        type Owned = Self;
3141
3142        #[inline(always)]
3143        fn inline_align(_context: fidl::encoding::Context) -> usize {
3144            8
3145        }
3146
3147        #[inline(always)]
3148        fn inline_size(_context: fidl::encoding::Context) -> usize {
3149            24
3150        }
3151    }
3152
3153    unsafe impl<D: fidl::encoding::ResourceDialect>
3154        fidl::encoding::Encode<RamdiskControllerCreateRequest, D>
3155        for &RamdiskControllerCreateRequest
3156    {
3157        #[inline]
3158        unsafe fn encode(
3159            self,
3160            encoder: &mut fidl::encoding::Encoder<'_, D>,
3161            offset: usize,
3162            _depth: fidl::encoding::Depth,
3163        ) -> fidl::Result<()> {
3164            encoder.debug_check_bounds::<RamdiskControllerCreateRequest>(offset);
3165            // Delegate to tuple encoding.
3166            fidl::encoding::Encode::<RamdiskControllerCreateRequest, D>::encode(
3167                (
3168                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.block_size),
3169                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.block_count),
3170                    <fidl::encoding::Boxed<Guid> as fidl::encoding::ValueTypeMarker>::borrow(
3171                        &self.type_guid,
3172                    ),
3173                ),
3174                encoder,
3175                offset,
3176                _depth,
3177            )
3178        }
3179    }
3180    unsafe impl<
3181            D: fidl::encoding::ResourceDialect,
3182            T0: fidl::encoding::Encode<u64, D>,
3183            T1: fidl::encoding::Encode<u64, D>,
3184            T2: fidl::encoding::Encode<fidl::encoding::Boxed<Guid>, D>,
3185        > fidl::encoding::Encode<RamdiskControllerCreateRequest, D> for (T0, T1, T2)
3186    {
3187        #[inline]
3188        unsafe fn encode(
3189            self,
3190            encoder: &mut fidl::encoding::Encoder<'_, D>,
3191            offset: usize,
3192            depth: fidl::encoding::Depth,
3193        ) -> fidl::Result<()> {
3194            encoder.debug_check_bounds::<RamdiskControllerCreateRequest>(offset);
3195            // Zero out padding regions. There's no need to apply masks
3196            // because the unmasked parts will be overwritten by fields.
3197            // Write the fields.
3198            self.0.encode(encoder, offset + 0, depth)?;
3199            self.1.encode(encoder, offset + 8, depth)?;
3200            self.2.encode(encoder, offset + 16, depth)?;
3201            Ok(())
3202        }
3203    }
3204
3205    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3206        for RamdiskControllerCreateRequest
3207    {
3208        #[inline(always)]
3209        fn new_empty() -> Self {
3210            Self {
3211                block_size: fidl::new_empty!(u64, D),
3212                block_count: fidl::new_empty!(u64, D),
3213                type_guid: fidl::new_empty!(fidl::encoding::Boxed<Guid>, D),
3214            }
3215        }
3216
3217        #[inline]
3218        unsafe fn decode(
3219            &mut self,
3220            decoder: &mut fidl::encoding::Decoder<'_, D>,
3221            offset: usize,
3222            _depth: fidl::encoding::Depth,
3223        ) -> fidl::Result<()> {
3224            decoder.debug_check_bounds::<Self>(offset);
3225            // Verify that padding bytes are zero.
3226            fidl::decode!(u64, D, &mut self.block_size, decoder, offset + 0, _depth)?;
3227            fidl::decode!(u64, D, &mut self.block_count, decoder, offset + 8, _depth)?;
3228            fidl::decode!(
3229                fidl::encoding::Boxed<Guid>,
3230                D,
3231                &mut self.type_guid,
3232                decoder,
3233                offset + 16,
3234                _depth
3235            )?;
3236            Ok(())
3237        }
3238    }
3239
3240    impl fidl::encoding::ValueTypeMarker for RamdiskControllerCreateFromVmoWithParamsResponse {
3241        type Borrowed<'a> = &'a Self;
3242        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3243            value
3244        }
3245    }
3246
3247    unsafe impl fidl::encoding::TypeMarker for RamdiskControllerCreateFromVmoWithParamsResponse {
3248        type Owned = Self;
3249
3250        #[inline(always)]
3251        fn inline_align(_context: fidl::encoding::Context) -> usize {
3252            8
3253        }
3254
3255        #[inline(always)]
3256        fn inline_size(_context: fidl::encoding::Context) -> usize {
3257            16
3258        }
3259    }
3260
3261    unsafe impl<D: fidl::encoding::ResourceDialect>
3262        fidl::encoding::Encode<RamdiskControllerCreateFromVmoWithParamsResponse, D>
3263        for &RamdiskControllerCreateFromVmoWithParamsResponse
3264    {
3265        #[inline]
3266        unsafe fn encode(
3267            self,
3268            encoder: &mut fidl::encoding::Encoder<'_, D>,
3269            offset: usize,
3270            _depth: fidl::encoding::Depth,
3271        ) -> fidl::Result<()> {
3272            encoder.debug_check_bounds::<RamdiskControllerCreateFromVmoWithParamsResponse>(offset);
3273            // Delegate to tuple encoding.
3274            fidl::encoding::Encode::<RamdiskControllerCreateFromVmoWithParamsResponse, D>::encode(
3275                (
3276                    <fidl::encoding::Optional<fidl::encoding::BoundedString<32>> as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
3277                ),
3278                encoder, offset, _depth
3279            )
3280        }
3281    }
3282    unsafe impl<
3283            D: fidl::encoding::ResourceDialect,
3284            T0: fidl::encoding::Encode<fidl::encoding::Optional<fidl::encoding::BoundedString<32>>, D>,
3285        > fidl::encoding::Encode<RamdiskControllerCreateFromVmoWithParamsResponse, D> for (T0,)
3286    {
3287        #[inline]
3288        unsafe fn encode(
3289            self,
3290            encoder: &mut fidl::encoding::Encoder<'_, D>,
3291            offset: usize,
3292            depth: fidl::encoding::Depth,
3293        ) -> fidl::Result<()> {
3294            encoder.debug_check_bounds::<RamdiskControllerCreateFromVmoWithParamsResponse>(offset);
3295            // Zero out padding regions. There's no need to apply masks
3296            // because the unmasked parts will be overwritten by fields.
3297            // Write the fields.
3298            self.0.encode(encoder, offset + 0, depth)?;
3299            Ok(())
3300        }
3301    }
3302
3303    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3304        for RamdiskControllerCreateFromVmoWithParamsResponse
3305    {
3306        #[inline(always)]
3307        fn new_empty() -> Self {
3308            Self {
3309                name: fidl::new_empty!(
3310                    fidl::encoding::Optional<fidl::encoding::BoundedString<32>>,
3311                    D
3312                ),
3313            }
3314        }
3315
3316        #[inline]
3317        unsafe fn decode(
3318            &mut self,
3319            decoder: &mut fidl::encoding::Decoder<'_, D>,
3320            offset: usize,
3321            _depth: fidl::encoding::Depth,
3322        ) -> fidl::Result<()> {
3323            decoder.debug_check_bounds::<Self>(offset);
3324            // Verify that padding bytes are zero.
3325            fidl::decode!(
3326                fidl::encoding::Optional<fidl::encoding::BoundedString<32>>,
3327                D,
3328                &mut self.name,
3329                decoder,
3330                offset + 0,
3331                _depth
3332            )?;
3333            Ok(())
3334        }
3335    }
3336
3337    impl fidl::encoding::ValueTypeMarker for RamdiskControllerCreateFromVmoResponse {
3338        type Borrowed<'a> = &'a Self;
3339        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3340            value
3341        }
3342    }
3343
3344    unsafe impl fidl::encoding::TypeMarker for RamdiskControllerCreateFromVmoResponse {
3345        type Owned = Self;
3346
3347        #[inline(always)]
3348        fn inline_align(_context: fidl::encoding::Context) -> usize {
3349            8
3350        }
3351
3352        #[inline(always)]
3353        fn inline_size(_context: fidl::encoding::Context) -> usize {
3354            16
3355        }
3356    }
3357
3358    unsafe impl<D: fidl::encoding::ResourceDialect>
3359        fidl::encoding::Encode<RamdiskControllerCreateFromVmoResponse, D>
3360        for &RamdiskControllerCreateFromVmoResponse
3361    {
3362        #[inline]
3363        unsafe fn encode(
3364            self,
3365            encoder: &mut fidl::encoding::Encoder<'_, D>,
3366            offset: usize,
3367            _depth: fidl::encoding::Depth,
3368        ) -> fidl::Result<()> {
3369            encoder.debug_check_bounds::<RamdiskControllerCreateFromVmoResponse>(offset);
3370            // Delegate to tuple encoding.
3371            fidl::encoding::Encode::<RamdiskControllerCreateFromVmoResponse, D>::encode(
3372                (
3373                    <fidl::encoding::Optional<fidl::encoding::BoundedString<32>> as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
3374                ),
3375                encoder, offset, _depth
3376            )
3377        }
3378    }
3379    unsafe impl<
3380            D: fidl::encoding::ResourceDialect,
3381            T0: fidl::encoding::Encode<fidl::encoding::Optional<fidl::encoding::BoundedString<32>>, D>,
3382        > fidl::encoding::Encode<RamdiskControllerCreateFromVmoResponse, D> for (T0,)
3383    {
3384        #[inline]
3385        unsafe fn encode(
3386            self,
3387            encoder: &mut fidl::encoding::Encoder<'_, D>,
3388            offset: usize,
3389            depth: fidl::encoding::Depth,
3390        ) -> fidl::Result<()> {
3391            encoder.debug_check_bounds::<RamdiskControllerCreateFromVmoResponse>(offset);
3392            // Zero out padding regions. There's no need to apply masks
3393            // because the unmasked parts will be overwritten by fields.
3394            // Write the fields.
3395            self.0.encode(encoder, offset + 0, depth)?;
3396            Ok(())
3397        }
3398    }
3399
3400    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3401        for RamdiskControllerCreateFromVmoResponse
3402    {
3403        #[inline(always)]
3404        fn new_empty() -> Self {
3405            Self {
3406                name: fidl::new_empty!(
3407                    fidl::encoding::Optional<fidl::encoding::BoundedString<32>>,
3408                    D
3409                ),
3410            }
3411        }
3412
3413        #[inline]
3414        unsafe fn decode(
3415            &mut self,
3416            decoder: &mut fidl::encoding::Decoder<'_, D>,
3417            offset: usize,
3418            _depth: fidl::encoding::Depth,
3419        ) -> fidl::Result<()> {
3420            decoder.debug_check_bounds::<Self>(offset);
3421            // Verify that padding bytes are zero.
3422            fidl::decode!(
3423                fidl::encoding::Optional<fidl::encoding::BoundedString<32>>,
3424                D,
3425                &mut self.name,
3426                decoder,
3427                offset + 0,
3428                _depth
3429            )?;
3430            Ok(())
3431        }
3432    }
3433
3434    impl fidl::encoding::ValueTypeMarker for RamdiskControllerCreateResponse {
3435        type Borrowed<'a> = &'a Self;
3436        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3437            value
3438        }
3439    }
3440
3441    unsafe impl fidl::encoding::TypeMarker for RamdiskControllerCreateResponse {
3442        type Owned = Self;
3443
3444        #[inline(always)]
3445        fn inline_align(_context: fidl::encoding::Context) -> usize {
3446            8
3447        }
3448
3449        #[inline(always)]
3450        fn inline_size(_context: fidl::encoding::Context) -> usize {
3451            16
3452        }
3453    }
3454
3455    unsafe impl<D: fidl::encoding::ResourceDialect>
3456        fidl::encoding::Encode<RamdiskControllerCreateResponse, D>
3457        for &RamdiskControllerCreateResponse
3458    {
3459        #[inline]
3460        unsafe fn encode(
3461            self,
3462            encoder: &mut fidl::encoding::Encoder<'_, D>,
3463            offset: usize,
3464            _depth: fidl::encoding::Depth,
3465        ) -> fidl::Result<()> {
3466            encoder.debug_check_bounds::<RamdiskControllerCreateResponse>(offset);
3467            // Delegate to tuple encoding.
3468            fidl::encoding::Encode::<RamdiskControllerCreateResponse, D>::encode(
3469                (
3470                    <fidl::encoding::Optional<fidl::encoding::BoundedString<32>> as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
3471                ),
3472                encoder, offset, _depth
3473            )
3474        }
3475    }
3476    unsafe impl<
3477            D: fidl::encoding::ResourceDialect,
3478            T0: fidl::encoding::Encode<fidl::encoding::Optional<fidl::encoding::BoundedString<32>>, D>,
3479        > fidl::encoding::Encode<RamdiskControllerCreateResponse, D> for (T0,)
3480    {
3481        #[inline]
3482        unsafe fn encode(
3483            self,
3484            encoder: &mut fidl::encoding::Encoder<'_, D>,
3485            offset: usize,
3486            depth: fidl::encoding::Depth,
3487        ) -> fidl::Result<()> {
3488            encoder.debug_check_bounds::<RamdiskControllerCreateResponse>(offset);
3489            // Zero out padding regions. There's no need to apply masks
3490            // because the unmasked parts will be overwritten by fields.
3491            // Write the fields.
3492            self.0.encode(encoder, offset + 0, depth)?;
3493            Ok(())
3494        }
3495    }
3496
3497    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3498        for RamdiskControllerCreateResponse
3499    {
3500        #[inline(always)]
3501        fn new_empty() -> Self {
3502            Self {
3503                name: fidl::new_empty!(
3504                    fidl::encoding::Optional<fidl::encoding::BoundedString<32>>,
3505                    D
3506                ),
3507            }
3508        }
3509
3510        #[inline]
3511        unsafe fn decode(
3512            &mut self,
3513            decoder: &mut fidl::encoding::Decoder<'_, D>,
3514            offset: usize,
3515            _depth: fidl::encoding::Depth,
3516        ) -> fidl::Result<()> {
3517            decoder.debug_check_bounds::<Self>(offset);
3518            // Verify that padding bytes are zero.
3519            fidl::decode!(
3520                fidl::encoding::Optional<fidl::encoding::BoundedString<32>>,
3521                D,
3522                &mut self.name,
3523                decoder,
3524                offset + 0,
3525                _depth
3526            )?;
3527            Ok(())
3528        }
3529    }
3530
3531    impl fidl::encoding::ValueTypeMarker for RamdiskGetBlockCountsResponse {
3532        type Borrowed<'a> = &'a Self;
3533        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3534            value
3535        }
3536    }
3537
3538    unsafe impl fidl::encoding::TypeMarker for RamdiskGetBlockCountsResponse {
3539        type Owned = Self;
3540
3541        #[inline(always)]
3542        fn inline_align(_context: fidl::encoding::Context) -> usize {
3543            8
3544        }
3545
3546        #[inline(always)]
3547        fn inline_size(_context: fidl::encoding::Context) -> usize {
3548            24
3549        }
3550        #[inline(always)]
3551        fn encode_is_copy() -> bool {
3552            true
3553        }
3554
3555        #[inline(always)]
3556        fn decode_is_copy() -> bool {
3557            true
3558        }
3559    }
3560
3561    unsafe impl<D: fidl::encoding::ResourceDialect>
3562        fidl::encoding::Encode<RamdiskGetBlockCountsResponse, D>
3563        for &RamdiskGetBlockCountsResponse
3564    {
3565        #[inline]
3566        unsafe fn encode(
3567            self,
3568            encoder: &mut fidl::encoding::Encoder<'_, D>,
3569            offset: usize,
3570            _depth: fidl::encoding::Depth,
3571        ) -> fidl::Result<()> {
3572            encoder.debug_check_bounds::<RamdiskGetBlockCountsResponse>(offset);
3573            unsafe {
3574                // Copy the object into the buffer.
3575                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
3576                (buf_ptr as *mut RamdiskGetBlockCountsResponse)
3577                    .write_unaligned((self as *const RamdiskGetBlockCountsResponse).read());
3578                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
3579                // done second because the memcpy will write garbage to these bytes.
3580            }
3581            Ok(())
3582        }
3583    }
3584    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<BlockWriteCounts, D>>
3585        fidl::encoding::Encode<RamdiskGetBlockCountsResponse, D> for (T0,)
3586    {
3587        #[inline]
3588        unsafe fn encode(
3589            self,
3590            encoder: &mut fidl::encoding::Encoder<'_, D>,
3591            offset: usize,
3592            depth: fidl::encoding::Depth,
3593        ) -> fidl::Result<()> {
3594            encoder.debug_check_bounds::<RamdiskGetBlockCountsResponse>(offset);
3595            // Zero out padding regions. There's no need to apply masks
3596            // because the unmasked parts will be overwritten by fields.
3597            // Write the fields.
3598            self.0.encode(encoder, offset + 0, depth)?;
3599            Ok(())
3600        }
3601    }
3602
3603    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3604        for RamdiskGetBlockCountsResponse
3605    {
3606        #[inline(always)]
3607        fn new_empty() -> Self {
3608            Self { counts: fidl::new_empty!(BlockWriteCounts, D) }
3609        }
3610
3611        #[inline]
3612        unsafe fn decode(
3613            &mut self,
3614            decoder: &mut fidl::encoding::Decoder<'_, D>,
3615            offset: usize,
3616            _depth: fidl::encoding::Depth,
3617        ) -> fidl::Result<()> {
3618            decoder.debug_check_bounds::<Self>(offset);
3619            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
3620            // Verify that padding bytes are zero.
3621            // Copy from the buffer into the object.
3622            unsafe {
3623                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 24);
3624            }
3625            Ok(())
3626        }
3627    }
3628
3629    impl fidl::encoding::ValueTypeMarker for RamdiskSetFlagsRequest {
3630        type Borrowed<'a> = &'a Self;
3631        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3632            value
3633        }
3634    }
3635
3636    unsafe impl fidl::encoding::TypeMarker for RamdiskSetFlagsRequest {
3637        type Owned = Self;
3638
3639        #[inline(always)]
3640        fn inline_align(_context: fidl::encoding::Context) -> usize {
3641            4
3642        }
3643
3644        #[inline(always)]
3645        fn inline_size(_context: fidl::encoding::Context) -> usize {
3646            4
3647        }
3648    }
3649
3650    unsafe impl<D: fidl::encoding::ResourceDialect>
3651        fidl::encoding::Encode<RamdiskSetFlagsRequest, D> for &RamdiskSetFlagsRequest
3652    {
3653        #[inline]
3654        unsafe fn encode(
3655            self,
3656            encoder: &mut fidl::encoding::Encoder<'_, D>,
3657            offset: usize,
3658            _depth: fidl::encoding::Depth,
3659        ) -> fidl::Result<()> {
3660            encoder.debug_check_bounds::<RamdiskSetFlagsRequest>(offset);
3661            // Delegate to tuple encoding.
3662            fidl::encoding::Encode::<RamdiskSetFlagsRequest, D>::encode(
3663                (<RamdiskFlag as fidl::encoding::ValueTypeMarker>::borrow(&self.flags),),
3664                encoder,
3665                offset,
3666                _depth,
3667            )
3668        }
3669    }
3670    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<RamdiskFlag, D>>
3671        fidl::encoding::Encode<RamdiskSetFlagsRequest, D> for (T0,)
3672    {
3673        #[inline]
3674        unsafe fn encode(
3675            self,
3676            encoder: &mut fidl::encoding::Encoder<'_, D>,
3677            offset: usize,
3678            depth: fidl::encoding::Depth,
3679        ) -> fidl::Result<()> {
3680            encoder.debug_check_bounds::<RamdiskSetFlagsRequest>(offset);
3681            // Zero out padding regions. There's no need to apply masks
3682            // because the unmasked parts will be overwritten by fields.
3683            // Write the fields.
3684            self.0.encode(encoder, offset + 0, depth)?;
3685            Ok(())
3686        }
3687    }
3688
3689    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3690        for RamdiskSetFlagsRequest
3691    {
3692        #[inline(always)]
3693        fn new_empty() -> Self {
3694            Self { flags: fidl::new_empty!(RamdiskFlag, D) }
3695        }
3696
3697        #[inline]
3698        unsafe fn decode(
3699            &mut self,
3700            decoder: &mut fidl::encoding::Decoder<'_, D>,
3701            offset: usize,
3702            _depth: fidl::encoding::Depth,
3703        ) -> fidl::Result<()> {
3704            decoder.debug_check_bounds::<Self>(offset);
3705            // Verify that padding bytes are zero.
3706            fidl::decode!(RamdiskFlag, D, &mut self.flags, decoder, offset + 0, _depth)?;
3707            Ok(())
3708        }
3709    }
3710
3711    impl fidl::encoding::ValueTypeMarker for RamdiskSleepAfterRequest {
3712        type Borrowed<'a> = &'a Self;
3713        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3714            value
3715        }
3716    }
3717
3718    unsafe impl fidl::encoding::TypeMarker for RamdiskSleepAfterRequest {
3719        type Owned = Self;
3720
3721        #[inline(always)]
3722        fn inline_align(_context: fidl::encoding::Context) -> usize {
3723            8
3724        }
3725
3726        #[inline(always)]
3727        fn inline_size(_context: fidl::encoding::Context) -> usize {
3728            8
3729        }
3730        #[inline(always)]
3731        fn encode_is_copy() -> bool {
3732            true
3733        }
3734
3735        #[inline(always)]
3736        fn decode_is_copy() -> bool {
3737            true
3738        }
3739    }
3740
3741    unsafe impl<D: fidl::encoding::ResourceDialect>
3742        fidl::encoding::Encode<RamdiskSleepAfterRequest, D> for &RamdiskSleepAfterRequest
3743    {
3744        #[inline]
3745        unsafe fn encode(
3746            self,
3747            encoder: &mut fidl::encoding::Encoder<'_, D>,
3748            offset: usize,
3749            _depth: fidl::encoding::Depth,
3750        ) -> fidl::Result<()> {
3751            encoder.debug_check_bounds::<RamdiskSleepAfterRequest>(offset);
3752            unsafe {
3753                // Copy the object into the buffer.
3754                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
3755                (buf_ptr as *mut RamdiskSleepAfterRequest)
3756                    .write_unaligned((self as *const RamdiskSleepAfterRequest).read());
3757                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
3758                // done second because the memcpy will write garbage to these bytes.
3759            }
3760            Ok(())
3761        }
3762    }
3763    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
3764        fidl::encoding::Encode<RamdiskSleepAfterRequest, D> for (T0,)
3765    {
3766        #[inline]
3767        unsafe fn encode(
3768            self,
3769            encoder: &mut fidl::encoding::Encoder<'_, D>,
3770            offset: usize,
3771            depth: fidl::encoding::Depth,
3772        ) -> fidl::Result<()> {
3773            encoder.debug_check_bounds::<RamdiskSleepAfterRequest>(offset);
3774            // Zero out padding regions. There's no need to apply masks
3775            // because the unmasked parts will be overwritten by fields.
3776            // Write the fields.
3777            self.0.encode(encoder, offset + 0, depth)?;
3778            Ok(())
3779        }
3780    }
3781
3782    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3783        for RamdiskSleepAfterRequest
3784    {
3785        #[inline(always)]
3786        fn new_empty() -> Self {
3787            Self { count: fidl::new_empty!(u64, D) }
3788        }
3789
3790        #[inline]
3791        unsafe fn decode(
3792            &mut self,
3793            decoder: &mut fidl::encoding::Decoder<'_, D>,
3794            offset: usize,
3795            _depth: fidl::encoding::Depth,
3796        ) -> fidl::Result<()> {
3797            decoder.debug_check_bounds::<Self>(offset);
3798            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
3799            // Verify that padding bytes are zero.
3800            // Copy from the buffer into the object.
3801            unsafe {
3802                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
3803            }
3804            Ok(())
3805        }
3806    }
3807
3808    impl Options {
3809        #[inline(always)]
3810        fn max_ordinal_present(&self) -> u64 {
3811            if let Some(_) = self.publish {
3812                return 5;
3813            }
3814            if let Some(_) = self.vmo {
3815                return 4;
3816            }
3817            if let Some(_) = self.type_guid {
3818                return 3;
3819            }
3820            if let Some(_) = self.block_count {
3821                return 2;
3822            }
3823            if let Some(_) = self.block_size {
3824                return 1;
3825            }
3826            0
3827        }
3828    }
3829
3830    impl fidl::encoding::ResourceTypeMarker for Options {
3831        type Borrowed<'a> = &'a mut Self;
3832        fn take_or_borrow<'a>(
3833            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3834        ) -> Self::Borrowed<'a> {
3835            value
3836        }
3837    }
3838
3839    unsafe impl fidl::encoding::TypeMarker for Options {
3840        type Owned = Self;
3841
3842        #[inline(always)]
3843        fn inline_align(_context: fidl::encoding::Context) -> usize {
3844            8
3845        }
3846
3847        #[inline(always)]
3848        fn inline_size(_context: fidl::encoding::Context) -> usize {
3849            16
3850        }
3851    }
3852
3853    unsafe impl fidl::encoding::Encode<Options, fidl::encoding::DefaultFuchsiaResourceDialect>
3854        for &mut Options
3855    {
3856        unsafe fn encode(
3857            self,
3858            encoder: &mut fidl::encoding::Encoder<
3859                '_,
3860                fidl::encoding::DefaultFuchsiaResourceDialect,
3861            >,
3862            offset: usize,
3863            mut depth: fidl::encoding::Depth,
3864        ) -> fidl::Result<()> {
3865            encoder.debug_check_bounds::<Options>(offset);
3866            // Vector header
3867            let max_ordinal: u64 = self.max_ordinal_present();
3868            encoder.write_num(max_ordinal, offset);
3869            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3870            // Calling encoder.out_of_line_offset(0) is not allowed.
3871            if max_ordinal == 0 {
3872                return Ok(());
3873            }
3874            depth.increment()?;
3875            let envelope_size = 8;
3876            let bytes_len = max_ordinal as usize * envelope_size;
3877            #[allow(unused_variables)]
3878            let offset = encoder.out_of_line_offset(bytes_len);
3879            let mut _prev_end_offset: usize = 0;
3880            if 1 > max_ordinal {
3881                return Ok(());
3882            }
3883
3884            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3885            // are envelope_size bytes.
3886            let cur_offset: usize = (1 - 1) * envelope_size;
3887
3888            // Zero reserved fields.
3889            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3890
3891            // Safety:
3892            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3893            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3894            //   envelope_size bytes, there is always sufficient room.
3895            fidl::encoding::encode_in_envelope_optional::<
3896                u32,
3897                fidl::encoding::DefaultFuchsiaResourceDialect,
3898            >(
3899                self.block_size.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
3900                encoder,
3901                offset + cur_offset,
3902                depth,
3903            )?;
3904
3905            _prev_end_offset = cur_offset + envelope_size;
3906            if 2 > max_ordinal {
3907                return Ok(());
3908            }
3909
3910            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3911            // are envelope_size bytes.
3912            let cur_offset: usize = (2 - 1) * envelope_size;
3913
3914            // Zero reserved fields.
3915            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3916
3917            // Safety:
3918            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3919            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3920            //   envelope_size bytes, there is always sufficient room.
3921            fidl::encoding::encode_in_envelope_optional::<
3922                u64,
3923                fidl::encoding::DefaultFuchsiaResourceDialect,
3924            >(
3925                self.block_count.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
3926                encoder,
3927                offset + cur_offset,
3928                depth,
3929            )?;
3930
3931            _prev_end_offset = cur_offset + envelope_size;
3932            if 3 > max_ordinal {
3933                return Ok(());
3934            }
3935
3936            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3937            // are envelope_size bytes.
3938            let cur_offset: usize = (3 - 1) * envelope_size;
3939
3940            // Zero reserved fields.
3941            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3942
3943            // Safety:
3944            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3945            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3946            //   envelope_size bytes, there is always sufficient room.
3947            fidl::encoding::encode_in_envelope_optional::<
3948                Guid,
3949                fidl::encoding::DefaultFuchsiaResourceDialect,
3950            >(
3951                self.type_guid.as_ref().map(<Guid as fidl::encoding::ValueTypeMarker>::borrow),
3952                encoder,
3953                offset + cur_offset,
3954                depth,
3955            )?;
3956
3957            _prev_end_offset = cur_offset + envelope_size;
3958            if 4 > max_ordinal {
3959                return Ok(());
3960            }
3961
3962            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3963            // are envelope_size bytes.
3964            let cur_offset: usize = (4 - 1) * envelope_size;
3965
3966            // Zero reserved fields.
3967            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3968
3969            // Safety:
3970            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3971            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3972            //   envelope_size bytes, there is always sufficient room.
3973            fidl::encoding::encode_in_envelope_optional::<
3974                fidl::encoding::HandleType<
3975                    fidl::Vmo,
3976                    { fidl::ObjectType::VMO.into_raw() },
3977                    2147483648,
3978                >,
3979                fidl::encoding::DefaultFuchsiaResourceDialect,
3980            >(
3981                self.vmo.as_mut().map(
3982                    <fidl::encoding::HandleType<
3983                        fidl::Vmo,
3984                        { fidl::ObjectType::VMO.into_raw() },
3985                        2147483648,
3986                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
3987                ),
3988                encoder,
3989                offset + cur_offset,
3990                depth,
3991            )?;
3992
3993            _prev_end_offset = cur_offset + envelope_size;
3994            if 5 > max_ordinal {
3995                return Ok(());
3996            }
3997
3998            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3999            // are envelope_size bytes.
4000            let cur_offset: usize = (5 - 1) * envelope_size;
4001
4002            // Zero reserved fields.
4003            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4004
4005            // Safety:
4006            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4007            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4008            //   envelope_size bytes, there is always sufficient room.
4009            fidl::encoding::encode_in_envelope_optional::<
4010                bool,
4011                fidl::encoding::DefaultFuchsiaResourceDialect,
4012            >(
4013                self.publish.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
4014                encoder,
4015                offset + cur_offset,
4016                depth,
4017            )?;
4018
4019            _prev_end_offset = cur_offset + envelope_size;
4020
4021            Ok(())
4022        }
4023    }
4024
4025    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for Options {
4026        #[inline(always)]
4027        fn new_empty() -> Self {
4028            Self::default()
4029        }
4030
4031        unsafe fn decode(
4032            &mut self,
4033            decoder: &mut fidl::encoding::Decoder<
4034                '_,
4035                fidl::encoding::DefaultFuchsiaResourceDialect,
4036            >,
4037            offset: usize,
4038            mut depth: fidl::encoding::Depth,
4039        ) -> fidl::Result<()> {
4040            decoder.debug_check_bounds::<Self>(offset);
4041            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4042                None => return Err(fidl::Error::NotNullable),
4043                Some(len) => len,
4044            };
4045            // Calling decoder.out_of_line_offset(0) is not allowed.
4046            if len == 0 {
4047                return Ok(());
4048            };
4049            depth.increment()?;
4050            let envelope_size = 8;
4051            let bytes_len = len * envelope_size;
4052            let offset = decoder.out_of_line_offset(bytes_len)?;
4053            // Decode the envelope for each type.
4054            let mut _next_ordinal_to_read = 0;
4055            let mut next_offset = offset;
4056            let end_offset = offset + bytes_len;
4057            _next_ordinal_to_read += 1;
4058            if next_offset >= end_offset {
4059                return Ok(());
4060            }
4061
4062            // Decode unknown envelopes for gaps in ordinals.
4063            while _next_ordinal_to_read < 1 {
4064                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4065                _next_ordinal_to_read += 1;
4066                next_offset += envelope_size;
4067            }
4068
4069            let next_out_of_line = decoder.next_out_of_line();
4070            let handles_before = decoder.remaining_handles();
4071            if let Some((inlined, num_bytes, num_handles)) =
4072                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4073            {
4074                let member_inline_size =
4075                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4076                if inlined != (member_inline_size <= 4) {
4077                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4078                }
4079                let inner_offset;
4080                let mut inner_depth = depth.clone();
4081                if inlined {
4082                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4083                    inner_offset = next_offset;
4084                } else {
4085                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4086                    inner_depth.increment()?;
4087                }
4088                let val_ref = self.block_size.get_or_insert_with(|| {
4089                    fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect)
4090                });
4091                fidl::decode!(
4092                    u32,
4093                    fidl::encoding::DefaultFuchsiaResourceDialect,
4094                    val_ref,
4095                    decoder,
4096                    inner_offset,
4097                    inner_depth
4098                )?;
4099                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4100                {
4101                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4102                }
4103                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4104                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4105                }
4106            }
4107
4108            next_offset += envelope_size;
4109            _next_ordinal_to_read += 1;
4110            if next_offset >= end_offset {
4111                return Ok(());
4112            }
4113
4114            // Decode unknown envelopes for gaps in ordinals.
4115            while _next_ordinal_to_read < 2 {
4116                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4117                _next_ordinal_to_read += 1;
4118                next_offset += envelope_size;
4119            }
4120
4121            let next_out_of_line = decoder.next_out_of_line();
4122            let handles_before = decoder.remaining_handles();
4123            if let Some((inlined, num_bytes, num_handles)) =
4124                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4125            {
4126                let member_inline_size =
4127                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4128                if inlined != (member_inline_size <= 4) {
4129                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4130                }
4131                let inner_offset;
4132                let mut inner_depth = depth.clone();
4133                if inlined {
4134                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4135                    inner_offset = next_offset;
4136                } else {
4137                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4138                    inner_depth.increment()?;
4139                }
4140                let val_ref = self.block_count.get_or_insert_with(|| {
4141                    fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
4142                });
4143                fidl::decode!(
4144                    u64,
4145                    fidl::encoding::DefaultFuchsiaResourceDialect,
4146                    val_ref,
4147                    decoder,
4148                    inner_offset,
4149                    inner_depth
4150                )?;
4151                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4152                {
4153                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4154                }
4155                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4156                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4157                }
4158            }
4159
4160            next_offset += envelope_size;
4161            _next_ordinal_to_read += 1;
4162            if next_offset >= end_offset {
4163                return Ok(());
4164            }
4165
4166            // Decode unknown envelopes for gaps in ordinals.
4167            while _next_ordinal_to_read < 3 {
4168                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4169                _next_ordinal_to_read += 1;
4170                next_offset += envelope_size;
4171            }
4172
4173            let next_out_of_line = decoder.next_out_of_line();
4174            let handles_before = decoder.remaining_handles();
4175            if let Some((inlined, num_bytes, num_handles)) =
4176                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4177            {
4178                let member_inline_size =
4179                    <Guid as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4180                if inlined != (member_inline_size <= 4) {
4181                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4182                }
4183                let inner_offset;
4184                let mut inner_depth = depth.clone();
4185                if inlined {
4186                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4187                    inner_offset = next_offset;
4188                } else {
4189                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4190                    inner_depth.increment()?;
4191                }
4192                let val_ref = self.type_guid.get_or_insert_with(|| {
4193                    fidl::new_empty!(Guid, fidl::encoding::DefaultFuchsiaResourceDialect)
4194                });
4195                fidl::decode!(
4196                    Guid,
4197                    fidl::encoding::DefaultFuchsiaResourceDialect,
4198                    val_ref,
4199                    decoder,
4200                    inner_offset,
4201                    inner_depth
4202                )?;
4203                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4204                {
4205                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4206                }
4207                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4208                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4209                }
4210            }
4211
4212            next_offset += envelope_size;
4213            _next_ordinal_to_read += 1;
4214            if next_offset >= end_offset {
4215                return Ok(());
4216            }
4217
4218            // Decode unknown envelopes for gaps in ordinals.
4219            while _next_ordinal_to_read < 4 {
4220                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4221                _next_ordinal_to_read += 1;
4222                next_offset += envelope_size;
4223            }
4224
4225            let next_out_of_line = decoder.next_out_of_line();
4226            let handles_before = decoder.remaining_handles();
4227            if let Some((inlined, num_bytes, num_handles)) =
4228                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4229            {
4230                let member_inline_size = <fidl::encoding::HandleType<
4231                    fidl::Vmo,
4232                    { fidl::ObjectType::VMO.into_raw() },
4233                    2147483648,
4234                > as fidl::encoding::TypeMarker>::inline_size(
4235                    decoder.context
4236                );
4237                if inlined != (member_inline_size <= 4) {
4238                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4239                }
4240                let inner_offset;
4241                let mut inner_depth = depth.clone();
4242                if inlined {
4243                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4244                    inner_offset = next_offset;
4245                } else {
4246                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4247                    inner_depth.increment()?;
4248                }
4249                let val_ref =
4250                self.vmo.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
4251                fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
4252                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4253                {
4254                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4255                }
4256                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4257                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4258                }
4259            }
4260
4261            next_offset += envelope_size;
4262            _next_ordinal_to_read += 1;
4263            if next_offset >= end_offset {
4264                return Ok(());
4265            }
4266
4267            // Decode unknown envelopes for gaps in ordinals.
4268            while _next_ordinal_to_read < 5 {
4269                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4270                _next_ordinal_to_read += 1;
4271                next_offset += envelope_size;
4272            }
4273
4274            let next_out_of_line = decoder.next_out_of_line();
4275            let handles_before = decoder.remaining_handles();
4276            if let Some((inlined, num_bytes, num_handles)) =
4277                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4278            {
4279                let member_inline_size =
4280                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4281                if inlined != (member_inline_size <= 4) {
4282                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4283                }
4284                let inner_offset;
4285                let mut inner_depth = depth.clone();
4286                if inlined {
4287                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4288                    inner_offset = next_offset;
4289                } else {
4290                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4291                    inner_depth.increment()?;
4292                }
4293                let val_ref = self.publish.get_or_insert_with(|| {
4294                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
4295                });
4296                fidl::decode!(
4297                    bool,
4298                    fidl::encoding::DefaultFuchsiaResourceDialect,
4299                    val_ref,
4300                    decoder,
4301                    inner_offset,
4302                    inner_depth
4303                )?;
4304                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4305                {
4306                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4307                }
4308                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4309                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4310                }
4311            }
4312
4313            next_offset += envelope_size;
4314
4315            // Decode the remaining unknown envelopes.
4316            while next_offset < end_offset {
4317                _next_ordinal_to_read += 1;
4318                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4319                next_offset += envelope_size;
4320            }
4321
4322            Ok(())
4323        }
4324    }
4325}