fidl_fuchsia_storage_partitions/
fidl_fuchsia_storage_partitions.rs

1// WARNING: This file is machine generated by fidlgen.
2
3#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::client::QueryResponseFut;
8use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
9use fidl::endpoints::{ControlHandle as _, Responder as _};
10pub use fidl_fuchsia_storage_partitions_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct PartitionsManagerCommitTransactionRequest {
16    pub transaction: fidl::EventPair,
17}
18
19impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
20    for PartitionsManagerCommitTransactionRequest
21{
22}
23
24#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
25pub struct PartitionsManagerCreateTransactionResponse {
26    pub transaction: fidl::EventPair,
27}
28
29impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
30    for PartitionsManagerCreateTransactionResponse
31{
32}
33
34#[derive(Debug, Default, PartialEq)]
35pub struct PartitionUpdateMetadataRequest {
36    pub transaction: Option<fidl::EventPair>,
37    pub type_guid: Option<fidl_fuchsia_hardware_block_partition::Guid>,
38    pub flags: Option<u64>,
39    #[doc(hidden)]
40    pub __source_breaking: fidl::marker::SourceBreaking,
41}
42
43impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
44    for PartitionUpdateMetadataRequest
45{
46}
47
48#[derive(Debug, Default, PartialEq)]
49pub struct PartitionsManagerAddPartitionRequest {
50    pub transaction: Option<fidl::EventPair>,
51    pub num_blocks: Option<u64>,
52    pub name: Option<String>,
53    pub type_guid: Option<fidl_fuchsia_hardware_block_partition::Guid>,
54    pub instance_guid: Option<fidl_fuchsia_hardware_block_partition::Guid>,
55    pub flags: Option<u64>,
56    #[doc(hidden)]
57    pub __source_breaking: fidl::marker::SourceBreaking,
58}
59
60impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
61    for PartitionsManagerAddPartitionRequest
62{
63}
64
65#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
66pub struct PartitionMarker;
67
68impl fidl::endpoints::ProtocolMarker for PartitionMarker {
69    type Proxy = PartitionProxy;
70    type RequestStream = PartitionRequestStream;
71    #[cfg(target_os = "fuchsia")]
72    type SynchronousProxy = PartitionSynchronousProxy;
73
74    const DEBUG_NAME: &'static str = "fuchsia.storage.partitions.Partition";
75}
76impl fidl::endpoints::DiscoverableProtocolMarker for PartitionMarker {}
77pub type PartitionUpdateMetadataResult = Result<(), i32>;
78
79pub trait PartitionProxyInterface: Send + Sync {
80    type UpdateMetadataResponseFut: std::future::Future<Output = Result<PartitionUpdateMetadataResult, fidl::Error>>
81        + Send;
82    fn r#update_metadata(
83        &self,
84        payload: PartitionUpdateMetadataRequest,
85    ) -> Self::UpdateMetadataResponseFut;
86}
87#[derive(Debug)]
88#[cfg(target_os = "fuchsia")]
89pub struct PartitionSynchronousProxy {
90    client: fidl::client::sync::Client,
91}
92
93#[cfg(target_os = "fuchsia")]
94impl fidl::endpoints::SynchronousProxy for PartitionSynchronousProxy {
95    type Proxy = PartitionProxy;
96    type Protocol = PartitionMarker;
97
98    fn from_channel(inner: fidl::Channel) -> Self {
99        Self::new(inner)
100    }
101
102    fn into_channel(self) -> fidl::Channel {
103        self.client.into_channel()
104    }
105
106    fn as_channel(&self) -> &fidl::Channel {
107        self.client.as_channel()
108    }
109}
110
111#[cfg(target_os = "fuchsia")]
112impl PartitionSynchronousProxy {
113    pub fn new(channel: fidl::Channel) -> Self {
114        let protocol_name = <PartitionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
115        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
116    }
117
118    pub fn into_channel(self) -> fidl::Channel {
119        self.client.into_channel()
120    }
121
122    /// Waits until an event arrives and returns it. It is safe for other
123    /// threads to make concurrent requests while waiting for an event.
124    pub fn wait_for_event(
125        &self,
126        deadline: zx::MonotonicInstant,
127    ) -> Result<PartitionEvent, fidl::Error> {
128        PartitionEvent::decode(self.client.wait_for_event(deadline)?)
129    }
130
131    /// Appends an update to `transaction` (see `PartitionManager.CreateTransaction`)
132    /// to modify the partition's metadata.  The update is only applied once the transaction
133    /// is committed.
134    pub fn r#update_metadata(
135        &self,
136        mut payload: PartitionUpdateMetadataRequest,
137        ___deadline: zx::MonotonicInstant,
138    ) -> Result<PartitionUpdateMetadataResult, fidl::Error> {
139        let _response = self.client.send_query::<
140            PartitionUpdateMetadataRequest,
141            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
142        >(
143            &mut payload,
144            0x7bce44e5c9d5009c,
145            fidl::encoding::DynamicFlags::empty(),
146            ___deadline,
147        )?;
148        Ok(_response.map(|x| x))
149    }
150}
151
152#[cfg(target_os = "fuchsia")]
153impl From<PartitionSynchronousProxy> for zx::Handle {
154    fn from(value: PartitionSynchronousProxy) -> Self {
155        value.into_channel().into()
156    }
157}
158
159#[cfg(target_os = "fuchsia")]
160impl From<fidl::Channel> for PartitionSynchronousProxy {
161    fn from(value: fidl::Channel) -> Self {
162        Self::new(value)
163    }
164}
165
166#[derive(Debug, Clone)]
167pub struct PartitionProxy {
168    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
169}
170
171impl fidl::endpoints::Proxy for PartitionProxy {
172    type Protocol = PartitionMarker;
173
174    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
175        Self::new(inner)
176    }
177
178    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
179        self.client.into_channel().map_err(|client| Self { client })
180    }
181
182    fn as_channel(&self) -> &::fidl::AsyncChannel {
183        self.client.as_channel()
184    }
185}
186
187impl PartitionProxy {
188    /// Create a new Proxy for fuchsia.storage.partitions/Partition.
189    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
190        let protocol_name = <PartitionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
191        Self { client: fidl::client::Client::new(channel, protocol_name) }
192    }
193
194    /// Get a Stream of events from the remote end of the protocol.
195    ///
196    /// # Panics
197    ///
198    /// Panics if the event stream was already taken.
199    pub fn take_event_stream(&self) -> PartitionEventStream {
200        PartitionEventStream { event_receiver: self.client.take_event_receiver() }
201    }
202
203    /// Appends an update to `transaction` (see `PartitionManager.CreateTransaction`)
204    /// to modify the partition's metadata.  The update is only applied once the transaction
205    /// is committed.
206    pub fn r#update_metadata(
207        &self,
208        mut payload: PartitionUpdateMetadataRequest,
209    ) -> fidl::client::QueryResponseFut<
210        PartitionUpdateMetadataResult,
211        fidl::encoding::DefaultFuchsiaResourceDialect,
212    > {
213        PartitionProxyInterface::r#update_metadata(self, payload)
214    }
215}
216
217impl PartitionProxyInterface for PartitionProxy {
218    type UpdateMetadataResponseFut = fidl::client::QueryResponseFut<
219        PartitionUpdateMetadataResult,
220        fidl::encoding::DefaultFuchsiaResourceDialect,
221    >;
222    fn r#update_metadata(
223        &self,
224        mut payload: PartitionUpdateMetadataRequest,
225    ) -> Self::UpdateMetadataResponseFut {
226        fn _decode(
227            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
228        ) -> Result<PartitionUpdateMetadataResult, fidl::Error> {
229            let _response = fidl::client::decode_transaction_body::<
230                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
231                fidl::encoding::DefaultFuchsiaResourceDialect,
232                0x7bce44e5c9d5009c,
233            >(_buf?)?;
234            Ok(_response.map(|x| x))
235        }
236        self.client
237            .send_query_and_decode::<PartitionUpdateMetadataRequest, PartitionUpdateMetadataResult>(
238                &mut payload,
239                0x7bce44e5c9d5009c,
240                fidl::encoding::DynamicFlags::empty(),
241                _decode,
242            )
243    }
244}
245
246pub struct PartitionEventStream {
247    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
248}
249
250impl std::marker::Unpin for PartitionEventStream {}
251
252impl futures::stream::FusedStream for PartitionEventStream {
253    fn is_terminated(&self) -> bool {
254        self.event_receiver.is_terminated()
255    }
256}
257
258impl futures::Stream for PartitionEventStream {
259    type Item = Result<PartitionEvent, fidl::Error>;
260
261    fn poll_next(
262        mut self: std::pin::Pin<&mut Self>,
263        cx: &mut std::task::Context<'_>,
264    ) -> std::task::Poll<Option<Self::Item>> {
265        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
266            &mut self.event_receiver,
267            cx
268        )?) {
269            Some(buf) => std::task::Poll::Ready(Some(PartitionEvent::decode(buf))),
270            None => std::task::Poll::Ready(None),
271        }
272    }
273}
274
275#[derive(Debug)]
276pub enum PartitionEvent {}
277
278impl PartitionEvent {
279    /// Decodes a message buffer as a [`PartitionEvent`].
280    fn decode(
281        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
282    ) -> Result<PartitionEvent, fidl::Error> {
283        let (bytes, _handles) = buf.split_mut();
284        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
285        debug_assert_eq!(tx_header.tx_id, 0);
286        match tx_header.ordinal {
287            _ => Err(fidl::Error::UnknownOrdinal {
288                ordinal: tx_header.ordinal,
289                protocol_name: <PartitionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
290            }),
291        }
292    }
293}
294
295/// A Stream of incoming requests for fuchsia.storage.partitions/Partition.
296pub struct PartitionRequestStream {
297    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
298    is_terminated: bool,
299}
300
301impl std::marker::Unpin for PartitionRequestStream {}
302
303impl futures::stream::FusedStream for PartitionRequestStream {
304    fn is_terminated(&self) -> bool {
305        self.is_terminated
306    }
307}
308
309impl fidl::endpoints::RequestStream for PartitionRequestStream {
310    type Protocol = PartitionMarker;
311    type ControlHandle = PartitionControlHandle;
312
313    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
314        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
315    }
316
317    fn control_handle(&self) -> Self::ControlHandle {
318        PartitionControlHandle { inner: self.inner.clone() }
319    }
320
321    fn into_inner(
322        self,
323    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
324    {
325        (self.inner, self.is_terminated)
326    }
327
328    fn from_inner(
329        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
330        is_terminated: bool,
331    ) -> Self {
332        Self { inner, is_terminated }
333    }
334}
335
336impl futures::Stream for PartitionRequestStream {
337    type Item = Result<PartitionRequest, fidl::Error>;
338
339    fn poll_next(
340        mut self: std::pin::Pin<&mut Self>,
341        cx: &mut std::task::Context<'_>,
342    ) -> std::task::Poll<Option<Self::Item>> {
343        let this = &mut *self;
344        if this.inner.check_shutdown(cx) {
345            this.is_terminated = true;
346            return std::task::Poll::Ready(None);
347        }
348        if this.is_terminated {
349            panic!("polled PartitionRequestStream after completion");
350        }
351        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
352            |bytes, handles| {
353                match this.inner.channel().read_etc(cx, bytes, handles) {
354                    std::task::Poll::Ready(Ok(())) => {}
355                    std::task::Poll::Pending => return std::task::Poll::Pending,
356                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
357                        this.is_terminated = true;
358                        return std::task::Poll::Ready(None);
359                    }
360                    std::task::Poll::Ready(Err(e)) => {
361                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
362                            e.into(),
363                        ))))
364                    }
365                }
366
367                // A message has been received from the channel
368                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
369
370                std::task::Poll::Ready(Some(match header.ordinal {
371                    0x7bce44e5c9d5009c => {
372                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
373                        let mut req = fidl::new_empty!(
374                            PartitionUpdateMetadataRequest,
375                            fidl::encoding::DefaultFuchsiaResourceDialect
376                        );
377                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PartitionUpdateMetadataRequest>(&header, _body_bytes, handles, &mut req)?;
378                        let control_handle = PartitionControlHandle { inner: this.inner.clone() };
379                        Ok(PartitionRequest::UpdateMetadata {
380                            payload: req,
381                            responder: PartitionUpdateMetadataResponder {
382                                control_handle: std::mem::ManuallyDrop::new(control_handle),
383                                tx_id: header.tx_id,
384                            },
385                        })
386                    }
387                    _ => Err(fidl::Error::UnknownOrdinal {
388                        ordinal: header.ordinal,
389                        protocol_name:
390                            <PartitionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
391                    }),
392                }))
393            },
394        )
395    }
396}
397
398#[derive(Debug)]
399pub enum PartitionRequest {
400    /// Appends an update to `transaction` (see `PartitionManager.CreateTransaction`)
401    /// to modify the partition's metadata.  The update is only applied once the transaction
402    /// is committed.
403    UpdateMetadata {
404        payload: PartitionUpdateMetadataRequest,
405        responder: PartitionUpdateMetadataResponder,
406    },
407}
408
409impl PartitionRequest {
410    #[allow(irrefutable_let_patterns)]
411    pub fn into_update_metadata(
412        self,
413    ) -> Option<(PartitionUpdateMetadataRequest, PartitionUpdateMetadataResponder)> {
414        if let PartitionRequest::UpdateMetadata { payload, responder } = self {
415            Some((payload, responder))
416        } else {
417            None
418        }
419    }
420
421    /// Name of the method defined in FIDL
422    pub fn method_name(&self) -> &'static str {
423        match *self {
424            PartitionRequest::UpdateMetadata { .. } => "update_metadata",
425        }
426    }
427}
428
429#[derive(Debug, Clone)]
430pub struct PartitionControlHandle {
431    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
432}
433
434impl fidl::endpoints::ControlHandle for PartitionControlHandle {
435    fn shutdown(&self) {
436        self.inner.shutdown()
437    }
438    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
439        self.inner.shutdown_with_epitaph(status)
440    }
441
442    fn is_closed(&self) -> bool {
443        self.inner.channel().is_closed()
444    }
445    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
446        self.inner.channel().on_closed()
447    }
448
449    #[cfg(target_os = "fuchsia")]
450    fn signal_peer(
451        &self,
452        clear_mask: zx::Signals,
453        set_mask: zx::Signals,
454    ) -> Result<(), zx_status::Status> {
455        use fidl::Peered;
456        self.inner.channel().signal_peer(clear_mask, set_mask)
457    }
458}
459
460impl PartitionControlHandle {}
461
462#[must_use = "FIDL methods require a response to be sent"]
463#[derive(Debug)]
464pub struct PartitionUpdateMetadataResponder {
465    control_handle: std::mem::ManuallyDrop<PartitionControlHandle>,
466    tx_id: u32,
467}
468
469/// Set the the channel to be shutdown (see [`PartitionControlHandle::shutdown`])
470/// if the responder is dropped without sending a response, so that the client
471/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
472impl std::ops::Drop for PartitionUpdateMetadataResponder {
473    fn drop(&mut self) {
474        self.control_handle.shutdown();
475        // Safety: drops once, never accessed again
476        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
477    }
478}
479
480impl fidl::endpoints::Responder for PartitionUpdateMetadataResponder {
481    type ControlHandle = PartitionControlHandle;
482
483    fn control_handle(&self) -> &PartitionControlHandle {
484        &self.control_handle
485    }
486
487    fn drop_without_shutdown(mut self) {
488        // Safety: drops once, never accessed again due to mem::forget
489        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
490        // Prevent Drop from running (which would shut down the channel)
491        std::mem::forget(self);
492    }
493}
494
495impl PartitionUpdateMetadataResponder {
496    /// Sends a response to the FIDL transaction.
497    ///
498    /// Sets the channel to shutdown if an error occurs.
499    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
500        let _result = self.send_raw(result);
501        if _result.is_err() {
502            self.control_handle.shutdown();
503        }
504        self.drop_without_shutdown();
505        _result
506    }
507
508    /// Similar to "send" but does not shutdown the channel if an error occurs.
509    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
510        let _result = self.send_raw(result);
511        self.drop_without_shutdown();
512        _result
513    }
514
515    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
516        self.control_handle
517            .inner
518            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
519                result,
520                self.tx_id,
521                0x7bce44e5c9d5009c,
522                fidl::encoding::DynamicFlags::empty(),
523            )
524    }
525}
526
527#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
528pub struct PartitionsAdminMarker;
529
530impl fidl::endpoints::ProtocolMarker for PartitionsAdminMarker {
531    type Proxy = PartitionsAdminProxy;
532    type RequestStream = PartitionsAdminRequestStream;
533    #[cfg(target_os = "fuchsia")]
534    type SynchronousProxy = PartitionsAdminSynchronousProxy;
535
536    const DEBUG_NAME: &'static str = "fuchsia.storage.partitions.PartitionsAdmin";
537}
538impl fidl::endpoints::DiscoverableProtocolMarker for PartitionsAdminMarker {}
539pub type PartitionsAdminResetPartitionTableResult = Result<(), i32>;
540
541pub trait PartitionsAdminProxyInterface: Send + Sync {
542    type ResetPartitionTableResponseFut: std::future::Future<Output = Result<PartitionsAdminResetPartitionTableResult, fidl::Error>>
543        + Send;
544    fn r#reset_partition_table(
545        &self,
546        partitions: &[PartitionInfo],
547    ) -> Self::ResetPartitionTableResponseFut;
548}
549#[derive(Debug)]
550#[cfg(target_os = "fuchsia")]
551pub struct PartitionsAdminSynchronousProxy {
552    client: fidl::client::sync::Client,
553}
554
555#[cfg(target_os = "fuchsia")]
556impl fidl::endpoints::SynchronousProxy for PartitionsAdminSynchronousProxy {
557    type Proxy = PartitionsAdminProxy;
558    type Protocol = PartitionsAdminMarker;
559
560    fn from_channel(inner: fidl::Channel) -> Self {
561        Self::new(inner)
562    }
563
564    fn into_channel(self) -> fidl::Channel {
565        self.client.into_channel()
566    }
567
568    fn as_channel(&self) -> &fidl::Channel {
569        self.client.as_channel()
570    }
571}
572
573#[cfg(target_os = "fuchsia")]
574impl PartitionsAdminSynchronousProxy {
575    pub fn new(channel: fidl::Channel) -> Self {
576        let protocol_name = <PartitionsAdminMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
577        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
578    }
579
580    pub fn into_channel(self) -> fidl::Channel {
581        self.client.into_channel()
582    }
583
584    /// Waits until an event arrives and returns it. It is safe for other
585    /// threads to make concurrent requests while waiting for an event.
586    pub fn wait_for_event(
587        &self,
588        deadline: zx::MonotonicInstant,
589    ) -> Result<PartitionsAdminEvent, fidl::Error> {
590        PartitionsAdminEvent::decode(self.client.wait_for_event(deadline)?)
591    }
592
593    /// Wipes and re-initializes the partition table.  This is a destructive operation!
594    /// If there are any active clients of existing partitions, their connections will be severed.
595    /// This function is only intended to be used in product configurations where nothing is
596    /// actively using any partitions, so there's no need to make this operation graceful.
597    ///
598    /// Partitions table entries are assigned in the specified order.  Empty entries are permitted
599    /// (i.e. all fields set to 0) and will result in an empty slot in the partition table, which
600    /// allows the table size to be set appropriately.
601    pub fn r#reset_partition_table(
602        &self,
603        mut partitions: &[PartitionInfo],
604        ___deadline: zx::MonotonicInstant,
605    ) -> Result<PartitionsAdminResetPartitionTableResult, fidl::Error> {
606        let _response = self.client.send_query::<
607            PartitionsAdminResetPartitionTableRequest,
608            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
609        >(
610            (partitions,),
611            0x6d999e2c120fef14,
612            fidl::encoding::DynamicFlags::empty(),
613            ___deadline,
614        )?;
615        Ok(_response.map(|x| x))
616    }
617}
618
619#[cfg(target_os = "fuchsia")]
620impl From<PartitionsAdminSynchronousProxy> for zx::Handle {
621    fn from(value: PartitionsAdminSynchronousProxy) -> Self {
622        value.into_channel().into()
623    }
624}
625
626#[cfg(target_os = "fuchsia")]
627impl From<fidl::Channel> for PartitionsAdminSynchronousProxy {
628    fn from(value: fidl::Channel) -> Self {
629        Self::new(value)
630    }
631}
632
633#[derive(Debug, Clone)]
634pub struct PartitionsAdminProxy {
635    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
636}
637
638impl fidl::endpoints::Proxy for PartitionsAdminProxy {
639    type Protocol = PartitionsAdminMarker;
640
641    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
642        Self::new(inner)
643    }
644
645    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
646        self.client.into_channel().map_err(|client| Self { client })
647    }
648
649    fn as_channel(&self) -> &::fidl::AsyncChannel {
650        self.client.as_channel()
651    }
652}
653
654impl PartitionsAdminProxy {
655    /// Create a new Proxy for fuchsia.storage.partitions/PartitionsAdmin.
656    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
657        let protocol_name = <PartitionsAdminMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
658        Self { client: fidl::client::Client::new(channel, protocol_name) }
659    }
660
661    /// Get a Stream of events from the remote end of the protocol.
662    ///
663    /// # Panics
664    ///
665    /// Panics if the event stream was already taken.
666    pub fn take_event_stream(&self) -> PartitionsAdminEventStream {
667        PartitionsAdminEventStream { event_receiver: self.client.take_event_receiver() }
668    }
669
670    /// Wipes and re-initializes the partition table.  This is a destructive operation!
671    /// If there are any active clients of existing partitions, their connections will be severed.
672    /// This function is only intended to be used in product configurations where nothing is
673    /// actively using any partitions, so there's no need to make this operation graceful.
674    ///
675    /// Partitions table entries are assigned in the specified order.  Empty entries are permitted
676    /// (i.e. all fields set to 0) and will result in an empty slot in the partition table, which
677    /// allows the table size to be set appropriately.
678    pub fn r#reset_partition_table(
679        &self,
680        mut partitions: &[PartitionInfo],
681    ) -> fidl::client::QueryResponseFut<
682        PartitionsAdminResetPartitionTableResult,
683        fidl::encoding::DefaultFuchsiaResourceDialect,
684    > {
685        PartitionsAdminProxyInterface::r#reset_partition_table(self, partitions)
686    }
687}
688
689impl PartitionsAdminProxyInterface for PartitionsAdminProxy {
690    type ResetPartitionTableResponseFut = fidl::client::QueryResponseFut<
691        PartitionsAdminResetPartitionTableResult,
692        fidl::encoding::DefaultFuchsiaResourceDialect,
693    >;
694    fn r#reset_partition_table(
695        &self,
696        mut partitions: &[PartitionInfo],
697    ) -> Self::ResetPartitionTableResponseFut {
698        fn _decode(
699            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
700        ) -> Result<PartitionsAdminResetPartitionTableResult, fidl::Error> {
701            let _response = fidl::client::decode_transaction_body::<
702                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
703                fidl::encoding::DefaultFuchsiaResourceDialect,
704                0x6d999e2c120fef14,
705            >(_buf?)?;
706            Ok(_response.map(|x| x))
707        }
708        self.client.send_query_and_decode::<
709            PartitionsAdminResetPartitionTableRequest,
710            PartitionsAdminResetPartitionTableResult,
711        >(
712            (partitions,),
713            0x6d999e2c120fef14,
714            fidl::encoding::DynamicFlags::empty(),
715            _decode,
716        )
717    }
718}
719
720pub struct PartitionsAdminEventStream {
721    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
722}
723
724impl std::marker::Unpin for PartitionsAdminEventStream {}
725
726impl futures::stream::FusedStream for PartitionsAdminEventStream {
727    fn is_terminated(&self) -> bool {
728        self.event_receiver.is_terminated()
729    }
730}
731
732impl futures::Stream for PartitionsAdminEventStream {
733    type Item = Result<PartitionsAdminEvent, fidl::Error>;
734
735    fn poll_next(
736        mut self: std::pin::Pin<&mut Self>,
737        cx: &mut std::task::Context<'_>,
738    ) -> std::task::Poll<Option<Self::Item>> {
739        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
740            &mut self.event_receiver,
741            cx
742        )?) {
743            Some(buf) => std::task::Poll::Ready(Some(PartitionsAdminEvent::decode(buf))),
744            None => std::task::Poll::Ready(None),
745        }
746    }
747}
748
749#[derive(Debug)]
750pub enum PartitionsAdminEvent {}
751
752impl PartitionsAdminEvent {
753    /// Decodes a message buffer as a [`PartitionsAdminEvent`].
754    fn decode(
755        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
756    ) -> Result<PartitionsAdminEvent, fidl::Error> {
757        let (bytes, _handles) = buf.split_mut();
758        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
759        debug_assert_eq!(tx_header.tx_id, 0);
760        match tx_header.ordinal {
761            _ => Err(fidl::Error::UnknownOrdinal {
762                ordinal: tx_header.ordinal,
763                protocol_name:
764                    <PartitionsAdminMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
765            }),
766        }
767    }
768}
769
770/// A Stream of incoming requests for fuchsia.storage.partitions/PartitionsAdmin.
771pub struct PartitionsAdminRequestStream {
772    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
773    is_terminated: bool,
774}
775
776impl std::marker::Unpin for PartitionsAdminRequestStream {}
777
778impl futures::stream::FusedStream for PartitionsAdminRequestStream {
779    fn is_terminated(&self) -> bool {
780        self.is_terminated
781    }
782}
783
784impl fidl::endpoints::RequestStream for PartitionsAdminRequestStream {
785    type Protocol = PartitionsAdminMarker;
786    type ControlHandle = PartitionsAdminControlHandle;
787
788    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
789        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
790    }
791
792    fn control_handle(&self) -> Self::ControlHandle {
793        PartitionsAdminControlHandle { inner: self.inner.clone() }
794    }
795
796    fn into_inner(
797        self,
798    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
799    {
800        (self.inner, self.is_terminated)
801    }
802
803    fn from_inner(
804        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
805        is_terminated: bool,
806    ) -> Self {
807        Self { inner, is_terminated }
808    }
809}
810
811impl futures::Stream for PartitionsAdminRequestStream {
812    type Item = Result<PartitionsAdminRequest, fidl::Error>;
813
814    fn poll_next(
815        mut self: std::pin::Pin<&mut Self>,
816        cx: &mut std::task::Context<'_>,
817    ) -> std::task::Poll<Option<Self::Item>> {
818        let this = &mut *self;
819        if this.inner.check_shutdown(cx) {
820            this.is_terminated = true;
821            return std::task::Poll::Ready(None);
822        }
823        if this.is_terminated {
824            panic!("polled PartitionsAdminRequestStream after completion");
825        }
826        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
827            |bytes, handles| {
828                match this.inner.channel().read_etc(cx, bytes, handles) {
829                    std::task::Poll::Ready(Ok(())) => {}
830                    std::task::Poll::Pending => return std::task::Poll::Pending,
831                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
832                        this.is_terminated = true;
833                        return std::task::Poll::Ready(None);
834                    }
835                    std::task::Poll::Ready(Err(e)) => {
836                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
837                            e.into(),
838                        ))))
839                    }
840                }
841
842                // A message has been received from the channel
843                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
844
845                std::task::Poll::Ready(Some(match header.ordinal {
846                    0x6d999e2c120fef14 => {
847                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
848                        let mut req = fidl::new_empty!(
849                            PartitionsAdminResetPartitionTableRequest,
850                            fidl::encoding::DefaultFuchsiaResourceDialect
851                        );
852                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PartitionsAdminResetPartitionTableRequest>(&header, _body_bytes, handles, &mut req)?;
853                        let control_handle =
854                            PartitionsAdminControlHandle { inner: this.inner.clone() };
855                        Ok(PartitionsAdminRequest::ResetPartitionTable {
856                            partitions: req.partitions,
857
858                            responder: PartitionsAdminResetPartitionTableResponder {
859                                control_handle: std::mem::ManuallyDrop::new(control_handle),
860                                tx_id: header.tx_id,
861                            },
862                        })
863                    }
864                    _ => Err(fidl::Error::UnknownOrdinal {
865                        ordinal: header.ordinal,
866                        protocol_name:
867                            <PartitionsAdminMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
868                    }),
869                }))
870            },
871        )
872    }
873}
874
875#[derive(Debug)]
876pub enum PartitionsAdminRequest {
877    /// Wipes and re-initializes the partition table.  This is a destructive operation!
878    /// If there are any active clients of existing partitions, their connections will be severed.
879    /// This function is only intended to be used in product configurations where nothing is
880    /// actively using any partitions, so there's no need to make this operation graceful.
881    ///
882    /// Partitions table entries are assigned in the specified order.  Empty entries are permitted
883    /// (i.e. all fields set to 0) and will result in an empty slot in the partition table, which
884    /// allows the table size to be set appropriately.
885    ResetPartitionTable {
886        partitions: Vec<PartitionInfo>,
887        responder: PartitionsAdminResetPartitionTableResponder,
888    },
889}
890
891impl PartitionsAdminRequest {
892    #[allow(irrefutable_let_patterns)]
893    pub fn into_reset_partition_table(
894        self,
895    ) -> Option<(Vec<PartitionInfo>, PartitionsAdminResetPartitionTableResponder)> {
896        if let PartitionsAdminRequest::ResetPartitionTable { partitions, responder } = self {
897            Some((partitions, responder))
898        } else {
899            None
900        }
901    }
902
903    /// Name of the method defined in FIDL
904    pub fn method_name(&self) -> &'static str {
905        match *self {
906            PartitionsAdminRequest::ResetPartitionTable { .. } => "reset_partition_table",
907        }
908    }
909}
910
911#[derive(Debug, Clone)]
912pub struct PartitionsAdminControlHandle {
913    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
914}
915
916impl fidl::endpoints::ControlHandle for PartitionsAdminControlHandle {
917    fn shutdown(&self) {
918        self.inner.shutdown()
919    }
920    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
921        self.inner.shutdown_with_epitaph(status)
922    }
923
924    fn is_closed(&self) -> bool {
925        self.inner.channel().is_closed()
926    }
927    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
928        self.inner.channel().on_closed()
929    }
930
931    #[cfg(target_os = "fuchsia")]
932    fn signal_peer(
933        &self,
934        clear_mask: zx::Signals,
935        set_mask: zx::Signals,
936    ) -> Result<(), zx_status::Status> {
937        use fidl::Peered;
938        self.inner.channel().signal_peer(clear_mask, set_mask)
939    }
940}
941
942impl PartitionsAdminControlHandle {}
943
944#[must_use = "FIDL methods require a response to be sent"]
945#[derive(Debug)]
946pub struct PartitionsAdminResetPartitionTableResponder {
947    control_handle: std::mem::ManuallyDrop<PartitionsAdminControlHandle>,
948    tx_id: u32,
949}
950
951/// Set the the channel to be shutdown (see [`PartitionsAdminControlHandle::shutdown`])
952/// if the responder is dropped without sending a response, so that the client
953/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
954impl std::ops::Drop for PartitionsAdminResetPartitionTableResponder {
955    fn drop(&mut self) {
956        self.control_handle.shutdown();
957        // Safety: drops once, never accessed again
958        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
959    }
960}
961
962impl fidl::endpoints::Responder for PartitionsAdminResetPartitionTableResponder {
963    type ControlHandle = PartitionsAdminControlHandle;
964
965    fn control_handle(&self) -> &PartitionsAdminControlHandle {
966        &self.control_handle
967    }
968
969    fn drop_without_shutdown(mut self) {
970        // Safety: drops once, never accessed again due to mem::forget
971        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
972        // Prevent Drop from running (which would shut down the channel)
973        std::mem::forget(self);
974    }
975}
976
977impl PartitionsAdminResetPartitionTableResponder {
978    /// Sends a response to the FIDL transaction.
979    ///
980    /// Sets the channel to shutdown if an error occurs.
981    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
982        let _result = self.send_raw(result);
983        if _result.is_err() {
984            self.control_handle.shutdown();
985        }
986        self.drop_without_shutdown();
987        _result
988    }
989
990    /// Similar to "send" but does not shutdown the channel if an error occurs.
991    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
992        let _result = self.send_raw(result);
993        self.drop_without_shutdown();
994        _result
995    }
996
997    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
998        self.control_handle
999            .inner
1000            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1001                result,
1002                self.tx_id,
1003                0x6d999e2c120fef14,
1004                fidl::encoding::DynamicFlags::empty(),
1005            )
1006    }
1007}
1008
1009#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1010pub struct PartitionsManagerMarker;
1011
1012impl fidl::endpoints::ProtocolMarker for PartitionsManagerMarker {
1013    type Proxy = PartitionsManagerProxy;
1014    type RequestStream = PartitionsManagerRequestStream;
1015    #[cfg(target_os = "fuchsia")]
1016    type SynchronousProxy = PartitionsManagerSynchronousProxy;
1017
1018    const DEBUG_NAME: &'static str = "fuchsia.storage.partitions.PartitionsManager";
1019}
1020impl fidl::endpoints::DiscoverableProtocolMarker for PartitionsManagerMarker {}
1021pub type PartitionsManagerGetBlockInfoResult = Result<(u64, u32), i32>;
1022pub type PartitionsManagerCreateTransactionResult = Result<fidl::EventPair, i32>;
1023pub type PartitionsManagerCommitTransactionResult = Result<(), i32>;
1024pub type PartitionsManagerAddPartitionResult = Result<(), i32>;
1025
1026pub trait PartitionsManagerProxyInterface: Send + Sync {
1027    type GetBlockInfoResponseFut: std::future::Future<Output = Result<PartitionsManagerGetBlockInfoResult, fidl::Error>>
1028        + Send;
1029    fn r#get_block_info(&self) -> Self::GetBlockInfoResponseFut;
1030    type CreateTransactionResponseFut: std::future::Future<Output = Result<PartitionsManagerCreateTransactionResult, fidl::Error>>
1031        + Send;
1032    fn r#create_transaction(&self) -> Self::CreateTransactionResponseFut;
1033    type CommitTransactionResponseFut: std::future::Future<Output = Result<PartitionsManagerCommitTransactionResult, fidl::Error>>
1034        + Send;
1035    fn r#commit_transaction(
1036        &self,
1037        transaction: fidl::EventPair,
1038    ) -> Self::CommitTransactionResponseFut;
1039    type AddPartitionResponseFut: std::future::Future<Output = Result<PartitionsManagerAddPartitionResult, fidl::Error>>
1040        + Send;
1041    fn r#add_partition(
1042        &self,
1043        payload: PartitionsManagerAddPartitionRequest,
1044    ) -> Self::AddPartitionResponseFut;
1045}
1046#[derive(Debug)]
1047#[cfg(target_os = "fuchsia")]
1048pub struct PartitionsManagerSynchronousProxy {
1049    client: fidl::client::sync::Client,
1050}
1051
1052#[cfg(target_os = "fuchsia")]
1053impl fidl::endpoints::SynchronousProxy for PartitionsManagerSynchronousProxy {
1054    type Proxy = PartitionsManagerProxy;
1055    type Protocol = PartitionsManagerMarker;
1056
1057    fn from_channel(inner: fidl::Channel) -> Self {
1058        Self::new(inner)
1059    }
1060
1061    fn into_channel(self) -> fidl::Channel {
1062        self.client.into_channel()
1063    }
1064
1065    fn as_channel(&self) -> &fidl::Channel {
1066        self.client.as_channel()
1067    }
1068}
1069
1070#[cfg(target_os = "fuchsia")]
1071impl PartitionsManagerSynchronousProxy {
1072    pub fn new(channel: fidl::Channel) -> Self {
1073        let protocol_name =
1074            <PartitionsManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1075        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1076    }
1077
1078    pub fn into_channel(self) -> fidl::Channel {
1079        self.client.into_channel()
1080    }
1081
1082    /// Waits until an event arrives and returns it. It is safe for other
1083    /// threads to make concurrent requests while waiting for an event.
1084    pub fn wait_for_event(
1085        &self,
1086        deadline: zx::MonotonicInstant,
1087    ) -> Result<PartitionsManagerEvent, fidl::Error> {
1088        PartitionsManagerEvent::decode(self.client.wait_for_event(deadline)?)
1089    }
1090
1091    /// Returns the dimensions of the block device the partition manager resides in.
1092    pub fn r#get_block_info(
1093        &self,
1094        ___deadline: zx::MonotonicInstant,
1095    ) -> Result<PartitionsManagerGetBlockInfoResult, fidl::Error> {
1096        let _response = self.client.send_query::<
1097            fidl::encoding::EmptyPayload,
1098            fidl::encoding::ResultType<PartitionsManagerGetBlockInfoResponse, i32>,
1099        >(
1100            (),
1101            0x55663648cae3a1ef,
1102            fidl::encoding::DynamicFlags::empty(),
1103            ___deadline,
1104        )?;
1105        Ok(_response.map(|x| (x.block_count, x.block_size)))
1106    }
1107
1108    /// Starts a new transaction to modify the partition table.  The transaction will only be
1109    /// applied when `CommitTransaction` is called.  Only one transaction may be active at any given
1110    /// time.  Closing all handles to the returned event will cancel the transaction.
1111    /// Changes are added to the transaction via the `Partition` interface, passing in a
1112    /// duplicate of the `transaction` object.
1113    ///
1114    /// All changes in the transaction are applied atomically.
1115    pub fn r#create_transaction(
1116        &self,
1117        ___deadline: zx::MonotonicInstant,
1118    ) -> Result<PartitionsManagerCreateTransactionResult, fidl::Error> {
1119        let _response =
1120            self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::ResultType<
1121                PartitionsManagerCreateTransactionResponse,
1122                i32,
1123            >>(
1124                (),
1125                0x5cedad08ef04fd02,
1126                fidl::encoding::DynamicFlags::empty(),
1127                ___deadline,
1128            )?;
1129        Ok(_response.map(|x| x.transaction))
1130    }
1131
1132    /// Commits the changes pending in the transaction.
1133    pub fn r#commit_transaction(
1134        &self,
1135        mut transaction: fidl::EventPair,
1136        ___deadline: zx::MonotonicInstant,
1137    ) -> Result<PartitionsManagerCommitTransactionResult, fidl::Error> {
1138        let _response = self.client.send_query::<
1139            PartitionsManagerCommitTransactionRequest,
1140            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1141        >(
1142            (transaction,),
1143            0x2354762d579c7654,
1144            fidl::encoding::DynamicFlags::empty(),
1145            ___deadline,
1146        )?;
1147        Ok(_response.map(|x| x))
1148    }
1149
1150    /// Allocates a new partition in `transaction`.  Fails if there is insufficient space for the
1151    /// requested partition.  There must be an empty slot in the partition table (the table will not
1152    /// be resized).
1153    pub fn r#add_partition(
1154        &self,
1155        mut payload: PartitionsManagerAddPartitionRequest,
1156        ___deadline: zx::MonotonicInstant,
1157    ) -> Result<PartitionsManagerAddPartitionResult, fidl::Error> {
1158        let _response = self.client.send_query::<
1159            PartitionsManagerAddPartitionRequest,
1160            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1161        >(
1162            &mut payload,
1163            0x32afa9f7acf47e38,
1164            fidl::encoding::DynamicFlags::empty(),
1165            ___deadline,
1166        )?;
1167        Ok(_response.map(|x| x))
1168    }
1169}
1170
1171#[cfg(target_os = "fuchsia")]
1172impl From<PartitionsManagerSynchronousProxy> for zx::Handle {
1173    fn from(value: PartitionsManagerSynchronousProxy) -> Self {
1174        value.into_channel().into()
1175    }
1176}
1177
1178#[cfg(target_os = "fuchsia")]
1179impl From<fidl::Channel> for PartitionsManagerSynchronousProxy {
1180    fn from(value: fidl::Channel) -> Self {
1181        Self::new(value)
1182    }
1183}
1184
1185#[derive(Debug, Clone)]
1186pub struct PartitionsManagerProxy {
1187    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1188}
1189
1190impl fidl::endpoints::Proxy for PartitionsManagerProxy {
1191    type Protocol = PartitionsManagerMarker;
1192
1193    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1194        Self::new(inner)
1195    }
1196
1197    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1198        self.client.into_channel().map_err(|client| Self { client })
1199    }
1200
1201    fn as_channel(&self) -> &::fidl::AsyncChannel {
1202        self.client.as_channel()
1203    }
1204}
1205
1206impl PartitionsManagerProxy {
1207    /// Create a new Proxy for fuchsia.storage.partitions/PartitionsManager.
1208    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1209        let protocol_name =
1210            <PartitionsManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1211        Self { client: fidl::client::Client::new(channel, protocol_name) }
1212    }
1213
1214    /// Get a Stream of events from the remote end of the protocol.
1215    ///
1216    /// # Panics
1217    ///
1218    /// Panics if the event stream was already taken.
1219    pub fn take_event_stream(&self) -> PartitionsManagerEventStream {
1220        PartitionsManagerEventStream { event_receiver: self.client.take_event_receiver() }
1221    }
1222
1223    /// Returns the dimensions of the block device the partition manager resides in.
1224    pub fn r#get_block_info(
1225        &self,
1226    ) -> fidl::client::QueryResponseFut<
1227        PartitionsManagerGetBlockInfoResult,
1228        fidl::encoding::DefaultFuchsiaResourceDialect,
1229    > {
1230        PartitionsManagerProxyInterface::r#get_block_info(self)
1231    }
1232
1233    /// Starts a new transaction to modify the partition table.  The transaction will only be
1234    /// applied when `CommitTransaction` is called.  Only one transaction may be active at any given
1235    /// time.  Closing all handles to the returned event will cancel the transaction.
1236    /// Changes are added to the transaction via the `Partition` interface, passing in a
1237    /// duplicate of the `transaction` object.
1238    ///
1239    /// All changes in the transaction are applied atomically.
1240    pub fn r#create_transaction(
1241        &self,
1242    ) -> fidl::client::QueryResponseFut<
1243        PartitionsManagerCreateTransactionResult,
1244        fidl::encoding::DefaultFuchsiaResourceDialect,
1245    > {
1246        PartitionsManagerProxyInterface::r#create_transaction(self)
1247    }
1248
1249    /// Commits the changes pending in the transaction.
1250    pub fn r#commit_transaction(
1251        &self,
1252        mut transaction: fidl::EventPair,
1253    ) -> fidl::client::QueryResponseFut<
1254        PartitionsManagerCommitTransactionResult,
1255        fidl::encoding::DefaultFuchsiaResourceDialect,
1256    > {
1257        PartitionsManagerProxyInterface::r#commit_transaction(self, transaction)
1258    }
1259
1260    /// Allocates a new partition in `transaction`.  Fails if there is insufficient space for the
1261    /// requested partition.  There must be an empty slot in the partition table (the table will not
1262    /// be resized).
1263    pub fn r#add_partition(
1264        &self,
1265        mut payload: PartitionsManagerAddPartitionRequest,
1266    ) -> fidl::client::QueryResponseFut<
1267        PartitionsManagerAddPartitionResult,
1268        fidl::encoding::DefaultFuchsiaResourceDialect,
1269    > {
1270        PartitionsManagerProxyInterface::r#add_partition(self, payload)
1271    }
1272}
1273
1274impl PartitionsManagerProxyInterface for PartitionsManagerProxy {
1275    type GetBlockInfoResponseFut = fidl::client::QueryResponseFut<
1276        PartitionsManagerGetBlockInfoResult,
1277        fidl::encoding::DefaultFuchsiaResourceDialect,
1278    >;
1279    fn r#get_block_info(&self) -> Self::GetBlockInfoResponseFut {
1280        fn _decode(
1281            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1282        ) -> Result<PartitionsManagerGetBlockInfoResult, fidl::Error> {
1283            let _response = fidl::client::decode_transaction_body::<
1284                fidl::encoding::ResultType<PartitionsManagerGetBlockInfoResponse, i32>,
1285                fidl::encoding::DefaultFuchsiaResourceDialect,
1286                0x55663648cae3a1ef,
1287            >(_buf?)?;
1288            Ok(_response.map(|x| (x.block_count, x.block_size)))
1289        }
1290        self.client.send_query_and_decode::<
1291            fidl::encoding::EmptyPayload,
1292            PartitionsManagerGetBlockInfoResult,
1293        >(
1294            (),
1295            0x55663648cae3a1ef,
1296            fidl::encoding::DynamicFlags::empty(),
1297            _decode,
1298        )
1299    }
1300
1301    type CreateTransactionResponseFut = fidl::client::QueryResponseFut<
1302        PartitionsManagerCreateTransactionResult,
1303        fidl::encoding::DefaultFuchsiaResourceDialect,
1304    >;
1305    fn r#create_transaction(&self) -> Self::CreateTransactionResponseFut {
1306        fn _decode(
1307            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1308        ) -> Result<PartitionsManagerCreateTransactionResult, fidl::Error> {
1309            let _response = fidl::client::decode_transaction_body::<
1310                fidl::encoding::ResultType<PartitionsManagerCreateTransactionResponse, i32>,
1311                fidl::encoding::DefaultFuchsiaResourceDialect,
1312                0x5cedad08ef04fd02,
1313            >(_buf?)?;
1314            Ok(_response.map(|x| x.transaction))
1315        }
1316        self.client.send_query_and_decode::<
1317            fidl::encoding::EmptyPayload,
1318            PartitionsManagerCreateTransactionResult,
1319        >(
1320            (),
1321            0x5cedad08ef04fd02,
1322            fidl::encoding::DynamicFlags::empty(),
1323            _decode,
1324        )
1325    }
1326
1327    type CommitTransactionResponseFut = fidl::client::QueryResponseFut<
1328        PartitionsManagerCommitTransactionResult,
1329        fidl::encoding::DefaultFuchsiaResourceDialect,
1330    >;
1331    fn r#commit_transaction(
1332        &self,
1333        mut transaction: fidl::EventPair,
1334    ) -> Self::CommitTransactionResponseFut {
1335        fn _decode(
1336            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1337        ) -> Result<PartitionsManagerCommitTransactionResult, fidl::Error> {
1338            let _response = fidl::client::decode_transaction_body::<
1339                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1340                fidl::encoding::DefaultFuchsiaResourceDialect,
1341                0x2354762d579c7654,
1342            >(_buf?)?;
1343            Ok(_response.map(|x| x))
1344        }
1345        self.client.send_query_and_decode::<
1346            PartitionsManagerCommitTransactionRequest,
1347            PartitionsManagerCommitTransactionResult,
1348        >(
1349            (transaction,),
1350            0x2354762d579c7654,
1351            fidl::encoding::DynamicFlags::empty(),
1352            _decode,
1353        )
1354    }
1355
1356    type AddPartitionResponseFut = fidl::client::QueryResponseFut<
1357        PartitionsManagerAddPartitionResult,
1358        fidl::encoding::DefaultFuchsiaResourceDialect,
1359    >;
1360    fn r#add_partition(
1361        &self,
1362        mut payload: PartitionsManagerAddPartitionRequest,
1363    ) -> Self::AddPartitionResponseFut {
1364        fn _decode(
1365            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1366        ) -> Result<PartitionsManagerAddPartitionResult, fidl::Error> {
1367            let _response = fidl::client::decode_transaction_body::<
1368                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1369                fidl::encoding::DefaultFuchsiaResourceDialect,
1370                0x32afa9f7acf47e38,
1371            >(_buf?)?;
1372            Ok(_response.map(|x| x))
1373        }
1374        self.client.send_query_and_decode::<
1375            PartitionsManagerAddPartitionRequest,
1376            PartitionsManagerAddPartitionResult,
1377        >(
1378            &mut payload,
1379            0x32afa9f7acf47e38,
1380            fidl::encoding::DynamicFlags::empty(),
1381            _decode,
1382        )
1383    }
1384}
1385
1386pub struct PartitionsManagerEventStream {
1387    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1388}
1389
1390impl std::marker::Unpin for PartitionsManagerEventStream {}
1391
1392impl futures::stream::FusedStream for PartitionsManagerEventStream {
1393    fn is_terminated(&self) -> bool {
1394        self.event_receiver.is_terminated()
1395    }
1396}
1397
1398impl futures::Stream for PartitionsManagerEventStream {
1399    type Item = Result<PartitionsManagerEvent, fidl::Error>;
1400
1401    fn poll_next(
1402        mut self: std::pin::Pin<&mut Self>,
1403        cx: &mut std::task::Context<'_>,
1404    ) -> std::task::Poll<Option<Self::Item>> {
1405        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1406            &mut self.event_receiver,
1407            cx
1408        )?) {
1409            Some(buf) => std::task::Poll::Ready(Some(PartitionsManagerEvent::decode(buf))),
1410            None => std::task::Poll::Ready(None),
1411        }
1412    }
1413}
1414
1415#[derive(Debug)]
1416pub enum PartitionsManagerEvent {}
1417
1418impl PartitionsManagerEvent {
1419    /// Decodes a message buffer as a [`PartitionsManagerEvent`].
1420    fn decode(
1421        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1422    ) -> Result<PartitionsManagerEvent, fidl::Error> {
1423        let (bytes, _handles) = buf.split_mut();
1424        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1425        debug_assert_eq!(tx_header.tx_id, 0);
1426        match tx_header.ordinal {
1427            _ => Err(fidl::Error::UnknownOrdinal {
1428                ordinal: tx_header.ordinal,
1429                protocol_name:
1430                    <PartitionsManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1431            }),
1432        }
1433    }
1434}
1435
1436/// A Stream of incoming requests for fuchsia.storage.partitions/PartitionsManager.
1437pub struct PartitionsManagerRequestStream {
1438    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1439    is_terminated: bool,
1440}
1441
1442impl std::marker::Unpin for PartitionsManagerRequestStream {}
1443
1444impl futures::stream::FusedStream for PartitionsManagerRequestStream {
1445    fn is_terminated(&self) -> bool {
1446        self.is_terminated
1447    }
1448}
1449
1450impl fidl::endpoints::RequestStream for PartitionsManagerRequestStream {
1451    type Protocol = PartitionsManagerMarker;
1452    type ControlHandle = PartitionsManagerControlHandle;
1453
1454    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1455        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1456    }
1457
1458    fn control_handle(&self) -> Self::ControlHandle {
1459        PartitionsManagerControlHandle { inner: self.inner.clone() }
1460    }
1461
1462    fn into_inner(
1463        self,
1464    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1465    {
1466        (self.inner, self.is_terminated)
1467    }
1468
1469    fn from_inner(
1470        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1471        is_terminated: bool,
1472    ) -> Self {
1473        Self { inner, is_terminated }
1474    }
1475}
1476
1477impl futures::Stream for PartitionsManagerRequestStream {
1478    type Item = Result<PartitionsManagerRequest, fidl::Error>;
1479
1480    fn poll_next(
1481        mut self: std::pin::Pin<&mut Self>,
1482        cx: &mut std::task::Context<'_>,
1483    ) -> std::task::Poll<Option<Self::Item>> {
1484        let this = &mut *self;
1485        if this.inner.check_shutdown(cx) {
1486            this.is_terminated = true;
1487            return std::task::Poll::Ready(None);
1488        }
1489        if this.is_terminated {
1490            panic!("polled PartitionsManagerRequestStream after completion");
1491        }
1492        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1493            |bytes, handles| {
1494                match this.inner.channel().read_etc(cx, bytes, handles) {
1495                    std::task::Poll::Ready(Ok(())) => {}
1496                    std::task::Poll::Pending => return std::task::Poll::Pending,
1497                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1498                        this.is_terminated = true;
1499                        return std::task::Poll::Ready(None);
1500                    }
1501                    std::task::Poll::Ready(Err(e)) => {
1502                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1503                            e.into(),
1504                        ))))
1505                    }
1506                }
1507
1508                // A message has been received from the channel
1509                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1510
1511                std::task::Poll::Ready(Some(match header.ordinal {
1512                    0x55663648cae3a1ef => {
1513                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1514                        let mut req = fidl::new_empty!(
1515                            fidl::encoding::EmptyPayload,
1516                            fidl::encoding::DefaultFuchsiaResourceDialect
1517                        );
1518                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1519                        let control_handle =
1520                            PartitionsManagerControlHandle { inner: this.inner.clone() };
1521                        Ok(PartitionsManagerRequest::GetBlockInfo {
1522                            responder: PartitionsManagerGetBlockInfoResponder {
1523                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1524                                tx_id: header.tx_id,
1525                            },
1526                        })
1527                    }
1528                    0x5cedad08ef04fd02 => {
1529                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1530                        let mut req = fidl::new_empty!(
1531                            fidl::encoding::EmptyPayload,
1532                            fidl::encoding::DefaultFuchsiaResourceDialect
1533                        );
1534                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1535                        let control_handle =
1536                            PartitionsManagerControlHandle { inner: this.inner.clone() };
1537                        Ok(PartitionsManagerRequest::CreateTransaction {
1538                            responder: PartitionsManagerCreateTransactionResponder {
1539                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1540                                tx_id: header.tx_id,
1541                            },
1542                        })
1543                    }
1544                    0x2354762d579c7654 => {
1545                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1546                        let mut req = fidl::new_empty!(
1547                            PartitionsManagerCommitTransactionRequest,
1548                            fidl::encoding::DefaultFuchsiaResourceDialect
1549                        );
1550                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PartitionsManagerCommitTransactionRequest>(&header, _body_bytes, handles, &mut req)?;
1551                        let control_handle =
1552                            PartitionsManagerControlHandle { inner: this.inner.clone() };
1553                        Ok(PartitionsManagerRequest::CommitTransaction {
1554                            transaction: req.transaction,
1555
1556                            responder: PartitionsManagerCommitTransactionResponder {
1557                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1558                                tx_id: header.tx_id,
1559                            },
1560                        })
1561                    }
1562                    0x32afa9f7acf47e38 => {
1563                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1564                        let mut req = fidl::new_empty!(
1565                            PartitionsManagerAddPartitionRequest,
1566                            fidl::encoding::DefaultFuchsiaResourceDialect
1567                        );
1568                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PartitionsManagerAddPartitionRequest>(&header, _body_bytes, handles, &mut req)?;
1569                        let control_handle =
1570                            PartitionsManagerControlHandle { inner: this.inner.clone() };
1571                        Ok(PartitionsManagerRequest::AddPartition {
1572                            payload: req,
1573                            responder: PartitionsManagerAddPartitionResponder {
1574                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1575                                tx_id: header.tx_id,
1576                            },
1577                        })
1578                    }
1579                    _ => Err(fidl::Error::UnknownOrdinal {
1580                        ordinal: header.ordinal,
1581                        protocol_name:
1582                            <PartitionsManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1583                    }),
1584                }))
1585            },
1586        )
1587    }
1588}
1589
1590#[derive(Debug)]
1591pub enum PartitionsManagerRequest {
1592    /// Returns the dimensions of the block device the partition manager resides in.
1593    GetBlockInfo { responder: PartitionsManagerGetBlockInfoResponder },
1594    /// Starts a new transaction to modify the partition table.  The transaction will only be
1595    /// applied when `CommitTransaction` is called.  Only one transaction may be active at any given
1596    /// time.  Closing all handles to the returned event will cancel the transaction.
1597    /// Changes are added to the transaction via the `Partition` interface, passing in a
1598    /// duplicate of the `transaction` object.
1599    ///
1600    /// All changes in the transaction are applied atomically.
1601    CreateTransaction { responder: PartitionsManagerCreateTransactionResponder },
1602    /// Commits the changes pending in the transaction.
1603    CommitTransaction {
1604        transaction: fidl::EventPair,
1605        responder: PartitionsManagerCommitTransactionResponder,
1606    },
1607    /// Allocates a new partition in `transaction`.  Fails if there is insufficient space for the
1608    /// requested partition.  There must be an empty slot in the partition table (the table will not
1609    /// be resized).
1610    AddPartition {
1611        payload: PartitionsManagerAddPartitionRequest,
1612        responder: PartitionsManagerAddPartitionResponder,
1613    },
1614}
1615
1616impl PartitionsManagerRequest {
1617    #[allow(irrefutable_let_patterns)]
1618    pub fn into_get_block_info(self) -> Option<(PartitionsManagerGetBlockInfoResponder)> {
1619        if let PartitionsManagerRequest::GetBlockInfo { responder } = self {
1620            Some((responder))
1621        } else {
1622            None
1623        }
1624    }
1625
1626    #[allow(irrefutable_let_patterns)]
1627    pub fn into_create_transaction(self) -> Option<(PartitionsManagerCreateTransactionResponder)> {
1628        if let PartitionsManagerRequest::CreateTransaction { responder } = self {
1629            Some((responder))
1630        } else {
1631            None
1632        }
1633    }
1634
1635    #[allow(irrefutable_let_patterns)]
1636    pub fn into_commit_transaction(
1637        self,
1638    ) -> Option<(fidl::EventPair, PartitionsManagerCommitTransactionResponder)> {
1639        if let PartitionsManagerRequest::CommitTransaction { transaction, responder } = self {
1640            Some((transaction, responder))
1641        } else {
1642            None
1643        }
1644    }
1645
1646    #[allow(irrefutable_let_patterns)]
1647    pub fn into_add_partition(
1648        self,
1649    ) -> Option<(PartitionsManagerAddPartitionRequest, PartitionsManagerAddPartitionResponder)>
1650    {
1651        if let PartitionsManagerRequest::AddPartition { payload, responder } = self {
1652            Some((payload, responder))
1653        } else {
1654            None
1655        }
1656    }
1657
1658    /// Name of the method defined in FIDL
1659    pub fn method_name(&self) -> &'static str {
1660        match *self {
1661            PartitionsManagerRequest::GetBlockInfo { .. } => "get_block_info",
1662            PartitionsManagerRequest::CreateTransaction { .. } => "create_transaction",
1663            PartitionsManagerRequest::CommitTransaction { .. } => "commit_transaction",
1664            PartitionsManagerRequest::AddPartition { .. } => "add_partition",
1665        }
1666    }
1667}
1668
1669#[derive(Debug, Clone)]
1670pub struct PartitionsManagerControlHandle {
1671    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1672}
1673
1674impl fidl::endpoints::ControlHandle for PartitionsManagerControlHandle {
1675    fn shutdown(&self) {
1676        self.inner.shutdown()
1677    }
1678    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1679        self.inner.shutdown_with_epitaph(status)
1680    }
1681
1682    fn is_closed(&self) -> bool {
1683        self.inner.channel().is_closed()
1684    }
1685    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1686        self.inner.channel().on_closed()
1687    }
1688
1689    #[cfg(target_os = "fuchsia")]
1690    fn signal_peer(
1691        &self,
1692        clear_mask: zx::Signals,
1693        set_mask: zx::Signals,
1694    ) -> Result<(), zx_status::Status> {
1695        use fidl::Peered;
1696        self.inner.channel().signal_peer(clear_mask, set_mask)
1697    }
1698}
1699
1700impl PartitionsManagerControlHandle {}
1701
1702#[must_use = "FIDL methods require a response to be sent"]
1703#[derive(Debug)]
1704pub struct PartitionsManagerGetBlockInfoResponder {
1705    control_handle: std::mem::ManuallyDrop<PartitionsManagerControlHandle>,
1706    tx_id: u32,
1707}
1708
1709/// Set the the channel to be shutdown (see [`PartitionsManagerControlHandle::shutdown`])
1710/// if the responder is dropped without sending a response, so that the client
1711/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1712impl std::ops::Drop for PartitionsManagerGetBlockInfoResponder {
1713    fn drop(&mut self) {
1714        self.control_handle.shutdown();
1715        // Safety: drops once, never accessed again
1716        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1717    }
1718}
1719
1720impl fidl::endpoints::Responder for PartitionsManagerGetBlockInfoResponder {
1721    type ControlHandle = PartitionsManagerControlHandle;
1722
1723    fn control_handle(&self) -> &PartitionsManagerControlHandle {
1724        &self.control_handle
1725    }
1726
1727    fn drop_without_shutdown(mut self) {
1728        // Safety: drops once, never accessed again due to mem::forget
1729        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1730        // Prevent Drop from running (which would shut down the channel)
1731        std::mem::forget(self);
1732    }
1733}
1734
1735impl PartitionsManagerGetBlockInfoResponder {
1736    /// Sends a response to the FIDL transaction.
1737    ///
1738    /// Sets the channel to shutdown if an error occurs.
1739    pub fn send(self, mut result: Result<(u64, u32), i32>) -> Result<(), fidl::Error> {
1740        let _result = self.send_raw(result);
1741        if _result.is_err() {
1742            self.control_handle.shutdown();
1743        }
1744        self.drop_without_shutdown();
1745        _result
1746    }
1747
1748    /// Similar to "send" but does not shutdown the channel if an error occurs.
1749    pub fn send_no_shutdown_on_err(
1750        self,
1751        mut result: Result<(u64, u32), i32>,
1752    ) -> Result<(), fidl::Error> {
1753        let _result = self.send_raw(result);
1754        self.drop_without_shutdown();
1755        _result
1756    }
1757
1758    fn send_raw(&self, mut result: Result<(u64, u32), i32>) -> Result<(), fidl::Error> {
1759        self.control_handle.inner.send::<fidl::encoding::ResultType<
1760            PartitionsManagerGetBlockInfoResponse,
1761            i32,
1762        >>(
1763            result,
1764            self.tx_id,
1765            0x55663648cae3a1ef,
1766            fidl::encoding::DynamicFlags::empty(),
1767        )
1768    }
1769}
1770
1771#[must_use = "FIDL methods require a response to be sent"]
1772#[derive(Debug)]
1773pub struct PartitionsManagerCreateTransactionResponder {
1774    control_handle: std::mem::ManuallyDrop<PartitionsManagerControlHandle>,
1775    tx_id: u32,
1776}
1777
1778/// Set the the channel to be shutdown (see [`PartitionsManagerControlHandle::shutdown`])
1779/// if the responder is dropped without sending a response, so that the client
1780/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1781impl std::ops::Drop for PartitionsManagerCreateTransactionResponder {
1782    fn drop(&mut self) {
1783        self.control_handle.shutdown();
1784        // Safety: drops once, never accessed again
1785        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1786    }
1787}
1788
1789impl fidl::endpoints::Responder for PartitionsManagerCreateTransactionResponder {
1790    type ControlHandle = PartitionsManagerControlHandle;
1791
1792    fn control_handle(&self) -> &PartitionsManagerControlHandle {
1793        &self.control_handle
1794    }
1795
1796    fn drop_without_shutdown(mut self) {
1797        // Safety: drops once, never accessed again due to mem::forget
1798        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1799        // Prevent Drop from running (which would shut down the channel)
1800        std::mem::forget(self);
1801    }
1802}
1803
1804impl PartitionsManagerCreateTransactionResponder {
1805    /// Sends a response to the FIDL transaction.
1806    ///
1807    /// Sets the channel to shutdown if an error occurs.
1808    pub fn send(self, mut result: Result<fidl::EventPair, i32>) -> Result<(), fidl::Error> {
1809        let _result = self.send_raw(result);
1810        if _result.is_err() {
1811            self.control_handle.shutdown();
1812        }
1813        self.drop_without_shutdown();
1814        _result
1815    }
1816
1817    /// Similar to "send" but does not shutdown the channel if an error occurs.
1818    pub fn send_no_shutdown_on_err(
1819        self,
1820        mut result: Result<fidl::EventPair, i32>,
1821    ) -> Result<(), fidl::Error> {
1822        let _result = self.send_raw(result);
1823        self.drop_without_shutdown();
1824        _result
1825    }
1826
1827    fn send_raw(&self, mut result: Result<fidl::EventPair, i32>) -> Result<(), fidl::Error> {
1828        self.control_handle.inner.send::<fidl::encoding::ResultType<
1829            PartitionsManagerCreateTransactionResponse,
1830            i32,
1831        >>(
1832            result.map(|transaction| (transaction,)),
1833            self.tx_id,
1834            0x5cedad08ef04fd02,
1835            fidl::encoding::DynamicFlags::empty(),
1836        )
1837    }
1838}
1839
1840#[must_use = "FIDL methods require a response to be sent"]
1841#[derive(Debug)]
1842pub struct PartitionsManagerCommitTransactionResponder {
1843    control_handle: std::mem::ManuallyDrop<PartitionsManagerControlHandle>,
1844    tx_id: u32,
1845}
1846
1847/// Set the the channel to be shutdown (see [`PartitionsManagerControlHandle::shutdown`])
1848/// if the responder is dropped without sending a response, so that the client
1849/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1850impl std::ops::Drop for PartitionsManagerCommitTransactionResponder {
1851    fn drop(&mut self) {
1852        self.control_handle.shutdown();
1853        // Safety: drops once, never accessed again
1854        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1855    }
1856}
1857
1858impl fidl::endpoints::Responder for PartitionsManagerCommitTransactionResponder {
1859    type ControlHandle = PartitionsManagerControlHandle;
1860
1861    fn control_handle(&self) -> &PartitionsManagerControlHandle {
1862        &self.control_handle
1863    }
1864
1865    fn drop_without_shutdown(mut self) {
1866        // Safety: drops once, never accessed again due to mem::forget
1867        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1868        // Prevent Drop from running (which would shut down the channel)
1869        std::mem::forget(self);
1870    }
1871}
1872
1873impl PartitionsManagerCommitTransactionResponder {
1874    /// Sends a response to the FIDL transaction.
1875    ///
1876    /// Sets the channel to shutdown if an error occurs.
1877    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1878        let _result = self.send_raw(result);
1879        if _result.is_err() {
1880            self.control_handle.shutdown();
1881        }
1882        self.drop_without_shutdown();
1883        _result
1884    }
1885
1886    /// Similar to "send" but does not shutdown the channel if an error occurs.
1887    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1888        let _result = self.send_raw(result);
1889        self.drop_without_shutdown();
1890        _result
1891    }
1892
1893    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1894        self.control_handle
1895            .inner
1896            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1897                result,
1898                self.tx_id,
1899                0x2354762d579c7654,
1900                fidl::encoding::DynamicFlags::empty(),
1901            )
1902    }
1903}
1904
1905#[must_use = "FIDL methods require a response to be sent"]
1906#[derive(Debug)]
1907pub struct PartitionsManagerAddPartitionResponder {
1908    control_handle: std::mem::ManuallyDrop<PartitionsManagerControlHandle>,
1909    tx_id: u32,
1910}
1911
1912/// Set the the channel to be shutdown (see [`PartitionsManagerControlHandle::shutdown`])
1913/// if the responder is dropped without sending a response, so that the client
1914/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1915impl std::ops::Drop for PartitionsManagerAddPartitionResponder {
1916    fn drop(&mut self) {
1917        self.control_handle.shutdown();
1918        // Safety: drops once, never accessed again
1919        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1920    }
1921}
1922
1923impl fidl::endpoints::Responder for PartitionsManagerAddPartitionResponder {
1924    type ControlHandle = PartitionsManagerControlHandle;
1925
1926    fn control_handle(&self) -> &PartitionsManagerControlHandle {
1927        &self.control_handle
1928    }
1929
1930    fn drop_without_shutdown(mut self) {
1931        // Safety: drops once, never accessed again due to mem::forget
1932        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1933        // Prevent Drop from running (which would shut down the channel)
1934        std::mem::forget(self);
1935    }
1936}
1937
1938impl PartitionsManagerAddPartitionResponder {
1939    /// Sends a response to the FIDL transaction.
1940    ///
1941    /// Sets the channel to shutdown if an error occurs.
1942    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1943        let _result = self.send_raw(result);
1944        if _result.is_err() {
1945            self.control_handle.shutdown();
1946        }
1947        self.drop_without_shutdown();
1948        _result
1949    }
1950
1951    /// Similar to "send" but does not shutdown the channel if an error occurs.
1952    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1953        let _result = self.send_raw(result);
1954        self.drop_without_shutdown();
1955        _result
1956    }
1957
1958    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1959        self.control_handle
1960            .inner
1961            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1962                result,
1963                self.tx_id,
1964                0x32afa9f7acf47e38,
1965                fidl::encoding::DynamicFlags::empty(),
1966            )
1967    }
1968}
1969
1970#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1971pub struct PartitionServiceMarker;
1972
1973#[cfg(target_os = "fuchsia")]
1974impl fidl::endpoints::ServiceMarker for PartitionServiceMarker {
1975    type Proxy = PartitionServiceProxy;
1976    type Request = PartitionServiceRequest;
1977    const SERVICE_NAME: &'static str = "fuchsia.storage.partitions.PartitionService";
1978}
1979
1980/// A request for one of the member protocols of PartitionService.
1981///
1982/// Each partition exposes this service.  The instance names are unique for each partition but
1983/// otherwise have no special meaning.  In practice they correspond to the index in the GPT.
1984#[cfg(target_os = "fuchsia")]
1985pub enum PartitionServiceRequest {
1986    Volume(fidl_fuchsia_hardware_block_volume::VolumeRequestStream),
1987    Partition(PartitionRequestStream),
1988}
1989
1990#[cfg(target_os = "fuchsia")]
1991impl fidl::endpoints::ServiceRequest for PartitionServiceRequest {
1992    type Service = PartitionServiceMarker;
1993
1994    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
1995        match name {
1996            "volume" => Self::Volume(
1997                <fidl_fuchsia_hardware_block_volume::VolumeRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
1998            ),
1999            "partition" => Self::Partition(
2000                <PartitionRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
2001            ),
2002            _ => panic!("no such member protocol name for service PartitionService"),
2003        }
2004    }
2005
2006    fn member_names() -> &'static [&'static str] {
2007        &["volume", "partition"]
2008    }
2009}
2010/// Each partition exposes this service.  The instance names are unique for each partition but
2011/// otherwise have no special meaning.  In practice they correspond to the index in the GPT.
2012#[cfg(target_os = "fuchsia")]
2013pub struct PartitionServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
2014
2015#[cfg(target_os = "fuchsia")]
2016impl fidl::endpoints::ServiceProxy for PartitionServiceProxy {
2017    type Service = PartitionServiceMarker;
2018
2019    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
2020        Self(opener)
2021    }
2022}
2023
2024#[cfg(target_os = "fuchsia")]
2025impl PartitionServiceProxy {
2026    pub fn connect_to_volume(
2027        &self,
2028    ) -> Result<fidl_fuchsia_hardware_block_volume::VolumeProxy, fidl::Error> {
2029        let (proxy, server_end) =
2030            fidl::endpoints::create_proxy::<fidl_fuchsia_hardware_block_volume::VolumeMarker>();
2031        self.connect_channel_to_volume(server_end)?;
2032        Ok(proxy)
2033    }
2034
2035    /// Like `connect_to_volume`, but returns a sync proxy.
2036    /// See [`Self::connect_to_volume`] for more details.
2037    pub fn connect_to_volume_sync(
2038        &self,
2039    ) -> Result<fidl_fuchsia_hardware_block_volume::VolumeSynchronousProxy, fidl::Error> {
2040        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<
2041            fidl_fuchsia_hardware_block_volume::VolumeMarker,
2042        >();
2043        self.connect_channel_to_volume(server_end)?;
2044        Ok(proxy)
2045    }
2046
2047    /// Like `connect_to_volume`, but accepts a server end.
2048    /// See [`Self::connect_to_volume`] for more details.
2049    pub fn connect_channel_to_volume(
2050        &self,
2051        server_end: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_block_volume::VolumeMarker>,
2052    ) -> Result<(), fidl::Error> {
2053        self.0.open_member("volume", server_end.into_channel())
2054    }
2055    pub fn connect_to_partition(&self) -> Result<PartitionProxy, fidl::Error> {
2056        let (proxy, server_end) = fidl::endpoints::create_proxy::<PartitionMarker>();
2057        self.connect_channel_to_partition(server_end)?;
2058        Ok(proxy)
2059    }
2060
2061    /// Like `connect_to_partition`, but returns a sync proxy.
2062    /// See [`Self::connect_to_partition`] for more details.
2063    pub fn connect_to_partition_sync(&self) -> Result<PartitionSynchronousProxy, fidl::Error> {
2064        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<PartitionMarker>();
2065        self.connect_channel_to_partition(server_end)?;
2066        Ok(proxy)
2067    }
2068
2069    /// Like `connect_to_partition`, but accepts a server end.
2070    /// See [`Self::connect_to_partition`] for more details.
2071    pub fn connect_channel_to_partition(
2072        &self,
2073        server_end: fidl::endpoints::ServerEnd<PartitionMarker>,
2074    ) -> Result<(), fidl::Error> {
2075        self.0.open_member("partition", server_end.into_channel())
2076    }
2077
2078    pub fn instance_name(&self) -> &str {
2079        self.0.instance_name()
2080    }
2081}
2082
2083mod internal {
2084    use super::*;
2085
2086    impl fidl::encoding::ResourceTypeMarker for PartitionsManagerCommitTransactionRequest {
2087        type Borrowed<'a> = &'a mut Self;
2088        fn take_or_borrow<'a>(
2089            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2090        ) -> Self::Borrowed<'a> {
2091            value
2092        }
2093    }
2094
2095    unsafe impl fidl::encoding::TypeMarker for PartitionsManagerCommitTransactionRequest {
2096        type Owned = Self;
2097
2098        #[inline(always)]
2099        fn inline_align(_context: fidl::encoding::Context) -> usize {
2100            4
2101        }
2102
2103        #[inline(always)]
2104        fn inline_size(_context: fidl::encoding::Context) -> usize {
2105            4
2106        }
2107    }
2108
2109    unsafe impl
2110        fidl::encoding::Encode<
2111            PartitionsManagerCommitTransactionRequest,
2112            fidl::encoding::DefaultFuchsiaResourceDialect,
2113        > for &mut PartitionsManagerCommitTransactionRequest
2114    {
2115        #[inline]
2116        unsafe fn encode(
2117            self,
2118            encoder: &mut fidl::encoding::Encoder<
2119                '_,
2120                fidl::encoding::DefaultFuchsiaResourceDialect,
2121            >,
2122            offset: usize,
2123            _depth: fidl::encoding::Depth,
2124        ) -> fidl::Result<()> {
2125            encoder.debug_check_bounds::<PartitionsManagerCommitTransactionRequest>(offset);
2126            // Delegate to tuple encoding.
2127            fidl::encoding::Encode::<
2128                PartitionsManagerCommitTransactionRequest,
2129                fidl::encoding::DefaultFuchsiaResourceDialect,
2130            >::encode(
2131                (<fidl::encoding::HandleType<
2132                    fidl::EventPair,
2133                    { fidl::ObjectType::EVENTPAIR.into_raw() },
2134                    2147483648,
2135                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2136                    &mut self.transaction
2137                ),),
2138                encoder,
2139                offset,
2140                _depth,
2141            )
2142        }
2143    }
2144    unsafe impl<
2145            T0: fidl::encoding::Encode<
2146                fidl::encoding::HandleType<
2147                    fidl::EventPair,
2148                    { fidl::ObjectType::EVENTPAIR.into_raw() },
2149                    2147483648,
2150                >,
2151                fidl::encoding::DefaultFuchsiaResourceDialect,
2152            >,
2153        >
2154        fidl::encoding::Encode<
2155            PartitionsManagerCommitTransactionRequest,
2156            fidl::encoding::DefaultFuchsiaResourceDialect,
2157        > for (T0,)
2158    {
2159        #[inline]
2160        unsafe fn encode(
2161            self,
2162            encoder: &mut fidl::encoding::Encoder<
2163                '_,
2164                fidl::encoding::DefaultFuchsiaResourceDialect,
2165            >,
2166            offset: usize,
2167            depth: fidl::encoding::Depth,
2168        ) -> fidl::Result<()> {
2169            encoder.debug_check_bounds::<PartitionsManagerCommitTransactionRequest>(offset);
2170            // Zero out padding regions. There's no need to apply masks
2171            // because the unmasked parts will be overwritten by fields.
2172            // Write the fields.
2173            self.0.encode(encoder, offset + 0, depth)?;
2174            Ok(())
2175        }
2176    }
2177
2178    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2179        for PartitionsManagerCommitTransactionRequest
2180    {
2181        #[inline(always)]
2182        fn new_empty() -> Self {
2183            Self {
2184                transaction: fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
2185            }
2186        }
2187
2188        #[inline]
2189        unsafe fn decode(
2190            &mut self,
2191            decoder: &mut fidl::encoding::Decoder<
2192                '_,
2193                fidl::encoding::DefaultFuchsiaResourceDialect,
2194            >,
2195            offset: usize,
2196            _depth: fidl::encoding::Depth,
2197        ) -> fidl::Result<()> {
2198            decoder.debug_check_bounds::<Self>(offset);
2199            // Verify that padding bytes are zero.
2200            fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.transaction, decoder, offset + 0, _depth)?;
2201            Ok(())
2202        }
2203    }
2204
2205    impl fidl::encoding::ResourceTypeMarker for PartitionsManagerCreateTransactionResponse {
2206        type Borrowed<'a> = &'a mut Self;
2207        fn take_or_borrow<'a>(
2208            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2209        ) -> Self::Borrowed<'a> {
2210            value
2211        }
2212    }
2213
2214    unsafe impl fidl::encoding::TypeMarker for PartitionsManagerCreateTransactionResponse {
2215        type Owned = Self;
2216
2217        #[inline(always)]
2218        fn inline_align(_context: fidl::encoding::Context) -> usize {
2219            4
2220        }
2221
2222        #[inline(always)]
2223        fn inline_size(_context: fidl::encoding::Context) -> usize {
2224            4
2225        }
2226    }
2227
2228    unsafe impl
2229        fidl::encoding::Encode<
2230            PartitionsManagerCreateTransactionResponse,
2231            fidl::encoding::DefaultFuchsiaResourceDialect,
2232        > for &mut PartitionsManagerCreateTransactionResponse
2233    {
2234        #[inline]
2235        unsafe fn encode(
2236            self,
2237            encoder: &mut fidl::encoding::Encoder<
2238                '_,
2239                fidl::encoding::DefaultFuchsiaResourceDialect,
2240            >,
2241            offset: usize,
2242            _depth: fidl::encoding::Depth,
2243        ) -> fidl::Result<()> {
2244            encoder.debug_check_bounds::<PartitionsManagerCreateTransactionResponse>(offset);
2245            // Delegate to tuple encoding.
2246            fidl::encoding::Encode::<
2247                PartitionsManagerCreateTransactionResponse,
2248                fidl::encoding::DefaultFuchsiaResourceDialect,
2249            >::encode(
2250                (<fidl::encoding::HandleType<
2251                    fidl::EventPair,
2252                    { fidl::ObjectType::EVENTPAIR.into_raw() },
2253                    2147483648,
2254                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2255                    &mut self.transaction
2256                ),),
2257                encoder,
2258                offset,
2259                _depth,
2260            )
2261        }
2262    }
2263    unsafe impl<
2264            T0: fidl::encoding::Encode<
2265                fidl::encoding::HandleType<
2266                    fidl::EventPair,
2267                    { fidl::ObjectType::EVENTPAIR.into_raw() },
2268                    2147483648,
2269                >,
2270                fidl::encoding::DefaultFuchsiaResourceDialect,
2271            >,
2272        >
2273        fidl::encoding::Encode<
2274            PartitionsManagerCreateTransactionResponse,
2275            fidl::encoding::DefaultFuchsiaResourceDialect,
2276        > for (T0,)
2277    {
2278        #[inline]
2279        unsafe fn encode(
2280            self,
2281            encoder: &mut fidl::encoding::Encoder<
2282                '_,
2283                fidl::encoding::DefaultFuchsiaResourceDialect,
2284            >,
2285            offset: usize,
2286            depth: fidl::encoding::Depth,
2287        ) -> fidl::Result<()> {
2288            encoder.debug_check_bounds::<PartitionsManagerCreateTransactionResponse>(offset);
2289            // Zero out padding regions. There's no need to apply masks
2290            // because the unmasked parts will be overwritten by fields.
2291            // Write the fields.
2292            self.0.encode(encoder, offset + 0, depth)?;
2293            Ok(())
2294        }
2295    }
2296
2297    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2298        for PartitionsManagerCreateTransactionResponse
2299    {
2300        #[inline(always)]
2301        fn new_empty() -> Self {
2302            Self {
2303                transaction: fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
2304            }
2305        }
2306
2307        #[inline]
2308        unsafe fn decode(
2309            &mut self,
2310            decoder: &mut fidl::encoding::Decoder<
2311                '_,
2312                fidl::encoding::DefaultFuchsiaResourceDialect,
2313            >,
2314            offset: usize,
2315            _depth: fidl::encoding::Depth,
2316        ) -> fidl::Result<()> {
2317            decoder.debug_check_bounds::<Self>(offset);
2318            // Verify that padding bytes are zero.
2319            fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.transaction, decoder, offset + 0, _depth)?;
2320            Ok(())
2321        }
2322    }
2323
2324    impl PartitionUpdateMetadataRequest {
2325        #[inline(always)]
2326        fn max_ordinal_present(&self) -> u64 {
2327            if let Some(_) = self.flags {
2328                return 3;
2329            }
2330            if let Some(_) = self.type_guid {
2331                return 2;
2332            }
2333            if let Some(_) = self.transaction {
2334                return 1;
2335            }
2336            0
2337        }
2338    }
2339
2340    impl fidl::encoding::ResourceTypeMarker for PartitionUpdateMetadataRequest {
2341        type Borrowed<'a> = &'a mut Self;
2342        fn take_or_borrow<'a>(
2343            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2344        ) -> Self::Borrowed<'a> {
2345            value
2346        }
2347    }
2348
2349    unsafe impl fidl::encoding::TypeMarker for PartitionUpdateMetadataRequest {
2350        type Owned = Self;
2351
2352        #[inline(always)]
2353        fn inline_align(_context: fidl::encoding::Context) -> usize {
2354            8
2355        }
2356
2357        #[inline(always)]
2358        fn inline_size(_context: fidl::encoding::Context) -> usize {
2359            16
2360        }
2361    }
2362
2363    unsafe impl
2364        fidl::encoding::Encode<
2365            PartitionUpdateMetadataRequest,
2366            fidl::encoding::DefaultFuchsiaResourceDialect,
2367        > for &mut PartitionUpdateMetadataRequest
2368    {
2369        unsafe fn encode(
2370            self,
2371            encoder: &mut fidl::encoding::Encoder<
2372                '_,
2373                fidl::encoding::DefaultFuchsiaResourceDialect,
2374            >,
2375            offset: usize,
2376            mut depth: fidl::encoding::Depth,
2377        ) -> fidl::Result<()> {
2378            encoder.debug_check_bounds::<PartitionUpdateMetadataRequest>(offset);
2379            // Vector header
2380            let max_ordinal: u64 = self.max_ordinal_present();
2381            encoder.write_num(max_ordinal, offset);
2382            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2383            // Calling encoder.out_of_line_offset(0) is not allowed.
2384            if max_ordinal == 0 {
2385                return Ok(());
2386            }
2387            depth.increment()?;
2388            let envelope_size = 8;
2389            let bytes_len = max_ordinal as usize * envelope_size;
2390            #[allow(unused_variables)]
2391            let offset = encoder.out_of_line_offset(bytes_len);
2392            let mut _prev_end_offset: usize = 0;
2393            if 1 > max_ordinal {
2394                return Ok(());
2395            }
2396
2397            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2398            // are envelope_size bytes.
2399            let cur_offset: usize = (1 - 1) * envelope_size;
2400
2401            // Zero reserved fields.
2402            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2403
2404            // Safety:
2405            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2406            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2407            //   envelope_size bytes, there is always sufficient room.
2408            fidl::encoding::encode_in_envelope_optional::<
2409                fidl::encoding::HandleType<
2410                    fidl::EventPair,
2411                    { fidl::ObjectType::EVENTPAIR.into_raw() },
2412                    2147483648,
2413                >,
2414                fidl::encoding::DefaultFuchsiaResourceDialect,
2415            >(
2416                self.transaction.as_mut().map(
2417                    <fidl::encoding::HandleType<
2418                        fidl::EventPair,
2419                        { fidl::ObjectType::EVENTPAIR.into_raw() },
2420                        2147483648,
2421                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
2422                ),
2423                encoder,
2424                offset + cur_offset,
2425                depth,
2426            )?;
2427
2428            _prev_end_offset = cur_offset + envelope_size;
2429            if 2 > max_ordinal {
2430                return Ok(());
2431            }
2432
2433            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2434            // are envelope_size bytes.
2435            let cur_offset: usize = (2 - 1) * envelope_size;
2436
2437            // Zero reserved fields.
2438            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2439
2440            // Safety:
2441            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2442            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2443            //   envelope_size bytes, there is always sufficient room.
2444            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_hardware_block_partition::Guid, fidl::encoding::DefaultFuchsiaResourceDialect>(
2445            self.type_guid.as_ref().map(<fidl_fuchsia_hardware_block_partition::Guid as fidl::encoding::ValueTypeMarker>::borrow),
2446            encoder, offset + cur_offset, depth
2447        )?;
2448
2449            _prev_end_offset = cur_offset + envelope_size;
2450            if 3 > max_ordinal {
2451                return Ok(());
2452            }
2453
2454            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2455            // are envelope_size bytes.
2456            let cur_offset: usize = (3 - 1) * envelope_size;
2457
2458            // Zero reserved fields.
2459            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2460
2461            // Safety:
2462            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2463            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2464            //   envelope_size bytes, there is always sufficient room.
2465            fidl::encoding::encode_in_envelope_optional::<
2466                u64,
2467                fidl::encoding::DefaultFuchsiaResourceDialect,
2468            >(
2469                self.flags.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
2470                encoder,
2471                offset + cur_offset,
2472                depth,
2473            )?;
2474
2475            _prev_end_offset = cur_offset + envelope_size;
2476
2477            Ok(())
2478        }
2479    }
2480
2481    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2482        for PartitionUpdateMetadataRequest
2483    {
2484        #[inline(always)]
2485        fn new_empty() -> Self {
2486            Self::default()
2487        }
2488
2489        unsafe fn decode(
2490            &mut self,
2491            decoder: &mut fidl::encoding::Decoder<
2492                '_,
2493                fidl::encoding::DefaultFuchsiaResourceDialect,
2494            >,
2495            offset: usize,
2496            mut depth: fidl::encoding::Depth,
2497        ) -> fidl::Result<()> {
2498            decoder.debug_check_bounds::<Self>(offset);
2499            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2500                None => return Err(fidl::Error::NotNullable),
2501                Some(len) => len,
2502            };
2503            // Calling decoder.out_of_line_offset(0) is not allowed.
2504            if len == 0 {
2505                return Ok(());
2506            };
2507            depth.increment()?;
2508            let envelope_size = 8;
2509            let bytes_len = len * envelope_size;
2510            let offset = decoder.out_of_line_offset(bytes_len)?;
2511            // Decode the envelope for each type.
2512            let mut _next_ordinal_to_read = 0;
2513            let mut next_offset = offset;
2514            let end_offset = offset + bytes_len;
2515            _next_ordinal_to_read += 1;
2516            if next_offset >= end_offset {
2517                return Ok(());
2518            }
2519
2520            // Decode unknown envelopes for gaps in ordinals.
2521            while _next_ordinal_to_read < 1 {
2522                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2523                _next_ordinal_to_read += 1;
2524                next_offset += envelope_size;
2525            }
2526
2527            let next_out_of_line = decoder.next_out_of_line();
2528            let handles_before = decoder.remaining_handles();
2529            if let Some((inlined, num_bytes, num_handles)) =
2530                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2531            {
2532                let member_inline_size = <fidl::encoding::HandleType<
2533                    fidl::EventPair,
2534                    { fidl::ObjectType::EVENTPAIR.into_raw() },
2535                    2147483648,
2536                > as fidl::encoding::TypeMarker>::inline_size(
2537                    decoder.context
2538                );
2539                if inlined != (member_inline_size <= 4) {
2540                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2541                }
2542                let inner_offset;
2543                let mut inner_depth = depth.clone();
2544                if inlined {
2545                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2546                    inner_offset = next_offset;
2547                } else {
2548                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2549                    inner_depth.increment()?;
2550                }
2551                let val_ref =
2552                self.transaction.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
2553                fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
2554                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2555                {
2556                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2557                }
2558                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2559                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2560                }
2561            }
2562
2563            next_offset += envelope_size;
2564            _next_ordinal_to_read += 1;
2565            if next_offset >= end_offset {
2566                return Ok(());
2567            }
2568
2569            // Decode unknown envelopes for gaps in ordinals.
2570            while _next_ordinal_to_read < 2 {
2571                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2572                _next_ordinal_to_read += 1;
2573                next_offset += envelope_size;
2574            }
2575
2576            let next_out_of_line = decoder.next_out_of_line();
2577            let handles_before = decoder.remaining_handles();
2578            if let Some((inlined, num_bytes, num_handles)) =
2579                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2580            {
2581                let member_inline_size = <fidl_fuchsia_hardware_block_partition::Guid as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2582                if inlined != (member_inline_size <= 4) {
2583                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2584                }
2585                let inner_offset;
2586                let mut inner_depth = depth.clone();
2587                if inlined {
2588                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2589                    inner_offset = next_offset;
2590                } else {
2591                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2592                    inner_depth.increment()?;
2593                }
2594                let val_ref = self.type_guid.get_or_insert_with(|| {
2595                    fidl::new_empty!(
2596                        fidl_fuchsia_hardware_block_partition::Guid,
2597                        fidl::encoding::DefaultFuchsiaResourceDialect
2598                    )
2599                });
2600                fidl::decode!(
2601                    fidl_fuchsia_hardware_block_partition::Guid,
2602                    fidl::encoding::DefaultFuchsiaResourceDialect,
2603                    val_ref,
2604                    decoder,
2605                    inner_offset,
2606                    inner_depth
2607                )?;
2608                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2609                {
2610                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2611                }
2612                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2613                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2614                }
2615            }
2616
2617            next_offset += envelope_size;
2618            _next_ordinal_to_read += 1;
2619            if next_offset >= end_offset {
2620                return Ok(());
2621            }
2622
2623            // Decode unknown envelopes for gaps in ordinals.
2624            while _next_ordinal_to_read < 3 {
2625                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2626                _next_ordinal_to_read += 1;
2627                next_offset += envelope_size;
2628            }
2629
2630            let next_out_of_line = decoder.next_out_of_line();
2631            let handles_before = decoder.remaining_handles();
2632            if let Some((inlined, num_bytes, num_handles)) =
2633                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2634            {
2635                let member_inline_size =
2636                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2637                if inlined != (member_inline_size <= 4) {
2638                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2639                }
2640                let inner_offset;
2641                let mut inner_depth = depth.clone();
2642                if inlined {
2643                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2644                    inner_offset = next_offset;
2645                } else {
2646                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2647                    inner_depth.increment()?;
2648                }
2649                let val_ref = self.flags.get_or_insert_with(|| {
2650                    fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
2651                });
2652                fidl::decode!(
2653                    u64,
2654                    fidl::encoding::DefaultFuchsiaResourceDialect,
2655                    val_ref,
2656                    decoder,
2657                    inner_offset,
2658                    inner_depth
2659                )?;
2660                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2661                {
2662                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2663                }
2664                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2665                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2666                }
2667            }
2668
2669            next_offset += envelope_size;
2670
2671            // Decode the remaining unknown envelopes.
2672            while next_offset < end_offset {
2673                _next_ordinal_to_read += 1;
2674                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2675                next_offset += envelope_size;
2676            }
2677
2678            Ok(())
2679        }
2680    }
2681
2682    impl PartitionsManagerAddPartitionRequest {
2683        #[inline(always)]
2684        fn max_ordinal_present(&self) -> u64 {
2685            if let Some(_) = self.flags {
2686                return 6;
2687            }
2688            if let Some(_) = self.instance_guid {
2689                return 5;
2690            }
2691            if let Some(_) = self.type_guid {
2692                return 4;
2693            }
2694            if let Some(_) = self.name {
2695                return 3;
2696            }
2697            if let Some(_) = self.num_blocks {
2698                return 2;
2699            }
2700            if let Some(_) = self.transaction {
2701                return 1;
2702            }
2703            0
2704        }
2705    }
2706
2707    impl fidl::encoding::ResourceTypeMarker for PartitionsManagerAddPartitionRequest {
2708        type Borrowed<'a> = &'a mut Self;
2709        fn take_or_borrow<'a>(
2710            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2711        ) -> Self::Borrowed<'a> {
2712            value
2713        }
2714    }
2715
2716    unsafe impl fidl::encoding::TypeMarker for PartitionsManagerAddPartitionRequest {
2717        type Owned = Self;
2718
2719        #[inline(always)]
2720        fn inline_align(_context: fidl::encoding::Context) -> usize {
2721            8
2722        }
2723
2724        #[inline(always)]
2725        fn inline_size(_context: fidl::encoding::Context) -> usize {
2726            16
2727        }
2728    }
2729
2730    unsafe impl
2731        fidl::encoding::Encode<
2732            PartitionsManagerAddPartitionRequest,
2733            fidl::encoding::DefaultFuchsiaResourceDialect,
2734        > for &mut PartitionsManagerAddPartitionRequest
2735    {
2736        unsafe fn encode(
2737            self,
2738            encoder: &mut fidl::encoding::Encoder<
2739                '_,
2740                fidl::encoding::DefaultFuchsiaResourceDialect,
2741            >,
2742            offset: usize,
2743            mut depth: fidl::encoding::Depth,
2744        ) -> fidl::Result<()> {
2745            encoder.debug_check_bounds::<PartitionsManagerAddPartitionRequest>(offset);
2746            // Vector header
2747            let max_ordinal: u64 = self.max_ordinal_present();
2748            encoder.write_num(max_ordinal, offset);
2749            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2750            // Calling encoder.out_of_line_offset(0) is not allowed.
2751            if max_ordinal == 0 {
2752                return Ok(());
2753            }
2754            depth.increment()?;
2755            let envelope_size = 8;
2756            let bytes_len = max_ordinal as usize * envelope_size;
2757            #[allow(unused_variables)]
2758            let offset = encoder.out_of_line_offset(bytes_len);
2759            let mut _prev_end_offset: usize = 0;
2760            if 1 > max_ordinal {
2761                return Ok(());
2762            }
2763
2764            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2765            // are envelope_size bytes.
2766            let cur_offset: usize = (1 - 1) * envelope_size;
2767
2768            // Zero reserved fields.
2769            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2770
2771            // Safety:
2772            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2773            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2774            //   envelope_size bytes, there is always sufficient room.
2775            fidl::encoding::encode_in_envelope_optional::<
2776                fidl::encoding::HandleType<
2777                    fidl::EventPair,
2778                    { fidl::ObjectType::EVENTPAIR.into_raw() },
2779                    2147483648,
2780                >,
2781                fidl::encoding::DefaultFuchsiaResourceDialect,
2782            >(
2783                self.transaction.as_mut().map(
2784                    <fidl::encoding::HandleType<
2785                        fidl::EventPair,
2786                        { fidl::ObjectType::EVENTPAIR.into_raw() },
2787                        2147483648,
2788                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
2789                ),
2790                encoder,
2791                offset + cur_offset,
2792                depth,
2793            )?;
2794
2795            _prev_end_offset = cur_offset + envelope_size;
2796            if 2 > max_ordinal {
2797                return Ok(());
2798            }
2799
2800            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2801            // are envelope_size bytes.
2802            let cur_offset: usize = (2 - 1) * envelope_size;
2803
2804            // Zero reserved fields.
2805            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2806
2807            // Safety:
2808            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2809            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2810            //   envelope_size bytes, there is always sufficient room.
2811            fidl::encoding::encode_in_envelope_optional::<
2812                u64,
2813                fidl::encoding::DefaultFuchsiaResourceDialect,
2814            >(
2815                self.num_blocks.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
2816                encoder,
2817                offset + cur_offset,
2818                depth,
2819            )?;
2820
2821            _prev_end_offset = cur_offset + envelope_size;
2822            if 3 > max_ordinal {
2823                return Ok(());
2824            }
2825
2826            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2827            // are envelope_size bytes.
2828            let cur_offset: usize = (3 - 1) * envelope_size;
2829
2830            // Zero reserved fields.
2831            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2832
2833            // Safety:
2834            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2835            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2836            //   envelope_size bytes, there is always sufficient room.
2837            fidl::encoding::encode_in_envelope_optional::<
2838                fidl::encoding::BoundedString<128>,
2839                fidl::encoding::DefaultFuchsiaResourceDialect,
2840            >(
2841                self.name.as_ref().map(
2842                    <fidl::encoding::BoundedString<128> as fidl::encoding::ValueTypeMarker>::borrow,
2843                ),
2844                encoder,
2845                offset + cur_offset,
2846                depth,
2847            )?;
2848
2849            _prev_end_offset = cur_offset + envelope_size;
2850            if 4 > max_ordinal {
2851                return Ok(());
2852            }
2853
2854            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2855            // are envelope_size bytes.
2856            let cur_offset: usize = (4 - 1) * envelope_size;
2857
2858            // Zero reserved fields.
2859            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2860
2861            // Safety:
2862            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2863            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2864            //   envelope_size bytes, there is always sufficient room.
2865            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_hardware_block_partition::Guid, fidl::encoding::DefaultFuchsiaResourceDialect>(
2866            self.type_guid.as_ref().map(<fidl_fuchsia_hardware_block_partition::Guid as fidl::encoding::ValueTypeMarker>::borrow),
2867            encoder, offset + cur_offset, depth
2868        )?;
2869
2870            _prev_end_offset = cur_offset + envelope_size;
2871            if 5 > max_ordinal {
2872                return Ok(());
2873            }
2874
2875            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2876            // are envelope_size bytes.
2877            let cur_offset: usize = (5 - 1) * envelope_size;
2878
2879            // Zero reserved fields.
2880            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2881
2882            // Safety:
2883            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2884            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2885            //   envelope_size bytes, there is always sufficient room.
2886            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_hardware_block_partition::Guid, fidl::encoding::DefaultFuchsiaResourceDialect>(
2887            self.instance_guid.as_ref().map(<fidl_fuchsia_hardware_block_partition::Guid as fidl::encoding::ValueTypeMarker>::borrow),
2888            encoder, offset + cur_offset, depth
2889        )?;
2890
2891            _prev_end_offset = cur_offset + envelope_size;
2892            if 6 > max_ordinal {
2893                return Ok(());
2894            }
2895
2896            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2897            // are envelope_size bytes.
2898            let cur_offset: usize = (6 - 1) * envelope_size;
2899
2900            // Zero reserved fields.
2901            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2902
2903            // Safety:
2904            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2905            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2906            //   envelope_size bytes, there is always sufficient room.
2907            fidl::encoding::encode_in_envelope_optional::<
2908                u64,
2909                fidl::encoding::DefaultFuchsiaResourceDialect,
2910            >(
2911                self.flags.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
2912                encoder,
2913                offset + cur_offset,
2914                depth,
2915            )?;
2916
2917            _prev_end_offset = cur_offset + envelope_size;
2918
2919            Ok(())
2920        }
2921    }
2922
2923    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2924        for PartitionsManagerAddPartitionRequest
2925    {
2926        #[inline(always)]
2927        fn new_empty() -> Self {
2928            Self::default()
2929        }
2930
2931        unsafe fn decode(
2932            &mut self,
2933            decoder: &mut fidl::encoding::Decoder<
2934                '_,
2935                fidl::encoding::DefaultFuchsiaResourceDialect,
2936            >,
2937            offset: usize,
2938            mut depth: fidl::encoding::Depth,
2939        ) -> fidl::Result<()> {
2940            decoder.debug_check_bounds::<Self>(offset);
2941            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2942                None => return Err(fidl::Error::NotNullable),
2943                Some(len) => len,
2944            };
2945            // Calling decoder.out_of_line_offset(0) is not allowed.
2946            if len == 0 {
2947                return Ok(());
2948            };
2949            depth.increment()?;
2950            let envelope_size = 8;
2951            let bytes_len = len * envelope_size;
2952            let offset = decoder.out_of_line_offset(bytes_len)?;
2953            // Decode the envelope for each type.
2954            let mut _next_ordinal_to_read = 0;
2955            let mut next_offset = offset;
2956            let end_offset = offset + bytes_len;
2957            _next_ordinal_to_read += 1;
2958            if next_offset >= end_offset {
2959                return Ok(());
2960            }
2961
2962            // Decode unknown envelopes for gaps in ordinals.
2963            while _next_ordinal_to_read < 1 {
2964                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2965                _next_ordinal_to_read += 1;
2966                next_offset += envelope_size;
2967            }
2968
2969            let next_out_of_line = decoder.next_out_of_line();
2970            let handles_before = decoder.remaining_handles();
2971            if let Some((inlined, num_bytes, num_handles)) =
2972                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2973            {
2974                let member_inline_size = <fidl::encoding::HandleType<
2975                    fidl::EventPair,
2976                    { fidl::ObjectType::EVENTPAIR.into_raw() },
2977                    2147483648,
2978                > as fidl::encoding::TypeMarker>::inline_size(
2979                    decoder.context
2980                );
2981                if inlined != (member_inline_size <= 4) {
2982                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2983                }
2984                let inner_offset;
2985                let mut inner_depth = depth.clone();
2986                if inlined {
2987                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2988                    inner_offset = next_offset;
2989                } else {
2990                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2991                    inner_depth.increment()?;
2992                }
2993                let val_ref =
2994                self.transaction.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
2995                fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
2996                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2997                {
2998                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2999                }
3000                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3001                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3002                }
3003            }
3004
3005            next_offset += envelope_size;
3006            _next_ordinal_to_read += 1;
3007            if next_offset >= end_offset {
3008                return Ok(());
3009            }
3010
3011            // Decode unknown envelopes for gaps in ordinals.
3012            while _next_ordinal_to_read < 2 {
3013                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3014                _next_ordinal_to_read += 1;
3015                next_offset += envelope_size;
3016            }
3017
3018            let next_out_of_line = decoder.next_out_of_line();
3019            let handles_before = decoder.remaining_handles();
3020            if let Some((inlined, num_bytes, num_handles)) =
3021                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3022            {
3023                let member_inline_size =
3024                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3025                if inlined != (member_inline_size <= 4) {
3026                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3027                }
3028                let inner_offset;
3029                let mut inner_depth = depth.clone();
3030                if inlined {
3031                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3032                    inner_offset = next_offset;
3033                } else {
3034                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3035                    inner_depth.increment()?;
3036                }
3037                let val_ref = self.num_blocks.get_or_insert_with(|| {
3038                    fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
3039                });
3040                fidl::decode!(
3041                    u64,
3042                    fidl::encoding::DefaultFuchsiaResourceDialect,
3043                    val_ref,
3044                    decoder,
3045                    inner_offset,
3046                    inner_depth
3047                )?;
3048                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3049                {
3050                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3051                }
3052                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3053                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3054                }
3055            }
3056
3057            next_offset += envelope_size;
3058            _next_ordinal_to_read += 1;
3059            if next_offset >= end_offset {
3060                return Ok(());
3061            }
3062
3063            // Decode unknown envelopes for gaps in ordinals.
3064            while _next_ordinal_to_read < 3 {
3065                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3066                _next_ordinal_to_read += 1;
3067                next_offset += envelope_size;
3068            }
3069
3070            let next_out_of_line = decoder.next_out_of_line();
3071            let handles_before = decoder.remaining_handles();
3072            if let Some((inlined, num_bytes, num_handles)) =
3073                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3074            {
3075                let member_inline_size =
3076                    <fidl::encoding::BoundedString<128> as fidl::encoding::TypeMarker>::inline_size(
3077                        decoder.context,
3078                    );
3079                if inlined != (member_inline_size <= 4) {
3080                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3081                }
3082                let inner_offset;
3083                let mut inner_depth = depth.clone();
3084                if inlined {
3085                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3086                    inner_offset = next_offset;
3087                } else {
3088                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3089                    inner_depth.increment()?;
3090                }
3091                let val_ref = self.name.get_or_insert_with(|| {
3092                    fidl::new_empty!(
3093                        fidl::encoding::BoundedString<128>,
3094                        fidl::encoding::DefaultFuchsiaResourceDialect
3095                    )
3096                });
3097                fidl::decode!(
3098                    fidl::encoding::BoundedString<128>,
3099                    fidl::encoding::DefaultFuchsiaResourceDialect,
3100                    val_ref,
3101                    decoder,
3102                    inner_offset,
3103                    inner_depth
3104                )?;
3105                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3106                {
3107                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3108                }
3109                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3110                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3111                }
3112            }
3113
3114            next_offset += envelope_size;
3115            _next_ordinal_to_read += 1;
3116            if next_offset >= end_offset {
3117                return Ok(());
3118            }
3119
3120            // Decode unknown envelopes for gaps in ordinals.
3121            while _next_ordinal_to_read < 4 {
3122                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3123                _next_ordinal_to_read += 1;
3124                next_offset += envelope_size;
3125            }
3126
3127            let next_out_of_line = decoder.next_out_of_line();
3128            let handles_before = decoder.remaining_handles();
3129            if let Some((inlined, num_bytes, num_handles)) =
3130                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3131            {
3132                let member_inline_size = <fidl_fuchsia_hardware_block_partition::Guid as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3133                if inlined != (member_inline_size <= 4) {
3134                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3135                }
3136                let inner_offset;
3137                let mut inner_depth = depth.clone();
3138                if inlined {
3139                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3140                    inner_offset = next_offset;
3141                } else {
3142                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3143                    inner_depth.increment()?;
3144                }
3145                let val_ref = self.type_guid.get_or_insert_with(|| {
3146                    fidl::new_empty!(
3147                        fidl_fuchsia_hardware_block_partition::Guid,
3148                        fidl::encoding::DefaultFuchsiaResourceDialect
3149                    )
3150                });
3151                fidl::decode!(
3152                    fidl_fuchsia_hardware_block_partition::Guid,
3153                    fidl::encoding::DefaultFuchsiaResourceDialect,
3154                    val_ref,
3155                    decoder,
3156                    inner_offset,
3157                    inner_depth
3158                )?;
3159                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3160                {
3161                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3162                }
3163                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3164                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3165                }
3166            }
3167
3168            next_offset += envelope_size;
3169            _next_ordinal_to_read += 1;
3170            if next_offset >= end_offset {
3171                return Ok(());
3172            }
3173
3174            // Decode unknown envelopes for gaps in ordinals.
3175            while _next_ordinal_to_read < 5 {
3176                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3177                _next_ordinal_to_read += 1;
3178                next_offset += envelope_size;
3179            }
3180
3181            let next_out_of_line = decoder.next_out_of_line();
3182            let handles_before = decoder.remaining_handles();
3183            if let Some((inlined, num_bytes, num_handles)) =
3184                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3185            {
3186                let member_inline_size = <fidl_fuchsia_hardware_block_partition::Guid as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3187                if inlined != (member_inline_size <= 4) {
3188                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3189                }
3190                let inner_offset;
3191                let mut inner_depth = depth.clone();
3192                if inlined {
3193                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3194                    inner_offset = next_offset;
3195                } else {
3196                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3197                    inner_depth.increment()?;
3198                }
3199                let val_ref = self.instance_guid.get_or_insert_with(|| {
3200                    fidl::new_empty!(
3201                        fidl_fuchsia_hardware_block_partition::Guid,
3202                        fidl::encoding::DefaultFuchsiaResourceDialect
3203                    )
3204                });
3205                fidl::decode!(
3206                    fidl_fuchsia_hardware_block_partition::Guid,
3207                    fidl::encoding::DefaultFuchsiaResourceDialect,
3208                    val_ref,
3209                    decoder,
3210                    inner_offset,
3211                    inner_depth
3212                )?;
3213                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3214                {
3215                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3216                }
3217                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3218                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3219                }
3220            }
3221
3222            next_offset += envelope_size;
3223            _next_ordinal_to_read += 1;
3224            if next_offset >= end_offset {
3225                return Ok(());
3226            }
3227
3228            // Decode unknown envelopes for gaps in ordinals.
3229            while _next_ordinal_to_read < 6 {
3230                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3231                _next_ordinal_to_read += 1;
3232                next_offset += envelope_size;
3233            }
3234
3235            let next_out_of_line = decoder.next_out_of_line();
3236            let handles_before = decoder.remaining_handles();
3237            if let Some((inlined, num_bytes, num_handles)) =
3238                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3239            {
3240                let member_inline_size =
3241                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3242                if inlined != (member_inline_size <= 4) {
3243                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3244                }
3245                let inner_offset;
3246                let mut inner_depth = depth.clone();
3247                if inlined {
3248                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3249                    inner_offset = next_offset;
3250                } else {
3251                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3252                    inner_depth.increment()?;
3253                }
3254                let val_ref = self.flags.get_or_insert_with(|| {
3255                    fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
3256                });
3257                fidl::decode!(
3258                    u64,
3259                    fidl::encoding::DefaultFuchsiaResourceDialect,
3260                    val_ref,
3261                    decoder,
3262                    inner_offset,
3263                    inner_depth
3264                )?;
3265                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3266                {
3267                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3268                }
3269                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3270                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3271                }
3272            }
3273
3274            next_offset += envelope_size;
3275
3276            // Decode the remaining unknown envelopes.
3277            while next_offset < end_offset {
3278                _next_ordinal_to_read += 1;
3279                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3280                next_offset += envelope_size;
3281            }
3282
3283            Ok(())
3284        }
3285    }
3286}