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