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_hardware_block_partition::Guid>,
38 pub flags: Option<u64>,
39 #[doc(hidden)]
40 pub __source_breaking: fidl::marker::SourceBreaking,
41}
42
43impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
44 for PartitionUpdateMetadataRequest
45{
46}
47
48#[derive(Debug, Default, PartialEq)]
49pub struct PartitionsManagerAddPartitionRequest {
50 pub transaction: Option<fidl::EventPair>,
51 pub num_blocks: Option<u64>,
52 pub name: Option<String>,
53 pub type_guid: Option<fidl_fuchsia_hardware_block_partition::Guid>,
54 pub instance_guid: Option<fidl_fuchsia_hardware_block_partition::Guid>,
55 pub flags: Option<u64>,
56 #[doc(hidden)]
57 pub __source_breaking: fidl::marker::SourceBreaking,
58}
59
60impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
61 for PartitionsManagerAddPartitionRequest
62{
63}
64
65#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
66pub struct 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::Handle {
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 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
433 self.inner.shutdown_with_epitaph(status)
434 }
435
436 fn is_closed(&self) -> bool {
437 self.inner.channel().is_closed()
438 }
439 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
440 self.inner.channel().on_closed()
441 }
442
443 #[cfg(target_os = "fuchsia")]
444 fn signal_peer(
445 &self,
446 clear_mask: zx::Signals,
447 set_mask: zx::Signals,
448 ) -> Result<(), zx_status::Status> {
449 use fidl::Peered;
450 self.inner.channel().signal_peer(clear_mask, set_mask)
451 }
452}
453
454impl OverlayPartitionControlHandle {}
455
456#[must_use = "FIDL methods require a response to be sent"]
457#[derive(Debug)]
458pub struct OverlayPartitionGetPartitionsResponder {
459 control_handle: std::mem::ManuallyDrop<OverlayPartitionControlHandle>,
460 tx_id: u32,
461}
462
463impl std::ops::Drop for OverlayPartitionGetPartitionsResponder {
467 fn drop(&mut self) {
468 self.control_handle.shutdown();
469 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
471 }
472}
473
474impl fidl::endpoints::Responder for OverlayPartitionGetPartitionsResponder {
475 type ControlHandle = OverlayPartitionControlHandle;
476
477 fn control_handle(&self) -> &OverlayPartitionControlHandle {
478 &self.control_handle
479 }
480
481 fn drop_without_shutdown(mut self) {
482 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
484 std::mem::forget(self);
486 }
487}
488
489impl OverlayPartitionGetPartitionsResponder {
490 pub fn send(self, mut result: Result<&[PartitionInfo], i32>) -> Result<(), fidl::Error> {
494 let _result = self.send_raw(result);
495 if _result.is_err() {
496 self.control_handle.shutdown();
497 }
498 self.drop_without_shutdown();
499 _result
500 }
501
502 pub fn send_no_shutdown_on_err(
504 self,
505 mut result: Result<&[PartitionInfo], i32>,
506 ) -> Result<(), fidl::Error> {
507 let _result = self.send_raw(result);
508 self.drop_without_shutdown();
509 _result
510 }
511
512 fn send_raw(&self, mut result: Result<&[PartitionInfo], i32>) -> Result<(), fidl::Error> {
513 self.control_handle.inner.send::<fidl::encoding::ResultType<
514 OverlayPartitionGetPartitionsResponse,
515 i32,
516 >>(
517 result.map(|partitions| (partitions,)),
518 self.tx_id,
519 0x7296daafa369c09b,
520 fidl::encoding::DynamicFlags::empty(),
521 )
522 }
523}
524
525#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
526pub struct PartitionMarker;
527
528impl fidl::endpoints::ProtocolMarker for PartitionMarker {
529 type Proxy = PartitionProxy;
530 type RequestStream = PartitionRequestStream;
531 #[cfg(target_os = "fuchsia")]
532 type SynchronousProxy = PartitionSynchronousProxy;
533
534 const DEBUG_NAME: &'static str = "fuchsia.storage.partitions.Partition";
535}
536impl fidl::endpoints::DiscoverableProtocolMarker for PartitionMarker {}
537pub type PartitionUpdateMetadataResult = Result<(), i32>;
538
539pub trait PartitionProxyInterface: Send + Sync {
540 type UpdateMetadataResponseFut: std::future::Future<Output = Result<PartitionUpdateMetadataResult, fidl::Error>>
541 + Send;
542 fn r#update_metadata(
543 &self,
544 payload: PartitionUpdateMetadataRequest,
545 ) -> Self::UpdateMetadataResponseFut;
546}
547#[derive(Debug)]
548#[cfg(target_os = "fuchsia")]
549pub struct PartitionSynchronousProxy {
550 client: fidl::client::sync::Client,
551}
552
553#[cfg(target_os = "fuchsia")]
554impl fidl::endpoints::SynchronousProxy for PartitionSynchronousProxy {
555 type Proxy = PartitionProxy;
556 type Protocol = PartitionMarker;
557
558 fn from_channel(inner: fidl::Channel) -> Self {
559 Self::new(inner)
560 }
561
562 fn into_channel(self) -> fidl::Channel {
563 self.client.into_channel()
564 }
565
566 fn as_channel(&self) -> &fidl::Channel {
567 self.client.as_channel()
568 }
569}
570
571#[cfg(target_os = "fuchsia")]
572impl PartitionSynchronousProxy {
573 pub fn new(channel: fidl::Channel) -> Self {
574 let protocol_name = <PartitionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
575 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
576 }
577
578 pub fn into_channel(self) -> fidl::Channel {
579 self.client.into_channel()
580 }
581
582 pub fn wait_for_event(
585 &self,
586 deadline: zx::MonotonicInstant,
587 ) -> Result<PartitionEvent, fidl::Error> {
588 PartitionEvent::decode(self.client.wait_for_event(deadline)?)
589 }
590
591 pub fn r#update_metadata(
595 &self,
596 mut payload: PartitionUpdateMetadataRequest,
597 ___deadline: zx::MonotonicInstant,
598 ) -> Result<PartitionUpdateMetadataResult, fidl::Error> {
599 let _response = self.client.send_query::<
600 PartitionUpdateMetadataRequest,
601 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
602 >(
603 &mut payload,
604 0x7bce44e5c9d5009c,
605 fidl::encoding::DynamicFlags::empty(),
606 ___deadline,
607 )?;
608 Ok(_response.map(|x| x))
609 }
610}
611
612#[cfg(target_os = "fuchsia")]
613impl From<PartitionSynchronousProxy> for zx::Handle {
614 fn from(value: PartitionSynchronousProxy) -> Self {
615 value.into_channel().into()
616 }
617}
618
619#[cfg(target_os = "fuchsia")]
620impl From<fidl::Channel> for PartitionSynchronousProxy {
621 fn from(value: fidl::Channel) -> Self {
622 Self::new(value)
623 }
624}
625
626#[cfg(target_os = "fuchsia")]
627impl fidl::endpoints::FromClient for PartitionSynchronousProxy {
628 type Protocol = PartitionMarker;
629
630 fn from_client(value: fidl::endpoints::ClientEnd<PartitionMarker>) -> Self {
631 Self::new(value.into_channel())
632 }
633}
634
635#[derive(Debug, Clone)]
636pub struct PartitionProxy {
637 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
638}
639
640impl fidl::endpoints::Proxy for PartitionProxy {
641 type Protocol = PartitionMarker;
642
643 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
644 Self::new(inner)
645 }
646
647 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
648 self.client.into_channel().map_err(|client| Self { client })
649 }
650
651 fn as_channel(&self) -> &::fidl::AsyncChannel {
652 self.client.as_channel()
653 }
654}
655
656impl PartitionProxy {
657 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
659 let protocol_name = <PartitionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
660 Self { client: fidl::client::Client::new(channel, protocol_name) }
661 }
662
663 pub fn take_event_stream(&self) -> PartitionEventStream {
669 PartitionEventStream { event_receiver: self.client.take_event_receiver() }
670 }
671
672 pub fn r#update_metadata(
676 &self,
677 mut payload: PartitionUpdateMetadataRequest,
678 ) -> fidl::client::QueryResponseFut<
679 PartitionUpdateMetadataResult,
680 fidl::encoding::DefaultFuchsiaResourceDialect,
681 > {
682 PartitionProxyInterface::r#update_metadata(self, payload)
683 }
684}
685
686impl PartitionProxyInterface for PartitionProxy {
687 type UpdateMetadataResponseFut = fidl::client::QueryResponseFut<
688 PartitionUpdateMetadataResult,
689 fidl::encoding::DefaultFuchsiaResourceDialect,
690 >;
691 fn r#update_metadata(
692 &self,
693 mut payload: PartitionUpdateMetadataRequest,
694 ) -> Self::UpdateMetadataResponseFut {
695 fn _decode(
696 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
697 ) -> Result<PartitionUpdateMetadataResult, fidl::Error> {
698 let _response = fidl::client::decode_transaction_body::<
699 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
700 fidl::encoding::DefaultFuchsiaResourceDialect,
701 0x7bce44e5c9d5009c,
702 >(_buf?)?;
703 Ok(_response.map(|x| x))
704 }
705 self.client
706 .send_query_and_decode::<PartitionUpdateMetadataRequest, PartitionUpdateMetadataResult>(
707 &mut payload,
708 0x7bce44e5c9d5009c,
709 fidl::encoding::DynamicFlags::empty(),
710 _decode,
711 )
712 }
713}
714
715pub struct PartitionEventStream {
716 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
717}
718
719impl std::marker::Unpin for PartitionEventStream {}
720
721impl futures::stream::FusedStream for PartitionEventStream {
722 fn is_terminated(&self) -> bool {
723 self.event_receiver.is_terminated()
724 }
725}
726
727impl futures::Stream for PartitionEventStream {
728 type Item = Result<PartitionEvent, fidl::Error>;
729
730 fn poll_next(
731 mut self: std::pin::Pin<&mut Self>,
732 cx: &mut std::task::Context<'_>,
733 ) -> std::task::Poll<Option<Self::Item>> {
734 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
735 &mut self.event_receiver,
736 cx
737 )?) {
738 Some(buf) => std::task::Poll::Ready(Some(PartitionEvent::decode(buf))),
739 None => std::task::Poll::Ready(None),
740 }
741 }
742}
743
744#[derive(Debug)]
745pub enum PartitionEvent {}
746
747impl PartitionEvent {
748 fn decode(
750 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
751 ) -> Result<PartitionEvent, fidl::Error> {
752 let (bytes, _handles) = buf.split_mut();
753 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
754 debug_assert_eq!(tx_header.tx_id, 0);
755 match tx_header.ordinal {
756 _ => Err(fidl::Error::UnknownOrdinal {
757 ordinal: tx_header.ordinal,
758 protocol_name: <PartitionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
759 }),
760 }
761 }
762}
763
764pub struct PartitionRequestStream {
766 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
767 is_terminated: bool,
768}
769
770impl std::marker::Unpin for PartitionRequestStream {}
771
772impl futures::stream::FusedStream for PartitionRequestStream {
773 fn is_terminated(&self) -> bool {
774 self.is_terminated
775 }
776}
777
778impl fidl::endpoints::RequestStream for PartitionRequestStream {
779 type Protocol = PartitionMarker;
780 type ControlHandle = PartitionControlHandle;
781
782 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
783 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
784 }
785
786 fn control_handle(&self) -> Self::ControlHandle {
787 PartitionControlHandle { inner: self.inner.clone() }
788 }
789
790 fn into_inner(
791 self,
792 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
793 {
794 (self.inner, self.is_terminated)
795 }
796
797 fn from_inner(
798 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
799 is_terminated: bool,
800 ) -> Self {
801 Self { inner, is_terminated }
802 }
803}
804
805impl futures::Stream for PartitionRequestStream {
806 type Item = Result<PartitionRequest, fidl::Error>;
807
808 fn poll_next(
809 mut self: std::pin::Pin<&mut Self>,
810 cx: &mut std::task::Context<'_>,
811 ) -> std::task::Poll<Option<Self::Item>> {
812 let this = &mut *self;
813 if this.inner.check_shutdown(cx) {
814 this.is_terminated = true;
815 return std::task::Poll::Ready(None);
816 }
817 if this.is_terminated {
818 panic!("polled PartitionRequestStream after completion");
819 }
820 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
821 |bytes, handles| {
822 match this.inner.channel().read_etc(cx, bytes, handles) {
823 std::task::Poll::Ready(Ok(())) => {}
824 std::task::Poll::Pending => return std::task::Poll::Pending,
825 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
826 this.is_terminated = true;
827 return std::task::Poll::Ready(None);
828 }
829 std::task::Poll::Ready(Err(e)) => {
830 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
831 e.into(),
832 ))));
833 }
834 }
835
836 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
838
839 std::task::Poll::Ready(Some(match header.ordinal {
840 0x7bce44e5c9d5009c => {
841 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
842 let mut req = fidl::new_empty!(
843 PartitionUpdateMetadataRequest,
844 fidl::encoding::DefaultFuchsiaResourceDialect
845 );
846 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PartitionUpdateMetadataRequest>(&header, _body_bytes, handles, &mut req)?;
847 let control_handle = PartitionControlHandle { inner: this.inner.clone() };
848 Ok(PartitionRequest::UpdateMetadata {
849 payload: req,
850 responder: PartitionUpdateMetadataResponder {
851 control_handle: std::mem::ManuallyDrop::new(control_handle),
852 tx_id: header.tx_id,
853 },
854 })
855 }
856 _ => Err(fidl::Error::UnknownOrdinal {
857 ordinal: header.ordinal,
858 protocol_name:
859 <PartitionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
860 }),
861 }))
862 },
863 )
864 }
865}
866
867#[derive(Debug)]
873pub enum PartitionRequest {
874 UpdateMetadata {
878 payload: PartitionUpdateMetadataRequest,
879 responder: PartitionUpdateMetadataResponder,
880 },
881}
882
883impl PartitionRequest {
884 #[allow(irrefutable_let_patterns)]
885 pub fn into_update_metadata(
886 self,
887 ) -> Option<(PartitionUpdateMetadataRequest, PartitionUpdateMetadataResponder)> {
888 if let PartitionRequest::UpdateMetadata { payload, responder } = self {
889 Some((payload, responder))
890 } else {
891 None
892 }
893 }
894
895 pub fn method_name(&self) -> &'static str {
897 match *self {
898 PartitionRequest::UpdateMetadata { .. } => "update_metadata",
899 }
900 }
901}
902
903#[derive(Debug, Clone)]
904pub struct PartitionControlHandle {
905 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
906}
907
908impl fidl::endpoints::ControlHandle for PartitionControlHandle {
909 fn shutdown(&self) {
910 self.inner.shutdown()
911 }
912 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
913 self.inner.shutdown_with_epitaph(status)
914 }
915
916 fn is_closed(&self) -> bool {
917 self.inner.channel().is_closed()
918 }
919 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
920 self.inner.channel().on_closed()
921 }
922
923 #[cfg(target_os = "fuchsia")]
924 fn signal_peer(
925 &self,
926 clear_mask: zx::Signals,
927 set_mask: zx::Signals,
928 ) -> Result<(), zx_status::Status> {
929 use fidl::Peered;
930 self.inner.channel().signal_peer(clear_mask, set_mask)
931 }
932}
933
934impl PartitionControlHandle {}
935
936#[must_use = "FIDL methods require a response to be sent"]
937#[derive(Debug)]
938pub struct PartitionUpdateMetadataResponder {
939 control_handle: std::mem::ManuallyDrop<PartitionControlHandle>,
940 tx_id: u32,
941}
942
943impl std::ops::Drop for PartitionUpdateMetadataResponder {
947 fn drop(&mut self) {
948 self.control_handle.shutdown();
949 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
951 }
952}
953
954impl fidl::endpoints::Responder for PartitionUpdateMetadataResponder {
955 type ControlHandle = PartitionControlHandle;
956
957 fn control_handle(&self) -> &PartitionControlHandle {
958 &self.control_handle
959 }
960
961 fn drop_without_shutdown(mut self) {
962 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
964 std::mem::forget(self);
966 }
967}
968
969impl PartitionUpdateMetadataResponder {
970 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
974 let _result = self.send_raw(result);
975 if _result.is_err() {
976 self.control_handle.shutdown();
977 }
978 self.drop_without_shutdown();
979 _result
980 }
981
982 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
984 let _result = self.send_raw(result);
985 self.drop_without_shutdown();
986 _result
987 }
988
989 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
990 self.control_handle
991 .inner
992 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
993 result,
994 self.tx_id,
995 0x7bce44e5c9d5009c,
996 fidl::encoding::DynamicFlags::empty(),
997 )
998 }
999}
1000
1001#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1002pub struct PartitionsAdminMarker;
1003
1004impl fidl::endpoints::ProtocolMarker for PartitionsAdminMarker {
1005 type Proxy = PartitionsAdminProxy;
1006 type RequestStream = PartitionsAdminRequestStream;
1007 #[cfg(target_os = "fuchsia")]
1008 type SynchronousProxy = PartitionsAdminSynchronousProxy;
1009
1010 const DEBUG_NAME: &'static str = "fuchsia.storage.partitions.PartitionsAdmin";
1011}
1012impl fidl::endpoints::DiscoverableProtocolMarker for PartitionsAdminMarker {}
1013pub type PartitionsAdminResetPartitionTableResult = Result<(), i32>;
1014
1015pub trait PartitionsAdminProxyInterface: Send + Sync {
1016 type ResetPartitionTableResponseFut: std::future::Future<Output = Result<PartitionsAdminResetPartitionTableResult, fidl::Error>>
1017 + Send;
1018 fn r#reset_partition_table(
1019 &self,
1020 partitions: &[PartitionInfo],
1021 ) -> Self::ResetPartitionTableResponseFut;
1022}
1023#[derive(Debug)]
1024#[cfg(target_os = "fuchsia")]
1025pub struct PartitionsAdminSynchronousProxy {
1026 client: fidl::client::sync::Client,
1027}
1028
1029#[cfg(target_os = "fuchsia")]
1030impl fidl::endpoints::SynchronousProxy for PartitionsAdminSynchronousProxy {
1031 type Proxy = PartitionsAdminProxy;
1032 type Protocol = PartitionsAdminMarker;
1033
1034 fn from_channel(inner: fidl::Channel) -> Self {
1035 Self::new(inner)
1036 }
1037
1038 fn into_channel(self) -> fidl::Channel {
1039 self.client.into_channel()
1040 }
1041
1042 fn as_channel(&self) -> &fidl::Channel {
1043 self.client.as_channel()
1044 }
1045}
1046
1047#[cfg(target_os = "fuchsia")]
1048impl PartitionsAdminSynchronousProxy {
1049 pub fn new(channel: fidl::Channel) -> Self {
1050 let protocol_name = <PartitionsAdminMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1051 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1052 }
1053
1054 pub fn into_channel(self) -> fidl::Channel {
1055 self.client.into_channel()
1056 }
1057
1058 pub fn wait_for_event(
1061 &self,
1062 deadline: zx::MonotonicInstant,
1063 ) -> Result<PartitionsAdminEvent, fidl::Error> {
1064 PartitionsAdminEvent::decode(self.client.wait_for_event(deadline)?)
1065 }
1066
1067 pub fn r#reset_partition_table(
1076 &self,
1077 mut partitions: &[PartitionInfo],
1078 ___deadline: zx::MonotonicInstant,
1079 ) -> Result<PartitionsAdminResetPartitionTableResult, fidl::Error> {
1080 let _response = self.client.send_query::<
1081 PartitionsAdminResetPartitionTableRequest,
1082 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1083 >(
1084 (partitions,),
1085 0x6d999e2c120fef14,
1086 fidl::encoding::DynamicFlags::empty(),
1087 ___deadline,
1088 )?;
1089 Ok(_response.map(|x| x))
1090 }
1091}
1092
1093#[cfg(target_os = "fuchsia")]
1094impl From<PartitionsAdminSynchronousProxy> for zx::Handle {
1095 fn from(value: PartitionsAdminSynchronousProxy) -> Self {
1096 value.into_channel().into()
1097 }
1098}
1099
1100#[cfg(target_os = "fuchsia")]
1101impl From<fidl::Channel> for PartitionsAdminSynchronousProxy {
1102 fn from(value: fidl::Channel) -> Self {
1103 Self::new(value)
1104 }
1105}
1106
1107#[cfg(target_os = "fuchsia")]
1108impl fidl::endpoints::FromClient for PartitionsAdminSynchronousProxy {
1109 type Protocol = PartitionsAdminMarker;
1110
1111 fn from_client(value: fidl::endpoints::ClientEnd<PartitionsAdminMarker>) -> Self {
1112 Self::new(value.into_channel())
1113 }
1114}
1115
1116#[derive(Debug, Clone)]
1117pub struct PartitionsAdminProxy {
1118 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1119}
1120
1121impl fidl::endpoints::Proxy for PartitionsAdminProxy {
1122 type Protocol = PartitionsAdminMarker;
1123
1124 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1125 Self::new(inner)
1126 }
1127
1128 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1129 self.client.into_channel().map_err(|client| Self { client })
1130 }
1131
1132 fn as_channel(&self) -> &::fidl::AsyncChannel {
1133 self.client.as_channel()
1134 }
1135}
1136
1137impl PartitionsAdminProxy {
1138 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1140 let protocol_name = <PartitionsAdminMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1141 Self { client: fidl::client::Client::new(channel, protocol_name) }
1142 }
1143
1144 pub fn take_event_stream(&self) -> PartitionsAdminEventStream {
1150 PartitionsAdminEventStream { event_receiver: self.client.take_event_receiver() }
1151 }
1152
1153 pub fn r#reset_partition_table(
1162 &self,
1163 mut partitions: &[PartitionInfo],
1164 ) -> fidl::client::QueryResponseFut<
1165 PartitionsAdminResetPartitionTableResult,
1166 fidl::encoding::DefaultFuchsiaResourceDialect,
1167 > {
1168 PartitionsAdminProxyInterface::r#reset_partition_table(self, partitions)
1169 }
1170}
1171
1172impl PartitionsAdminProxyInterface for PartitionsAdminProxy {
1173 type ResetPartitionTableResponseFut = fidl::client::QueryResponseFut<
1174 PartitionsAdminResetPartitionTableResult,
1175 fidl::encoding::DefaultFuchsiaResourceDialect,
1176 >;
1177 fn r#reset_partition_table(
1178 &self,
1179 mut partitions: &[PartitionInfo],
1180 ) -> Self::ResetPartitionTableResponseFut {
1181 fn _decode(
1182 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1183 ) -> Result<PartitionsAdminResetPartitionTableResult, fidl::Error> {
1184 let _response = fidl::client::decode_transaction_body::<
1185 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1186 fidl::encoding::DefaultFuchsiaResourceDialect,
1187 0x6d999e2c120fef14,
1188 >(_buf?)?;
1189 Ok(_response.map(|x| x))
1190 }
1191 self.client.send_query_and_decode::<
1192 PartitionsAdminResetPartitionTableRequest,
1193 PartitionsAdminResetPartitionTableResult,
1194 >(
1195 (partitions,),
1196 0x6d999e2c120fef14,
1197 fidl::encoding::DynamicFlags::empty(),
1198 _decode,
1199 )
1200 }
1201}
1202
1203pub struct PartitionsAdminEventStream {
1204 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1205}
1206
1207impl std::marker::Unpin for PartitionsAdminEventStream {}
1208
1209impl futures::stream::FusedStream for PartitionsAdminEventStream {
1210 fn is_terminated(&self) -> bool {
1211 self.event_receiver.is_terminated()
1212 }
1213}
1214
1215impl futures::Stream for PartitionsAdminEventStream {
1216 type Item = Result<PartitionsAdminEvent, fidl::Error>;
1217
1218 fn poll_next(
1219 mut self: std::pin::Pin<&mut Self>,
1220 cx: &mut std::task::Context<'_>,
1221 ) -> std::task::Poll<Option<Self::Item>> {
1222 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1223 &mut self.event_receiver,
1224 cx
1225 )?) {
1226 Some(buf) => std::task::Poll::Ready(Some(PartitionsAdminEvent::decode(buf))),
1227 None => std::task::Poll::Ready(None),
1228 }
1229 }
1230}
1231
1232#[derive(Debug)]
1233pub enum PartitionsAdminEvent {}
1234
1235impl PartitionsAdminEvent {
1236 fn decode(
1238 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1239 ) -> Result<PartitionsAdminEvent, fidl::Error> {
1240 let (bytes, _handles) = buf.split_mut();
1241 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1242 debug_assert_eq!(tx_header.tx_id, 0);
1243 match tx_header.ordinal {
1244 _ => Err(fidl::Error::UnknownOrdinal {
1245 ordinal: tx_header.ordinal,
1246 protocol_name:
1247 <PartitionsAdminMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1248 }),
1249 }
1250 }
1251}
1252
1253pub struct PartitionsAdminRequestStream {
1255 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1256 is_terminated: bool,
1257}
1258
1259impl std::marker::Unpin for PartitionsAdminRequestStream {}
1260
1261impl futures::stream::FusedStream for PartitionsAdminRequestStream {
1262 fn is_terminated(&self) -> bool {
1263 self.is_terminated
1264 }
1265}
1266
1267impl fidl::endpoints::RequestStream for PartitionsAdminRequestStream {
1268 type Protocol = PartitionsAdminMarker;
1269 type ControlHandle = PartitionsAdminControlHandle;
1270
1271 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1272 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1273 }
1274
1275 fn control_handle(&self) -> Self::ControlHandle {
1276 PartitionsAdminControlHandle { inner: self.inner.clone() }
1277 }
1278
1279 fn into_inner(
1280 self,
1281 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1282 {
1283 (self.inner, self.is_terminated)
1284 }
1285
1286 fn from_inner(
1287 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1288 is_terminated: bool,
1289 ) -> Self {
1290 Self { inner, is_terminated }
1291 }
1292}
1293
1294impl futures::Stream for PartitionsAdminRequestStream {
1295 type Item = Result<PartitionsAdminRequest, fidl::Error>;
1296
1297 fn poll_next(
1298 mut self: std::pin::Pin<&mut Self>,
1299 cx: &mut std::task::Context<'_>,
1300 ) -> std::task::Poll<Option<Self::Item>> {
1301 let this = &mut *self;
1302 if this.inner.check_shutdown(cx) {
1303 this.is_terminated = true;
1304 return std::task::Poll::Ready(None);
1305 }
1306 if this.is_terminated {
1307 panic!("polled PartitionsAdminRequestStream after completion");
1308 }
1309 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1310 |bytes, handles| {
1311 match this.inner.channel().read_etc(cx, bytes, handles) {
1312 std::task::Poll::Ready(Ok(())) => {}
1313 std::task::Poll::Pending => return std::task::Poll::Pending,
1314 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1315 this.is_terminated = true;
1316 return std::task::Poll::Ready(None);
1317 }
1318 std::task::Poll::Ready(Err(e)) => {
1319 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1320 e.into(),
1321 ))));
1322 }
1323 }
1324
1325 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1327
1328 std::task::Poll::Ready(Some(match header.ordinal {
1329 0x6d999e2c120fef14 => {
1330 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1331 let mut req = fidl::new_empty!(
1332 PartitionsAdminResetPartitionTableRequest,
1333 fidl::encoding::DefaultFuchsiaResourceDialect
1334 );
1335 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PartitionsAdminResetPartitionTableRequest>(&header, _body_bytes, handles, &mut req)?;
1336 let control_handle =
1337 PartitionsAdminControlHandle { inner: this.inner.clone() };
1338 Ok(PartitionsAdminRequest::ResetPartitionTable {
1339 partitions: req.partitions,
1340
1341 responder: PartitionsAdminResetPartitionTableResponder {
1342 control_handle: std::mem::ManuallyDrop::new(control_handle),
1343 tx_id: header.tx_id,
1344 },
1345 })
1346 }
1347 _ => Err(fidl::Error::UnknownOrdinal {
1348 ordinal: header.ordinal,
1349 protocol_name:
1350 <PartitionsAdminMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1351 }),
1352 }))
1353 },
1354 )
1355 }
1356}
1357
1358#[derive(Debug)]
1359pub enum PartitionsAdminRequest {
1360 ResetPartitionTable {
1369 partitions: Vec<PartitionInfo>,
1370 responder: PartitionsAdminResetPartitionTableResponder,
1371 },
1372}
1373
1374impl PartitionsAdminRequest {
1375 #[allow(irrefutable_let_patterns)]
1376 pub fn into_reset_partition_table(
1377 self,
1378 ) -> Option<(Vec<PartitionInfo>, PartitionsAdminResetPartitionTableResponder)> {
1379 if let PartitionsAdminRequest::ResetPartitionTable { partitions, responder } = self {
1380 Some((partitions, responder))
1381 } else {
1382 None
1383 }
1384 }
1385
1386 pub fn method_name(&self) -> &'static str {
1388 match *self {
1389 PartitionsAdminRequest::ResetPartitionTable { .. } => "reset_partition_table",
1390 }
1391 }
1392}
1393
1394#[derive(Debug, Clone)]
1395pub struct PartitionsAdminControlHandle {
1396 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1397}
1398
1399impl fidl::endpoints::ControlHandle for PartitionsAdminControlHandle {
1400 fn shutdown(&self) {
1401 self.inner.shutdown()
1402 }
1403 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1404 self.inner.shutdown_with_epitaph(status)
1405 }
1406
1407 fn is_closed(&self) -> bool {
1408 self.inner.channel().is_closed()
1409 }
1410 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1411 self.inner.channel().on_closed()
1412 }
1413
1414 #[cfg(target_os = "fuchsia")]
1415 fn signal_peer(
1416 &self,
1417 clear_mask: zx::Signals,
1418 set_mask: zx::Signals,
1419 ) -> Result<(), zx_status::Status> {
1420 use fidl::Peered;
1421 self.inner.channel().signal_peer(clear_mask, set_mask)
1422 }
1423}
1424
1425impl PartitionsAdminControlHandle {}
1426
1427#[must_use = "FIDL methods require a response to be sent"]
1428#[derive(Debug)]
1429pub struct PartitionsAdminResetPartitionTableResponder {
1430 control_handle: std::mem::ManuallyDrop<PartitionsAdminControlHandle>,
1431 tx_id: u32,
1432}
1433
1434impl std::ops::Drop for PartitionsAdminResetPartitionTableResponder {
1438 fn drop(&mut self) {
1439 self.control_handle.shutdown();
1440 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1442 }
1443}
1444
1445impl fidl::endpoints::Responder for PartitionsAdminResetPartitionTableResponder {
1446 type ControlHandle = PartitionsAdminControlHandle;
1447
1448 fn control_handle(&self) -> &PartitionsAdminControlHandle {
1449 &self.control_handle
1450 }
1451
1452 fn drop_without_shutdown(mut self) {
1453 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1455 std::mem::forget(self);
1457 }
1458}
1459
1460impl PartitionsAdminResetPartitionTableResponder {
1461 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1465 let _result = self.send_raw(result);
1466 if _result.is_err() {
1467 self.control_handle.shutdown();
1468 }
1469 self.drop_without_shutdown();
1470 _result
1471 }
1472
1473 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1475 let _result = self.send_raw(result);
1476 self.drop_without_shutdown();
1477 _result
1478 }
1479
1480 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1481 self.control_handle
1482 .inner
1483 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1484 result,
1485 self.tx_id,
1486 0x6d999e2c120fef14,
1487 fidl::encoding::DynamicFlags::empty(),
1488 )
1489 }
1490}
1491
1492#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1493pub struct PartitionsManagerMarker;
1494
1495impl fidl::endpoints::ProtocolMarker for PartitionsManagerMarker {
1496 type Proxy = PartitionsManagerProxy;
1497 type RequestStream = PartitionsManagerRequestStream;
1498 #[cfg(target_os = "fuchsia")]
1499 type SynchronousProxy = PartitionsManagerSynchronousProxy;
1500
1501 const DEBUG_NAME: &'static str = "fuchsia.storage.partitions.PartitionsManager";
1502}
1503impl fidl::endpoints::DiscoverableProtocolMarker for PartitionsManagerMarker {}
1504pub type PartitionsManagerGetBlockInfoResult = Result<(u64, u32), i32>;
1505pub type PartitionsManagerCreateTransactionResult = Result<fidl::EventPair, i32>;
1506pub type PartitionsManagerCommitTransactionResult = Result<(), i32>;
1507pub type PartitionsManagerAddPartitionResult = Result<(), i32>;
1508
1509pub trait PartitionsManagerProxyInterface: Send + Sync {
1510 type GetBlockInfoResponseFut: std::future::Future<Output = Result<PartitionsManagerGetBlockInfoResult, fidl::Error>>
1511 + Send;
1512 fn r#get_block_info(&self) -> Self::GetBlockInfoResponseFut;
1513 type CreateTransactionResponseFut: std::future::Future<Output = Result<PartitionsManagerCreateTransactionResult, fidl::Error>>
1514 + Send;
1515 fn r#create_transaction(&self) -> Self::CreateTransactionResponseFut;
1516 type CommitTransactionResponseFut: std::future::Future<Output = Result<PartitionsManagerCommitTransactionResult, fidl::Error>>
1517 + Send;
1518 fn r#commit_transaction(
1519 &self,
1520 transaction: fidl::EventPair,
1521 ) -> Self::CommitTransactionResponseFut;
1522 type AddPartitionResponseFut: std::future::Future<Output = Result<PartitionsManagerAddPartitionResult, fidl::Error>>
1523 + Send;
1524 fn r#add_partition(
1525 &self,
1526 payload: PartitionsManagerAddPartitionRequest,
1527 ) -> Self::AddPartitionResponseFut;
1528}
1529#[derive(Debug)]
1530#[cfg(target_os = "fuchsia")]
1531pub struct PartitionsManagerSynchronousProxy {
1532 client: fidl::client::sync::Client,
1533}
1534
1535#[cfg(target_os = "fuchsia")]
1536impl fidl::endpoints::SynchronousProxy for PartitionsManagerSynchronousProxy {
1537 type Proxy = PartitionsManagerProxy;
1538 type Protocol = PartitionsManagerMarker;
1539
1540 fn from_channel(inner: fidl::Channel) -> Self {
1541 Self::new(inner)
1542 }
1543
1544 fn into_channel(self) -> fidl::Channel {
1545 self.client.into_channel()
1546 }
1547
1548 fn as_channel(&self) -> &fidl::Channel {
1549 self.client.as_channel()
1550 }
1551}
1552
1553#[cfg(target_os = "fuchsia")]
1554impl PartitionsManagerSynchronousProxy {
1555 pub fn new(channel: fidl::Channel) -> Self {
1556 let protocol_name =
1557 <PartitionsManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1558 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1559 }
1560
1561 pub fn into_channel(self) -> fidl::Channel {
1562 self.client.into_channel()
1563 }
1564
1565 pub fn wait_for_event(
1568 &self,
1569 deadline: zx::MonotonicInstant,
1570 ) -> Result<PartitionsManagerEvent, fidl::Error> {
1571 PartitionsManagerEvent::decode(self.client.wait_for_event(deadline)?)
1572 }
1573
1574 pub fn r#get_block_info(
1576 &self,
1577 ___deadline: zx::MonotonicInstant,
1578 ) -> Result<PartitionsManagerGetBlockInfoResult, fidl::Error> {
1579 let _response = self.client.send_query::<
1580 fidl::encoding::EmptyPayload,
1581 fidl::encoding::ResultType<PartitionsManagerGetBlockInfoResponse, i32>,
1582 >(
1583 (),
1584 0x55663648cae3a1ef,
1585 fidl::encoding::DynamicFlags::empty(),
1586 ___deadline,
1587 )?;
1588 Ok(_response.map(|x| (x.block_count, x.block_size)))
1589 }
1590
1591 pub fn r#create_transaction(
1599 &self,
1600 ___deadline: zx::MonotonicInstant,
1601 ) -> Result<PartitionsManagerCreateTransactionResult, fidl::Error> {
1602 let _response =
1603 self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::ResultType<
1604 PartitionsManagerCreateTransactionResponse,
1605 i32,
1606 >>(
1607 (),
1608 0x5cedad08ef04fd02,
1609 fidl::encoding::DynamicFlags::empty(),
1610 ___deadline,
1611 )?;
1612 Ok(_response.map(|x| x.transaction))
1613 }
1614
1615 pub fn r#commit_transaction(
1617 &self,
1618 mut transaction: fidl::EventPair,
1619 ___deadline: zx::MonotonicInstant,
1620 ) -> Result<PartitionsManagerCommitTransactionResult, fidl::Error> {
1621 let _response = self.client.send_query::<
1622 PartitionsManagerCommitTransactionRequest,
1623 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1624 >(
1625 (transaction,),
1626 0x2354762d579c7654,
1627 fidl::encoding::DynamicFlags::empty(),
1628 ___deadline,
1629 )?;
1630 Ok(_response.map(|x| x))
1631 }
1632
1633 pub fn r#add_partition(
1637 &self,
1638 mut payload: PartitionsManagerAddPartitionRequest,
1639 ___deadline: zx::MonotonicInstant,
1640 ) -> Result<PartitionsManagerAddPartitionResult, fidl::Error> {
1641 let _response = self.client.send_query::<
1642 PartitionsManagerAddPartitionRequest,
1643 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1644 >(
1645 &mut payload,
1646 0x32afa9f7acf47e38,
1647 fidl::encoding::DynamicFlags::empty(),
1648 ___deadline,
1649 )?;
1650 Ok(_response.map(|x| x))
1651 }
1652}
1653
1654#[cfg(target_os = "fuchsia")]
1655impl From<PartitionsManagerSynchronousProxy> for zx::Handle {
1656 fn from(value: PartitionsManagerSynchronousProxy) -> Self {
1657 value.into_channel().into()
1658 }
1659}
1660
1661#[cfg(target_os = "fuchsia")]
1662impl From<fidl::Channel> for PartitionsManagerSynchronousProxy {
1663 fn from(value: fidl::Channel) -> Self {
1664 Self::new(value)
1665 }
1666}
1667
1668#[cfg(target_os = "fuchsia")]
1669impl fidl::endpoints::FromClient for PartitionsManagerSynchronousProxy {
1670 type Protocol = PartitionsManagerMarker;
1671
1672 fn from_client(value: fidl::endpoints::ClientEnd<PartitionsManagerMarker>) -> Self {
1673 Self::new(value.into_channel())
1674 }
1675}
1676
1677#[derive(Debug, Clone)]
1678pub struct PartitionsManagerProxy {
1679 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1680}
1681
1682impl fidl::endpoints::Proxy for PartitionsManagerProxy {
1683 type Protocol = PartitionsManagerMarker;
1684
1685 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1686 Self::new(inner)
1687 }
1688
1689 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1690 self.client.into_channel().map_err(|client| Self { client })
1691 }
1692
1693 fn as_channel(&self) -> &::fidl::AsyncChannel {
1694 self.client.as_channel()
1695 }
1696}
1697
1698impl PartitionsManagerProxy {
1699 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1701 let protocol_name =
1702 <PartitionsManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1703 Self { client: fidl::client::Client::new(channel, protocol_name) }
1704 }
1705
1706 pub fn take_event_stream(&self) -> PartitionsManagerEventStream {
1712 PartitionsManagerEventStream { event_receiver: self.client.take_event_receiver() }
1713 }
1714
1715 pub fn r#get_block_info(
1717 &self,
1718 ) -> fidl::client::QueryResponseFut<
1719 PartitionsManagerGetBlockInfoResult,
1720 fidl::encoding::DefaultFuchsiaResourceDialect,
1721 > {
1722 PartitionsManagerProxyInterface::r#get_block_info(self)
1723 }
1724
1725 pub fn r#create_transaction(
1733 &self,
1734 ) -> fidl::client::QueryResponseFut<
1735 PartitionsManagerCreateTransactionResult,
1736 fidl::encoding::DefaultFuchsiaResourceDialect,
1737 > {
1738 PartitionsManagerProxyInterface::r#create_transaction(self)
1739 }
1740
1741 pub fn r#commit_transaction(
1743 &self,
1744 mut transaction: fidl::EventPair,
1745 ) -> fidl::client::QueryResponseFut<
1746 PartitionsManagerCommitTransactionResult,
1747 fidl::encoding::DefaultFuchsiaResourceDialect,
1748 > {
1749 PartitionsManagerProxyInterface::r#commit_transaction(self, transaction)
1750 }
1751
1752 pub fn r#add_partition(
1756 &self,
1757 mut payload: PartitionsManagerAddPartitionRequest,
1758 ) -> fidl::client::QueryResponseFut<
1759 PartitionsManagerAddPartitionResult,
1760 fidl::encoding::DefaultFuchsiaResourceDialect,
1761 > {
1762 PartitionsManagerProxyInterface::r#add_partition(self, payload)
1763 }
1764}
1765
1766impl PartitionsManagerProxyInterface for PartitionsManagerProxy {
1767 type GetBlockInfoResponseFut = fidl::client::QueryResponseFut<
1768 PartitionsManagerGetBlockInfoResult,
1769 fidl::encoding::DefaultFuchsiaResourceDialect,
1770 >;
1771 fn r#get_block_info(&self) -> Self::GetBlockInfoResponseFut {
1772 fn _decode(
1773 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1774 ) -> Result<PartitionsManagerGetBlockInfoResult, fidl::Error> {
1775 let _response = fidl::client::decode_transaction_body::<
1776 fidl::encoding::ResultType<PartitionsManagerGetBlockInfoResponse, i32>,
1777 fidl::encoding::DefaultFuchsiaResourceDialect,
1778 0x55663648cae3a1ef,
1779 >(_buf?)?;
1780 Ok(_response.map(|x| (x.block_count, x.block_size)))
1781 }
1782 self.client.send_query_and_decode::<
1783 fidl::encoding::EmptyPayload,
1784 PartitionsManagerGetBlockInfoResult,
1785 >(
1786 (),
1787 0x55663648cae3a1ef,
1788 fidl::encoding::DynamicFlags::empty(),
1789 _decode,
1790 )
1791 }
1792
1793 type CreateTransactionResponseFut = fidl::client::QueryResponseFut<
1794 PartitionsManagerCreateTransactionResult,
1795 fidl::encoding::DefaultFuchsiaResourceDialect,
1796 >;
1797 fn r#create_transaction(&self) -> Self::CreateTransactionResponseFut {
1798 fn _decode(
1799 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1800 ) -> Result<PartitionsManagerCreateTransactionResult, fidl::Error> {
1801 let _response = fidl::client::decode_transaction_body::<
1802 fidl::encoding::ResultType<PartitionsManagerCreateTransactionResponse, i32>,
1803 fidl::encoding::DefaultFuchsiaResourceDialect,
1804 0x5cedad08ef04fd02,
1805 >(_buf?)?;
1806 Ok(_response.map(|x| x.transaction))
1807 }
1808 self.client.send_query_and_decode::<
1809 fidl::encoding::EmptyPayload,
1810 PartitionsManagerCreateTransactionResult,
1811 >(
1812 (),
1813 0x5cedad08ef04fd02,
1814 fidl::encoding::DynamicFlags::empty(),
1815 _decode,
1816 )
1817 }
1818
1819 type CommitTransactionResponseFut = fidl::client::QueryResponseFut<
1820 PartitionsManagerCommitTransactionResult,
1821 fidl::encoding::DefaultFuchsiaResourceDialect,
1822 >;
1823 fn r#commit_transaction(
1824 &self,
1825 mut transaction: fidl::EventPair,
1826 ) -> Self::CommitTransactionResponseFut {
1827 fn _decode(
1828 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1829 ) -> Result<PartitionsManagerCommitTransactionResult, fidl::Error> {
1830 let _response = fidl::client::decode_transaction_body::<
1831 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1832 fidl::encoding::DefaultFuchsiaResourceDialect,
1833 0x2354762d579c7654,
1834 >(_buf?)?;
1835 Ok(_response.map(|x| x))
1836 }
1837 self.client.send_query_and_decode::<
1838 PartitionsManagerCommitTransactionRequest,
1839 PartitionsManagerCommitTransactionResult,
1840 >(
1841 (transaction,),
1842 0x2354762d579c7654,
1843 fidl::encoding::DynamicFlags::empty(),
1844 _decode,
1845 )
1846 }
1847
1848 type AddPartitionResponseFut = fidl::client::QueryResponseFut<
1849 PartitionsManagerAddPartitionResult,
1850 fidl::encoding::DefaultFuchsiaResourceDialect,
1851 >;
1852 fn r#add_partition(
1853 &self,
1854 mut payload: PartitionsManagerAddPartitionRequest,
1855 ) -> Self::AddPartitionResponseFut {
1856 fn _decode(
1857 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1858 ) -> Result<PartitionsManagerAddPartitionResult, fidl::Error> {
1859 let _response = fidl::client::decode_transaction_body::<
1860 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1861 fidl::encoding::DefaultFuchsiaResourceDialect,
1862 0x32afa9f7acf47e38,
1863 >(_buf?)?;
1864 Ok(_response.map(|x| x))
1865 }
1866 self.client.send_query_and_decode::<
1867 PartitionsManagerAddPartitionRequest,
1868 PartitionsManagerAddPartitionResult,
1869 >(
1870 &mut payload,
1871 0x32afa9f7acf47e38,
1872 fidl::encoding::DynamicFlags::empty(),
1873 _decode,
1874 )
1875 }
1876}
1877
1878pub struct PartitionsManagerEventStream {
1879 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1880}
1881
1882impl std::marker::Unpin for PartitionsManagerEventStream {}
1883
1884impl futures::stream::FusedStream for PartitionsManagerEventStream {
1885 fn is_terminated(&self) -> bool {
1886 self.event_receiver.is_terminated()
1887 }
1888}
1889
1890impl futures::Stream for PartitionsManagerEventStream {
1891 type Item = Result<PartitionsManagerEvent, fidl::Error>;
1892
1893 fn poll_next(
1894 mut self: std::pin::Pin<&mut Self>,
1895 cx: &mut std::task::Context<'_>,
1896 ) -> std::task::Poll<Option<Self::Item>> {
1897 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1898 &mut self.event_receiver,
1899 cx
1900 )?) {
1901 Some(buf) => std::task::Poll::Ready(Some(PartitionsManagerEvent::decode(buf))),
1902 None => std::task::Poll::Ready(None),
1903 }
1904 }
1905}
1906
1907#[derive(Debug)]
1908pub enum PartitionsManagerEvent {}
1909
1910impl PartitionsManagerEvent {
1911 fn decode(
1913 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1914 ) -> Result<PartitionsManagerEvent, fidl::Error> {
1915 let (bytes, _handles) = buf.split_mut();
1916 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1917 debug_assert_eq!(tx_header.tx_id, 0);
1918 match tx_header.ordinal {
1919 _ => Err(fidl::Error::UnknownOrdinal {
1920 ordinal: tx_header.ordinal,
1921 protocol_name:
1922 <PartitionsManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1923 }),
1924 }
1925 }
1926}
1927
1928pub struct PartitionsManagerRequestStream {
1930 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1931 is_terminated: bool,
1932}
1933
1934impl std::marker::Unpin for PartitionsManagerRequestStream {}
1935
1936impl futures::stream::FusedStream for PartitionsManagerRequestStream {
1937 fn is_terminated(&self) -> bool {
1938 self.is_terminated
1939 }
1940}
1941
1942impl fidl::endpoints::RequestStream for PartitionsManagerRequestStream {
1943 type Protocol = PartitionsManagerMarker;
1944 type ControlHandle = PartitionsManagerControlHandle;
1945
1946 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1947 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1948 }
1949
1950 fn control_handle(&self) -> Self::ControlHandle {
1951 PartitionsManagerControlHandle { inner: self.inner.clone() }
1952 }
1953
1954 fn into_inner(
1955 self,
1956 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1957 {
1958 (self.inner, self.is_terminated)
1959 }
1960
1961 fn from_inner(
1962 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1963 is_terminated: bool,
1964 ) -> Self {
1965 Self { inner, is_terminated }
1966 }
1967}
1968
1969impl futures::Stream for PartitionsManagerRequestStream {
1970 type Item = Result<PartitionsManagerRequest, fidl::Error>;
1971
1972 fn poll_next(
1973 mut self: std::pin::Pin<&mut Self>,
1974 cx: &mut std::task::Context<'_>,
1975 ) -> std::task::Poll<Option<Self::Item>> {
1976 let this = &mut *self;
1977 if this.inner.check_shutdown(cx) {
1978 this.is_terminated = true;
1979 return std::task::Poll::Ready(None);
1980 }
1981 if this.is_terminated {
1982 panic!("polled PartitionsManagerRequestStream after completion");
1983 }
1984 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1985 |bytes, handles| {
1986 match this.inner.channel().read_etc(cx, bytes, handles) {
1987 std::task::Poll::Ready(Ok(())) => {}
1988 std::task::Poll::Pending => return std::task::Poll::Pending,
1989 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1990 this.is_terminated = true;
1991 return std::task::Poll::Ready(None);
1992 }
1993 std::task::Poll::Ready(Err(e)) => {
1994 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1995 e.into(),
1996 ))));
1997 }
1998 }
1999
2000 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2002
2003 std::task::Poll::Ready(Some(match header.ordinal {
2004 0x55663648cae3a1ef => {
2005 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2006 let mut req = fidl::new_empty!(
2007 fidl::encoding::EmptyPayload,
2008 fidl::encoding::DefaultFuchsiaResourceDialect
2009 );
2010 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2011 let control_handle =
2012 PartitionsManagerControlHandle { inner: this.inner.clone() };
2013 Ok(PartitionsManagerRequest::GetBlockInfo {
2014 responder: PartitionsManagerGetBlockInfoResponder {
2015 control_handle: std::mem::ManuallyDrop::new(control_handle),
2016 tx_id: header.tx_id,
2017 },
2018 })
2019 }
2020 0x5cedad08ef04fd02 => {
2021 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2022 let mut req = fidl::new_empty!(
2023 fidl::encoding::EmptyPayload,
2024 fidl::encoding::DefaultFuchsiaResourceDialect
2025 );
2026 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2027 let control_handle =
2028 PartitionsManagerControlHandle { inner: this.inner.clone() };
2029 Ok(PartitionsManagerRequest::CreateTransaction {
2030 responder: PartitionsManagerCreateTransactionResponder {
2031 control_handle: std::mem::ManuallyDrop::new(control_handle),
2032 tx_id: header.tx_id,
2033 },
2034 })
2035 }
2036 0x2354762d579c7654 => {
2037 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2038 let mut req = fidl::new_empty!(
2039 PartitionsManagerCommitTransactionRequest,
2040 fidl::encoding::DefaultFuchsiaResourceDialect
2041 );
2042 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PartitionsManagerCommitTransactionRequest>(&header, _body_bytes, handles, &mut req)?;
2043 let control_handle =
2044 PartitionsManagerControlHandle { inner: this.inner.clone() };
2045 Ok(PartitionsManagerRequest::CommitTransaction {
2046 transaction: req.transaction,
2047
2048 responder: PartitionsManagerCommitTransactionResponder {
2049 control_handle: std::mem::ManuallyDrop::new(control_handle),
2050 tx_id: header.tx_id,
2051 },
2052 })
2053 }
2054 0x32afa9f7acf47e38 => {
2055 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2056 let mut req = fidl::new_empty!(
2057 PartitionsManagerAddPartitionRequest,
2058 fidl::encoding::DefaultFuchsiaResourceDialect
2059 );
2060 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PartitionsManagerAddPartitionRequest>(&header, _body_bytes, handles, &mut req)?;
2061 let control_handle =
2062 PartitionsManagerControlHandle { inner: this.inner.clone() };
2063 Ok(PartitionsManagerRequest::AddPartition {
2064 payload: req,
2065 responder: PartitionsManagerAddPartitionResponder {
2066 control_handle: std::mem::ManuallyDrop::new(control_handle),
2067 tx_id: header.tx_id,
2068 },
2069 })
2070 }
2071 _ => Err(fidl::Error::UnknownOrdinal {
2072 ordinal: header.ordinal,
2073 protocol_name:
2074 <PartitionsManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2075 }),
2076 }))
2077 },
2078 )
2079 }
2080}
2081
2082#[derive(Debug)]
2083pub enum PartitionsManagerRequest {
2084 GetBlockInfo { responder: PartitionsManagerGetBlockInfoResponder },
2086 CreateTransaction { responder: PartitionsManagerCreateTransactionResponder },
2094 CommitTransaction {
2096 transaction: fidl::EventPair,
2097 responder: PartitionsManagerCommitTransactionResponder,
2098 },
2099 AddPartition {
2103 payload: PartitionsManagerAddPartitionRequest,
2104 responder: PartitionsManagerAddPartitionResponder,
2105 },
2106}
2107
2108impl PartitionsManagerRequest {
2109 #[allow(irrefutable_let_patterns)]
2110 pub fn into_get_block_info(self) -> Option<(PartitionsManagerGetBlockInfoResponder)> {
2111 if let PartitionsManagerRequest::GetBlockInfo { responder } = self {
2112 Some((responder))
2113 } else {
2114 None
2115 }
2116 }
2117
2118 #[allow(irrefutable_let_patterns)]
2119 pub fn into_create_transaction(self) -> Option<(PartitionsManagerCreateTransactionResponder)> {
2120 if let PartitionsManagerRequest::CreateTransaction { responder } = self {
2121 Some((responder))
2122 } else {
2123 None
2124 }
2125 }
2126
2127 #[allow(irrefutable_let_patterns)]
2128 pub fn into_commit_transaction(
2129 self,
2130 ) -> Option<(fidl::EventPair, PartitionsManagerCommitTransactionResponder)> {
2131 if let PartitionsManagerRequest::CommitTransaction { transaction, responder } = self {
2132 Some((transaction, responder))
2133 } else {
2134 None
2135 }
2136 }
2137
2138 #[allow(irrefutable_let_patterns)]
2139 pub fn into_add_partition(
2140 self,
2141 ) -> Option<(PartitionsManagerAddPartitionRequest, PartitionsManagerAddPartitionResponder)>
2142 {
2143 if let PartitionsManagerRequest::AddPartition { payload, responder } = self {
2144 Some((payload, responder))
2145 } else {
2146 None
2147 }
2148 }
2149
2150 pub fn method_name(&self) -> &'static str {
2152 match *self {
2153 PartitionsManagerRequest::GetBlockInfo { .. } => "get_block_info",
2154 PartitionsManagerRequest::CreateTransaction { .. } => "create_transaction",
2155 PartitionsManagerRequest::CommitTransaction { .. } => "commit_transaction",
2156 PartitionsManagerRequest::AddPartition { .. } => "add_partition",
2157 }
2158 }
2159}
2160
2161#[derive(Debug, Clone)]
2162pub struct PartitionsManagerControlHandle {
2163 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2164}
2165
2166impl fidl::endpoints::ControlHandle for PartitionsManagerControlHandle {
2167 fn shutdown(&self) {
2168 self.inner.shutdown()
2169 }
2170 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2171 self.inner.shutdown_with_epitaph(status)
2172 }
2173
2174 fn is_closed(&self) -> bool {
2175 self.inner.channel().is_closed()
2176 }
2177 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2178 self.inner.channel().on_closed()
2179 }
2180
2181 #[cfg(target_os = "fuchsia")]
2182 fn signal_peer(
2183 &self,
2184 clear_mask: zx::Signals,
2185 set_mask: zx::Signals,
2186 ) -> Result<(), zx_status::Status> {
2187 use fidl::Peered;
2188 self.inner.channel().signal_peer(clear_mask, set_mask)
2189 }
2190}
2191
2192impl PartitionsManagerControlHandle {}
2193
2194#[must_use = "FIDL methods require a response to be sent"]
2195#[derive(Debug)]
2196pub struct PartitionsManagerGetBlockInfoResponder {
2197 control_handle: std::mem::ManuallyDrop<PartitionsManagerControlHandle>,
2198 tx_id: u32,
2199}
2200
2201impl std::ops::Drop for PartitionsManagerGetBlockInfoResponder {
2205 fn drop(&mut self) {
2206 self.control_handle.shutdown();
2207 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2209 }
2210}
2211
2212impl fidl::endpoints::Responder for PartitionsManagerGetBlockInfoResponder {
2213 type ControlHandle = PartitionsManagerControlHandle;
2214
2215 fn control_handle(&self) -> &PartitionsManagerControlHandle {
2216 &self.control_handle
2217 }
2218
2219 fn drop_without_shutdown(mut self) {
2220 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2222 std::mem::forget(self);
2224 }
2225}
2226
2227impl PartitionsManagerGetBlockInfoResponder {
2228 pub fn send(self, mut result: Result<(u64, u32), i32>) -> Result<(), fidl::Error> {
2232 let _result = self.send_raw(result);
2233 if _result.is_err() {
2234 self.control_handle.shutdown();
2235 }
2236 self.drop_without_shutdown();
2237 _result
2238 }
2239
2240 pub fn send_no_shutdown_on_err(
2242 self,
2243 mut result: Result<(u64, u32), i32>,
2244 ) -> Result<(), fidl::Error> {
2245 let _result = self.send_raw(result);
2246 self.drop_without_shutdown();
2247 _result
2248 }
2249
2250 fn send_raw(&self, mut result: Result<(u64, u32), i32>) -> Result<(), fidl::Error> {
2251 self.control_handle.inner.send::<fidl::encoding::ResultType<
2252 PartitionsManagerGetBlockInfoResponse,
2253 i32,
2254 >>(
2255 result,
2256 self.tx_id,
2257 0x55663648cae3a1ef,
2258 fidl::encoding::DynamicFlags::empty(),
2259 )
2260 }
2261}
2262
2263#[must_use = "FIDL methods require a response to be sent"]
2264#[derive(Debug)]
2265pub struct PartitionsManagerCreateTransactionResponder {
2266 control_handle: std::mem::ManuallyDrop<PartitionsManagerControlHandle>,
2267 tx_id: u32,
2268}
2269
2270impl std::ops::Drop for PartitionsManagerCreateTransactionResponder {
2274 fn drop(&mut self) {
2275 self.control_handle.shutdown();
2276 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2278 }
2279}
2280
2281impl fidl::endpoints::Responder for PartitionsManagerCreateTransactionResponder {
2282 type ControlHandle = PartitionsManagerControlHandle;
2283
2284 fn control_handle(&self) -> &PartitionsManagerControlHandle {
2285 &self.control_handle
2286 }
2287
2288 fn drop_without_shutdown(mut self) {
2289 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2291 std::mem::forget(self);
2293 }
2294}
2295
2296impl PartitionsManagerCreateTransactionResponder {
2297 pub fn send(self, mut result: Result<fidl::EventPair, i32>) -> Result<(), fidl::Error> {
2301 let _result = self.send_raw(result);
2302 if _result.is_err() {
2303 self.control_handle.shutdown();
2304 }
2305 self.drop_without_shutdown();
2306 _result
2307 }
2308
2309 pub fn send_no_shutdown_on_err(
2311 self,
2312 mut result: Result<fidl::EventPair, i32>,
2313 ) -> Result<(), fidl::Error> {
2314 let _result = self.send_raw(result);
2315 self.drop_without_shutdown();
2316 _result
2317 }
2318
2319 fn send_raw(&self, mut result: Result<fidl::EventPair, i32>) -> Result<(), fidl::Error> {
2320 self.control_handle.inner.send::<fidl::encoding::ResultType<
2321 PartitionsManagerCreateTransactionResponse,
2322 i32,
2323 >>(
2324 result.map(|transaction| (transaction,)),
2325 self.tx_id,
2326 0x5cedad08ef04fd02,
2327 fidl::encoding::DynamicFlags::empty(),
2328 )
2329 }
2330}
2331
2332#[must_use = "FIDL methods require a response to be sent"]
2333#[derive(Debug)]
2334pub struct PartitionsManagerCommitTransactionResponder {
2335 control_handle: std::mem::ManuallyDrop<PartitionsManagerControlHandle>,
2336 tx_id: u32,
2337}
2338
2339impl std::ops::Drop for PartitionsManagerCommitTransactionResponder {
2343 fn drop(&mut self) {
2344 self.control_handle.shutdown();
2345 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2347 }
2348}
2349
2350impl fidl::endpoints::Responder for PartitionsManagerCommitTransactionResponder {
2351 type ControlHandle = PartitionsManagerControlHandle;
2352
2353 fn control_handle(&self) -> &PartitionsManagerControlHandle {
2354 &self.control_handle
2355 }
2356
2357 fn drop_without_shutdown(mut self) {
2358 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2360 std::mem::forget(self);
2362 }
2363}
2364
2365impl PartitionsManagerCommitTransactionResponder {
2366 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2370 let _result = self.send_raw(result);
2371 if _result.is_err() {
2372 self.control_handle.shutdown();
2373 }
2374 self.drop_without_shutdown();
2375 _result
2376 }
2377
2378 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2380 let _result = self.send_raw(result);
2381 self.drop_without_shutdown();
2382 _result
2383 }
2384
2385 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2386 self.control_handle
2387 .inner
2388 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
2389 result,
2390 self.tx_id,
2391 0x2354762d579c7654,
2392 fidl::encoding::DynamicFlags::empty(),
2393 )
2394 }
2395}
2396
2397#[must_use = "FIDL methods require a response to be sent"]
2398#[derive(Debug)]
2399pub struct PartitionsManagerAddPartitionResponder {
2400 control_handle: std::mem::ManuallyDrop<PartitionsManagerControlHandle>,
2401 tx_id: u32,
2402}
2403
2404impl std::ops::Drop for PartitionsManagerAddPartitionResponder {
2408 fn drop(&mut self) {
2409 self.control_handle.shutdown();
2410 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2412 }
2413}
2414
2415impl fidl::endpoints::Responder for PartitionsManagerAddPartitionResponder {
2416 type ControlHandle = PartitionsManagerControlHandle;
2417
2418 fn control_handle(&self) -> &PartitionsManagerControlHandle {
2419 &self.control_handle
2420 }
2421
2422 fn drop_without_shutdown(mut self) {
2423 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2425 std::mem::forget(self);
2427 }
2428}
2429
2430impl PartitionsManagerAddPartitionResponder {
2431 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2435 let _result = self.send_raw(result);
2436 if _result.is_err() {
2437 self.control_handle.shutdown();
2438 }
2439 self.drop_without_shutdown();
2440 _result
2441 }
2442
2443 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2445 let _result = self.send_raw(result);
2446 self.drop_without_shutdown();
2447 _result
2448 }
2449
2450 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2451 self.control_handle
2452 .inner
2453 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
2454 result,
2455 self.tx_id,
2456 0x32afa9f7acf47e38,
2457 fidl::encoding::DynamicFlags::empty(),
2458 )
2459 }
2460}
2461
2462#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2463pub struct PartitionServiceMarker;
2464
2465#[cfg(target_os = "fuchsia")]
2466impl fidl::endpoints::ServiceMarker for PartitionServiceMarker {
2467 type Proxy = PartitionServiceProxy;
2468 type Request = PartitionServiceRequest;
2469 const SERVICE_NAME: &'static str = "fuchsia.storage.partitions.PartitionService";
2470}
2471
2472#[cfg(target_os = "fuchsia")]
2477pub enum PartitionServiceRequest {
2478 Volume(fidl_fuchsia_hardware_block_volume::VolumeRequestStream),
2480 Partition(PartitionRequestStream),
2482 Overlay(OverlayPartitionRequestStream),
2485}
2486
2487#[cfg(target_os = "fuchsia")]
2488impl fidl::endpoints::ServiceRequest for PartitionServiceRequest {
2489 type Service = PartitionServiceMarker;
2490
2491 fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
2492 match name {
2493 "volume" => Self::Volume(
2494 <fidl_fuchsia_hardware_block_volume::VolumeRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
2495 ),
2496 "partition" => Self::Partition(
2497 <PartitionRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
2498 ),
2499 "overlay" => Self::Overlay(
2500 <OverlayPartitionRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
2501 ),
2502 _ => panic!("no such member protocol name for service PartitionService"),
2503 }
2504 }
2505
2506 fn member_names() -> &'static [&'static str] {
2507 &["volume", "partition", "overlay"]
2508 }
2509}
2510#[cfg(target_os = "fuchsia")]
2513pub struct PartitionServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
2514
2515#[cfg(target_os = "fuchsia")]
2516impl fidl::endpoints::ServiceProxy for PartitionServiceProxy {
2517 type Service = PartitionServiceMarker;
2518
2519 fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
2520 Self(opener)
2521 }
2522}
2523
2524#[cfg(target_os = "fuchsia")]
2525impl PartitionServiceProxy {
2526 pub fn connect_to_volume(
2528 &self,
2529 ) -> Result<fidl_fuchsia_hardware_block_volume::VolumeProxy, fidl::Error> {
2530 let (proxy, server_end) =
2531 fidl::endpoints::create_proxy::<fidl_fuchsia_hardware_block_volume::VolumeMarker>();
2532 self.connect_channel_to_volume(server_end)?;
2533 Ok(proxy)
2534 }
2535
2536 pub fn connect_to_volume_sync(
2539 &self,
2540 ) -> Result<fidl_fuchsia_hardware_block_volume::VolumeSynchronousProxy, fidl::Error> {
2541 let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<
2542 fidl_fuchsia_hardware_block_volume::VolumeMarker,
2543 >();
2544 self.connect_channel_to_volume(server_end)?;
2545 Ok(proxy)
2546 }
2547
2548 pub fn connect_channel_to_volume(
2551 &self,
2552 server_end: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_block_volume::VolumeMarker>,
2553 ) -> Result<(), fidl::Error> {
2554 self.0.open_member("volume", server_end.into_channel())
2555 }
2556 pub fn connect_to_partition(&self) -> Result<PartitionProxy, fidl::Error> {
2558 let (proxy, server_end) = fidl::endpoints::create_proxy::<PartitionMarker>();
2559 self.connect_channel_to_partition(server_end)?;
2560 Ok(proxy)
2561 }
2562
2563 pub fn connect_to_partition_sync(&self) -> Result<PartitionSynchronousProxy, fidl::Error> {
2566 let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<PartitionMarker>();
2567 self.connect_channel_to_partition(server_end)?;
2568 Ok(proxy)
2569 }
2570
2571 pub fn connect_channel_to_partition(
2574 &self,
2575 server_end: fidl::endpoints::ServerEnd<PartitionMarker>,
2576 ) -> Result<(), fidl::Error> {
2577 self.0.open_member("partition", server_end.into_channel())
2578 }
2579 pub fn connect_to_overlay(&self) -> Result<OverlayPartitionProxy, fidl::Error> {
2582 let (proxy, server_end) = fidl::endpoints::create_proxy::<OverlayPartitionMarker>();
2583 self.connect_channel_to_overlay(server_end)?;
2584 Ok(proxy)
2585 }
2586
2587 pub fn connect_to_overlay_sync(&self) -> Result<OverlayPartitionSynchronousProxy, fidl::Error> {
2590 let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<OverlayPartitionMarker>();
2591 self.connect_channel_to_overlay(server_end)?;
2592 Ok(proxy)
2593 }
2594
2595 pub fn connect_channel_to_overlay(
2598 &self,
2599 server_end: fidl::endpoints::ServerEnd<OverlayPartitionMarker>,
2600 ) -> Result<(), fidl::Error> {
2601 self.0.open_member("overlay", server_end.into_channel())
2602 }
2603
2604 pub fn instance_name(&self) -> &str {
2605 self.0.instance_name()
2606 }
2607}
2608
2609mod internal {
2610 use super::*;
2611
2612 impl fidl::encoding::ResourceTypeMarker for PartitionsManagerCommitTransactionRequest {
2613 type Borrowed<'a> = &'a mut Self;
2614 fn take_or_borrow<'a>(
2615 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2616 ) -> Self::Borrowed<'a> {
2617 value
2618 }
2619 }
2620
2621 unsafe impl fidl::encoding::TypeMarker for PartitionsManagerCommitTransactionRequest {
2622 type Owned = Self;
2623
2624 #[inline(always)]
2625 fn inline_align(_context: fidl::encoding::Context) -> usize {
2626 4
2627 }
2628
2629 #[inline(always)]
2630 fn inline_size(_context: fidl::encoding::Context) -> usize {
2631 4
2632 }
2633 }
2634
2635 unsafe impl
2636 fidl::encoding::Encode<
2637 PartitionsManagerCommitTransactionRequest,
2638 fidl::encoding::DefaultFuchsiaResourceDialect,
2639 > for &mut PartitionsManagerCommitTransactionRequest
2640 {
2641 #[inline]
2642 unsafe fn encode(
2643 self,
2644 encoder: &mut fidl::encoding::Encoder<
2645 '_,
2646 fidl::encoding::DefaultFuchsiaResourceDialect,
2647 >,
2648 offset: usize,
2649 _depth: fidl::encoding::Depth,
2650 ) -> fidl::Result<()> {
2651 encoder.debug_check_bounds::<PartitionsManagerCommitTransactionRequest>(offset);
2652 fidl::encoding::Encode::<
2654 PartitionsManagerCommitTransactionRequest,
2655 fidl::encoding::DefaultFuchsiaResourceDialect,
2656 >::encode(
2657 (<fidl::encoding::HandleType<
2658 fidl::EventPair,
2659 { fidl::ObjectType::EVENTPAIR.into_raw() },
2660 2147483648,
2661 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2662 &mut self.transaction
2663 ),),
2664 encoder,
2665 offset,
2666 _depth,
2667 )
2668 }
2669 }
2670 unsafe impl<
2671 T0: fidl::encoding::Encode<
2672 fidl::encoding::HandleType<
2673 fidl::EventPair,
2674 { fidl::ObjectType::EVENTPAIR.into_raw() },
2675 2147483648,
2676 >,
2677 fidl::encoding::DefaultFuchsiaResourceDialect,
2678 >,
2679 >
2680 fidl::encoding::Encode<
2681 PartitionsManagerCommitTransactionRequest,
2682 fidl::encoding::DefaultFuchsiaResourceDialect,
2683 > for (T0,)
2684 {
2685 #[inline]
2686 unsafe fn encode(
2687 self,
2688 encoder: &mut fidl::encoding::Encoder<
2689 '_,
2690 fidl::encoding::DefaultFuchsiaResourceDialect,
2691 >,
2692 offset: usize,
2693 depth: fidl::encoding::Depth,
2694 ) -> fidl::Result<()> {
2695 encoder.debug_check_bounds::<PartitionsManagerCommitTransactionRequest>(offset);
2696 self.0.encode(encoder, offset + 0, depth)?;
2700 Ok(())
2701 }
2702 }
2703
2704 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2705 for PartitionsManagerCommitTransactionRequest
2706 {
2707 #[inline(always)]
2708 fn new_empty() -> Self {
2709 Self {
2710 transaction: fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
2711 }
2712 }
2713
2714 #[inline]
2715 unsafe fn decode(
2716 &mut self,
2717 decoder: &mut fidl::encoding::Decoder<
2718 '_,
2719 fidl::encoding::DefaultFuchsiaResourceDialect,
2720 >,
2721 offset: usize,
2722 _depth: fidl::encoding::Depth,
2723 ) -> fidl::Result<()> {
2724 decoder.debug_check_bounds::<Self>(offset);
2725 fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.transaction, decoder, offset + 0, _depth)?;
2727 Ok(())
2728 }
2729 }
2730
2731 impl fidl::encoding::ResourceTypeMarker for PartitionsManagerCreateTransactionResponse {
2732 type Borrowed<'a> = &'a mut Self;
2733 fn take_or_borrow<'a>(
2734 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2735 ) -> Self::Borrowed<'a> {
2736 value
2737 }
2738 }
2739
2740 unsafe impl fidl::encoding::TypeMarker for PartitionsManagerCreateTransactionResponse {
2741 type Owned = Self;
2742
2743 #[inline(always)]
2744 fn inline_align(_context: fidl::encoding::Context) -> usize {
2745 4
2746 }
2747
2748 #[inline(always)]
2749 fn inline_size(_context: fidl::encoding::Context) -> usize {
2750 4
2751 }
2752 }
2753
2754 unsafe impl
2755 fidl::encoding::Encode<
2756 PartitionsManagerCreateTransactionResponse,
2757 fidl::encoding::DefaultFuchsiaResourceDialect,
2758 > for &mut PartitionsManagerCreateTransactionResponse
2759 {
2760 #[inline]
2761 unsafe fn encode(
2762 self,
2763 encoder: &mut fidl::encoding::Encoder<
2764 '_,
2765 fidl::encoding::DefaultFuchsiaResourceDialect,
2766 >,
2767 offset: usize,
2768 _depth: fidl::encoding::Depth,
2769 ) -> fidl::Result<()> {
2770 encoder.debug_check_bounds::<PartitionsManagerCreateTransactionResponse>(offset);
2771 fidl::encoding::Encode::<
2773 PartitionsManagerCreateTransactionResponse,
2774 fidl::encoding::DefaultFuchsiaResourceDialect,
2775 >::encode(
2776 (<fidl::encoding::HandleType<
2777 fidl::EventPair,
2778 { fidl::ObjectType::EVENTPAIR.into_raw() },
2779 2147483648,
2780 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2781 &mut self.transaction
2782 ),),
2783 encoder,
2784 offset,
2785 _depth,
2786 )
2787 }
2788 }
2789 unsafe impl<
2790 T0: fidl::encoding::Encode<
2791 fidl::encoding::HandleType<
2792 fidl::EventPair,
2793 { fidl::ObjectType::EVENTPAIR.into_raw() },
2794 2147483648,
2795 >,
2796 fidl::encoding::DefaultFuchsiaResourceDialect,
2797 >,
2798 >
2799 fidl::encoding::Encode<
2800 PartitionsManagerCreateTransactionResponse,
2801 fidl::encoding::DefaultFuchsiaResourceDialect,
2802 > for (T0,)
2803 {
2804 #[inline]
2805 unsafe fn encode(
2806 self,
2807 encoder: &mut fidl::encoding::Encoder<
2808 '_,
2809 fidl::encoding::DefaultFuchsiaResourceDialect,
2810 >,
2811 offset: usize,
2812 depth: fidl::encoding::Depth,
2813 ) -> fidl::Result<()> {
2814 encoder.debug_check_bounds::<PartitionsManagerCreateTransactionResponse>(offset);
2815 self.0.encode(encoder, offset + 0, depth)?;
2819 Ok(())
2820 }
2821 }
2822
2823 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2824 for PartitionsManagerCreateTransactionResponse
2825 {
2826 #[inline(always)]
2827 fn new_empty() -> Self {
2828 Self {
2829 transaction: fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
2830 }
2831 }
2832
2833 #[inline]
2834 unsafe fn decode(
2835 &mut self,
2836 decoder: &mut fidl::encoding::Decoder<
2837 '_,
2838 fidl::encoding::DefaultFuchsiaResourceDialect,
2839 >,
2840 offset: usize,
2841 _depth: fidl::encoding::Depth,
2842 ) -> fidl::Result<()> {
2843 decoder.debug_check_bounds::<Self>(offset);
2844 fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.transaction, decoder, offset + 0, _depth)?;
2846 Ok(())
2847 }
2848 }
2849
2850 impl PartitionUpdateMetadataRequest {
2851 #[inline(always)]
2852 fn max_ordinal_present(&self) -> u64 {
2853 if let Some(_) = self.flags {
2854 return 3;
2855 }
2856 if let Some(_) = self.type_guid {
2857 return 2;
2858 }
2859 if let Some(_) = self.transaction {
2860 return 1;
2861 }
2862 0
2863 }
2864 }
2865
2866 impl fidl::encoding::ResourceTypeMarker for PartitionUpdateMetadataRequest {
2867 type Borrowed<'a> = &'a mut Self;
2868 fn take_or_borrow<'a>(
2869 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2870 ) -> Self::Borrowed<'a> {
2871 value
2872 }
2873 }
2874
2875 unsafe impl fidl::encoding::TypeMarker for PartitionUpdateMetadataRequest {
2876 type Owned = Self;
2877
2878 #[inline(always)]
2879 fn inline_align(_context: fidl::encoding::Context) -> usize {
2880 8
2881 }
2882
2883 #[inline(always)]
2884 fn inline_size(_context: fidl::encoding::Context) -> usize {
2885 16
2886 }
2887 }
2888
2889 unsafe impl
2890 fidl::encoding::Encode<
2891 PartitionUpdateMetadataRequest,
2892 fidl::encoding::DefaultFuchsiaResourceDialect,
2893 > for &mut PartitionUpdateMetadataRequest
2894 {
2895 unsafe fn encode(
2896 self,
2897 encoder: &mut fidl::encoding::Encoder<
2898 '_,
2899 fidl::encoding::DefaultFuchsiaResourceDialect,
2900 >,
2901 offset: usize,
2902 mut depth: fidl::encoding::Depth,
2903 ) -> fidl::Result<()> {
2904 encoder.debug_check_bounds::<PartitionUpdateMetadataRequest>(offset);
2905 let max_ordinal: u64 = self.max_ordinal_present();
2907 encoder.write_num(max_ordinal, offset);
2908 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2909 if max_ordinal == 0 {
2911 return Ok(());
2912 }
2913 depth.increment()?;
2914 let envelope_size = 8;
2915 let bytes_len = max_ordinal as usize * envelope_size;
2916 #[allow(unused_variables)]
2917 let offset = encoder.out_of_line_offset(bytes_len);
2918 let mut _prev_end_offset: usize = 0;
2919 if 1 > max_ordinal {
2920 return Ok(());
2921 }
2922
2923 let cur_offset: usize = (1 - 1) * envelope_size;
2926
2927 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2929
2930 fidl::encoding::encode_in_envelope_optional::<
2935 fidl::encoding::HandleType<
2936 fidl::EventPair,
2937 { fidl::ObjectType::EVENTPAIR.into_raw() },
2938 2147483648,
2939 >,
2940 fidl::encoding::DefaultFuchsiaResourceDialect,
2941 >(
2942 self.transaction.as_mut().map(
2943 <fidl::encoding::HandleType<
2944 fidl::EventPair,
2945 { fidl::ObjectType::EVENTPAIR.into_raw() },
2946 2147483648,
2947 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
2948 ),
2949 encoder,
2950 offset + cur_offset,
2951 depth,
2952 )?;
2953
2954 _prev_end_offset = cur_offset + envelope_size;
2955 if 2 > max_ordinal {
2956 return Ok(());
2957 }
2958
2959 let cur_offset: usize = (2 - 1) * envelope_size;
2962
2963 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2965
2966 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_hardware_block_partition::Guid, fidl::encoding::DefaultFuchsiaResourceDialect>(
2971 self.type_guid.as_ref().map(<fidl_fuchsia_hardware_block_partition::Guid as fidl::encoding::ValueTypeMarker>::borrow),
2972 encoder, offset + cur_offset, depth
2973 )?;
2974
2975 _prev_end_offset = cur_offset + envelope_size;
2976 if 3 > max_ordinal {
2977 return Ok(());
2978 }
2979
2980 let cur_offset: usize = (3 - 1) * envelope_size;
2983
2984 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2986
2987 fidl::encoding::encode_in_envelope_optional::<
2992 u64,
2993 fidl::encoding::DefaultFuchsiaResourceDialect,
2994 >(
2995 self.flags.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
2996 encoder,
2997 offset + cur_offset,
2998 depth,
2999 )?;
3000
3001 _prev_end_offset = cur_offset + envelope_size;
3002
3003 Ok(())
3004 }
3005 }
3006
3007 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3008 for PartitionUpdateMetadataRequest
3009 {
3010 #[inline(always)]
3011 fn new_empty() -> Self {
3012 Self::default()
3013 }
3014
3015 unsafe fn decode(
3016 &mut self,
3017 decoder: &mut fidl::encoding::Decoder<
3018 '_,
3019 fidl::encoding::DefaultFuchsiaResourceDialect,
3020 >,
3021 offset: usize,
3022 mut depth: fidl::encoding::Depth,
3023 ) -> fidl::Result<()> {
3024 decoder.debug_check_bounds::<Self>(offset);
3025 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3026 None => return Err(fidl::Error::NotNullable),
3027 Some(len) => len,
3028 };
3029 if len == 0 {
3031 return Ok(());
3032 };
3033 depth.increment()?;
3034 let envelope_size = 8;
3035 let bytes_len = len * envelope_size;
3036 let offset = decoder.out_of_line_offset(bytes_len)?;
3037 let mut _next_ordinal_to_read = 0;
3039 let mut next_offset = offset;
3040 let end_offset = offset + bytes_len;
3041 _next_ordinal_to_read += 1;
3042 if next_offset >= end_offset {
3043 return Ok(());
3044 }
3045
3046 while _next_ordinal_to_read < 1 {
3048 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3049 _next_ordinal_to_read += 1;
3050 next_offset += envelope_size;
3051 }
3052
3053 let next_out_of_line = decoder.next_out_of_line();
3054 let handles_before = decoder.remaining_handles();
3055 if let Some((inlined, num_bytes, num_handles)) =
3056 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3057 {
3058 let member_inline_size = <fidl::encoding::HandleType<
3059 fidl::EventPair,
3060 { fidl::ObjectType::EVENTPAIR.into_raw() },
3061 2147483648,
3062 > as fidl::encoding::TypeMarker>::inline_size(
3063 decoder.context
3064 );
3065 if inlined != (member_inline_size <= 4) {
3066 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3067 }
3068 let inner_offset;
3069 let mut inner_depth = depth.clone();
3070 if inlined {
3071 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3072 inner_offset = next_offset;
3073 } else {
3074 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3075 inner_depth.increment()?;
3076 }
3077 let val_ref =
3078 self.transaction.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
3079 fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
3080 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3081 {
3082 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3083 }
3084 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3085 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3086 }
3087 }
3088
3089 next_offset += envelope_size;
3090 _next_ordinal_to_read += 1;
3091 if next_offset >= end_offset {
3092 return Ok(());
3093 }
3094
3095 while _next_ordinal_to_read < 2 {
3097 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3098 _next_ordinal_to_read += 1;
3099 next_offset += envelope_size;
3100 }
3101
3102 let next_out_of_line = decoder.next_out_of_line();
3103 let handles_before = decoder.remaining_handles();
3104 if let Some((inlined, num_bytes, num_handles)) =
3105 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3106 {
3107 let member_inline_size = <fidl_fuchsia_hardware_block_partition::Guid as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3108 if inlined != (member_inline_size <= 4) {
3109 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3110 }
3111 let inner_offset;
3112 let mut inner_depth = depth.clone();
3113 if inlined {
3114 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3115 inner_offset = next_offset;
3116 } else {
3117 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3118 inner_depth.increment()?;
3119 }
3120 let val_ref = self.type_guid.get_or_insert_with(|| {
3121 fidl::new_empty!(
3122 fidl_fuchsia_hardware_block_partition::Guid,
3123 fidl::encoding::DefaultFuchsiaResourceDialect
3124 )
3125 });
3126 fidl::decode!(
3127 fidl_fuchsia_hardware_block_partition::Guid,
3128 fidl::encoding::DefaultFuchsiaResourceDialect,
3129 val_ref,
3130 decoder,
3131 inner_offset,
3132 inner_depth
3133 )?;
3134 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3135 {
3136 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3137 }
3138 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3139 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3140 }
3141 }
3142
3143 next_offset += envelope_size;
3144 _next_ordinal_to_read += 1;
3145 if next_offset >= end_offset {
3146 return Ok(());
3147 }
3148
3149 while _next_ordinal_to_read < 3 {
3151 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3152 _next_ordinal_to_read += 1;
3153 next_offset += envelope_size;
3154 }
3155
3156 let next_out_of_line = decoder.next_out_of_line();
3157 let handles_before = decoder.remaining_handles();
3158 if let Some((inlined, num_bytes, num_handles)) =
3159 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3160 {
3161 let member_inline_size =
3162 <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3163 if inlined != (member_inline_size <= 4) {
3164 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3165 }
3166 let inner_offset;
3167 let mut inner_depth = depth.clone();
3168 if inlined {
3169 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3170 inner_offset = next_offset;
3171 } else {
3172 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3173 inner_depth.increment()?;
3174 }
3175 let val_ref = self.flags.get_or_insert_with(|| {
3176 fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
3177 });
3178 fidl::decode!(
3179 u64,
3180 fidl::encoding::DefaultFuchsiaResourceDialect,
3181 val_ref,
3182 decoder,
3183 inner_offset,
3184 inner_depth
3185 )?;
3186 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3187 {
3188 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3189 }
3190 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3191 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3192 }
3193 }
3194
3195 next_offset += envelope_size;
3196
3197 while next_offset < end_offset {
3199 _next_ordinal_to_read += 1;
3200 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3201 next_offset += envelope_size;
3202 }
3203
3204 Ok(())
3205 }
3206 }
3207
3208 impl PartitionsManagerAddPartitionRequest {
3209 #[inline(always)]
3210 fn max_ordinal_present(&self) -> u64 {
3211 if let Some(_) = self.flags {
3212 return 6;
3213 }
3214 if let Some(_) = self.instance_guid {
3215 return 5;
3216 }
3217 if let Some(_) = self.type_guid {
3218 return 4;
3219 }
3220 if let Some(_) = self.name {
3221 return 3;
3222 }
3223 if let Some(_) = self.num_blocks {
3224 return 2;
3225 }
3226 if let Some(_) = self.transaction {
3227 return 1;
3228 }
3229 0
3230 }
3231 }
3232
3233 impl fidl::encoding::ResourceTypeMarker for PartitionsManagerAddPartitionRequest {
3234 type Borrowed<'a> = &'a mut Self;
3235 fn take_or_borrow<'a>(
3236 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3237 ) -> Self::Borrowed<'a> {
3238 value
3239 }
3240 }
3241
3242 unsafe impl fidl::encoding::TypeMarker for PartitionsManagerAddPartitionRequest {
3243 type Owned = Self;
3244
3245 #[inline(always)]
3246 fn inline_align(_context: fidl::encoding::Context) -> usize {
3247 8
3248 }
3249
3250 #[inline(always)]
3251 fn inline_size(_context: fidl::encoding::Context) -> usize {
3252 16
3253 }
3254 }
3255
3256 unsafe impl
3257 fidl::encoding::Encode<
3258 PartitionsManagerAddPartitionRequest,
3259 fidl::encoding::DefaultFuchsiaResourceDialect,
3260 > for &mut PartitionsManagerAddPartitionRequest
3261 {
3262 unsafe fn encode(
3263 self,
3264 encoder: &mut fidl::encoding::Encoder<
3265 '_,
3266 fidl::encoding::DefaultFuchsiaResourceDialect,
3267 >,
3268 offset: usize,
3269 mut depth: fidl::encoding::Depth,
3270 ) -> fidl::Result<()> {
3271 encoder.debug_check_bounds::<PartitionsManagerAddPartitionRequest>(offset);
3272 let max_ordinal: u64 = self.max_ordinal_present();
3274 encoder.write_num(max_ordinal, offset);
3275 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3276 if max_ordinal == 0 {
3278 return Ok(());
3279 }
3280 depth.increment()?;
3281 let envelope_size = 8;
3282 let bytes_len = max_ordinal as usize * envelope_size;
3283 #[allow(unused_variables)]
3284 let offset = encoder.out_of_line_offset(bytes_len);
3285 let mut _prev_end_offset: usize = 0;
3286 if 1 > max_ordinal {
3287 return Ok(());
3288 }
3289
3290 let cur_offset: usize = (1 - 1) * envelope_size;
3293
3294 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3296
3297 fidl::encoding::encode_in_envelope_optional::<
3302 fidl::encoding::HandleType<
3303 fidl::EventPair,
3304 { fidl::ObjectType::EVENTPAIR.into_raw() },
3305 2147483648,
3306 >,
3307 fidl::encoding::DefaultFuchsiaResourceDialect,
3308 >(
3309 self.transaction.as_mut().map(
3310 <fidl::encoding::HandleType<
3311 fidl::EventPair,
3312 { fidl::ObjectType::EVENTPAIR.into_raw() },
3313 2147483648,
3314 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
3315 ),
3316 encoder,
3317 offset + cur_offset,
3318 depth,
3319 )?;
3320
3321 _prev_end_offset = cur_offset + envelope_size;
3322 if 2 > max_ordinal {
3323 return Ok(());
3324 }
3325
3326 let cur_offset: usize = (2 - 1) * envelope_size;
3329
3330 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3332
3333 fidl::encoding::encode_in_envelope_optional::<
3338 u64,
3339 fidl::encoding::DefaultFuchsiaResourceDialect,
3340 >(
3341 self.num_blocks.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
3342 encoder,
3343 offset + cur_offset,
3344 depth,
3345 )?;
3346
3347 _prev_end_offset = cur_offset + envelope_size;
3348 if 3 > max_ordinal {
3349 return Ok(());
3350 }
3351
3352 let cur_offset: usize = (3 - 1) * envelope_size;
3355
3356 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3358
3359 fidl::encoding::encode_in_envelope_optional::<
3364 fidl::encoding::BoundedString<128>,
3365 fidl::encoding::DefaultFuchsiaResourceDialect,
3366 >(
3367 self.name.as_ref().map(
3368 <fidl::encoding::BoundedString<128> as fidl::encoding::ValueTypeMarker>::borrow,
3369 ),
3370 encoder,
3371 offset + cur_offset,
3372 depth,
3373 )?;
3374
3375 _prev_end_offset = cur_offset + envelope_size;
3376 if 4 > max_ordinal {
3377 return Ok(());
3378 }
3379
3380 let cur_offset: usize = (4 - 1) * envelope_size;
3383
3384 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3386
3387 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_hardware_block_partition::Guid, fidl::encoding::DefaultFuchsiaResourceDialect>(
3392 self.type_guid.as_ref().map(<fidl_fuchsia_hardware_block_partition::Guid as fidl::encoding::ValueTypeMarker>::borrow),
3393 encoder, offset + cur_offset, depth
3394 )?;
3395
3396 _prev_end_offset = cur_offset + envelope_size;
3397 if 5 > max_ordinal {
3398 return Ok(());
3399 }
3400
3401 let cur_offset: usize = (5 - 1) * envelope_size;
3404
3405 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3407
3408 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_hardware_block_partition::Guid, fidl::encoding::DefaultFuchsiaResourceDialect>(
3413 self.instance_guid.as_ref().map(<fidl_fuchsia_hardware_block_partition::Guid as fidl::encoding::ValueTypeMarker>::borrow),
3414 encoder, offset + cur_offset, depth
3415 )?;
3416
3417 _prev_end_offset = cur_offset + envelope_size;
3418 if 6 > max_ordinal {
3419 return Ok(());
3420 }
3421
3422 let cur_offset: usize = (6 - 1) * envelope_size;
3425
3426 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3428
3429 fidl::encoding::encode_in_envelope_optional::<
3434 u64,
3435 fidl::encoding::DefaultFuchsiaResourceDialect,
3436 >(
3437 self.flags.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
3438 encoder,
3439 offset + cur_offset,
3440 depth,
3441 )?;
3442
3443 _prev_end_offset = cur_offset + envelope_size;
3444
3445 Ok(())
3446 }
3447 }
3448
3449 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3450 for PartitionsManagerAddPartitionRequest
3451 {
3452 #[inline(always)]
3453 fn new_empty() -> Self {
3454 Self::default()
3455 }
3456
3457 unsafe fn decode(
3458 &mut self,
3459 decoder: &mut fidl::encoding::Decoder<
3460 '_,
3461 fidl::encoding::DefaultFuchsiaResourceDialect,
3462 >,
3463 offset: usize,
3464 mut depth: fidl::encoding::Depth,
3465 ) -> fidl::Result<()> {
3466 decoder.debug_check_bounds::<Self>(offset);
3467 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3468 None => return Err(fidl::Error::NotNullable),
3469 Some(len) => len,
3470 };
3471 if len == 0 {
3473 return Ok(());
3474 };
3475 depth.increment()?;
3476 let envelope_size = 8;
3477 let bytes_len = len * envelope_size;
3478 let offset = decoder.out_of_line_offset(bytes_len)?;
3479 let mut _next_ordinal_to_read = 0;
3481 let mut next_offset = offset;
3482 let end_offset = offset + bytes_len;
3483 _next_ordinal_to_read += 1;
3484 if next_offset >= end_offset {
3485 return Ok(());
3486 }
3487
3488 while _next_ordinal_to_read < 1 {
3490 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3491 _next_ordinal_to_read += 1;
3492 next_offset += envelope_size;
3493 }
3494
3495 let next_out_of_line = decoder.next_out_of_line();
3496 let handles_before = decoder.remaining_handles();
3497 if let Some((inlined, num_bytes, num_handles)) =
3498 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3499 {
3500 let member_inline_size = <fidl::encoding::HandleType<
3501 fidl::EventPair,
3502 { fidl::ObjectType::EVENTPAIR.into_raw() },
3503 2147483648,
3504 > as fidl::encoding::TypeMarker>::inline_size(
3505 decoder.context
3506 );
3507 if inlined != (member_inline_size <= 4) {
3508 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3509 }
3510 let inner_offset;
3511 let mut inner_depth = depth.clone();
3512 if inlined {
3513 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3514 inner_offset = next_offset;
3515 } else {
3516 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3517 inner_depth.increment()?;
3518 }
3519 let val_ref =
3520 self.transaction.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
3521 fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
3522 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3523 {
3524 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3525 }
3526 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3527 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3528 }
3529 }
3530
3531 next_offset += envelope_size;
3532 _next_ordinal_to_read += 1;
3533 if next_offset >= end_offset {
3534 return Ok(());
3535 }
3536
3537 while _next_ordinal_to_read < 2 {
3539 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3540 _next_ordinal_to_read += 1;
3541 next_offset += envelope_size;
3542 }
3543
3544 let next_out_of_line = decoder.next_out_of_line();
3545 let handles_before = decoder.remaining_handles();
3546 if let Some((inlined, num_bytes, num_handles)) =
3547 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3548 {
3549 let member_inline_size =
3550 <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3551 if inlined != (member_inline_size <= 4) {
3552 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3553 }
3554 let inner_offset;
3555 let mut inner_depth = depth.clone();
3556 if inlined {
3557 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3558 inner_offset = next_offset;
3559 } else {
3560 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3561 inner_depth.increment()?;
3562 }
3563 let val_ref = self.num_blocks.get_or_insert_with(|| {
3564 fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
3565 });
3566 fidl::decode!(
3567 u64,
3568 fidl::encoding::DefaultFuchsiaResourceDialect,
3569 val_ref,
3570 decoder,
3571 inner_offset,
3572 inner_depth
3573 )?;
3574 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3575 {
3576 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3577 }
3578 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3579 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3580 }
3581 }
3582
3583 next_offset += envelope_size;
3584 _next_ordinal_to_read += 1;
3585 if next_offset >= end_offset {
3586 return Ok(());
3587 }
3588
3589 while _next_ordinal_to_read < 3 {
3591 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3592 _next_ordinal_to_read += 1;
3593 next_offset += envelope_size;
3594 }
3595
3596 let next_out_of_line = decoder.next_out_of_line();
3597 let handles_before = decoder.remaining_handles();
3598 if let Some((inlined, num_bytes, num_handles)) =
3599 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3600 {
3601 let member_inline_size =
3602 <fidl::encoding::BoundedString<128> as fidl::encoding::TypeMarker>::inline_size(
3603 decoder.context,
3604 );
3605 if inlined != (member_inline_size <= 4) {
3606 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3607 }
3608 let inner_offset;
3609 let mut inner_depth = depth.clone();
3610 if inlined {
3611 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3612 inner_offset = next_offset;
3613 } else {
3614 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3615 inner_depth.increment()?;
3616 }
3617 let val_ref = self.name.get_or_insert_with(|| {
3618 fidl::new_empty!(
3619 fidl::encoding::BoundedString<128>,
3620 fidl::encoding::DefaultFuchsiaResourceDialect
3621 )
3622 });
3623 fidl::decode!(
3624 fidl::encoding::BoundedString<128>,
3625 fidl::encoding::DefaultFuchsiaResourceDialect,
3626 val_ref,
3627 decoder,
3628 inner_offset,
3629 inner_depth
3630 )?;
3631 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3632 {
3633 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3634 }
3635 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3636 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3637 }
3638 }
3639
3640 next_offset += envelope_size;
3641 _next_ordinal_to_read += 1;
3642 if next_offset >= end_offset {
3643 return Ok(());
3644 }
3645
3646 while _next_ordinal_to_read < 4 {
3648 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3649 _next_ordinal_to_read += 1;
3650 next_offset += envelope_size;
3651 }
3652
3653 let next_out_of_line = decoder.next_out_of_line();
3654 let handles_before = decoder.remaining_handles();
3655 if let Some((inlined, num_bytes, num_handles)) =
3656 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3657 {
3658 let member_inline_size = <fidl_fuchsia_hardware_block_partition::Guid as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3659 if inlined != (member_inline_size <= 4) {
3660 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3661 }
3662 let inner_offset;
3663 let mut inner_depth = depth.clone();
3664 if inlined {
3665 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3666 inner_offset = next_offset;
3667 } else {
3668 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3669 inner_depth.increment()?;
3670 }
3671 let val_ref = self.type_guid.get_or_insert_with(|| {
3672 fidl::new_empty!(
3673 fidl_fuchsia_hardware_block_partition::Guid,
3674 fidl::encoding::DefaultFuchsiaResourceDialect
3675 )
3676 });
3677 fidl::decode!(
3678 fidl_fuchsia_hardware_block_partition::Guid,
3679 fidl::encoding::DefaultFuchsiaResourceDialect,
3680 val_ref,
3681 decoder,
3682 inner_offset,
3683 inner_depth
3684 )?;
3685 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3686 {
3687 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3688 }
3689 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3690 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3691 }
3692 }
3693
3694 next_offset += envelope_size;
3695 _next_ordinal_to_read += 1;
3696 if next_offset >= end_offset {
3697 return Ok(());
3698 }
3699
3700 while _next_ordinal_to_read < 5 {
3702 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3703 _next_ordinal_to_read += 1;
3704 next_offset += envelope_size;
3705 }
3706
3707 let next_out_of_line = decoder.next_out_of_line();
3708 let handles_before = decoder.remaining_handles();
3709 if let Some((inlined, num_bytes, num_handles)) =
3710 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3711 {
3712 let member_inline_size = <fidl_fuchsia_hardware_block_partition::Guid as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3713 if inlined != (member_inline_size <= 4) {
3714 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3715 }
3716 let inner_offset;
3717 let mut inner_depth = depth.clone();
3718 if inlined {
3719 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3720 inner_offset = next_offset;
3721 } else {
3722 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3723 inner_depth.increment()?;
3724 }
3725 let val_ref = self.instance_guid.get_or_insert_with(|| {
3726 fidl::new_empty!(
3727 fidl_fuchsia_hardware_block_partition::Guid,
3728 fidl::encoding::DefaultFuchsiaResourceDialect
3729 )
3730 });
3731 fidl::decode!(
3732 fidl_fuchsia_hardware_block_partition::Guid,
3733 fidl::encoding::DefaultFuchsiaResourceDialect,
3734 val_ref,
3735 decoder,
3736 inner_offset,
3737 inner_depth
3738 )?;
3739 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3740 {
3741 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3742 }
3743 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3744 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3745 }
3746 }
3747
3748 next_offset += envelope_size;
3749 _next_ordinal_to_read += 1;
3750 if next_offset >= end_offset {
3751 return Ok(());
3752 }
3753
3754 while _next_ordinal_to_read < 6 {
3756 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3757 _next_ordinal_to_read += 1;
3758 next_offset += envelope_size;
3759 }
3760
3761 let next_out_of_line = decoder.next_out_of_line();
3762 let handles_before = decoder.remaining_handles();
3763 if let Some((inlined, num_bytes, num_handles)) =
3764 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3765 {
3766 let member_inline_size =
3767 <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3768 if inlined != (member_inline_size <= 4) {
3769 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3770 }
3771 let inner_offset;
3772 let mut inner_depth = depth.clone();
3773 if inlined {
3774 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3775 inner_offset = next_offset;
3776 } else {
3777 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3778 inner_depth.increment()?;
3779 }
3780 let val_ref = self.flags.get_or_insert_with(|| {
3781 fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
3782 });
3783 fidl::decode!(
3784 u64,
3785 fidl::encoding::DefaultFuchsiaResourceDialect,
3786 val_ref,
3787 decoder,
3788 inner_offset,
3789 inner_depth
3790 )?;
3791 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3792 {
3793 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3794 }
3795 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3796 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3797 }
3798 }
3799
3800 next_offset += envelope_size;
3801
3802 while next_offset < end_offset {
3804 _next_ordinal_to_read += 1;
3805 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3806 next_offset += envelope_size;
3807 }
3808
3809 Ok(())
3810 }
3811 }
3812}