1#![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_storage_block::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_storage_block::Guid>,
54 pub instance_guid: Option<fidl_fuchsia_storage_block::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 OverlayPartitionMarker;
67
68impl fidl::endpoints::ProtocolMarker for OverlayPartitionMarker {
69 type Proxy = OverlayPartitionProxy;
70 type RequestStream = OverlayPartitionRequestStream;
71 #[cfg(target_os = "fuchsia")]
72 type SynchronousProxy = OverlayPartitionSynchronousProxy;
73
74 const DEBUG_NAME: &'static str = "fuchsia.storage.partitions.OverlayPartition";
75}
76impl fidl::endpoints::DiscoverableProtocolMarker for OverlayPartitionMarker {}
77pub type OverlayPartitionGetPartitionsResult =
78 Result<Vec<fidl_fuchsia_storage_block::PartitionInfo>, i32>;
79
80pub trait OverlayPartitionProxyInterface: Send + Sync {
81 type GetPartitionsResponseFut: std::future::Future<Output = Result<OverlayPartitionGetPartitionsResult, fidl::Error>>
82 + Send;
83 fn r#get_partitions(&self) -> Self::GetPartitionsResponseFut;
84}
85#[derive(Debug)]
86#[cfg(target_os = "fuchsia")]
87pub struct OverlayPartitionSynchronousProxy {
88 client: fidl::client::sync::Client,
89}
90
91#[cfg(target_os = "fuchsia")]
92impl fidl::endpoints::SynchronousProxy for OverlayPartitionSynchronousProxy {
93 type Proxy = OverlayPartitionProxy;
94 type Protocol = OverlayPartitionMarker;
95
96 fn from_channel(inner: fidl::Channel) -> Self {
97 Self::new(inner)
98 }
99
100 fn into_channel(self) -> fidl::Channel {
101 self.client.into_channel()
102 }
103
104 fn as_channel(&self) -> &fidl::Channel {
105 self.client.as_channel()
106 }
107}
108
109#[cfg(target_os = "fuchsia")]
110impl OverlayPartitionSynchronousProxy {
111 pub fn new(channel: fidl::Channel) -> Self {
112 Self { client: fidl::client::sync::Client::new(channel) }
113 }
114
115 pub fn into_channel(self) -> fidl::Channel {
116 self.client.into_channel()
117 }
118
119 pub fn wait_for_event(
122 &self,
123 deadline: zx::MonotonicInstant,
124 ) -> Result<OverlayPartitionEvent, fidl::Error> {
125 OverlayPartitionEvent::decode(
126 self.client.wait_for_event::<OverlayPartitionMarker>(deadline)?,
127 )
128 }
129
130 pub fn r#get_partitions(
132 &self,
133 ___deadline: zx::MonotonicInstant,
134 ) -> Result<OverlayPartitionGetPartitionsResult, fidl::Error> {
135 let _response = self.client.send_query::<
136 fidl::encoding::EmptyPayload,
137 fidl::encoding::ResultType<OverlayPartitionGetPartitionsResponse, i32>,
138 OverlayPartitionMarker,
139 >(
140 (),
141 0x7296daafa369c09b,
142 fidl::encoding::DynamicFlags::empty(),
143 ___deadline,
144 )?;
145 Ok(_response.map(|x| x.partitions))
146 }
147}
148
149#[cfg(target_os = "fuchsia")]
150impl From<OverlayPartitionSynchronousProxy> for zx::NullableHandle {
151 fn from(value: OverlayPartitionSynchronousProxy) -> Self {
152 value.into_channel().into()
153 }
154}
155
156#[cfg(target_os = "fuchsia")]
157impl From<fidl::Channel> for OverlayPartitionSynchronousProxy {
158 fn from(value: fidl::Channel) -> Self {
159 Self::new(value)
160 }
161}
162
163#[cfg(target_os = "fuchsia")]
164impl fidl::endpoints::FromClient for OverlayPartitionSynchronousProxy {
165 type Protocol = OverlayPartitionMarker;
166
167 fn from_client(value: fidl::endpoints::ClientEnd<OverlayPartitionMarker>) -> Self {
168 Self::new(value.into_channel())
169 }
170}
171
172#[derive(Debug, Clone)]
173pub struct OverlayPartitionProxy {
174 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
175}
176
177impl fidl::endpoints::Proxy for OverlayPartitionProxy {
178 type Protocol = OverlayPartitionMarker;
179
180 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
181 Self::new(inner)
182 }
183
184 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
185 self.client.into_channel().map_err(|client| Self { client })
186 }
187
188 fn as_channel(&self) -> &::fidl::AsyncChannel {
189 self.client.as_channel()
190 }
191}
192
193impl OverlayPartitionProxy {
194 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
196 let protocol_name = <OverlayPartitionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
197 Self { client: fidl::client::Client::new(channel, protocol_name) }
198 }
199
200 pub fn take_event_stream(&self) -> OverlayPartitionEventStream {
206 OverlayPartitionEventStream { event_receiver: self.client.take_event_receiver() }
207 }
208
209 pub fn r#get_partitions(
211 &self,
212 ) -> fidl::client::QueryResponseFut<
213 OverlayPartitionGetPartitionsResult,
214 fidl::encoding::DefaultFuchsiaResourceDialect,
215 > {
216 OverlayPartitionProxyInterface::r#get_partitions(self)
217 }
218}
219
220impl OverlayPartitionProxyInterface for OverlayPartitionProxy {
221 type GetPartitionsResponseFut = fidl::client::QueryResponseFut<
222 OverlayPartitionGetPartitionsResult,
223 fidl::encoding::DefaultFuchsiaResourceDialect,
224 >;
225 fn r#get_partitions(&self) -> Self::GetPartitionsResponseFut {
226 fn _decode(
227 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
228 ) -> Result<OverlayPartitionGetPartitionsResult, fidl::Error> {
229 let _response = fidl::client::decode_transaction_body::<
230 fidl::encoding::ResultType<OverlayPartitionGetPartitionsResponse, i32>,
231 fidl::encoding::DefaultFuchsiaResourceDialect,
232 0x7296daafa369c09b,
233 >(_buf?)?;
234 Ok(_response.map(|x| x.partitions))
235 }
236 self.client.send_query_and_decode::<
237 fidl::encoding::EmptyPayload,
238 OverlayPartitionGetPartitionsResult,
239 >(
240 (),
241 0x7296daafa369c09b,
242 fidl::encoding::DynamicFlags::empty(),
243 _decode,
244 )
245 }
246}
247
248pub struct OverlayPartitionEventStream {
249 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
250}
251
252impl std::marker::Unpin for OverlayPartitionEventStream {}
253
254impl futures::stream::FusedStream for OverlayPartitionEventStream {
255 fn is_terminated(&self) -> bool {
256 self.event_receiver.is_terminated()
257 }
258}
259
260impl futures::Stream for OverlayPartitionEventStream {
261 type Item = Result<OverlayPartitionEvent, fidl::Error>;
262
263 fn poll_next(
264 mut self: std::pin::Pin<&mut Self>,
265 cx: &mut std::task::Context<'_>,
266 ) -> std::task::Poll<Option<Self::Item>> {
267 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
268 &mut self.event_receiver,
269 cx
270 )?) {
271 Some(buf) => std::task::Poll::Ready(Some(OverlayPartitionEvent::decode(buf))),
272 None => std::task::Poll::Ready(None),
273 }
274 }
275}
276
277#[derive(Debug)]
278pub enum OverlayPartitionEvent {}
279
280impl OverlayPartitionEvent {
281 fn decode(
283 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
284 ) -> Result<OverlayPartitionEvent, fidl::Error> {
285 let (bytes, _handles) = buf.split_mut();
286 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
287 debug_assert_eq!(tx_header.tx_id, 0);
288 match tx_header.ordinal {
289 _ => Err(fidl::Error::UnknownOrdinal {
290 ordinal: tx_header.ordinal,
291 protocol_name:
292 <OverlayPartitionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
293 }),
294 }
295 }
296}
297
298pub struct OverlayPartitionRequestStream {
300 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
301 is_terminated: bool,
302}
303
304impl std::marker::Unpin for OverlayPartitionRequestStream {}
305
306impl futures::stream::FusedStream for OverlayPartitionRequestStream {
307 fn is_terminated(&self) -> bool {
308 self.is_terminated
309 }
310}
311
312impl fidl::endpoints::RequestStream for OverlayPartitionRequestStream {
313 type Protocol = OverlayPartitionMarker;
314 type ControlHandle = OverlayPartitionControlHandle;
315
316 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
317 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
318 }
319
320 fn control_handle(&self) -> Self::ControlHandle {
321 OverlayPartitionControlHandle { inner: self.inner.clone() }
322 }
323
324 fn into_inner(
325 self,
326 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
327 {
328 (self.inner, self.is_terminated)
329 }
330
331 fn from_inner(
332 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
333 is_terminated: bool,
334 ) -> Self {
335 Self { inner, is_terminated }
336 }
337}
338
339impl futures::Stream for OverlayPartitionRequestStream {
340 type Item = Result<OverlayPartitionRequest, fidl::Error>;
341
342 fn poll_next(
343 mut self: std::pin::Pin<&mut Self>,
344 cx: &mut std::task::Context<'_>,
345 ) -> std::task::Poll<Option<Self::Item>> {
346 let this = &mut *self;
347 if this.inner.check_shutdown(cx) {
348 this.is_terminated = true;
349 return std::task::Poll::Ready(None);
350 }
351 if this.is_terminated {
352 panic!("polled OverlayPartitionRequestStream after completion");
353 }
354 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
355 |bytes, handles| {
356 match this.inner.channel().read_etc(cx, bytes, handles) {
357 std::task::Poll::Ready(Ok(())) => {}
358 std::task::Poll::Pending => return std::task::Poll::Pending,
359 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
360 this.is_terminated = true;
361 return std::task::Poll::Ready(None);
362 }
363 std::task::Poll::Ready(Err(e)) => {
364 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
365 e.into(),
366 ))));
367 }
368 }
369
370 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
372
373 std::task::Poll::Ready(Some(match header.ordinal {
374 0x7296daafa369c09b => {
375 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
376 let mut req = fidl::new_empty!(
377 fidl::encoding::EmptyPayload,
378 fidl::encoding::DefaultFuchsiaResourceDialect
379 );
380 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
381 let control_handle =
382 OverlayPartitionControlHandle { inner: this.inner.clone() };
383 Ok(OverlayPartitionRequest::GetPartitions {
384 responder: OverlayPartitionGetPartitionsResponder {
385 control_handle: std::mem::ManuallyDrop::new(control_handle),
386 tx_id: header.tx_id,
387 },
388 })
389 }
390 _ => Err(fidl::Error::UnknownOrdinal {
391 ordinal: header.ordinal,
392 protocol_name:
393 <OverlayPartitionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
394 }),
395 }))
396 },
397 )
398 }
399}
400
401#[derive(Debug)]
403pub enum OverlayPartitionRequest {
404 GetPartitions { responder: OverlayPartitionGetPartitionsResponder },
406}
407
408impl OverlayPartitionRequest {
409 #[allow(irrefutable_let_patterns)]
410 pub fn into_get_partitions(self) -> Option<(OverlayPartitionGetPartitionsResponder)> {
411 if let OverlayPartitionRequest::GetPartitions { responder } = self {
412 Some((responder))
413 } else {
414 None
415 }
416 }
417
418 pub fn method_name(&self) -> &'static str {
420 match *self {
421 OverlayPartitionRequest::GetPartitions { .. } => "get_partitions",
422 }
423 }
424}
425
426#[derive(Debug, Clone)]
427pub struct OverlayPartitionControlHandle {
428 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
429}
430
431impl OverlayPartitionControlHandle {
432 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
433 self.inner.shutdown_with_epitaph(status.into())
434 }
435}
436
437impl fidl::endpoints::ControlHandle for OverlayPartitionControlHandle {
438 fn shutdown(&self) {
439 self.inner.shutdown()
440 }
441
442 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
443 self.inner.shutdown_with_epitaph(status)
444 }
445
446 fn is_closed(&self) -> bool {
447 self.inner.channel().is_closed()
448 }
449 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
450 self.inner.channel().on_closed()
451 }
452
453 #[cfg(target_os = "fuchsia")]
454 fn signal_peer(
455 &self,
456 clear_mask: zx::Signals,
457 set_mask: zx::Signals,
458 ) -> Result<(), zx_status::Status> {
459 use fidl::Peered;
460 self.inner.channel().signal_peer(clear_mask, set_mask)
461 }
462}
463
464impl OverlayPartitionControlHandle {}
465
466#[must_use = "FIDL methods require a response to be sent"]
467#[derive(Debug)]
468pub struct OverlayPartitionGetPartitionsResponder {
469 control_handle: std::mem::ManuallyDrop<OverlayPartitionControlHandle>,
470 tx_id: u32,
471}
472
473impl std::ops::Drop for OverlayPartitionGetPartitionsResponder {
477 fn drop(&mut self) {
478 self.control_handle.shutdown();
479 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
481 }
482}
483
484impl fidl::endpoints::Responder for OverlayPartitionGetPartitionsResponder {
485 type ControlHandle = OverlayPartitionControlHandle;
486
487 fn control_handle(&self) -> &OverlayPartitionControlHandle {
488 &self.control_handle
489 }
490
491 fn drop_without_shutdown(mut self) {
492 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
494 std::mem::forget(self);
496 }
497}
498
499impl OverlayPartitionGetPartitionsResponder {
500 pub fn send(
504 self,
505 mut result: Result<&[fidl_fuchsia_storage_block::PartitionInfo], i32>,
506 ) -> Result<(), fidl::Error> {
507 let _result = self.send_raw(result);
508 if _result.is_err() {
509 self.control_handle.shutdown();
510 }
511 self.drop_without_shutdown();
512 _result
513 }
514
515 pub fn send_no_shutdown_on_err(
517 self,
518 mut result: Result<&[fidl_fuchsia_storage_block::PartitionInfo], i32>,
519 ) -> Result<(), fidl::Error> {
520 let _result = self.send_raw(result);
521 self.drop_without_shutdown();
522 _result
523 }
524
525 fn send_raw(
526 &self,
527 mut result: Result<&[fidl_fuchsia_storage_block::PartitionInfo], i32>,
528 ) -> Result<(), fidl::Error> {
529 self.control_handle.inner.send::<fidl::encoding::ResultType<
530 OverlayPartitionGetPartitionsResponse,
531 i32,
532 >>(
533 result.map(|partitions| (partitions,)),
534 self.tx_id,
535 0x7296daafa369c09b,
536 fidl::encoding::DynamicFlags::empty(),
537 )
538 }
539}
540
541#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
542pub struct PartitionMarker;
543
544impl fidl::endpoints::ProtocolMarker for PartitionMarker {
545 type Proxy = PartitionProxy;
546 type RequestStream = PartitionRequestStream;
547 #[cfg(target_os = "fuchsia")]
548 type SynchronousProxy = PartitionSynchronousProxy;
549
550 const DEBUG_NAME: &'static str = "fuchsia.storage.partitions.Partition";
551}
552impl fidl::endpoints::DiscoverableProtocolMarker for PartitionMarker {}
553pub type PartitionUpdateMetadataResult = Result<(), i32>;
554
555pub trait PartitionProxyInterface: Send + Sync {
556 type UpdateMetadataResponseFut: std::future::Future<Output = Result<PartitionUpdateMetadataResult, fidl::Error>>
557 + Send;
558 fn r#update_metadata(
559 &self,
560 payload: PartitionUpdateMetadataRequest,
561 ) -> Self::UpdateMetadataResponseFut;
562}
563#[derive(Debug)]
564#[cfg(target_os = "fuchsia")]
565pub struct PartitionSynchronousProxy {
566 client: fidl::client::sync::Client,
567}
568
569#[cfg(target_os = "fuchsia")]
570impl fidl::endpoints::SynchronousProxy for PartitionSynchronousProxy {
571 type Proxy = PartitionProxy;
572 type Protocol = PartitionMarker;
573
574 fn from_channel(inner: fidl::Channel) -> Self {
575 Self::new(inner)
576 }
577
578 fn into_channel(self) -> fidl::Channel {
579 self.client.into_channel()
580 }
581
582 fn as_channel(&self) -> &fidl::Channel {
583 self.client.as_channel()
584 }
585}
586
587#[cfg(target_os = "fuchsia")]
588impl PartitionSynchronousProxy {
589 pub fn new(channel: fidl::Channel) -> Self {
590 Self { client: fidl::client::sync::Client::new(channel) }
591 }
592
593 pub fn into_channel(self) -> fidl::Channel {
594 self.client.into_channel()
595 }
596
597 pub fn wait_for_event(
600 &self,
601 deadline: zx::MonotonicInstant,
602 ) -> Result<PartitionEvent, fidl::Error> {
603 PartitionEvent::decode(self.client.wait_for_event::<PartitionMarker>(deadline)?)
604 }
605
606 pub fn r#update_metadata(
610 &self,
611 mut payload: PartitionUpdateMetadataRequest,
612 ___deadline: zx::MonotonicInstant,
613 ) -> Result<PartitionUpdateMetadataResult, fidl::Error> {
614 let _response = self.client.send_query::<
615 PartitionUpdateMetadataRequest,
616 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
617 PartitionMarker,
618 >(
619 &mut payload,
620 0x7bce44e5c9d5009c,
621 fidl::encoding::DynamicFlags::empty(),
622 ___deadline,
623 )?;
624 Ok(_response.map(|x| x))
625 }
626}
627
628#[cfg(target_os = "fuchsia")]
629impl From<PartitionSynchronousProxy> for zx::NullableHandle {
630 fn from(value: PartitionSynchronousProxy) -> Self {
631 value.into_channel().into()
632 }
633}
634
635#[cfg(target_os = "fuchsia")]
636impl From<fidl::Channel> for PartitionSynchronousProxy {
637 fn from(value: fidl::Channel) -> Self {
638 Self::new(value)
639 }
640}
641
642#[cfg(target_os = "fuchsia")]
643impl fidl::endpoints::FromClient for PartitionSynchronousProxy {
644 type Protocol = PartitionMarker;
645
646 fn from_client(value: fidl::endpoints::ClientEnd<PartitionMarker>) -> Self {
647 Self::new(value.into_channel())
648 }
649}
650
651#[derive(Debug, Clone)]
652pub struct PartitionProxy {
653 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
654}
655
656impl fidl::endpoints::Proxy for PartitionProxy {
657 type Protocol = PartitionMarker;
658
659 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
660 Self::new(inner)
661 }
662
663 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
664 self.client.into_channel().map_err(|client| Self { client })
665 }
666
667 fn as_channel(&self) -> &::fidl::AsyncChannel {
668 self.client.as_channel()
669 }
670}
671
672impl PartitionProxy {
673 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
675 let protocol_name = <PartitionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
676 Self { client: fidl::client::Client::new(channel, protocol_name) }
677 }
678
679 pub fn take_event_stream(&self) -> PartitionEventStream {
685 PartitionEventStream { event_receiver: self.client.take_event_receiver() }
686 }
687
688 pub fn r#update_metadata(
692 &self,
693 mut payload: PartitionUpdateMetadataRequest,
694 ) -> fidl::client::QueryResponseFut<
695 PartitionUpdateMetadataResult,
696 fidl::encoding::DefaultFuchsiaResourceDialect,
697 > {
698 PartitionProxyInterface::r#update_metadata(self, payload)
699 }
700}
701
702impl PartitionProxyInterface for PartitionProxy {
703 type UpdateMetadataResponseFut = fidl::client::QueryResponseFut<
704 PartitionUpdateMetadataResult,
705 fidl::encoding::DefaultFuchsiaResourceDialect,
706 >;
707 fn r#update_metadata(
708 &self,
709 mut payload: PartitionUpdateMetadataRequest,
710 ) -> Self::UpdateMetadataResponseFut {
711 fn _decode(
712 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
713 ) -> Result<PartitionUpdateMetadataResult, fidl::Error> {
714 let _response = fidl::client::decode_transaction_body::<
715 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
716 fidl::encoding::DefaultFuchsiaResourceDialect,
717 0x7bce44e5c9d5009c,
718 >(_buf?)?;
719 Ok(_response.map(|x| x))
720 }
721 self.client
722 .send_query_and_decode::<PartitionUpdateMetadataRequest, PartitionUpdateMetadataResult>(
723 &mut payload,
724 0x7bce44e5c9d5009c,
725 fidl::encoding::DynamicFlags::empty(),
726 _decode,
727 )
728 }
729}
730
731pub struct PartitionEventStream {
732 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
733}
734
735impl std::marker::Unpin for PartitionEventStream {}
736
737impl futures::stream::FusedStream for PartitionEventStream {
738 fn is_terminated(&self) -> bool {
739 self.event_receiver.is_terminated()
740 }
741}
742
743impl futures::Stream for PartitionEventStream {
744 type Item = Result<PartitionEvent, fidl::Error>;
745
746 fn poll_next(
747 mut self: std::pin::Pin<&mut Self>,
748 cx: &mut std::task::Context<'_>,
749 ) -> std::task::Poll<Option<Self::Item>> {
750 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
751 &mut self.event_receiver,
752 cx
753 )?) {
754 Some(buf) => std::task::Poll::Ready(Some(PartitionEvent::decode(buf))),
755 None => std::task::Poll::Ready(None),
756 }
757 }
758}
759
760#[derive(Debug)]
761pub enum PartitionEvent {}
762
763impl PartitionEvent {
764 fn decode(
766 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
767 ) -> Result<PartitionEvent, fidl::Error> {
768 let (bytes, _handles) = buf.split_mut();
769 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
770 debug_assert_eq!(tx_header.tx_id, 0);
771 match tx_header.ordinal {
772 _ => Err(fidl::Error::UnknownOrdinal {
773 ordinal: tx_header.ordinal,
774 protocol_name: <PartitionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
775 }),
776 }
777 }
778}
779
780pub struct PartitionRequestStream {
782 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
783 is_terminated: bool,
784}
785
786impl std::marker::Unpin for PartitionRequestStream {}
787
788impl futures::stream::FusedStream for PartitionRequestStream {
789 fn is_terminated(&self) -> bool {
790 self.is_terminated
791 }
792}
793
794impl fidl::endpoints::RequestStream for PartitionRequestStream {
795 type Protocol = PartitionMarker;
796 type ControlHandle = PartitionControlHandle;
797
798 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
799 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
800 }
801
802 fn control_handle(&self) -> Self::ControlHandle {
803 PartitionControlHandle { inner: self.inner.clone() }
804 }
805
806 fn into_inner(
807 self,
808 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
809 {
810 (self.inner, self.is_terminated)
811 }
812
813 fn from_inner(
814 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
815 is_terminated: bool,
816 ) -> Self {
817 Self { inner, is_terminated }
818 }
819}
820
821impl futures::Stream for PartitionRequestStream {
822 type Item = Result<PartitionRequest, fidl::Error>;
823
824 fn poll_next(
825 mut self: std::pin::Pin<&mut Self>,
826 cx: &mut std::task::Context<'_>,
827 ) -> std::task::Poll<Option<Self::Item>> {
828 let this = &mut *self;
829 if this.inner.check_shutdown(cx) {
830 this.is_terminated = true;
831 return std::task::Poll::Ready(None);
832 }
833 if this.is_terminated {
834 panic!("polled PartitionRequestStream after completion");
835 }
836 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
837 |bytes, handles| {
838 match this.inner.channel().read_etc(cx, bytes, handles) {
839 std::task::Poll::Ready(Ok(())) => {}
840 std::task::Poll::Pending => return std::task::Poll::Pending,
841 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
842 this.is_terminated = true;
843 return std::task::Poll::Ready(None);
844 }
845 std::task::Poll::Ready(Err(e)) => {
846 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
847 e.into(),
848 ))));
849 }
850 }
851
852 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
854
855 std::task::Poll::Ready(Some(match header.ordinal {
856 0x7bce44e5c9d5009c => {
857 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
858 let mut req = fidl::new_empty!(
859 PartitionUpdateMetadataRequest,
860 fidl::encoding::DefaultFuchsiaResourceDialect
861 );
862 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PartitionUpdateMetadataRequest>(&header, _body_bytes, handles, &mut req)?;
863 let control_handle = PartitionControlHandle { inner: this.inner.clone() };
864 Ok(PartitionRequest::UpdateMetadata {
865 payload: req,
866 responder: PartitionUpdateMetadataResponder {
867 control_handle: std::mem::ManuallyDrop::new(control_handle),
868 tx_id: header.tx_id,
869 },
870 })
871 }
872 _ => Err(fidl::Error::UnknownOrdinal {
873 ordinal: header.ordinal,
874 protocol_name:
875 <PartitionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
876 }),
877 }))
878 },
879 )
880 }
881}
882
883#[derive(Debug)]
889pub enum PartitionRequest {
890 UpdateMetadata {
894 payload: PartitionUpdateMetadataRequest,
895 responder: PartitionUpdateMetadataResponder,
896 },
897}
898
899impl PartitionRequest {
900 #[allow(irrefutable_let_patterns)]
901 pub fn into_update_metadata(
902 self,
903 ) -> Option<(PartitionUpdateMetadataRequest, PartitionUpdateMetadataResponder)> {
904 if let PartitionRequest::UpdateMetadata { payload, responder } = self {
905 Some((payload, responder))
906 } else {
907 None
908 }
909 }
910
911 pub fn method_name(&self) -> &'static str {
913 match *self {
914 PartitionRequest::UpdateMetadata { .. } => "update_metadata",
915 }
916 }
917}
918
919#[derive(Debug, Clone)]
920pub struct PartitionControlHandle {
921 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
922}
923
924impl PartitionControlHandle {
925 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
926 self.inner.shutdown_with_epitaph(status.into())
927 }
928}
929
930impl fidl::endpoints::ControlHandle for PartitionControlHandle {
931 fn shutdown(&self) {
932 self.inner.shutdown()
933 }
934
935 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
936 self.inner.shutdown_with_epitaph(status)
937 }
938
939 fn is_closed(&self) -> bool {
940 self.inner.channel().is_closed()
941 }
942 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
943 self.inner.channel().on_closed()
944 }
945
946 #[cfg(target_os = "fuchsia")]
947 fn signal_peer(
948 &self,
949 clear_mask: zx::Signals,
950 set_mask: zx::Signals,
951 ) -> Result<(), zx_status::Status> {
952 use fidl::Peered;
953 self.inner.channel().signal_peer(clear_mask, set_mask)
954 }
955}
956
957impl PartitionControlHandle {}
958
959#[must_use = "FIDL methods require a response to be sent"]
960#[derive(Debug)]
961pub struct PartitionUpdateMetadataResponder {
962 control_handle: std::mem::ManuallyDrop<PartitionControlHandle>,
963 tx_id: u32,
964}
965
966impl std::ops::Drop for PartitionUpdateMetadataResponder {
970 fn drop(&mut self) {
971 self.control_handle.shutdown();
972 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
974 }
975}
976
977impl fidl::endpoints::Responder for PartitionUpdateMetadataResponder {
978 type ControlHandle = PartitionControlHandle;
979
980 fn control_handle(&self) -> &PartitionControlHandle {
981 &self.control_handle
982 }
983
984 fn drop_without_shutdown(mut self) {
985 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
987 std::mem::forget(self);
989 }
990}
991
992impl PartitionUpdateMetadataResponder {
993 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
997 let _result = self.send_raw(result);
998 if _result.is_err() {
999 self.control_handle.shutdown();
1000 }
1001 self.drop_without_shutdown();
1002 _result
1003 }
1004
1005 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1007 let _result = self.send_raw(result);
1008 self.drop_without_shutdown();
1009 _result
1010 }
1011
1012 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1013 self.control_handle
1014 .inner
1015 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1016 result,
1017 self.tx_id,
1018 0x7bce44e5c9d5009c,
1019 fidl::encoding::DynamicFlags::empty(),
1020 )
1021 }
1022}
1023
1024#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1025pub struct PartitionsAdminMarker;
1026
1027impl fidl::endpoints::ProtocolMarker for PartitionsAdminMarker {
1028 type Proxy = PartitionsAdminProxy;
1029 type RequestStream = PartitionsAdminRequestStream;
1030 #[cfg(target_os = "fuchsia")]
1031 type SynchronousProxy = PartitionsAdminSynchronousProxy;
1032
1033 const DEBUG_NAME: &'static str = "fuchsia.storage.partitions.PartitionsAdmin";
1034}
1035impl fidl::endpoints::DiscoverableProtocolMarker for PartitionsAdminMarker {}
1036pub type PartitionsAdminResetPartitionTableResult = Result<(), i32>;
1037
1038pub trait PartitionsAdminProxyInterface: Send + Sync {
1039 type ResetPartitionTableResponseFut: std::future::Future<Output = Result<PartitionsAdminResetPartitionTableResult, fidl::Error>>
1040 + Send;
1041 fn r#reset_partition_table(
1042 &self,
1043 partitions: &[PartitionEntry],
1044 ) -> Self::ResetPartitionTableResponseFut;
1045}
1046#[derive(Debug)]
1047#[cfg(target_os = "fuchsia")]
1048pub struct PartitionsAdminSynchronousProxy {
1049 client: fidl::client::sync::Client,
1050}
1051
1052#[cfg(target_os = "fuchsia")]
1053impl fidl::endpoints::SynchronousProxy for PartitionsAdminSynchronousProxy {
1054 type Proxy = PartitionsAdminProxy;
1055 type Protocol = PartitionsAdminMarker;
1056
1057 fn from_channel(inner: fidl::Channel) -> Self {
1058 Self::new(inner)
1059 }
1060
1061 fn into_channel(self) -> fidl::Channel {
1062 self.client.into_channel()
1063 }
1064
1065 fn as_channel(&self) -> &fidl::Channel {
1066 self.client.as_channel()
1067 }
1068}
1069
1070#[cfg(target_os = "fuchsia")]
1071impl PartitionsAdminSynchronousProxy {
1072 pub fn new(channel: fidl::Channel) -> Self {
1073 Self { client: fidl::client::sync::Client::new(channel) }
1074 }
1075
1076 pub fn into_channel(self) -> fidl::Channel {
1077 self.client.into_channel()
1078 }
1079
1080 pub fn wait_for_event(
1083 &self,
1084 deadline: zx::MonotonicInstant,
1085 ) -> Result<PartitionsAdminEvent, fidl::Error> {
1086 PartitionsAdminEvent::decode(self.client.wait_for_event::<PartitionsAdminMarker>(deadline)?)
1087 }
1088
1089 pub fn r#reset_partition_table(
1098 &self,
1099 mut partitions: &[PartitionEntry],
1100 ___deadline: zx::MonotonicInstant,
1101 ) -> Result<PartitionsAdminResetPartitionTableResult, fidl::Error> {
1102 let _response = self.client.send_query::<
1103 PartitionsAdminResetPartitionTableRequest,
1104 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1105 PartitionsAdminMarker,
1106 >(
1107 (partitions,),
1108 0x6d999e2c120fef14,
1109 fidl::encoding::DynamicFlags::empty(),
1110 ___deadline,
1111 )?;
1112 Ok(_response.map(|x| x))
1113 }
1114}
1115
1116#[cfg(target_os = "fuchsia")]
1117impl From<PartitionsAdminSynchronousProxy> for zx::NullableHandle {
1118 fn from(value: PartitionsAdminSynchronousProxy) -> Self {
1119 value.into_channel().into()
1120 }
1121}
1122
1123#[cfg(target_os = "fuchsia")]
1124impl From<fidl::Channel> for PartitionsAdminSynchronousProxy {
1125 fn from(value: fidl::Channel) -> Self {
1126 Self::new(value)
1127 }
1128}
1129
1130#[cfg(target_os = "fuchsia")]
1131impl fidl::endpoints::FromClient for PartitionsAdminSynchronousProxy {
1132 type Protocol = PartitionsAdminMarker;
1133
1134 fn from_client(value: fidl::endpoints::ClientEnd<PartitionsAdminMarker>) -> Self {
1135 Self::new(value.into_channel())
1136 }
1137}
1138
1139#[derive(Debug, Clone)]
1140pub struct PartitionsAdminProxy {
1141 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1142}
1143
1144impl fidl::endpoints::Proxy for PartitionsAdminProxy {
1145 type Protocol = PartitionsAdminMarker;
1146
1147 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1148 Self::new(inner)
1149 }
1150
1151 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1152 self.client.into_channel().map_err(|client| Self { client })
1153 }
1154
1155 fn as_channel(&self) -> &::fidl::AsyncChannel {
1156 self.client.as_channel()
1157 }
1158}
1159
1160impl PartitionsAdminProxy {
1161 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1163 let protocol_name = <PartitionsAdminMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1164 Self { client: fidl::client::Client::new(channel, protocol_name) }
1165 }
1166
1167 pub fn take_event_stream(&self) -> PartitionsAdminEventStream {
1173 PartitionsAdminEventStream { event_receiver: self.client.take_event_receiver() }
1174 }
1175
1176 pub fn r#reset_partition_table(
1185 &self,
1186 mut partitions: &[PartitionEntry],
1187 ) -> fidl::client::QueryResponseFut<
1188 PartitionsAdminResetPartitionTableResult,
1189 fidl::encoding::DefaultFuchsiaResourceDialect,
1190 > {
1191 PartitionsAdminProxyInterface::r#reset_partition_table(self, partitions)
1192 }
1193}
1194
1195impl PartitionsAdminProxyInterface for PartitionsAdminProxy {
1196 type ResetPartitionTableResponseFut = fidl::client::QueryResponseFut<
1197 PartitionsAdminResetPartitionTableResult,
1198 fidl::encoding::DefaultFuchsiaResourceDialect,
1199 >;
1200 fn r#reset_partition_table(
1201 &self,
1202 mut partitions: &[PartitionEntry],
1203 ) -> Self::ResetPartitionTableResponseFut {
1204 fn _decode(
1205 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1206 ) -> Result<PartitionsAdminResetPartitionTableResult, fidl::Error> {
1207 let _response = fidl::client::decode_transaction_body::<
1208 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1209 fidl::encoding::DefaultFuchsiaResourceDialect,
1210 0x6d999e2c120fef14,
1211 >(_buf?)?;
1212 Ok(_response.map(|x| x))
1213 }
1214 self.client.send_query_and_decode::<
1215 PartitionsAdminResetPartitionTableRequest,
1216 PartitionsAdminResetPartitionTableResult,
1217 >(
1218 (partitions,),
1219 0x6d999e2c120fef14,
1220 fidl::encoding::DynamicFlags::empty(),
1221 _decode,
1222 )
1223 }
1224}
1225
1226pub struct PartitionsAdminEventStream {
1227 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1228}
1229
1230impl std::marker::Unpin for PartitionsAdminEventStream {}
1231
1232impl futures::stream::FusedStream for PartitionsAdminEventStream {
1233 fn is_terminated(&self) -> bool {
1234 self.event_receiver.is_terminated()
1235 }
1236}
1237
1238impl futures::Stream for PartitionsAdminEventStream {
1239 type Item = Result<PartitionsAdminEvent, fidl::Error>;
1240
1241 fn poll_next(
1242 mut self: std::pin::Pin<&mut Self>,
1243 cx: &mut std::task::Context<'_>,
1244 ) -> std::task::Poll<Option<Self::Item>> {
1245 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1246 &mut self.event_receiver,
1247 cx
1248 )?) {
1249 Some(buf) => std::task::Poll::Ready(Some(PartitionsAdminEvent::decode(buf))),
1250 None => std::task::Poll::Ready(None),
1251 }
1252 }
1253}
1254
1255#[derive(Debug)]
1256pub enum PartitionsAdminEvent {}
1257
1258impl PartitionsAdminEvent {
1259 fn decode(
1261 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1262 ) -> Result<PartitionsAdminEvent, fidl::Error> {
1263 let (bytes, _handles) = buf.split_mut();
1264 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1265 debug_assert_eq!(tx_header.tx_id, 0);
1266 match tx_header.ordinal {
1267 _ => Err(fidl::Error::UnknownOrdinal {
1268 ordinal: tx_header.ordinal,
1269 protocol_name:
1270 <PartitionsAdminMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1271 }),
1272 }
1273 }
1274}
1275
1276pub struct PartitionsAdminRequestStream {
1278 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1279 is_terminated: bool,
1280}
1281
1282impl std::marker::Unpin for PartitionsAdminRequestStream {}
1283
1284impl futures::stream::FusedStream for PartitionsAdminRequestStream {
1285 fn is_terminated(&self) -> bool {
1286 self.is_terminated
1287 }
1288}
1289
1290impl fidl::endpoints::RequestStream for PartitionsAdminRequestStream {
1291 type Protocol = PartitionsAdminMarker;
1292 type ControlHandle = PartitionsAdminControlHandle;
1293
1294 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1295 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1296 }
1297
1298 fn control_handle(&self) -> Self::ControlHandle {
1299 PartitionsAdminControlHandle { inner: self.inner.clone() }
1300 }
1301
1302 fn into_inner(
1303 self,
1304 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1305 {
1306 (self.inner, self.is_terminated)
1307 }
1308
1309 fn from_inner(
1310 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1311 is_terminated: bool,
1312 ) -> Self {
1313 Self { inner, is_terminated }
1314 }
1315}
1316
1317impl futures::Stream for PartitionsAdminRequestStream {
1318 type Item = Result<PartitionsAdminRequest, fidl::Error>;
1319
1320 fn poll_next(
1321 mut self: std::pin::Pin<&mut Self>,
1322 cx: &mut std::task::Context<'_>,
1323 ) -> std::task::Poll<Option<Self::Item>> {
1324 let this = &mut *self;
1325 if this.inner.check_shutdown(cx) {
1326 this.is_terminated = true;
1327 return std::task::Poll::Ready(None);
1328 }
1329 if this.is_terminated {
1330 panic!("polled PartitionsAdminRequestStream after completion");
1331 }
1332 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1333 |bytes, handles| {
1334 match this.inner.channel().read_etc(cx, bytes, handles) {
1335 std::task::Poll::Ready(Ok(())) => {}
1336 std::task::Poll::Pending => return std::task::Poll::Pending,
1337 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1338 this.is_terminated = true;
1339 return std::task::Poll::Ready(None);
1340 }
1341 std::task::Poll::Ready(Err(e)) => {
1342 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1343 e.into(),
1344 ))));
1345 }
1346 }
1347
1348 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1350
1351 std::task::Poll::Ready(Some(match header.ordinal {
1352 0x6d999e2c120fef14 => {
1353 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1354 let mut req = fidl::new_empty!(
1355 PartitionsAdminResetPartitionTableRequest,
1356 fidl::encoding::DefaultFuchsiaResourceDialect
1357 );
1358 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PartitionsAdminResetPartitionTableRequest>(&header, _body_bytes, handles, &mut req)?;
1359 let control_handle =
1360 PartitionsAdminControlHandle { inner: this.inner.clone() };
1361 Ok(PartitionsAdminRequest::ResetPartitionTable {
1362 partitions: req.partitions,
1363
1364 responder: PartitionsAdminResetPartitionTableResponder {
1365 control_handle: std::mem::ManuallyDrop::new(control_handle),
1366 tx_id: header.tx_id,
1367 },
1368 })
1369 }
1370 _ => Err(fidl::Error::UnknownOrdinal {
1371 ordinal: header.ordinal,
1372 protocol_name:
1373 <PartitionsAdminMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1374 }),
1375 }))
1376 },
1377 )
1378 }
1379}
1380
1381#[derive(Debug)]
1382pub enum PartitionsAdminRequest {
1383 ResetPartitionTable {
1392 partitions: Vec<PartitionEntry>,
1393 responder: PartitionsAdminResetPartitionTableResponder,
1394 },
1395}
1396
1397impl PartitionsAdminRequest {
1398 #[allow(irrefutable_let_patterns)]
1399 pub fn into_reset_partition_table(
1400 self,
1401 ) -> Option<(Vec<PartitionEntry>, PartitionsAdminResetPartitionTableResponder)> {
1402 if let PartitionsAdminRequest::ResetPartitionTable { partitions, responder } = self {
1403 Some((partitions, responder))
1404 } else {
1405 None
1406 }
1407 }
1408
1409 pub fn method_name(&self) -> &'static str {
1411 match *self {
1412 PartitionsAdminRequest::ResetPartitionTable { .. } => "reset_partition_table",
1413 }
1414 }
1415}
1416
1417#[derive(Debug, Clone)]
1418pub struct PartitionsAdminControlHandle {
1419 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1420}
1421
1422impl PartitionsAdminControlHandle {
1423 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
1424 self.inner.shutdown_with_epitaph(status.into())
1425 }
1426}
1427
1428impl fidl::endpoints::ControlHandle for PartitionsAdminControlHandle {
1429 fn shutdown(&self) {
1430 self.inner.shutdown()
1431 }
1432
1433 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
1434 self.inner.shutdown_with_epitaph(status)
1435 }
1436
1437 fn is_closed(&self) -> bool {
1438 self.inner.channel().is_closed()
1439 }
1440 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1441 self.inner.channel().on_closed()
1442 }
1443
1444 #[cfg(target_os = "fuchsia")]
1445 fn signal_peer(
1446 &self,
1447 clear_mask: zx::Signals,
1448 set_mask: zx::Signals,
1449 ) -> Result<(), zx_status::Status> {
1450 use fidl::Peered;
1451 self.inner.channel().signal_peer(clear_mask, set_mask)
1452 }
1453}
1454
1455impl PartitionsAdminControlHandle {}
1456
1457#[must_use = "FIDL methods require a response to be sent"]
1458#[derive(Debug)]
1459pub struct PartitionsAdminResetPartitionTableResponder {
1460 control_handle: std::mem::ManuallyDrop<PartitionsAdminControlHandle>,
1461 tx_id: u32,
1462}
1463
1464impl std::ops::Drop for PartitionsAdminResetPartitionTableResponder {
1468 fn drop(&mut self) {
1469 self.control_handle.shutdown();
1470 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1472 }
1473}
1474
1475impl fidl::endpoints::Responder for PartitionsAdminResetPartitionTableResponder {
1476 type ControlHandle = PartitionsAdminControlHandle;
1477
1478 fn control_handle(&self) -> &PartitionsAdminControlHandle {
1479 &self.control_handle
1480 }
1481
1482 fn drop_without_shutdown(mut self) {
1483 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1485 std::mem::forget(self);
1487 }
1488}
1489
1490impl PartitionsAdminResetPartitionTableResponder {
1491 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1495 let _result = self.send_raw(result);
1496 if _result.is_err() {
1497 self.control_handle.shutdown();
1498 }
1499 self.drop_without_shutdown();
1500 _result
1501 }
1502
1503 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1505 let _result = self.send_raw(result);
1506 self.drop_without_shutdown();
1507 _result
1508 }
1509
1510 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1511 self.control_handle
1512 .inner
1513 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1514 result,
1515 self.tx_id,
1516 0x6d999e2c120fef14,
1517 fidl::encoding::DynamicFlags::empty(),
1518 )
1519 }
1520}
1521
1522#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1523pub struct PartitionsManagerMarker;
1524
1525impl fidl::endpoints::ProtocolMarker for PartitionsManagerMarker {
1526 type Proxy = PartitionsManagerProxy;
1527 type RequestStream = PartitionsManagerRequestStream;
1528 #[cfg(target_os = "fuchsia")]
1529 type SynchronousProxy = PartitionsManagerSynchronousProxy;
1530
1531 const DEBUG_NAME: &'static str = "fuchsia.storage.partitions.PartitionsManager";
1532}
1533impl fidl::endpoints::DiscoverableProtocolMarker for PartitionsManagerMarker {}
1534pub type PartitionsManagerGetBlockInfoResult = Result<(u64, u32), i32>;
1535pub type PartitionsManagerCreateTransactionResult = Result<fidl::EventPair, i32>;
1536pub type PartitionsManagerCommitTransactionResult = Result<(), i32>;
1537pub type PartitionsManagerAddPartitionResult = Result<(), i32>;
1538
1539pub trait PartitionsManagerProxyInterface: Send + Sync {
1540 type GetBlockInfoResponseFut: std::future::Future<Output = Result<PartitionsManagerGetBlockInfoResult, fidl::Error>>
1541 + Send;
1542 fn r#get_block_info(&self) -> Self::GetBlockInfoResponseFut;
1543 type CreateTransactionResponseFut: std::future::Future<Output = Result<PartitionsManagerCreateTransactionResult, fidl::Error>>
1544 + Send;
1545 fn r#create_transaction(&self) -> Self::CreateTransactionResponseFut;
1546 type CommitTransactionResponseFut: std::future::Future<Output = Result<PartitionsManagerCommitTransactionResult, fidl::Error>>
1547 + Send;
1548 fn r#commit_transaction(
1549 &self,
1550 transaction: fidl::EventPair,
1551 ) -> Self::CommitTransactionResponseFut;
1552 type AddPartitionResponseFut: std::future::Future<Output = Result<PartitionsManagerAddPartitionResult, fidl::Error>>
1553 + Send;
1554 fn r#add_partition(
1555 &self,
1556 payload: PartitionsManagerAddPartitionRequest,
1557 ) -> Self::AddPartitionResponseFut;
1558}
1559#[derive(Debug)]
1560#[cfg(target_os = "fuchsia")]
1561pub struct PartitionsManagerSynchronousProxy {
1562 client: fidl::client::sync::Client,
1563}
1564
1565#[cfg(target_os = "fuchsia")]
1566impl fidl::endpoints::SynchronousProxy for PartitionsManagerSynchronousProxy {
1567 type Proxy = PartitionsManagerProxy;
1568 type Protocol = PartitionsManagerMarker;
1569
1570 fn from_channel(inner: fidl::Channel) -> Self {
1571 Self::new(inner)
1572 }
1573
1574 fn into_channel(self) -> fidl::Channel {
1575 self.client.into_channel()
1576 }
1577
1578 fn as_channel(&self) -> &fidl::Channel {
1579 self.client.as_channel()
1580 }
1581}
1582
1583#[cfg(target_os = "fuchsia")]
1584impl PartitionsManagerSynchronousProxy {
1585 pub fn new(channel: fidl::Channel) -> Self {
1586 Self { client: fidl::client::sync::Client::new(channel) }
1587 }
1588
1589 pub fn into_channel(self) -> fidl::Channel {
1590 self.client.into_channel()
1591 }
1592
1593 pub fn wait_for_event(
1596 &self,
1597 deadline: zx::MonotonicInstant,
1598 ) -> Result<PartitionsManagerEvent, fidl::Error> {
1599 PartitionsManagerEvent::decode(
1600 self.client.wait_for_event::<PartitionsManagerMarker>(deadline)?,
1601 )
1602 }
1603
1604 pub fn r#get_block_info(
1606 &self,
1607 ___deadline: zx::MonotonicInstant,
1608 ) -> Result<PartitionsManagerGetBlockInfoResult, fidl::Error> {
1609 let _response = self.client.send_query::<
1610 fidl::encoding::EmptyPayload,
1611 fidl::encoding::ResultType<PartitionsManagerGetBlockInfoResponse, i32>,
1612 PartitionsManagerMarker,
1613 >(
1614 (),
1615 0x55663648cae3a1ef,
1616 fidl::encoding::DynamicFlags::empty(),
1617 ___deadline,
1618 )?;
1619 Ok(_response.map(|x| (x.block_count, x.block_size)))
1620 }
1621
1622 pub fn r#create_transaction(
1630 &self,
1631 ___deadline: zx::MonotonicInstant,
1632 ) -> Result<PartitionsManagerCreateTransactionResult, fidl::Error> {
1633 let _response =
1634 self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::ResultType<
1635 PartitionsManagerCreateTransactionResponse,
1636 i32,
1637 >, PartitionsManagerMarker>(
1638 (),
1639 0x5cedad08ef04fd02,
1640 fidl::encoding::DynamicFlags::empty(),
1641 ___deadline,
1642 )?;
1643 Ok(_response.map(|x| x.transaction))
1644 }
1645
1646 pub fn r#commit_transaction(
1648 &self,
1649 mut transaction: fidl::EventPair,
1650 ___deadline: zx::MonotonicInstant,
1651 ) -> Result<PartitionsManagerCommitTransactionResult, fidl::Error> {
1652 let _response = self.client.send_query::<
1653 PartitionsManagerCommitTransactionRequest,
1654 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1655 PartitionsManagerMarker,
1656 >(
1657 (transaction,),
1658 0x2354762d579c7654,
1659 fidl::encoding::DynamicFlags::empty(),
1660 ___deadline,
1661 )?;
1662 Ok(_response.map(|x| x))
1663 }
1664
1665 pub fn r#add_partition(
1669 &self,
1670 mut payload: PartitionsManagerAddPartitionRequest,
1671 ___deadline: zx::MonotonicInstant,
1672 ) -> Result<PartitionsManagerAddPartitionResult, fidl::Error> {
1673 let _response = self.client.send_query::<
1674 PartitionsManagerAddPartitionRequest,
1675 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1676 PartitionsManagerMarker,
1677 >(
1678 &mut payload,
1679 0x32afa9f7acf47e38,
1680 fidl::encoding::DynamicFlags::empty(),
1681 ___deadline,
1682 )?;
1683 Ok(_response.map(|x| x))
1684 }
1685}
1686
1687#[cfg(target_os = "fuchsia")]
1688impl From<PartitionsManagerSynchronousProxy> for zx::NullableHandle {
1689 fn from(value: PartitionsManagerSynchronousProxy) -> Self {
1690 value.into_channel().into()
1691 }
1692}
1693
1694#[cfg(target_os = "fuchsia")]
1695impl From<fidl::Channel> for PartitionsManagerSynchronousProxy {
1696 fn from(value: fidl::Channel) -> Self {
1697 Self::new(value)
1698 }
1699}
1700
1701#[cfg(target_os = "fuchsia")]
1702impl fidl::endpoints::FromClient for PartitionsManagerSynchronousProxy {
1703 type Protocol = PartitionsManagerMarker;
1704
1705 fn from_client(value: fidl::endpoints::ClientEnd<PartitionsManagerMarker>) -> Self {
1706 Self::new(value.into_channel())
1707 }
1708}
1709
1710#[derive(Debug, Clone)]
1711pub struct PartitionsManagerProxy {
1712 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1713}
1714
1715impl fidl::endpoints::Proxy for PartitionsManagerProxy {
1716 type Protocol = PartitionsManagerMarker;
1717
1718 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1719 Self::new(inner)
1720 }
1721
1722 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1723 self.client.into_channel().map_err(|client| Self { client })
1724 }
1725
1726 fn as_channel(&self) -> &::fidl::AsyncChannel {
1727 self.client.as_channel()
1728 }
1729}
1730
1731impl PartitionsManagerProxy {
1732 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1734 let protocol_name =
1735 <PartitionsManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1736 Self { client: fidl::client::Client::new(channel, protocol_name) }
1737 }
1738
1739 pub fn take_event_stream(&self) -> PartitionsManagerEventStream {
1745 PartitionsManagerEventStream { event_receiver: self.client.take_event_receiver() }
1746 }
1747
1748 pub fn r#get_block_info(
1750 &self,
1751 ) -> fidl::client::QueryResponseFut<
1752 PartitionsManagerGetBlockInfoResult,
1753 fidl::encoding::DefaultFuchsiaResourceDialect,
1754 > {
1755 PartitionsManagerProxyInterface::r#get_block_info(self)
1756 }
1757
1758 pub fn r#create_transaction(
1766 &self,
1767 ) -> fidl::client::QueryResponseFut<
1768 PartitionsManagerCreateTransactionResult,
1769 fidl::encoding::DefaultFuchsiaResourceDialect,
1770 > {
1771 PartitionsManagerProxyInterface::r#create_transaction(self)
1772 }
1773
1774 pub fn r#commit_transaction(
1776 &self,
1777 mut transaction: fidl::EventPair,
1778 ) -> fidl::client::QueryResponseFut<
1779 PartitionsManagerCommitTransactionResult,
1780 fidl::encoding::DefaultFuchsiaResourceDialect,
1781 > {
1782 PartitionsManagerProxyInterface::r#commit_transaction(self, transaction)
1783 }
1784
1785 pub fn r#add_partition(
1789 &self,
1790 mut payload: PartitionsManagerAddPartitionRequest,
1791 ) -> fidl::client::QueryResponseFut<
1792 PartitionsManagerAddPartitionResult,
1793 fidl::encoding::DefaultFuchsiaResourceDialect,
1794 > {
1795 PartitionsManagerProxyInterface::r#add_partition(self, payload)
1796 }
1797}
1798
1799impl PartitionsManagerProxyInterface for PartitionsManagerProxy {
1800 type GetBlockInfoResponseFut = fidl::client::QueryResponseFut<
1801 PartitionsManagerGetBlockInfoResult,
1802 fidl::encoding::DefaultFuchsiaResourceDialect,
1803 >;
1804 fn r#get_block_info(&self) -> Self::GetBlockInfoResponseFut {
1805 fn _decode(
1806 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1807 ) -> Result<PartitionsManagerGetBlockInfoResult, fidl::Error> {
1808 let _response = fidl::client::decode_transaction_body::<
1809 fidl::encoding::ResultType<PartitionsManagerGetBlockInfoResponse, i32>,
1810 fidl::encoding::DefaultFuchsiaResourceDialect,
1811 0x55663648cae3a1ef,
1812 >(_buf?)?;
1813 Ok(_response.map(|x| (x.block_count, x.block_size)))
1814 }
1815 self.client.send_query_and_decode::<
1816 fidl::encoding::EmptyPayload,
1817 PartitionsManagerGetBlockInfoResult,
1818 >(
1819 (),
1820 0x55663648cae3a1ef,
1821 fidl::encoding::DynamicFlags::empty(),
1822 _decode,
1823 )
1824 }
1825
1826 type CreateTransactionResponseFut = fidl::client::QueryResponseFut<
1827 PartitionsManagerCreateTransactionResult,
1828 fidl::encoding::DefaultFuchsiaResourceDialect,
1829 >;
1830 fn r#create_transaction(&self) -> Self::CreateTransactionResponseFut {
1831 fn _decode(
1832 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1833 ) -> Result<PartitionsManagerCreateTransactionResult, fidl::Error> {
1834 let _response = fidl::client::decode_transaction_body::<
1835 fidl::encoding::ResultType<PartitionsManagerCreateTransactionResponse, i32>,
1836 fidl::encoding::DefaultFuchsiaResourceDialect,
1837 0x5cedad08ef04fd02,
1838 >(_buf?)?;
1839 Ok(_response.map(|x| x.transaction))
1840 }
1841 self.client.send_query_and_decode::<
1842 fidl::encoding::EmptyPayload,
1843 PartitionsManagerCreateTransactionResult,
1844 >(
1845 (),
1846 0x5cedad08ef04fd02,
1847 fidl::encoding::DynamicFlags::empty(),
1848 _decode,
1849 )
1850 }
1851
1852 type CommitTransactionResponseFut = fidl::client::QueryResponseFut<
1853 PartitionsManagerCommitTransactionResult,
1854 fidl::encoding::DefaultFuchsiaResourceDialect,
1855 >;
1856 fn r#commit_transaction(
1857 &self,
1858 mut transaction: fidl::EventPair,
1859 ) -> Self::CommitTransactionResponseFut {
1860 fn _decode(
1861 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1862 ) -> Result<PartitionsManagerCommitTransactionResult, fidl::Error> {
1863 let _response = fidl::client::decode_transaction_body::<
1864 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1865 fidl::encoding::DefaultFuchsiaResourceDialect,
1866 0x2354762d579c7654,
1867 >(_buf?)?;
1868 Ok(_response.map(|x| x))
1869 }
1870 self.client.send_query_and_decode::<
1871 PartitionsManagerCommitTransactionRequest,
1872 PartitionsManagerCommitTransactionResult,
1873 >(
1874 (transaction,),
1875 0x2354762d579c7654,
1876 fidl::encoding::DynamicFlags::empty(),
1877 _decode,
1878 )
1879 }
1880
1881 type AddPartitionResponseFut = fidl::client::QueryResponseFut<
1882 PartitionsManagerAddPartitionResult,
1883 fidl::encoding::DefaultFuchsiaResourceDialect,
1884 >;
1885 fn r#add_partition(
1886 &self,
1887 mut payload: PartitionsManagerAddPartitionRequest,
1888 ) -> Self::AddPartitionResponseFut {
1889 fn _decode(
1890 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1891 ) -> Result<PartitionsManagerAddPartitionResult, fidl::Error> {
1892 let _response = fidl::client::decode_transaction_body::<
1893 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1894 fidl::encoding::DefaultFuchsiaResourceDialect,
1895 0x32afa9f7acf47e38,
1896 >(_buf?)?;
1897 Ok(_response.map(|x| x))
1898 }
1899 self.client.send_query_and_decode::<
1900 PartitionsManagerAddPartitionRequest,
1901 PartitionsManagerAddPartitionResult,
1902 >(
1903 &mut payload,
1904 0x32afa9f7acf47e38,
1905 fidl::encoding::DynamicFlags::empty(),
1906 _decode,
1907 )
1908 }
1909}
1910
1911pub struct PartitionsManagerEventStream {
1912 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1913}
1914
1915impl std::marker::Unpin for PartitionsManagerEventStream {}
1916
1917impl futures::stream::FusedStream for PartitionsManagerEventStream {
1918 fn is_terminated(&self) -> bool {
1919 self.event_receiver.is_terminated()
1920 }
1921}
1922
1923impl futures::Stream for PartitionsManagerEventStream {
1924 type Item = Result<PartitionsManagerEvent, fidl::Error>;
1925
1926 fn poll_next(
1927 mut self: std::pin::Pin<&mut Self>,
1928 cx: &mut std::task::Context<'_>,
1929 ) -> std::task::Poll<Option<Self::Item>> {
1930 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1931 &mut self.event_receiver,
1932 cx
1933 )?) {
1934 Some(buf) => std::task::Poll::Ready(Some(PartitionsManagerEvent::decode(buf))),
1935 None => std::task::Poll::Ready(None),
1936 }
1937 }
1938}
1939
1940#[derive(Debug)]
1941pub enum PartitionsManagerEvent {}
1942
1943impl PartitionsManagerEvent {
1944 fn decode(
1946 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1947 ) -> Result<PartitionsManagerEvent, fidl::Error> {
1948 let (bytes, _handles) = buf.split_mut();
1949 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1950 debug_assert_eq!(tx_header.tx_id, 0);
1951 match tx_header.ordinal {
1952 _ => Err(fidl::Error::UnknownOrdinal {
1953 ordinal: tx_header.ordinal,
1954 protocol_name:
1955 <PartitionsManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1956 }),
1957 }
1958 }
1959}
1960
1961pub struct PartitionsManagerRequestStream {
1963 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1964 is_terminated: bool,
1965}
1966
1967impl std::marker::Unpin for PartitionsManagerRequestStream {}
1968
1969impl futures::stream::FusedStream for PartitionsManagerRequestStream {
1970 fn is_terminated(&self) -> bool {
1971 self.is_terminated
1972 }
1973}
1974
1975impl fidl::endpoints::RequestStream for PartitionsManagerRequestStream {
1976 type Protocol = PartitionsManagerMarker;
1977 type ControlHandle = PartitionsManagerControlHandle;
1978
1979 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1980 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1981 }
1982
1983 fn control_handle(&self) -> Self::ControlHandle {
1984 PartitionsManagerControlHandle { inner: self.inner.clone() }
1985 }
1986
1987 fn into_inner(
1988 self,
1989 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1990 {
1991 (self.inner, self.is_terminated)
1992 }
1993
1994 fn from_inner(
1995 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1996 is_terminated: bool,
1997 ) -> Self {
1998 Self { inner, is_terminated }
1999 }
2000}
2001
2002impl futures::Stream for PartitionsManagerRequestStream {
2003 type Item = Result<PartitionsManagerRequest, fidl::Error>;
2004
2005 fn poll_next(
2006 mut self: std::pin::Pin<&mut Self>,
2007 cx: &mut std::task::Context<'_>,
2008 ) -> std::task::Poll<Option<Self::Item>> {
2009 let this = &mut *self;
2010 if this.inner.check_shutdown(cx) {
2011 this.is_terminated = true;
2012 return std::task::Poll::Ready(None);
2013 }
2014 if this.is_terminated {
2015 panic!("polled PartitionsManagerRequestStream after completion");
2016 }
2017 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2018 |bytes, handles| {
2019 match this.inner.channel().read_etc(cx, bytes, handles) {
2020 std::task::Poll::Ready(Ok(())) => {}
2021 std::task::Poll::Pending => return std::task::Poll::Pending,
2022 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2023 this.is_terminated = true;
2024 return std::task::Poll::Ready(None);
2025 }
2026 std::task::Poll::Ready(Err(e)) => {
2027 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2028 e.into(),
2029 ))));
2030 }
2031 }
2032
2033 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2035
2036 std::task::Poll::Ready(Some(match header.ordinal {
2037 0x55663648cae3a1ef => {
2038 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2039 let mut req = fidl::new_empty!(
2040 fidl::encoding::EmptyPayload,
2041 fidl::encoding::DefaultFuchsiaResourceDialect
2042 );
2043 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2044 let control_handle =
2045 PartitionsManagerControlHandle { inner: this.inner.clone() };
2046 Ok(PartitionsManagerRequest::GetBlockInfo {
2047 responder: PartitionsManagerGetBlockInfoResponder {
2048 control_handle: std::mem::ManuallyDrop::new(control_handle),
2049 tx_id: header.tx_id,
2050 },
2051 })
2052 }
2053 0x5cedad08ef04fd02 => {
2054 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2055 let mut req = fidl::new_empty!(
2056 fidl::encoding::EmptyPayload,
2057 fidl::encoding::DefaultFuchsiaResourceDialect
2058 );
2059 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2060 let control_handle =
2061 PartitionsManagerControlHandle { inner: this.inner.clone() };
2062 Ok(PartitionsManagerRequest::CreateTransaction {
2063 responder: PartitionsManagerCreateTransactionResponder {
2064 control_handle: std::mem::ManuallyDrop::new(control_handle),
2065 tx_id: header.tx_id,
2066 },
2067 })
2068 }
2069 0x2354762d579c7654 => {
2070 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2071 let mut req = fidl::new_empty!(
2072 PartitionsManagerCommitTransactionRequest,
2073 fidl::encoding::DefaultFuchsiaResourceDialect
2074 );
2075 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PartitionsManagerCommitTransactionRequest>(&header, _body_bytes, handles, &mut req)?;
2076 let control_handle =
2077 PartitionsManagerControlHandle { inner: this.inner.clone() };
2078 Ok(PartitionsManagerRequest::CommitTransaction {
2079 transaction: req.transaction,
2080
2081 responder: PartitionsManagerCommitTransactionResponder {
2082 control_handle: std::mem::ManuallyDrop::new(control_handle),
2083 tx_id: header.tx_id,
2084 },
2085 })
2086 }
2087 0x32afa9f7acf47e38 => {
2088 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2089 let mut req = fidl::new_empty!(
2090 PartitionsManagerAddPartitionRequest,
2091 fidl::encoding::DefaultFuchsiaResourceDialect
2092 );
2093 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PartitionsManagerAddPartitionRequest>(&header, _body_bytes, handles, &mut req)?;
2094 let control_handle =
2095 PartitionsManagerControlHandle { inner: this.inner.clone() };
2096 Ok(PartitionsManagerRequest::AddPartition {
2097 payload: req,
2098 responder: PartitionsManagerAddPartitionResponder {
2099 control_handle: std::mem::ManuallyDrop::new(control_handle),
2100 tx_id: header.tx_id,
2101 },
2102 })
2103 }
2104 _ => Err(fidl::Error::UnknownOrdinal {
2105 ordinal: header.ordinal,
2106 protocol_name:
2107 <PartitionsManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2108 }),
2109 }))
2110 },
2111 )
2112 }
2113}
2114
2115#[derive(Debug)]
2116pub enum PartitionsManagerRequest {
2117 GetBlockInfo { responder: PartitionsManagerGetBlockInfoResponder },
2119 CreateTransaction { responder: PartitionsManagerCreateTransactionResponder },
2127 CommitTransaction {
2129 transaction: fidl::EventPair,
2130 responder: PartitionsManagerCommitTransactionResponder,
2131 },
2132 AddPartition {
2136 payload: PartitionsManagerAddPartitionRequest,
2137 responder: PartitionsManagerAddPartitionResponder,
2138 },
2139}
2140
2141impl PartitionsManagerRequest {
2142 #[allow(irrefutable_let_patterns)]
2143 pub fn into_get_block_info(self) -> Option<(PartitionsManagerGetBlockInfoResponder)> {
2144 if let PartitionsManagerRequest::GetBlockInfo { responder } = self {
2145 Some((responder))
2146 } else {
2147 None
2148 }
2149 }
2150
2151 #[allow(irrefutable_let_patterns)]
2152 pub fn into_create_transaction(self) -> Option<(PartitionsManagerCreateTransactionResponder)> {
2153 if let PartitionsManagerRequest::CreateTransaction { responder } = self {
2154 Some((responder))
2155 } else {
2156 None
2157 }
2158 }
2159
2160 #[allow(irrefutable_let_patterns)]
2161 pub fn into_commit_transaction(
2162 self,
2163 ) -> Option<(fidl::EventPair, PartitionsManagerCommitTransactionResponder)> {
2164 if let PartitionsManagerRequest::CommitTransaction { transaction, responder } = self {
2165 Some((transaction, responder))
2166 } else {
2167 None
2168 }
2169 }
2170
2171 #[allow(irrefutable_let_patterns)]
2172 pub fn into_add_partition(
2173 self,
2174 ) -> Option<(PartitionsManagerAddPartitionRequest, PartitionsManagerAddPartitionResponder)>
2175 {
2176 if let PartitionsManagerRequest::AddPartition { payload, responder } = self {
2177 Some((payload, responder))
2178 } else {
2179 None
2180 }
2181 }
2182
2183 pub fn method_name(&self) -> &'static str {
2185 match *self {
2186 PartitionsManagerRequest::GetBlockInfo { .. } => "get_block_info",
2187 PartitionsManagerRequest::CreateTransaction { .. } => "create_transaction",
2188 PartitionsManagerRequest::CommitTransaction { .. } => "commit_transaction",
2189 PartitionsManagerRequest::AddPartition { .. } => "add_partition",
2190 }
2191 }
2192}
2193
2194#[derive(Debug, Clone)]
2195pub struct PartitionsManagerControlHandle {
2196 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2197}
2198
2199impl PartitionsManagerControlHandle {
2200 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
2201 self.inner.shutdown_with_epitaph(status.into())
2202 }
2203}
2204
2205impl fidl::endpoints::ControlHandle for PartitionsManagerControlHandle {
2206 fn shutdown(&self) {
2207 self.inner.shutdown()
2208 }
2209
2210 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
2211 self.inner.shutdown_with_epitaph(status)
2212 }
2213
2214 fn is_closed(&self) -> bool {
2215 self.inner.channel().is_closed()
2216 }
2217 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2218 self.inner.channel().on_closed()
2219 }
2220
2221 #[cfg(target_os = "fuchsia")]
2222 fn signal_peer(
2223 &self,
2224 clear_mask: zx::Signals,
2225 set_mask: zx::Signals,
2226 ) -> Result<(), zx_status::Status> {
2227 use fidl::Peered;
2228 self.inner.channel().signal_peer(clear_mask, set_mask)
2229 }
2230}
2231
2232impl PartitionsManagerControlHandle {}
2233
2234#[must_use = "FIDL methods require a response to be sent"]
2235#[derive(Debug)]
2236pub struct PartitionsManagerGetBlockInfoResponder {
2237 control_handle: std::mem::ManuallyDrop<PartitionsManagerControlHandle>,
2238 tx_id: u32,
2239}
2240
2241impl std::ops::Drop for PartitionsManagerGetBlockInfoResponder {
2245 fn drop(&mut self) {
2246 self.control_handle.shutdown();
2247 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2249 }
2250}
2251
2252impl fidl::endpoints::Responder for PartitionsManagerGetBlockInfoResponder {
2253 type ControlHandle = PartitionsManagerControlHandle;
2254
2255 fn control_handle(&self) -> &PartitionsManagerControlHandle {
2256 &self.control_handle
2257 }
2258
2259 fn drop_without_shutdown(mut self) {
2260 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2262 std::mem::forget(self);
2264 }
2265}
2266
2267impl PartitionsManagerGetBlockInfoResponder {
2268 pub fn send(self, mut result: Result<(u64, u32), i32>) -> Result<(), fidl::Error> {
2272 let _result = self.send_raw(result);
2273 if _result.is_err() {
2274 self.control_handle.shutdown();
2275 }
2276 self.drop_without_shutdown();
2277 _result
2278 }
2279
2280 pub fn send_no_shutdown_on_err(
2282 self,
2283 mut result: Result<(u64, u32), i32>,
2284 ) -> Result<(), fidl::Error> {
2285 let _result = self.send_raw(result);
2286 self.drop_without_shutdown();
2287 _result
2288 }
2289
2290 fn send_raw(&self, mut result: Result<(u64, u32), i32>) -> Result<(), fidl::Error> {
2291 self.control_handle.inner.send::<fidl::encoding::ResultType<
2292 PartitionsManagerGetBlockInfoResponse,
2293 i32,
2294 >>(
2295 result,
2296 self.tx_id,
2297 0x55663648cae3a1ef,
2298 fidl::encoding::DynamicFlags::empty(),
2299 )
2300 }
2301}
2302
2303#[must_use = "FIDL methods require a response to be sent"]
2304#[derive(Debug)]
2305pub struct PartitionsManagerCreateTransactionResponder {
2306 control_handle: std::mem::ManuallyDrop<PartitionsManagerControlHandle>,
2307 tx_id: u32,
2308}
2309
2310impl std::ops::Drop for PartitionsManagerCreateTransactionResponder {
2314 fn drop(&mut self) {
2315 self.control_handle.shutdown();
2316 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2318 }
2319}
2320
2321impl fidl::endpoints::Responder for PartitionsManagerCreateTransactionResponder {
2322 type ControlHandle = PartitionsManagerControlHandle;
2323
2324 fn control_handle(&self) -> &PartitionsManagerControlHandle {
2325 &self.control_handle
2326 }
2327
2328 fn drop_without_shutdown(mut self) {
2329 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2331 std::mem::forget(self);
2333 }
2334}
2335
2336impl PartitionsManagerCreateTransactionResponder {
2337 pub fn send(self, mut result: Result<fidl::EventPair, i32>) -> Result<(), fidl::Error> {
2341 let _result = self.send_raw(result);
2342 if _result.is_err() {
2343 self.control_handle.shutdown();
2344 }
2345 self.drop_without_shutdown();
2346 _result
2347 }
2348
2349 pub fn send_no_shutdown_on_err(
2351 self,
2352 mut result: Result<fidl::EventPair, i32>,
2353 ) -> Result<(), fidl::Error> {
2354 let _result = self.send_raw(result);
2355 self.drop_without_shutdown();
2356 _result
2357 }
2358
2359 fn send_raw(&self, mut result: Result<fidl::EventPair, i32>) -> Result<(), fidl::Error> {
2360 self.control_handle.inner.send::<fidl::encoding::ResultType<
2361 PartitionsManagerCreateTransactionResponse,
2362 i32,
2363 >>(
2364 result.map(|transaction| (transaction,)),
2365 self.tx_id,
2366 0x5cedad08ef04fd02,
2367 fidl::encoding::DynamicFlags::empty(),
2368 )
2369 }
2370}
2371
2372#[must_use = "FIDL methods require a response to be sent"]
2373#[derive(Debug)]
2374pub struct PartitionsManagerCommitTransactionResponder {
2375 control_handle: std::mem::ManuallyDrop<PartitionsManagerControlHandle>,
2376 tx_id: u32,
2377}
2378
2379impl std::ops::Drop for PartitionsManagerCommitTransactionResponder {
2383 fn drop(&mut self) {
2384 self.control_handle.shutdown();
2385 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2387 }
2388}
2389
2390impl fidl::endpoints::Responder for PartitionsManagerCommitTransactionResponder {
2391 type ControlHandle = PartitionsManagerControlHandle;
2392
2393 fn control_handle(&self) -> &PartitionsManagerControlHandle {
2394 &self.control_handle
2395 }
2396
2397 fn drop_without_shutdown(mut self) {
2398 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2400 std::mem::forget(self);
2402 }
2403}
2404
2405impl PartitionsManagerCommitTransactionResponder {
2406 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2410 let _result = self.send_raw(result);
2411 if _result.is_err() {
2412 self.control_handle.shutdown();
2413 }
2414 self.drop_without_shutdown();
2415 _result
2416 }
2417
2418 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2420 let _result = self.send_raw(result);
2421 self.drop_without_shutdown();
2422 _result
2423 }
2424
2425 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2426 self.control_handle
2427 .inner
2428 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
2429 result,
2430 self.tx_id,
2431 0x2354762d579c7654,
2432 fidl::encoding::DynamicFlags::empty(),
2433 )
2434 }
2435}
2436
2437#[must_use = "FIDL methods require a response to be sent"]
2438#[derive(Debug)]
2439pub struct PartitionsManagerAddPartitionResponder {
2440 control_handle: std::mem::ManuallyDrop<PartitionsManagerControlHandle>,
2441 tx_id: u32,
2442}
2443
2444impl std::ops::Drop for PartitionsManagerAddPartitionResponder {
2448 fn drop(&mut self) {
2449 self.control_handle.shutdown();
2450 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2452 }
2453}
2454
2455impl fidl::endpoints::Responder for PartitionsManagerAddPartitionResponder {
2456 type ControlHandle = PartitionsManagerControlHandle;
2457
2458 fn control_handle(&self) -> &PartitionsManagerControlHandle {
2459 &self.control_handle
2460 }
2461
2462 fn drop_without_shutdown(mut self) {
2463 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2465 std::mem::forget(self);
2467 }
2468}
2469
2470impl PartitionsManagerAddPartitionResponder {
2471 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2475 let _result = self.send_raw(result);
2476 if _result.is_err() {
2477 self.control_handle.shutdown();
2478 }
2479 self.drop_without_shutdown();
2480 _result
2481 }
2482
2483 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2485 let _result = self.send_raw(result);
2486 self.drop_without_shutdown();
2487 _result
2488 }
2489
2490 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2491 self.control_handle
2492 .inner
2493 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
2494 result,
2495 self.tx_id,
2496 0x32afa9f7acf47e38,
2497 fidl::encoding::DynamicFlags::empty(),
2498 )
2499 }
2500}
2501
2502#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2503pub struct PartitionServiceMarker;
2504
2505#[cfg(target_os = "fuchsia")]
2506impl fidl::endpoints::ServiceMarker for PartitionServiceMarker {
2507 type Proxy = PartitionServiceProxy;
2508 type Request = PartitionServiceRequest;
2509 const SERVICE_NAME: &'static str = "fuchsia.storage.partitions.PartitionService";
2510}
2511
2512#[cfg(target_os = "fuchsia")]
2517pub enum PartitionServiceRequest {
2518 Volume(fidl_fuchsia_storage_block::BlockRequestStream),
2520 Mapper(fidl_fuchsia_storage_block::MapperRequestStream),
2522 Partition(PartitionRequestStream),
2524 Overlay(OverlayPartitionRequestStream),
2527}
2528
2529#[cfg(target_os = "fuchsia")]
2530impl fidl::endpoints::ServiceRequest for PartitionServiceRequest {
2531 type Service = PartitionServiceMarker;
2532
2533 fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
2534 match name {
2535 "volume" => Self::Volume(
2536 <fidl_fuchsia_storage_block::BlockRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
2537 ),
2538 "mapper" => Self::Mapper(
2539 <fidl_fuchsia_storage_block::MapperRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
2540 ),
2541 "partition" => Self::Partition(
2542 <PartitionRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
2543 ),
2544 "overlay" => Self::Overlay(
2545 <OverlayPartitionRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
2546 ),
2547 _ => panic!("no such member protocol name for service PartitionService"),
2548 }
2549 }
2550
2551 fn member_names() -> &'static [&'static str] {
2552 &["volume", "mapper", "partition", "overlay"]
2553 }
2554}
2555#[cfg(target_os = "fuchsia")]
2558pub struct PartitionServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
2559
2560#[cfg(target_os = "fuchsia")]
2561impl fidl::endpoints::ServiceProxy for PartitionServiceProxy {
2562 type Service = PartitionServiceMarker;
2563
2564 fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
2565 Self(opener)
2566 }
2567}
2568
2569#[cfg(target_os = "fuchsia")]
2570impl PartitionServiceProxy {
2571 pub fn connect_to_volume(&self) -> Result<fidl_fuchsia_storage_block::BlockProxy, fidl::Error> {
2573 let (proxy, server_end) =
2574 fidl::endpoints::create_proxy::<fidl_fuchsia_storage_block::BlockMarker>();
2575 self.connect_channel_to_volume(server_end)?;
2576 Ok(proxy)
2577 }
2578
2579 pub fn connect_to_volume_sync(
2582 &self,
2583 ) -> Result<fidl_fuchsia_storage_block::BlockSynchronousProxy, fidl::Error> {
2584 let (proxy, server_end) =
2585 fidl::endpoints::create_sync_proxy::<fidl_fuchsia_storage_block::BlockMarker>();
2586 self.connect_channel_to_volume(server_end)?;
2587 Ok(proxy)
2588 }
2589
2590 pub fn connect_channel_to_volume(
2593 &self,
2594 server_end: fidl::endpoints::ServerEnd<fidl_fuchsia_storage_block::BlockMarker>,
2595 ) -> Result<(), fidl::Error> {
2596 self.0.open_member("volume", server_end.into_channel())
2597 }
2598 pub fn connect_to_mapper(
2600 &self,
2601 ) -> Result<fidl_fuchsia_storage_block::MapperProxy, fidl::Error> {
2602 let (proxy, server_end) =
2603 fidl::endpoints::create_proxy::<fidl_fuchsia_storage_block::MapperMarker>();
2604 self.connect_channel_to_mapper(server_end)?;
2605 Ok(proxy)
2606 }
2607
2608 pub fn connect_to_mapper_sync(
2611 &self,
2612 ) -> Result<fidl_fuchsia_storage_block::MapperSynchronousProxy, fidl::Error> {
2613 let (proxy, server_end) =
2614 fidl::endpoints::create_sync_proxy::<fidl_fuchsia_storage_block::MapperMarker>();
2615 self.connect_channel_to_mapper(server_end)?;
2616 Ok(proxy)
2617 }
2618
2619 pub fn connect_channel_to_mapper(
2622 &self,
2623 server_end: fidl::endpoints::ServerEnd<fidl_fuchsia_storage_block::MapperMarker>,
2624 ) -> Result<(), fidl::Error> {
2625 self.0.open_member("mapper", server_end.into_channel())
2626 }
2627 pub fn connect_to_partition(&self) -> Result<PartitionProxy, fidl::Error> {
2629 let (proxy, server_end) = fidl::endpoints::create_proxy::<PartitionMarker>();
2630 self.connect_channel_to_partition(server_end)?;
2631 Ok(proxy)
2632 }
2633
2634 pub fn connect_to_partition_sync(&self) -> Result<PartitionSynchronousProxy, fidl::Error> {
2637 let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<PartitionMarker>();
2638 self.connect_channel_to_partition(server_end)?;
2639 Ok(proxy)
2640 }
2641
2642 pub fn connect_channel_to_partition(
2645 &self,
2646 server_end: fidl::endpoints::ServerEnd<PartitionMarker>,
2647 ) -> Result<(), fidl::Error> {
2648 self.0.open_member("partition", server_end.into_channel())
2649 }
2650 pub fn connect_to_overlay(&self) -> Result<OverlayPartitionProxy, fidl::Error> {
2653 let (proxy, server_end) = fidl::endpoints::create_proxy::<OverlayPartitionMarker>();
2654 self.connect_channel_to_overlay(server_end)?;
2655 Ok(proxy)
2656 }
2657
2658 pub fn connect_to_overlay_sync(&self) -> Result<OverlayPartitionSynchronousProxy, fidl::Error> {
2661 let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<OverlayPartitionMarker>();
2662 self.connect_channel_to_overlay(server_end)?;
2663 Ok(proxy)
2664 }
2665
2666 pub fn connect_channel_to_overlay(
2669 &self,
2670 server_end: fidl::endpoints::ServerEnd<OverlayPartitionMarker>,
2671 ) -> Result<(), fidl::Error> {
2672 self.0.open_member("overlay", server_end.into_channel())
2673 }
2674
2675 pub fn instance_name(&self) -> &str {
2676 self.0.instance_name()
2677 }
2678}
2679
2680mod internal {
2681 use super::*;
2682
2683 impl fidl::encoding::ResourceTypeMarker for PartitionsManagerCommitTransactionRequest {
2684 type Borrowed<'a> = &'a mut Self;
2685 fn take_or_borrow<'a>(
2686 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2687 ) -> Self::Borrowed<'a> {
2688 value
2689 }
2690 }
2691
2692 unsafe impl fidl::encoding::TypeMarker for PartitionsManagerCommitTransactionRequest {
2693 type Owned = Self;
2694
2695 #[inline(always)]
2696 fn inline_align(_context: fidl::encoding::Context) -> usize {
2697 4
2698 }
2699
2700 #[inline(always)]
2701 fn inline_size(_context: fidl::encoding::Context) -> usize {
2702 4
2703 }
2704 }
2705
2706 unsafe impl
2707 fidl::encoding::Encode<
2708 PartitionsManagerCommitTransactionRequest,
2709 fidl::encoding::DefaultFuchsiaResourceDialect,
2710 > for &mut PartitionsManagerCommitTransactionRequest
2711 {
2712 #[inline]
2713 unsafe fn encode(
2714 self,
2715 encoder: &mut fidl::encoding::Encoder<
2716 '_,
2717 fidl::encoding::DefaultFuchsiaResourceDialect,
2718 >,
2719 offset: usize,
2720 _depth: fidl::encoding::Depth,
2721 ) -> fidl::Result<()> {
2722 encoder.debug_check_bounds::<PartitionsManagerCommitTransactionRequest>(offset);
2723 fidl::encoding::Encode::<
2725 PartitionsManagerCommitTransactionRequest,
2726 fidl::encoding::DefaultFuchsiaResourceDialect,
2727 >::encode(
2728 (<fidl::encoding::HandleType<
2729 fidl::EventPair,
2730 { fidl::ObjectType::EVENTPAIR.into_raw() },
2731 2147483648,
2732 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2733 &mut self.transaction
2734 ),),
2735 encoder,
2736 offset,
2737 _depth,
2738 )
2739 }
2740 }
2741 unsafe impl<
2742 T0: fidl::encoding::Encode<
2743 fidl::encoding::HandleType<
2744 fidl::EventPair,
2745 { fidl::ObjectType::EVENTPAIR.into_raw() },
2746 2147483648,
2747 >,
2748 fidl::encoding::DefaultFuchsiaResourceDialect,
2749 >,
2750 >
2751 fidl::encoding::Encode<
2752 PartitionsManagerCommitTransactionRequest,
2753 fidl::encoding::DefaultFuchsiaResourceDialect,
2754 > for (T0,)
2755 {
2756 #[inline]
2757 unsafe fn encode(
2758 self,
2759 encoder: &mut fidl::encoding::Encoder<
2760 '_,
2761 fidl::encoding::DefaultFuchsiaResourceDialect,
2762 >,
2763 offset: usize,
2764 depth: fidl::encoding::Depth,
2765 ) -> fidl::Result<()> {
2766 encoder.debug_check_bounds::<PartitionsManagerCommitTransactionRequest>(offset);
2767 self.0.encode(encoder, offset + 0, depth)?;
2771 Ok(())
2772 }
2773 }
2774
2775 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2776 for PartitionsManagerCommitTransactionRequest
2777 {
2778 #[inline(always)]
2779 fn new_empty() -> Self {
2780 Self {
2781 transaction: fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
2782 }
2783 }
2784
2785 #[inline]
2786 unsafe fn decode(
2787 &mut self,
2788 decoder: &mut fidl::encoding::Decoder<
2789 '_,
2790 fidl::encoding::DefaultFuchsiaResourceDialect,
2791 >,
2792 offset: usize,
2793 _depth: fidl::encoding::Depth,
2794 ) -> fidl::Result<()> {
2795 decoder.debug_check_bounds::<Self>(offset);
2796 fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.transaction, decoder, offset + 0, _depth)?;
2798 Ok(())
2799 }
2800 }
2801
2802 impl fidl::encoding::ResourceTypeMarker for PartitionsManagerCreateTransactionResponse {
2803 type Borrowed<'a> = &'a mut Self;
2804 fn take_or_borrow<'a>(
2805 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2806 ) -> Self::Borrowed<'a> {
2807 value
2808 }
2809 }
2810
2811 unsafe impl fidl::encoding::TypeMarker for PartitionsManagerCreateTransactionResponse {
2812 type Owned = Self;
2813
2814 #[inline(always)]
2815 fn inline_align(_context: fidl::encoding::Context) -> usize {
2816 4
2817 }
2818
2819 #[inline(always)]
2820 fn inline_size(_context: fidl::encoding::Context) -> usize {
2821 4
2822 }
2823 }
2824
2825 unsafe impl
2826 fidl::encoding::Encode<
2827 PartitionsManagerCreateTransactionResponse,
2828 fidl::encoding::DefaultFuchsiaResourceDialect,
2829 > for &mut PartitionsManagerCreateTransactionResponse
2830 {
2831 #[inline]
2832 unsafe fn encode(
2833 self,
2834 encoder: &mut fidl::encoding::Encoder<
2835 '_,
2836 fidl::encoding::DefaultFuchsiaResourceDialect,
2837 >,
2838 offset: usize,
2839 _depth: fidl::encoding::Depth,
2840 ) -> fidl::Result<()> {
2841 encoder.debug_check_bounds::<PartitionsManagerCreateTransactionResponse>(offset);
2842 fidl::encoding::Encode::<
2844 PartitionsManagerCreateTransactionResponse,
2845 fidl::encoding::DefaultFuchsiaResourceDialect,
2846 >::encode(
2847 (<fidl::encoding::HandleType<
2848 fidl::EventPair,
2849 { fidl::ObjectType::EVENTPAIR.into_raw() },
2850 2147483648,
2851 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2852 &mut self.transaction
2853 ),),
2854 encoder,
2855 offset,
2856 _depth,
2857 )
2858 }
2859 }
2860 unsafe impl<
2861 T0: fidl::encoding::Encode<
2862 fidl::encoding::HandleType<
2863 fidl::EventPair,
2864 { fidl::ObjectType::EVENTPAIR.into_raw() },
2865 2147483648,
2866 >,
2867 fidl::encoding::DefaultFuchsiaResourceDialect,
2868 >,
2869 >
2870 fidl::encoding::Encode<
2871 PartitionsManagerCreateTransactionResponse,
2872 fidl::encoding::DefaultFuchsiaResourceDialect,
2873 > for (T0,)
2874 {
2875 #[inline]
2876 unsafe fn encode(
2877 self,
2878 encoder: &mut fidl::encoding::Encoder<
2879 '_,
2880 fidl::encoding::DefaultFuchsiaResourceDialect,
2881 >,
2882 offset: usize,
2883 depth: fidl::encoding::Depth,
2884 ) -> fidl::Result<()> {
2885 encoder.debug_check_bounds::<PartitionsManagerCreateTransactionResponse>(offset);
2886 self.0.encode(encoder, offset + 0, depth)?;
2890 Ok(())
2891 }
2892 }
2893
2894 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2895 for PartitionsManagerCreateTransactionResponse
2896 {
2897 #[inline(always)]
2898 fn new_empty() -> Self {
2899 Self {
2900 transaction: fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
2901 }
2902 }
2903
2904 #[inline]
2905 unsafe fn decode(
2906 &mut self,
2907 decoder: &mut fidl::encoding::Decoder<
2908 '_,
2909 fidl::encoding::DefaultFuchsiaResourceDialect,
2910 >,
2911 offset: usize,
2912 _depth: fidl::encoding::Depth,
2913 ) -> fidl::Result<()> {
2914 decoder.debug_check_bounds::<Self>(offset);
2915 fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.transaction, decoder, offset + 0, _depth)?;
2917 Ok(())
2918 }
2919 }
2920
2921 impl PartitionUpdateMetadataRequest {
2922 #[inline(always)]
2923 fn max_ordinal_present(&self) -> u64 {
2924 if let Some(_) = self.flags {
2925 return 3;
2926 }
2927 if let Some(_) = self.type_guid {
2928 return 2;
2929 }
2930 if let Some(_) = self.transaction {
2931 return 1;
2932 }
2933 0
2934 }
2935 }
2936
2937 impl fidl::encoding::ResourceTypeMarker for PartitionUpdateMetadataRequest {
2938 type Borrowed<'a> = &'a mut Self;
2939 fn take_or_borrow<'a>(
2940 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2941 ) -> Self::Borrowed<'a> {
2942 value
2943 }
2944 }
2945
2946 unsafe impl fidl::encoding::TypeMarker for PartitionUpdateMetadataRequest {
2947 type Owned = Self;
2948
2949 #[inline(always)]
2950 fn inline_align(_context: fidl::encoding::Context) -> usize {
2951 8
2952 }
2953
2954 #[inline(always)]
2955 fn inline_size(_context: fidl::encoding::Context) -> usize {
2956 16
2957 }
2958 }
2959
2960 unsafe impl
2961 fidl::encoding::Encode<
2962 PartitionUpdateMetadataRequest,
2963 fidl::encoding::DefaultFuchsiaResourceDialect,
2964 > for &mut PartitionUpdateMetadataRequest
2965 {
2966 unsafe fn encode(
2967 self,
2968 encoder: &mut fidl::encoding::Encoder<
2969 '_,
2970 fidl::encoding::DefaultFuchsiaResourceDialect,
2971 >,
2972 offset: usize,
2973 mut depth: fidl::encoding::Depth,
2974 ) -> fidl::Result<()> {
2975 encoder.debug_check_bounds::<PartitionUpdateMetadataRequest>(offset);
2976 let max_ordinal: u64 = self.max_ordinal_present();
2978 encoder.write_num(max_ordinal, offset);
2979 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2980 if max_ordinal == 0 {
2982 return Ok(());
2983 }
2984 depth.increment()?;
2985 let envelope_size = 8;
2986 let bytes_len = max_ordinal as usize * envelope_size;
2987 #[allow(unused_variables)]
2988 let offset = encoder.out_of_line_offset(bytes_len);
2989 let mut _prev_end_offset: usize = 0;
2990 if 1 > max_ordinal {
2991 return Ok(());
2992 }
2993
2994 let cur_offset: usize = (1 - 1) * envelope_size;
2997
2998 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3000
3001 fidl::encoding::encode_in_envelope_optional::<
3006 fidl::encoding::HandleType<
3007 fidl::EventPair,
3008 { fidl::ObjectType::EVENTPAIR.into_raw() },
3009 2147483648,
3010 >,
3011 fidl::encoding::DefaultFuchsiaResourceDialect,
3012 >(
3013 self.transaction.as_mut().map(
3014 <fidl::encoding::HandleType<
3015 fidl::EventPair,
3016 { fidl::ObjectType::EVENTPAIR.into_raw() },
3017 2147483648,
3018 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
3019 ),
3020 encoder,
3021 offset + cur_offset,
3022 depth,
3023 )?;
3024
3025 _prev_end_offset = cur_offset + envelope_size;
3026 if 2 > max_ordinal {
3027 return Ok(());
3028 }
3029
3030 let cur_offset: usize = (2 - 1) * envelope_size;
3033
3034 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3036
3037 fidl::encoding::encode_in_envelope_optional::<
3042 fidl_fuchsia_storage_block::Guid,
3043 fidl::encoding::DefaultFuchsiaResourceDialect,
3044 >(
3045 self.type_guid.as_ref().map(
3046 <fidl_fuchsia_storage_block::Guid as fidl::encoding::ValueTypeMarker>::borrow,
3047 ),
3048 encoder,
3049 offset + cur_offset,
3050 depth,
3051 )?;
3052
3053 _prev_end_offset = cur_offset + envelope_size;
3054 if 3 > max_ordinal {
3055 return Ok(());
3056 }
3057
3058 let cur_offset: usize = (3 - 1) * envelope_size;
3061
3062 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3064
3065 fidl::encoding::encode_in_envelope_optional::<
3070 u64,
3071 fidl::encoding::DefaultFuchsiaResourceDialect,
3072 >(
3073 self.flags.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
3074 encoder,
3075 offset + cur_offset,
3076 depth,
3077 )?;
3078
3079 _prev_end_offset = cur_offset + envelope_size;
3080
3081 Ok(())
3082 }
3083 }
3084
3085 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3086 for PartitionUpdateMetadataRequest
3087 {
3088 #[inline(always)]
3089 fn new_empty() -> Self {
3090 Self::default()
3091 }
3092
3093 unsafe fn decode(
3094 &mut self,
3095 decoder: &mut fidl::encoding::Decoder<
3096 '_,
3097 fidl::encoding::DefaultFuchsiaResourceDialect,
3098 >,
3099 offset: usize,
3100 mut depth: fidl::encoding::Depth,
3101 ) -> fidl::Result<()> {
3102 decoder.debug_check_bounds::<Self>(offset);
3103 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3104 None => return Err(fidl::Error::NotNullable),
3105 Some(len) => len,
3106 };
3107 if len == 0 {
3109 return Ok(());
3110 };
3111 depth.increment()?;
3112 let envelope_size = 8;
3113 let bytes_len = len * envelope_size;
3114 let offset = decoder.out_of_line_offset(bytes_len)?;
3115 let mut _next_ordinal_to_read = 0;
3117 let mut next_offset = offset;
3118 let end_offset = offset + bytes_len;
3119 _next_ordinal_to_read += 1;
3120 if next_offset >= end_offset {
3121 return Ok(());
3122 }
3123
3124 while _next_ordinal_to_read < 1 {
3126 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3127 _next_ordinal_to_read += 1;
3128 next_offset += envelope_size;
3129 }
3130
3131 let next_out_of_line = decoder.next_out_of_line();
3132 let handles_before = decoder.remaining_handles();
3133 if let Some((inlined, num_bytes, num_handles)) =
3134 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3135 {
3136 let member_inline_size = <fidl::encoding::HandleType<
3137 fidl::EventPair,
3138 { fidl::ObjectType::EVENTPAIR.into_raw() },
3139 2147483648,
3140 > as fidl::encoding::TypeMarker>::inline_size(
3141 decoder.context
3142 );
3143 if inlined != (member_inline_size <= 4) {
3144 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3145 }
3146 let inner_offset;
3147 let mut inner_depth = depth.clone();
3148 if inlined {
3149 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3150 inner_offset = next_offset;
3151 } else {
3152 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3153 inner_depth.increment()?;
3154 }
3155 let val_ref =
3156 self.transaction.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
3157 fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
3158 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3159 {
3160 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3161 }
3162 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3163 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3164 }
3165 }
3166
3167 next_offset += envelope_size;
3168 _next_ordinal_to_read += 1;
3169 if next_offset >= end_offset {
3170 return Ok(());
3171 }
3172
3173 while _next_ordinal_to_read < 2 {
3175 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3176 _next_ordinal_to_read += 1;
3177 next_offset += envelope_size;
3178 }
3179
3180 let next_out_of_line = decoder.next_out_of_line();
3181 let handles_before = decoder.remaining_handles();
3182 if let Some((inlined, num_bytes, num_handles)) =
3183 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3184 {
3185 let member_inline_size =
3186 <fidl_fuchsia_storage_block::Guid as fidl::encoding::TypeMarker>::inline_size(
3187 decoder.context,
3188 );
3189 if inlined != (member_inline_size <= 4) {
3190 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3191 }
3192 let inner_offset;
3193 let mut inner_depth = depth.clone();
3194 if inlined {
3195 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3196 inner_offset = next_offset;
3197 } else {
3198 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3199 inner_depth.increment()?;
3200 }
3201 let val_ref = self.type_guid.get_or_insert_with(|| {
3202 fidl::new_empty!(
3203 fidl_fuchsia_storage_block::Guid,
3204 fidl::encoding::DefaultFuchsiaResourceDialect
3205 )
3206 });
3207 fidl::decode!(
3208 fidl_fuchsia_storage_block::Guid,
3209 fidl::encoding::DefaultFuchsiaResourceDialect,
3210 val_ref,
3211 decoder,
3212 inner_offset,
3213 inner_depth
3214 )?;
3215 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3216 {
3217 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3218 }
3219 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3220 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3221 }
3222 }
3223
3224 next_offset += envelope_size;
3225 _next_ordinal_to_read += 1;
3226 if next_offset >= end_offset {
3227 return Ok(());
3228 }
3229
3230 while _next_ordinal_to_read < 3 {
3232 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3233 _next_ordinal_to_read += 1;
3234 next_offset += envelope_size;
3235 }
3236
3237 let next_out_of_line = decoder.next_out_of_line();
3238 let handles_before = decoder.remaining_handles();
3239 if let Some((inlined, num_bytes, num_handles)) =
3240 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3241 {
3242 let member_inline_size =
3243 <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3244 if inlined != (member_inline_size <= 4) {
3245 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3246 }
3247 let inner_offset;
3248 let mut inner_depth = depth.clone();
3249 if inlined {
3250 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3251 inner_offset = next_offset;
3252 } else {
3253 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3254 inner_depth.increment()?;
3255 }
3256 let val_ref = self.flags.get_or_insert_with(|| {
3257 fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
3258 });
3259 fidl::decode!(
3260 u64,
3261 fidl::encoding::DefaultFuchsiaResourceDialect,
3262 val_ref,
3263 decoder,
3264 inner_offset,
3265 inner_depth
3266 )?;
3267 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3268 {
3269 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3270 }
3271 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3272 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3273 }
3274 }
3275
3276 next_offset += envelope_size;
3277
3278 while next_offset < end_offset {
3280 _next_ordinal_to_read += 1;
3281 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3282 next_offset += envelope_size;
3283 }
3284
3285 Ok(())
3286 }
3287 }
3288
3289 impl PartitionsManagerAddPartitionRequest {
3290 #[inline(always)]
3291 fn max_ordinal_present(&self) -> u64 {
3292 if let Some(_) = self.flags {
3293 return 6;
3294 }
3295 if let Some(_) = self.instance_guid {
3296 return 5;
3297 }
3298 if let Some(_) = self.type_guid {
3299 return 4;
3300 }
3301 if let Some(_) = self.name {
3302 return 3;
3303 }
3304 if let Some(_) = self.num_blocks {
3305 return 2;
3306 }
3307 if let Some(_) = self.transaction {
3308 return 1;
3309 }
3310 0
3311 }
3312 }
3313
3314 impl fidl::encoding::ResourceTypeMarker for PartitionsManagerAddPartitionRequest {
3315 type Borrowed<'a> = &'a mut Self;
3316 fn take_or_borrow<'a>(
3317 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3318 ) -> Self::Borrowed<'a> {
3319 value
3320 }
3321 }
3322
3323 unsafe impl fidl::encoding::TypeMarker for PartitionsManagerAddPartitionRequest {
3324 type Owned = Self;
3325
3326 #[inline(always)]
3327 fn inline_align(_context: fidl::encoding::Context) -> usize {
3328 8
3329 }
3330
3331 #[inline(always)]
3332 fn inline_size(_context: fidl::encoding::Context) -> usize {
3333 16
3334 }
3335 }
3336
3337 unsafe impl
3338 fidl::encoding::Encode<
3339 PartitionsManagerAddPartitionRequest,
3340 fidl::encoding::DefaultFuchsiaResourceDialect,
3341 > for &mut PartitionsManagerAddPartitionRequest
3342 {
3343 unsafe fn encode(
3344 self,
3345 encoder: &mut fidl::encoding::Encoder<
3346 '_,
3347 fidl::encoding::DefaultFuchsiaResourceDialect,
3348 >,
3349 offset: usize,
3350 mut depth: fidl::encoding::Depth,
3351 ) -> fidl::Result<()> {
3352 encoder.debug_check_bounds::<PartitionsManagerAddPartitionRequest>(offset);
3353 let max_ordinal: u64 = self.max_ordinal_present();
3355 encoder.write_num(max_ordinal, offset);
3356 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3357 if max_ordinal == 0 {
3359 return Ok(());
3360 }
3361 depth.increment()?;
3362 let envelope_size = 8;
3363 let bytes_len = max_ordinal as usize * envelope_size;
3364 #[allow(unused_variables)]
3365 let offset = encoder.out_of_line_offset(bytes_len);
3366 let mut _prev_end_offset: usize = 0;
3367 if 1 > max_ordinal {
3368 return Ok(());
3369 }
3370
3371 let cur_offset: usize = (1 - 1) * envelope_size;
3374
3375 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3377
3378 fidl::encoding::encode_in_envelope_optional::<
3383 fidl::encoding::HandleType<
3384 fidl::EventPair,
3385 { fidl::ObjectType::EVENTPAIR.into_raw() },
3386 2147483648,
3387 >,
3388 fidl::encoding::DefaultFuchsiaResourceDialect,
3389 >(
3390 self.transaction.as_mut().map(
3391 <fidl::encoding::HandleType<
3392 fidl::EventPair,
3393 { fidl::ObjectType::EVENTPAIR.into_raw() },
3394 2147483648,
3395 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
3396 ),
3397 encoder,
3398 offset + cur_offset,
3399 depth,
3400 )?;
3401
3402 _prev_end_offset = cur_offset + envelope_size;
3403 if 2 > max_ordinal {
3404 return Ok(());
3405 }
3406
3407 let cur_offset: usize = (2 - 1) * envelope_size;
3410
3411 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3413
3414 fidl::encoding::encode_in_envelope_optional::<
3419 u64,
3420 fidl::encoding::DefaultFuchsiaResourceDialect,
3421 >(
3422 self.num_blocks.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
3423 encoder,
3424 offset + cur_offset,
3425 depth,
3426 )?;
3427
3428 _prev_end_offset = cur_offset + envelope_size;
3429 if 3 > max_ordinal {
3430 return Ok(());
3431 }
3432
3433 let cur_offset: usize = (3 - 1) * envelope_size;
3436
3437 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3439
3440 fidl::encoding::encode_in_envelope_optional::<
3445 fidl::encoding::BoundedString<128>,
3446 fidl::encoding::DefaultFuchsiaResourceDialect,
3447 >(
3448 self.name.as_ref().map(
3449 <fidl::encoding::BoundedString<128> as fidl::encoding::ValueTypeMarker>::borrow,
3450 ),
3451 encoder,
3452 offset + cur_offset,
3453 depth,
3454 )?;
3455
3456 _prev_end_offset = cur_offset + envelope_size;
3457 if 4 > max_ordinal {
3458 return Ok(());
3459 }
3460
3461 let cur_offset: usize = (4 - 1) * envelope_size;
3464
3465 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3467
3468 fidl::encoding::encode_in_envelope_optional::<
3473 fidl_fuchsia_storage_block::Guid,
3474 fidl::encoding::DefaultFuchsiaResourceDialect,
3475 >(
3476 self.type_guid.as_ref().map(
3477 <fidl_fuchsia_storage_block::Guid as fidl::encoding::ValueTypeMarker>::borrow,
3478 ),
3479 encoder,
3480 offset + cur_offset,
3481 depth,
3482 )?;
3483
3484 _prev_end_offset = cur_offset + envelope_size;
3485 if 5 > max_ordinal {
3486 return Ok(());
3487 }
3488
3489 let cur_offset: usize = (5 - 1) * envelope_size;
3492
3493 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3495
3496 fidl::encoding::encode_in_envelope_optional::<
3501 fidl_fuchsia_storage_block::Guid,
3502 fidl::encoding::DefaultFuchsiaResourceDialect,
3503 >(
3504 self.instance_guid.as_ref().map(
3505 <fidl_fuchsia_storage_block::Guid as fidl::encoding::ValueTypeMarker>::borrow,
3506 ),
3507 encoder,
3508 offset + cur_offset,
3509 depth,
3510 )?;
3511
3512 _prev_end_offset = cur_offset + envelope_size;
3513 if 6 > max_ordinal {
3514 return Ok(());
3515 }
3516
3517 let cur_offset: usize = (6 - 1) * envelope_size;
3520
3521 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3523
3524 fidl::encoding::encode_in_envelope_optional::<
3529 u64,
3530 fidl::encoding::DefaultFuchsiaResourceDialect,
3531 >(
3532 self.flags.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
3533 encoder,
3534 offset + cur_offset,
3535 depth,
3536 )?;
3537
3538 _prev_end_offset = cur_offset + envelope_size;
3539
3540 Ok(())
3541 }
3542 }
3543
3544 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3545 for PartitionsManagerAddPartitionRequest
3546 {
3547 #[inline(always)]
3548 fn new_empty() -> Self {
3549 Self::default()
3550 }
3551
3552 unsafe fn decode(
3553 &mut self,
3554 decoder: &mut fidl::encoding::Decoder<
3555 '_,
3556 fidl::encoding::DefaultFuchsiaResourceDialect,
3557 >,
3558 offset: usize,
3559 mut depth: fidl::encoding::Depth,
3560 ) -> fidl::Result<()> {
3561 decoder.debug_check_bounds::<Self>(offset);
3562 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3563 None => return Err(fidl::Error::NotNullable),
3564 Some(len) => len,
3565 };
3566 if len == 0 {
3568 return Ok(());
3569 };
3570 depth.increment()?;
3571 let envelope_size = 8;
3572 let bytes_len = len * envelope_size;
3573 let offset = decoder.out_of_line_offset(bytes_len)?;
3574 let mut _next_ordinal_to_read = 0;
3576 let mut next_offset = offset;
3577 let end_offset = offset + bytes_len;
3578 _next_ordinal_to_read += 1;
3579 if next_offset >= end_offset {
3580 return Ok(());
3581 }
3582
3583 while _next_ordinal_to_read < 1 {
3585 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3586 _next_ordinal_to_read += 1;
3587 next_offset += envelope_size;
3588 }
3589
3590 let next_out_of_line = decoder.next_out_of_line();
3591 let handles_before = decoder.remaining_handles();
3592 if let Some((inlined, num_bytes, num_handles)) =
3593 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3594 {
3595 let member_inline_size = <fidl::encoding::HandleType<
3596 fidl::EventPair,
3597 { fidl::ObjectType::EVENTPAIR.into_raw() },
3598 2147483648,
3599 > as fidl::encoding::TypeMarker>::inline_size(
3600 decoder.context
3601 );
3602 if inlined != (member_inline_size <= 4) {
3603 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3604 }
3605 let inner_offset;
3606 let mut inner_depth = depth.clone();
3607 if inlined {
3608 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3609 inner_offset = next_offset;
3610 } else {
3611 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3612 inner_depth.increment()?;
3613 }
3614 let val_ref =
3615 self.transaction.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
3616 fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
3617 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3618 {
3619 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3620 }
3621 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3622 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3623 }
3624 }
3625
3626 next_offset += envelope_size;
3627 _next_ordinal_to_read += 1;
3628 if next_offset >= end_offset {
3629 return Ok(());
3630 }
3631
3632 while _next_ordinal_to_read < 2 {
3634 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3635 _next_ordinal_to_read += 1;
3636 next_offset += envelope_size;
3637 }
3638
3639 let next_out_of_line = decoder.next_out_of_line();
3640 let handles_before = decoder.remaining_handles();
3641 if let Some((inlined, num_bytes, num_handles)) =
3642 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3643 {
3644 let member_inline_size =
3645 <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3646 if inlined != (member_inline_size <= 4) {
3647 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3648 }
3649 let inner_offset;
3650 let mut inner_depth = depth.clone();
3651 if inlined {
3652 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3653 inner_offset = next_offset;
3654 } else {
3655 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3656 inner_depth.increment()?;
3657 }
3658 let val_ref = self.num_blocks.get_or_insert_with(|| {
3659 fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
3660 });
3661 fidl::decode!(
3662 u64,
3663 fidl::encoding::DefaultFuchsiaResourceDialect,
3664 val_ref,
3665 decoder,
3666 inner_offset,
3667 inner_depth
3668 )?;
3669 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3670 {
3671 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3672 }
3673 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3674 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3675 }
3676 }
3677
3678 next_offset += envelope_size;
3679 _next_ordinal_to_read += 1;
3680 if next_offset >= end_offset {
3681 return Ok(());
3682 }
3683
3684 while _next_ordinal_to_read < 3 {
3686 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3687 _next_ordinal_to_read += 1;
3688 next_offset += envelope_size;
3689 }
3690
3691 let next_out_of_line = decoder.next_out_of_line();
3692 let handles_before = decoder.remaining_handles();
3693 if let Some((inlined, num_bytes, num_handles)) =
3694 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3695 {
3696 let member_inline_size =
3697 <fidl::encoding::BoundedString<128> as fidl::encoding::TypeMarker>::inline_size(
3698 decoder.context,
3699 );
3700 if inlined != (member_inline_size <= 4) {
3701 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3702 }
3703 let inner_offset;
3704 let mut inner_depth = depth.clone();
3705 if inlined {
3706 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3707 inner_offset = next_offset;
3708 } else {
3709 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3710 inner_depth.increment()?;
3711 }
3712 let val_ref = self.name.get_or_insert_with(|| {
3713 fidl::new_empty!(
3714 fidl::encoding::BoundedString<128>,
3715 fidl::encoding::DefaultFuchsiaResourceDialect
3716 )
3717 });
3718 fidl::decode!(
3719 fidl::encoding::BoundedString<128>,
3720 fidl::encoding::DefaultFuchsiaResourceDialect,
3721 val_ref,
3722 decoder,
3723 inner_offset,
3724 inner_depth
3725 )?;
3726 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3727 {
3728 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3729 }
3730 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3731 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3732 }
3733 }
3734
3735 next_offset += envelope_size;
3736 _next_ordinal_to_read += 1;
3737 if next_offset >= end_offset {
3738 return Ok(());
3739 }
3740
3741 while _next_ordinal_to_read < 4 {
3743 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3744 _next_ordinal_to_read += 1;
3745 next_offset += envelope_size;
3746 }
3747
3748 let next_out_of_line = decoder.next_out_of_line();
3749 let handles_before = decoder.remaining_handles();
3750 if let Some((inlined, num_bytes, num_handles)) =
3751 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3752 {
3753 let member_inline_size =
3754 <fidl_fuchsia_storage_block::Guid as fidl::encoding::TypeMarker>::inline_size(
3755 decoder.context,
3756 );
3757 if inlined != (member_inline_size <= 4) {
3758 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3759 }
3760 let inner_offset;
3761 let mut inner_depth = depth.clone();
3762 if inlined {
3763 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3764 inner_offset = next_offset;
3765 } else {
3766 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3767 inner_depth.increment()?;
3768 }
3769 let val_ref = self.type_guid.get_or_insert_with(|| {
3770 fidl::new_empty!(
3771 fidl_fuchsia_storage_block::Guid,
3772 fidl::encoding::DefaultFuchsiaResourceDialect
3773 )
3774 });
3775 fidl::decode!(
3776 fidl_fuchsia_storage_block::Guid,
3777 fidl::encoding::DefaultFuchsiaResourceDialect,
3778 val_ref,
3779 decoder,
3780 inner_offset,
3781 inner_depth
3782 )?;
3783 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3784 {
3785 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3786 }
3787 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3788 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3789 }
3790 }
3791
3792 next_offset += envelope_size;
3793 _next_ordinal_to_read += 1;
3794 if next_offset >= end_offset {
3795 return Ok(());
3796 }
3797
3798 while _next_ordinal_to_read < 5 {
3800 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3801 _next_ordinal_to_read += 1;
3802 next_offset += envelope_size;
3803 }
3804
3805 let next_out_of_line = decoder.next_out_of_line();
3806 let handles_before = decoder.remaining_handles();
3807 if let Some((inlined, num_bytes, num_handles)) =
3808 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3809 {
3810 let member_inline_size =
3811 <fidl_fuchsia_storage_block::Guid as fidl::encoding::TypeMarker>::inline_size(
3812 decoder.context,
3813 );
3814 if inlined != (member_inline_size <= 4) {
3815 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3816 }
3817 let inner_offset;
3818 let mut inner_depth = depth.clone();
3819 if inlined {
3820 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3821 inner_offset = next_offset;
3822 } else {
3823 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3824 inner_depth.increment()?;
3825 }
3826 let val_ref = self.instance_guid.get_or_insert_with(|| {
3827 fidl::new_empty!(
3828 fidl_fuchsia_storage_block::Guid,
3829 fidl::encoding::DefaultFuchsiaResourceDialect
3830 )
3831 });
3832 fidl::decode!(
3833 fidl_fuchsia_storage_block::Guid,
3834 fidl::encoding::DefaultFuchsiaResourceDialect,
3835 val_ref,
3836 decoder,
3837 inner_offset,
3838 inner_depth
3839 )?;
3840 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3841 {
3842 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3843 }
3844 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3845 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3846 }
3847 }
3848
3849 next_offset += envelope_size;
3850 _next_ordinal_to_read += 1;
3851 if next_offset >= end_offset {
3852 return Ok(());
3853 }
3854
3855 while _next_ordinal_to_read < 6 {
3857 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3858 _next_ordinal_to_read += 1;
3859 next_offset += envelope_size;
3860 }
3861
3862 let next_out_of_line = decoder.next_out_of_line();
3863 let handles_before = decoder.remaining_handles();
3864 if let Some((inlined, num_bytes, num_handles)) =
3865 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3866 {
3867 let member_inline_size =
3868 <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3869 if inlined != (member_inline_size <= 4) {
3870 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3871 }
3872 let inner_offset;
3873 let mut inner_depth = depth.clone();
3874 if inlined {
3875 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3876 inner_offset = next_offset;
3877 } else {
3878 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3879 inner_depth.increment()?;
3880 }
3881 let val_ref = self.flags.get_or_insert_with(|| {
3882 fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
3883 });
3884 fidl::decode!(
3885 u64,
3886 fidl::encoding::DefaultFuchsiaResourceDialect,
3887 val_ref,
3888 decoder,
3889 inner_offset,
3890 inner_depth
3891 )?;
3892 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3893 {
3894 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3895 }
3896 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3897 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3898 }
3899 }
3900
3901 next_offset += envelope_size;
3902
3903 while next_offset < end_offset {
3905 _next_ordinal_to_read += 1;
3906 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3907 next_offset += envelope_size;
3908 }
3909
3910 Ok(())
3911 }
3912 }
3913}