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 Partition(PartitionRequestStream),
2522 Overlay(OverlayPartitionRequestStream),
2525}
2526
2527#[cfg(target_os = "fuchsia")]
2528impl fidl::endpoints::ServiceRequest for PartitionServiceRequest {
2529 type Service = PartitionServiceMarker;
2530
2531 fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
2532 match name {
2533 "volume" => Self::Volume(
2534 <fidl_fuchsia_storage_block::BlockRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
2535 ),
2536 "partition" => Self::Partition(
2537 <PartitionRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
2538 ),
2539 "overlay" => Self::Overlay(
2540 <OverlayPartitionRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
2541 ),
2542 _ => panic!("no such member protocol name for service PartitionService"),
2543 }
2544 }
2545
2546 fn member_names() -> &'static [&'static str] {
2547 &["volume", "partition", "overlay"]
2548 }
2549}
2550#[cfg(target_os = "fuchsia")]
2553pub struct PartitionServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
2554
2555#[cfg(target_os = "fuchsia")]
2556impl fidl::endpoints::ServiceProxy for PartitionServiceProxy {
2557 type Service = PartitionServiceMarker;
2558
2559 fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
2560 Self(opener)
2561 }
2562}
2563
2564#[cfg(target_os = "fuchsia")]
2565impl PartitionServiceProxy {
2566 pub fn connect_to_volume(&self) -> Result<fidl_fuchsia_storage_block::BlockProxy, fidl::Error> {
2568 let (proxy, server_end) =
2569 fidl::endpoints::create_proxy::<fidl_fuchsia_storage_block::BlockMarker>();
2570 self.connect_channel_to_volume(server_end)?;
2571 Ok(proxy)
2572 }
2573
2574 pub fn connect_to_volume_sync(
2577 &self,
2578 ) -> Result<fidl_fuchsia_storage_block::BlockSynchronousProxy, fidl::Error> {
2579 let (proxy, server_end) =
2580 fidl::endpoints::create_sync_proxy::<fidl_fuchsia_storage_block::BlockMarker>();
2581 self.connect_channel_to_volume(server_end)?;
2582 Ok(proxy)
2583 }
2584
2585 pub fn connect_channel_to_volume(
2588 &self,
2589 server_end: fidl::endpoints::ServerEnd<fidl_fuchsia_storage_block::BlockMarker>,
2590 ) -> Result<(), fidl::Error> {
2591 self.0.open_member("volume", server_end.into_channel())
2592 }
2593 pub fn connect_to_partition(&self) -> Result<PartitionProxy, fidl::Error> {
2595 let (proxy, server_end) = fidl::endpoints::create_proxy::<PartitionMarker>();
2596 self.connect_channel_to_partition(server_end)?;
2597 Ok(proxy)
2598 }
2599
2600 pub fn connect_to_partition_sync(&self) -> Result<PartitionSynchronousProxy, fidl::Error> {
2603 let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<PartitionMarker>();
2604 self.connect_channel_to_partition(server_end)?;
2605 Ok(proxy)
2606 }
2607
2608 pub fn connect_channel_to_partition(
2611 &self,
2612 server_end: fidl::endpoints::ServerEnd<PartitionMarker>,
2613 ) -> Result<(), fidl::Error> {
2614 self.0.open_member("partition", server_end.into_channel())
2615 }
2616 pub fn connect_to_overlay(&self) -> Result<OverlayPartitionProxy, fidl::Error> {
2619 let (proxy, server_end) = fidl::endpoints::create_proxy::<OverlayPartitionMarker>();
2620 self.connect_channel_to_overlay(server_end)?;
2621 Ok(proxy)
2622 }
2623
2624 pub fn connect_to_overlay_sync(&self) -> Result<OverlayPartitionSynchronousProxy, fidl::Error> {
2627 let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<OverlayPartitionMarker>();
2628 self.connect_channel_to_overlay(server_end)?;
2629 Ok(proxy)
2630 }
2631
2632 pub fn connect_channel_to_overlay(
2635 &self,
2636 server_end: fidl::endpoints::ServerEnd<OverlayPartitionMarker>,
2637 ) -> Result<(), fidl::Error> {
2638 self.0.open_member("overlay", server_end.into_channel())
2639 }
2640
2641 pub fn instance_name(&self) -> &str {
2642 self.0.instance_name()
2643 }
2644}
2645
2646mod internal {
2647 use super::*;
2648
2649 impl fidl::encoding::ResourceTypeMarker for PartitionsManagerCommitTransactionRequest {
2650 type Borrowed<'a> = &'a mut Self;
2651 fn take_or_borrow<'a>(
2652 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2653 ) -> Self::Borrowed<'a> {
2654 value
2655 }
2656 }
2657
2658 unsafe impl fidl::encoding::TypeMarker for PartitionsManagerCommitTransactionRequest {
2659 type Owned = Self;
2660
2661 #[inline(always)]
2662 fn inline_align(_context: fidl::encoding::Context) -> usize {
2663 4
2664 }
2665
2666 #[inline(always)]
2667 fn inline_size(_context: fidl::encoding::Context) -> usize {
2668 4
2669 }
2670 }
2671
2672 unsafe impl
2673 fidl::encoding::Encode<
2674 PartitionsManagerCommitTransactionRequest,
2675 fidl::encoding::DefaultFuchsiaResourceDialect,
2676 > for &mut PartitionsManagerCommitTransactionRequest
2677 {
2678 #[inline]
2679 unsafe fn encode(
2680 self,
2681 encoder: &mut fidl::encoding::Encoder<
2682 '_,
2683 fidl::encoding::DefaultFuchsiaResourceDialect,
2684 >,
2685 offset: usize,
2686 _depth: fidl::encoding::Depth,
2687 ) -> fidl::Result<()> {
2688 encoder.debug_check_bounds::<PartitionsManagerCommitTransactionRequest>(offset);
2689 fidl::encoding::Encode::<
2691 PartitionsManagerCommitTransactionRequest,
2692 fidl::encoding::DefaultFuchsiaResourceDialect,
2693 >::encode(
2694 (<fidl::encoding::HandleType<
2695 fidl::EventPair,
2696 { fidl::ObjectType::EVENTPAIR.into_raw() },
2697 2147483648,
2698 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2699 &mut self.transaction
2700 ),),
2701 encoder,
2702 offset,
2703 _depth,
2704 )
2705 }
2706 }
2707 unsafe impl<
2708 T0: fidl::encoding::Encode<
2709 fidl::encoding::HandleType<
2710 fidl::EventPair,
2711 { fidl::ObjectType::EVENTPAIR.into_raw() },
2712 2147483648,
2713 >,
2714 fidl::encoding::DefaultFuchsiaResourceDialect,
2715 >,
2716 >
2717 fidl::encoding::Encode<
2718 PartitionsManagerCommitTransactionRequest,
2719 fidl::encoding::DefaultFuchsiaResourceDialect,
2720 > for (T0,)
2721 {
2722 #[inline]
2723 unsafe fn encode(
2724 self,
2725 encoder: &mut fidl::encoding::Encoder<
2726 '_,
2727 fidl::encoding::DefaultFuchsiaResourceDialect,
2728 >,
2729 offset: usize,
2730 depth: fidl::encoding::Depth,
2731 ) -> fidl::Result<()> {
2732 encoder.debug_check_bounds::<PartitionsManagerCommitTransactionRequest>(offset);
2733 self.0.encode(encoder, offset + 0, depth)?;
2737 Ok(())
2738 }
2739 }
2740
2741 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2742 for PartitionsManagerCommitTransactionRequest
2743 {
2744 #[inline(always)]
2745 fn new_empty() -> Self {
2746 Self {
2747 transaction: fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
2748 }
2749 }
2750
2751 #[inline]
2752 unsafe fn decode(
2753 &mut self,
2754 decoder: &mut fidl::encoding::Decoder<
2755 '_,
2756 fidl::encoding::DefaultFuchsiaResourceDialect,
2757 >,
2758 offset: usize,
2759 _depth: fidl::encoding::Depth,
2760 ) -> fidl::Result<()> {
2761 decoder.debug_check_bounds::<Self>(offset);
2762 fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.transaction, decoder, offset + 0, _depth)?;
2764 Ok(())
2765 }
2766 }
2767
2768 impl fidl::encoding::ResourceTypeMarker for PartitionsManagerCreateTransactionResponse {
2769 type Borrowed<'a> = &'a mut Self;
2770 fn take_or_borrow<'a>(
2771 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2772 ) -> Self::Borrowed<'a> {
2773 value
2774 }
2775 }
2776
2777 unsafe impl fidl::encoding::TypeMarker for PartitionsManagerCreateTransactionResponse {
2778 type Owned = Self;
2779
2780 #[inline(always)]
2781 fn inline_align(_context: fidl::encoding::Context) -> usize {
2782 4
2783 }
2784
2785 #[inline(always)]
2786 fn inline_size(_context: fidl::encoding::Context) -> usize {
2787 4
2788 }
2789 }
2790
2791 unsafe impl
2792 fidl::encoding::Encode<
2793 PartitionsManagerCreateTransactionResponse,
2794 fidl::encoding::DefaultFuchsiaResourceDialect,
2795 > for &mut PartitionsManagerCreateTransactionResponse
2796 {
2797 #[inline]
2798 unsafe fn encode(
2799 self,
2800 encoder: &mut fidl::encoding::Encoder<
2801 '_,
2802 fidl::encoding::DefaultFuchsiaResourceDialect,
2803 >,
2804 offset: usize,
2805 _depth: fidl::encoding::Depth,
2806 ) -> fidl::Result<()> {
2807 encoder.debug_check_bounds::<PartitionsManagerCreateTransactionResponse>(offset);
2808 fidl::encoding::Encode::<
2810 PartitionsManagerCreateTransactionResponse,
2811 fidl::encoding::DefaultFuchsiaResourceDialect,
2812 >::encode(
2813 (<fidl::encoding::HandleType<
2814 fidl::EventPair,
2815 { fidl::ObjectType::EVENTPAIR.into_raw() },
2816 2147483648,
2817 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2818 &mut self.transaction
2819 ),),
2820 encoder,
2821 offset,
2822 _depth,
2823 )
2824 }
2825 }
2826 unsafe impl<
2827 T0: fidl::encoding::Encode<
2828 fidl::encoding::HandleType<
2829 fidl::EventPair,
2830 { fidl::ObjectType::EVENTPAIR.into_raw() },
2831 2147483648,
2832 >,
2833 fidl::encoding::DefaultFuchsiaResourceDialect,
2834 >,
2835 >
2836 fidl::encoding::Encode<
2837 PartitionsManagerCreateTransactionResponse,
2838 fidl::encoding::DefaultFuchsiaResourceDialect,
2839 > for (T0,)
2840 {
2841 #[inline]
2842 unsafe fn encode(
2843 self,
2844 encoder: &mut fidl::encoding::Encoder<
2845 '_,
2846 fidl::encoding::DefaultFuchsiaResourceDialect,
2847 >,
2848 offset: usize,
2849 depth: fidl::encoding::Depth,
2850 ) -> fidl::Result<()> {
2851 encoder.debug_check_bounds::<PartitionsManagerCreateTransactionResponse>(offset);
2852 self.0.encode(encoder, offset + 0, depth)?;
2856 Ok(())
2857 }
2858 }
2859
2860 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2861 for PartitionsManagerCreateTransactionResponse
2862 {
2863 #[inline(always)]
2864 fn new_empty() -> Self {
2865 Self {
2866 transaction: fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
2867 }
2868 }
2869
2870 #[inline]
2871 unsafe fn decode(
2872 &mut self,
2873 decoder: &mut fidl::encoding::Decoder<
2874 '_,
2875 fidl::encoding::DefaultFuchsiaResourceDialect,
2876 >,
2877 offset: usize,
2878 _depth: fidl::encoding::Depth,
2879 ) -> fidl::Result<()> {
2880 decoder.debug_check_bounds::<Self>(offset);
2881 fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.transaction, decoder, offset + 0, _depth)?;
2883 Ok(())
2884 }
2885 }
2886
2887 impl PartitionUpdateMetadataRequest {
2888 #[inline(always)]
2889 fn max_ordinal_present(&self) -> u64 {
2890 if let Some(_) = self.flags {
2891 return 3;
2892 }
2893 if let Some(_) = self.type_guid {
2894 return 2;
2895 }
2896 if let Some(_) = self.transaction {
2897 return 1;
2898 }
2899 0
2900 }
2901 }
2902
2903 impl fidl::encoding::ResourceTypeMarker for PartitionUpdateMetadataRequest {
2904 type Borrowed<'a> = &'a mut Self;
2905 fn take_or_borrow<'a>(
2906 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2907 ) -> Self::Borrowed<'a> {
2908 value
2909 }
2910 }
2911
2912 unsafe impl fidl::encoding::TypeMarker for PartitionUpdateMetadataRequest {
2913 type Owned = Self;
2914
2915 #[inline(always)]
2916 fn inline_align(_context: fidl::encoding::Context) -> usize {
2917 8
2918 }
2919
2920 #[inline(always)]
2921 fn inline_size(_context: fidl::encoding::Context) -> usize {
2922 16
2923 }
2924 }
2925
2926 unsafe impl
2927 fidl::encoding::Encode<
2928 PartitionUpdateMetadataRequest,
2929 fidl::encoding::DefaultFuchsiaResourceDialect,
2930 > for &mut PartitionUpdateMetadataRequest
2931 {
2932 unsafe fn encode(
2933 self,
2934 encoder: &mut fidl::encoding::Encoder<
2935 '_,
2936 fidl::encoding::DefaultFuchsiaResourceDialect,
2937 >,
2938 offset: usize,
2939 mut depth: fidl::encoding::Depth,
2940 ) -> fidl::Result<()> {
2941 encoder.debug_check_bounds::<PartitionUpdateMetadataRequest>(offset);
2942 let max_ordinal: u64 = self.max_ordinal_present();
2944 encoder.write_num(max_ordinal, offset);
2945 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2946 if max_ordinal == 0 {
2948 return Ok(());
2949 }
2950 depth.increment()?;
2951 let envelope_size = 8;
2952 let bytes_len = max_ordinal as usize * envelope_size;
2953 #[allow(unused_variables)]
2954 let offset = encoder.out_of_line_offset(bytes_len);
2955 let mut _prev_end_offset: usize = 0;
2956 if 1 > max_ordinal {
2957 return Ok(());
2958 }
2959
2960 let cur_offset: usize = (1 - 1) * envelope_size;
2963
2964 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2966
2967 fidl::encoding::encode_in_envelope_optional::<
2972 fidl::encoding::HandleType<
2973 fidl::EventPair,
2974 { fidl::ObjectType::EVENTPAIR.into_raw() },
2975 2147483648,
2976 >,
2977 fidl::encoding::DefaultFuchsiaResourceDialect,
2978 >(
2979 self.transaction.as_mut().map(
2980 <fidl::encoding::HandleType<
2981 fidl::EventPair,
2982 { fidl::ObjectType::EVENTPAIR.into_raw() },
2983 2147483648,
2984 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
2985 ),
2986 encoder,
2987 offset + cur_offset,
2988 depth,
2989 )?;
2990
2991 _prev_end_offset = cur_offset + envelope_size;
2992 if 2 > max_ordinal {
2993 return Ok(());
2994 }
2995
2996 let cur_offset: usize = (2 - 1) * envelope_size;
2999
3000 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3002
3003 fidl::encoding::encode_in_envelope_optional::<
3008 fidl_fuchsia_storage_block::Guid,
3009 fidl::encoding::DefaultFuchsiaResourceDialect,
3010 >(
3011 self.type_guid.as_ref().map(
3012 <fidl_fuchsia_storage_block::Guid as fidl::encoding::ValueTypeMarker>::borrow,
3013 ),
3014 encoder,
3015 offset + cur_offset,
3016 depth,
3017 )?;
3018
3019 _prev_end_offset = cur_offset + envelope_size;
3020 if 3 > max_ordinal {
3021 return Ok(());
3022 }
3023
3024 let cur_offset: usize = (3 - 1) * envelope_size;
3027
3028 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3030
3031 fidl::encoding::encode_in_envelope_optional::<
3036 u64,
3037 fidl::encoding::DefaultFuchsiaResourceDialect,
3038 >(
3039 self.flags.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
3040 encoder,
3041 offset + cur_offset,
3042 depth,
3043 )?;
3044
3045 _prev_end_offset = cur_offset + envelope_size;
3046
3047 Ok(())
3048 }
3049 }
3050
3051 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3052 for PartitionUpdateMetadataRequest
3053 {
3054 #[inline(always)]
3055 fn new_empty() -> Self {
3056 Self::default()
3057 }
3058
3059 unsafe fn decode(
3060 &mut self,
3061 decoder: &mut fidl::encoding::Decoder<
3062 '_,
3063 fidl::encoding::DefaultFuchsiaResourceDialect,
3064 >,
3065 offset: usize,
3066 mut depth: fidl::encoding::Depth,
3067 ) -> fidl::Result<()> {
3068 decoder.debug_check_bounds::<Self>(offset);
3069 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3070 None => return Err(fidl::Error::NotNullable),
3071 Some(len) => len,
3072 };
3073 if len == 0 {
3075 return Ok(());
3076 };
3077 depth.increment()?;
3078 let envelope_size = 8;
3079 let bytes_len = len * envelope_size;
3080 let offset = decoder.out_of_line_offset(bytes_len)?;
3081 let mut _next_ordinal_to_read = 0;
3083 let mut next_offset = offset;
3084 let end_offset = offset + bytes_len;
3085 _next_ordinal_to_read += 1;
3086 if next_offset >= end_offset {
3087 return Ok(());
3088 }
3089
3090 while _next_ordinal_to_read < 1 {
3092 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3093 _next_ordinal_to_read += 1;
3094 next_offset += envelope_size;
3095 }
3096
3097 let next_out_of_line = decoder.next_out_of_line();
3098 let handles_before = decoder.remaining_handles();
3099 if let Some((inlined, num_bytes, num_handles)) =
3100 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3101 {
3102 let member_inline_size = <fidl::encoding::HandleType<
3103 fidl::EventPair,
3104 { fidl::ObjectType::EVENTPAIR.into_raw() },
3105 2147483648,
3106 > as fidl::encoding::TypeMarker>::inline_size(
3107 decoder.context
3108 );
3109 if inlined != (member_inline_size <= 4) {
3110 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3111 }
3112 let inner_offset;
3113 let mut inner_depth = depth.clone();
3114 if inlined {
3115 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3116 inner_offset = next_offset;
3117 } else {
3118 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3119 inner_depth.increment()?;
3120 }
3121 let val_ref =
3122 self.transaction.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
3123 fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
3124 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3125 {
3126 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3127 }
3128 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3129 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3130 }
3131 }
3132
3133 next_offset += envelope_size;
3134 _next_ordinal_to_read += 1;
3135 if next_offset >= end_offset {
3136 return Ok(());
3137 }
3138
3139 while _next_ordinal_to_read < 2 {
3141 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3142 _next_ordinal_to_read += 1;
3143 next_offset += envelope_size;
3144 }
3145
3146 let next_out_of_line = decoder.next_out_of_line();
3147 let handles_before = decoder.remaining_handles();
3148 if let Some((inlined, num_bytes, num_handles)) =
3149 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3150 {
3151 let member_inline_size =
3152 <fidl_fuchsia_storage_block::Guid as fidl::encoding::TypeMarker>::inline_size(
3153 decoder.context,
3154 );
3155 if inlined != (member_inline_size <= 4) {
3156 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3157 }
3158 let inner_offset;
3159 let mut inner_depth = depth.clone();
3160 if inlined {
3161 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3162 inner_offset = next_offset;
3163 } else {
3164 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3165 inner_depth.increment()?;
3166 }
3167 let val_ref = self.type_guid.get_or_insert_with(|| {
3168 fidl::new_empty!(
3169 fidl_fuchsia_storage_block::Guid,
3170 fidl::encoding::DefaultFuchsiaResourceDialect
3171 )
3172 });
3173 fidl::decode!(
3174 fidl_fuchsia_storage_block::Guid,
3175 fidl::encoding::DefaultFuchsiaResourceDialect,
3176 val_ref,
3177 decoder,
3178 inner_offset,
3179 inner_depth
3180 )?;
3181 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3182 {
3183 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3184 }
3185 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3186 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3187 }
3188 }
3189
3190 next_offset += envelope_size;
3191 _next_ordinal_to_read += 1;
3192 if next_offset >= end_offset {
3193 return Ok(());
3194 }
3195
3196 while _next_ordinal_to_read < 3 {
3198 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3199 _next_ordinal_to_read += 1;
3200 next_offset += envelope_size;
3201 }
3202
3203 let next_out_of_line = decoder.next_out_of_line();
3204 let handles_before = decoder.remaining_handles();
3205 if let Some((inlined, num_bytes, num_handles)) =
3206 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3207 {
3208 let member_inline_size =
3209 <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3210 if inlined != (member_inline_size <= 4) {
3211 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3212 }
3213 let inner_offset;
3214 let mut inner_depth = depth.clone();
3215 if inlined {
3216 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3217 inner_offset = next_offset;
3218 } else {
3219 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3220 inner_depth.increment()?;
3221 }
3222 let val_ref = self.flags.get_or_insert_with(|| {
3223 fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
3224 });
3225 fidl::decode!(
3226 u64,
3227 fidl::encoding::DefaultFuchsiaResourceDialect,
3228 val_ref,
3229 decoder,
3230 inner_offset,
3231 inner_depth
3232 )?;
3233 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3234 {
3235 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3236 }
3237 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3238 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3239 }
3240 }
3241
3242 next_offset += envelope_size;
3243
3244 while next_offset < end_offset {
3246 _next_ordinal_to_read += 1;
3247 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3248 next_offset += envelope_size;
3249 }
3250
3251 Ok(())
3252 }
3253 }
3254
3255 impl PartitionsManagerAddPartitionRequest {
3256 #[inline(always)]
3257 fn max_ordinal_present(&self) -> u64 {
3258 if let Some(_) = self.flags {
3259 return 6;
3260 }
3261 if let Some(_) = self.instance_guid {
3262 return 5;
3263 }
3264 if let Some(_) = self.type_guid {
3265 return 4;
3266 }
3267 if let Some(_) = self.name {
3268 return 3;
3269 }
3270 if let Some(_) = self.num_blocks {
3271 return 2;
3272 }
3273 if let Some(_) = self.transaction {
3274 return 1;
3275 }
3276 0
3277 }
3278 }
3279
3280 impl fidl::encoding::ResourceTypeMarker for PartitionsManagerAddPartitionRequest {
3281 type Borrowed<'a> = &'a mut Self;
3282 fn take_or_borrow<'a>(
3283 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3284 ) -> Self::Borrowed<'a> {
3285 value
3286 }
3287 }
3288
3289 unsafe impl fidl::encoding::TypeMarker for PartitionsManagerAddPartitionRequest {
3290 type Owned = Self;
3291
3292 #[inline(always)]
3293 fn inline_align(_context: fidl::encoding::Context) -> usize {
3294 8
3295 }
3296
3297 #[inline(always)]
3298 fn inline_size(_context: fidl::encoding::Context) -> usize {
3299 16
3300 }
3301 }
3302
3303 unsafe impl
3304 fidl::encoding::Encode<
3305 PartitionsManagerAddPartitionRequest,
3306 fidl::encoding::DefaultFuchsiaResourceDialect,
3307 > for &mut PartitionsManagerAddPartitionRequest
3308 {
3309 unsafe fn encode(
3310 self,
3311 encoder: &mut fidl::encoding::Encoder<
3312 '_,
3313 fidl::encoding::DefaultFuchsiaResourceDialect,
3314 >,
3315 offset: usize,
3316 mut depth: fidl::encoding::Depth,
3317 ) -> fidl::Result<()> {
3318 encoder.debug_check_bounds::<PartitionsManagerAddPartitionRequest>(offset);
3319 let max_ordinal: u64 = self.max_ordinal_present();
3321 encoder.write_num(max_ordinal, offset);
3322 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3323 if max_ordinal == 0 {
3325 return Ok(());
3326 }
3327 depth.increment()?;
3328 let envelope_size = 8;
3329 let bytes_len = max_ordinal as usize * envelope_size;
3330 #[allow(unused_variables)]
3331 let offset = encoder.out_of_line_offset(bytes_len);
3332 let mut _prev_end_offset: usize = 0;
3333 if 1 > max_ordinal {
3334 return Ok(());
3335 }
3336
3337 let cur_offset: usize = (1 - 1) * envelope_size;
3340
3341 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3343
3344 fidl::encoding::encode_in_envelope_optional::<
3349 fidl::encoding::HandleType<
3350 fidl::EventPair,
3351 { fidl::ObjectType::EVENTPAIR.into_raw() },
3352 2147483648,
3353 >,
3354 fidl::encoding::DefaultFuchsiaResourceDialect,
3355 >(
3356 self.transaction.as_mut().map(
3357 <fidl::encoding::HandleType<
3358 fidl::EventPair,
3359 { fidl::ObjectType::EVENTPAIR.into_raw() },
3360 2147483648,
3361 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
3362 ),
3363 encoder,
3364 offset + cur_offset,
3365 depth,
3366 )?;
3367
3368 _prev_end_offset = cur_offset + envelope_size;
3369 if 2 > max_ordinal {
3370 return Ok(());
3371 }
3372
3373 let cur_offset: usize = (2 - 1) * envelope_size;
3376
3377 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3379
3380 fidl::encoding::encode_in_envelope_optional::<
3385 u64,
3386 fidl::encoding::DefaultFuchsiaResourceDialect,
3387 >(
3388 self.num_blocks.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
3389 encoder,
3390 offset + cur_offset,
3391 depth,
3392 )?;
3393
3394 _prev_end_offset = cur_offset + envelope_size;
3395 if 3 > max_ordinal {
3396 return Ok(());
3397 }
3398
3399 let cur_offset: usize = (3 - 1) * envelope_size;
3402
3403 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3405
3406 fidl::encoding::encode_in_envelope_optional::<
3411 fidl::encoding::BoundedString<128>,
3412 fidl::encoding::DefaultFuchsiaResourceDialect,
3413 >(
3414 self.name.as_ref().map(
3415 <fidl::encoding::BoundedString<128> as fidl::encoding::ValueTypeMarker>::borrow,
3416 ),
3417 encoder,
3418 offset + cur_offset,
3419 depth,
3420 )?;
3421
3422 _prev_end_offset = cur_offset + envelope_size;
3423 if 4 > max_ordinal {
3424 return Ok(());
3425 }
3426
3427 let cur_offset: usize = (4 - 1) * envelope_size;
3430
3431 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3433
3434 fidl::encoding::encode_in_envelope_optional::<
3439 fidl_fuchsia_storage_block::Guid,
3440 fidl::encoding::DefaultFuchsiaResourceDialect,
3441 >(
3442 self.type_guid.as_ref().map(
3443 <fidl_fuchsia_storage_block::Guid as fidl::encoding::ValueTypeMarker>::borrow,
3444 ),
3445 encoder,
3446 offset + cur_offset,
3447 depth,
3448 )?;
3449
3450 _prev_end_offset = cur_offset + envelope_size;
3451 if 5 > max_ordinal {
3452 return Ok(());
3453 }
3454
3455 let cur_offset: usize = (5 - 1) * envelope_size;
3458
3459 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3461
3462 fidl::encoding::encode_in_envelope_optional::<
3467 fidl_fuchsia_storage_block::Guid,
3468 fidl::encoding::DefaultFuchsiaResourceDialect,
3469 >(
3470 self.instance_guid.as_ref().map(
3471 <fidl_fuchsia_storage_block::Guid as fidl::encoding::ValueTypeMarker>::borrow,
3472 ),
3473 encoder,
3474 offset + cur_offset,
3475 depth,
3476 )?;
3477
3478 _prev_end_offset = cur_offset + envelope_size;
3479 if 6 > max_ordinal {
3480 return Ok(());
3481 }
3482
3483 let cur_offset: usize = (6 - 1) * envelope_size;
3486
3487 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3489
3490 fidl::encoding::encode_in_envelope_optional::<
3495 u64,
3496 fidl::encoding::DefaultFuchsiaResourceDialect,
3497 >(
3498 self.flags.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
3499 encoder,
3500 offset + cur_offset,
3501 depth,
3502 )?;
3503
3504 _prev_end_offset = cur_offset + envelope_size;
3505
3506 Ok(())
3507 }
3508 }
3509
3510 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3511 for PartitionsManagerAddPartitionRequest
3512 {
3513 #[inline(always)]
3514 fn new_empty() -> Self {
3515 Self::default()
3516 }
3517
3518 unsafe fn decode(
3519 &mut self,
3520 decoder: &mut fidl::encoding::Decoder<
3521 '_,
3522 fidl::encoding::DefaultFuchsiaResourceDialect,
3523 >,
3524 offset: usize,
3525 mut depth: fidl::encoding::Depth,
3526 ) -> fidl::Result<()> {
3527 decoder.debug_check_bounds::<Self>(offset);
3528 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3529 None => return Err(fidl::Error::NotNullable),
3530 Some(len) => len,
3531 };
3532 if len == 0 {
3534 return Ok(());
3535 };
3536 depth.increment()?;
3537 let envelope_size = 8;
3538 let bytes_len = len * envelope_size;
3539 let offset = decoder.out_of_line_offset(bytes_len)?;
3540 let mut _next_ordinal_to_read = 0;
3542 let mut next_offset = offset;
3543 let end_offset = offset + bytes_len;
3544 _next_ordinal_to_read += 1;
3545 if next_offset >= end_offset {
3546 return Ok(());
3547 }
3548
3549 while _next_ordinal_to_read < 1 {
3551 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3552 _next_ordinal_to_read += 1;
3553 next_offset += envelope_size;
3554 }
3555
3556 let next_out_of_line = decoder.next_out_of_line();
3557 let handles_before = decoder.remaining_handles();
3558 if let Some((inlined, num_bytes, num_handles)) =
3559 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3560 {
3561 let member_inline_size = <fidl::encoding::HandleType<
3562 fidl::EventPair,
3563 { fidl::ObjectType::EVENTPAIR.into_raw() },
3564 2147483648,
3565 > as fidl::encoding::TypeMarker>::inline_size(
3566 decoder.context
3567 );
3568 if inlined != (member_inline_size <= 4) {
3569 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3570 }
3571 let inner_offset;
3572 let mut inner_depth = depth.clone();
3573 if inlined {
3574 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3575 inner_offset = next_offset;
3576 } else {
3577 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3578 inner_depth.increment()?;
3579 }
3580 let val_ref =
3581 self.transaction.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
3582 fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
3583 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3584 {
3585 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3586 }
3587 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3588 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3589 }
3590 }
3591
3592 next_offset += envelope_size;
3593 _next_ordinal_to_read += 1;
3594 if next_offset >= end_offset {
3595 return Ok(());
3596 }
3597
3598 while _next_ordinal_to_read < 2 {
3600 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3601 _next_ordinal_to_read += 1;
3602 next_offset += envelope_size;
3603 }
3604
3605 let next_out_of_line = decoder.next_out_of_line();
3606 let handles_before = decoder.remaining_handles();
3607 if let Some((inlined, num_bytes, num_handles)) =
3608 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3609 {
3610 let member_inline_size =
3611 <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3612 if inlined != (member_inline_size <= 4) {
3613 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3614 }
3615 let inner_offset;
3616 let mut inner_depth = depth.clone();
3617 if inlined {
3618 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3619 inner_offset = next_offset;
3620 } else {
3621 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3622 inner_depth.increment()?;
3623 }
3624 let val_ref = self.num_blocks.get_or_insert_with(|| {
3625 fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
3626 });
3627 fidl::decode!(
3628 u64,
3629 fidl::encoding::DefaultFuchsiaResourceDialect,
3630 val_ref,
3631 decoder,
3632 inner_offset,
3633 inner_depth
3634 )?;
3635 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3636 {
3637 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3638 }
3639 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3640 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3641 }
3642 }
3643
3644 next_offset += envelope_size;
3645 _next_ordinal_to_read += 1;
3646 if next_offset >= end_offset {
3647 return Ok(());
3648 }
3649
3650 while _next_ordinal_to_read < 3 {
3652 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3653 _next_ordinal_to_read += 1;
3654 next_offset += envelope_size;
3655 }
3656
3657 let next_out_of_line = decoder.next_out_of_line();
3658 let handles_before = decoder.remaining_handles();
3659 if let Some((inlined, num_bytes, num_handles)) =
3660 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3661 {
3662 let member_inline_size =
3663 <fidl::encoding::BoundedString<128> as fidl::encoding::TypeMarker>::inline_size(
3664 decoder.context,
3665 );
3666 if inlined != (member_inline_size <= 4) {
3667 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3668 }
3669 let inner_offset;
3670 let mut inner_depth = depth.clone();
3671 if inlined {
3672 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3673 inner_offset = next_offset;
3674 } else {
3675 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3676 inner_depth.increment()?;
3677 }
3678 let val_ref = self.name.get_or_insert_with(|| {
3679 fidl::new_empty!(
3680 fidl::encoding::BoundedString<128>,
3681 fidl::encoding::DefaultFuchsiaResourceDialect
3682 )
3683 });
3684 fidl::decode!(
3685 fidl::encoding::BoundedString<128>,
3686 fidl::encoding::DefaultFuchsiaResourceDialect,
3687 val_ref,
3688 decoder,
3689 inner_offset,
3690 inner_depth
3691 )?;
3692 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3693 {
3694 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3695 }
3696 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3697 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3698 }
3699 }
3700
3701 next_offset += envelope_size;
3702 _next_ordinal_to_read += 1;
3703 if next_offset >= end_offset {
3704 return Ok(());
3705 }
3706
3707 while _next_ordinal_to_read < 4 {
3709 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3710 _next_ordinal_to_read += 1;
3711 next_offset += envelope_size;
3712 }
3713
3714 let next_out_of_line = decoder.next_out_of_line();
3715 let handles_before = decoder.remaining_handles();
3716 if let Some((inlined, num_bytes, num_handles)) =
3717 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3718 {
3719 let member_inline_size =
3720 <fidl_fuchsia_storage_block::Guid as fidl::encoding::TypeMarker>::inline_size(
3721 decoder.context,
3722 );
3723 if inlined != (member_inline_size <= 4) {
3724 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3725 }
3726 let inner_offset;
3727 let mut inner_depth = depth.clone();
3728 if inlined {
3729 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3730 inner_offset = next_offset;
3731 } else {
3732 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3733 inner_depth.increment()?;
3734 }
3735 let val_ref = self.type_guid.get_or_insert_with(|| {
3736 fidl::new_empty!(
3737 fidl_fuchsia_storage_block::Guid,
3738 fidl::encoding::DefaultFuchsiaResourceDialect
3739 )
3740 });
3741 fidl::decode!(
3742 fidl_fuchsia_storage_block::Guid,
3743 fidl::encoding::DefaultFuchsiaResourceDialect,
3744 val_ref,
3745 decoder,
3746 inner_offset,
3747 inner_depth
3748 )?;
3749 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3750 {
3751 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3752 }
3753 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3754 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3755 }
3756 }
3757
3758 next_offset += envelope_size;
3759 _next_ordinal_to_read += 1;
3760 if next_offset >= end_offset {
3761 return Ok(());
3762 }
3763
3764 while _next_ordinal_to_read < 5 {
3766 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3767 _next_ordinal_to_read += 1;
3768 next_offset += envelope_size;
3769 }
3770
3771 let next_out_of_line = decoder.next_out_of_line();
3772 let handles_before = decoder.remaining_handles();
3773 if let Some((inlined, num_bytes, num_handles)) =
3774 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3775 {
3776 let member_inline_size =
3777 <fidl_fuchsia_storage_block::Guid as fidl::encoding::TypeMarker>::inline_size(
3778 decoder.context,
3779 );
3780 if inlined != (member_inline_size <= 4) {
3781 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3782 }
3783 let inner_offset;
3784 let mut inner_depth = depth.clone();
3785 if inlined {
3786 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3787 inner_offset = next_offset;
3788 } else {
3789 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3790 inner_depth.increment()?;
3791 }
3792 let val_ref = self.instance_guid.get_or_insert_with(|| {
3793 fidl::new_empty!(
3794 fidl_fuchsia_storage_block::Guid,
3795 fidl::encoding::DefaultFuchsiaResourceDialect
3796 )
3797 });
3798 fidl::decode!(
3799 fidl_fuchsia_storage_block::Guid,
3800 fidl::encoding::DefaultFuchsiaResourceDialect,
3801 val_ref,
3802 decoder,
3803 inner_offset,
3804 inner_depth
3805 )?;
3806 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3807 {
3808 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3809 }
3810 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3811 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3812 }
3813 }
3814
3815 next_offset += envelope_size;
3816 _next_ordinal_to_read += 1;
3817 if next_offset >= end_offset {
3818 return Ok(());
3819 }
3820
3821 while _next_ordinal_to_read < 6 {
3823 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3824 _next_ordinal_to_read += 1;
3825 next_offset += envelope_size;
3826 }
3827
3828 let next_out_of_line = decoder.next_out_of_line();
3829 let handles_before = decoder.remaining_handles();
3830 if let Some((inlined, num_bytes, num_handles)) =
3831 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3832 {
3833 let member_inline_size =
3834 <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3835 if inlined != (member_inline_size <= 4) {
3836 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3837 }
3838 let inner_offset;
3839 let mut inner_depth = depth.clone();
3840 if inlined {
3841 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3842 inner_offset = next_offset;
3843 } else {
3844 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3845 inner_depth.increment()?;
3846 }
3847 let val_ref = self.flags.get_or_insert_with(|| {
3848 fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
3849 });
3850 fidl::decode!(
3851 u64,
3852 fidl::encoding::DefaultFuchsiaResourceDialect,
3853 val_ref,
3854 decoder,
3855 inner_offset,
3856 inner_depth
3857 )?;
3858 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3859 {
3860 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3861 }
3862 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3863 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3864 }
3865 }
3866
3867 next_offset += envelope_size;
3868
3869 while next_offset < end_offset {
3871 _next_ordinal_to_read += 1;
3872 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3873 next_offset += envelope_size;
3874 }
3875
3876 Ok(())
3877 }
3878 }
3879}