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