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