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_hardware_block_partition__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
15pub struct PartitionMarker;
16
17impl fidl::endpoints::ProtocolMarker for PartitionMarker {
18 type Proxy = PartitionProxy;
19 type RequestStream = PartitionRequestStream;
20 #[cfg(target_os = "fuchsia")]
21 type SynchronousProxy = PartitionSynchronousProxy;
22
23 const DEBUG_NAME: &'static str = "(anonymous) Partition";
24}
25pub type PartitionGetMetadataResult = Result<PartitionGetMetadataResponse, i32>;
26
27pub trait PartitionProxyInterface: Send + Sync {
28 type GetInfoResponseFut: std::future::Future<
29 Output = Result<fidl_fuchsia_hardware_block::BlockGetInfoResult, fidl::Error>,
30 > + Send;
31 fn r#get_info(&self) -> Self::GetInfoResponseFut;
32 fn r#open_session(
33 &self,
34 session: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_block::SessionMarker>,
35 ) -> Result<(), fidl::Error>;
36 fn r#open_session_with_offset_map(
37 &self,
38 session: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_block::SessionMarker>,
39 offset_map: Option<
40 fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_block::OffsetMapMarker>,
41 >,
42 initial_mappings: Option<&[fidl_fuchsia_hardware_block::BlockOffsetMapping]>,
43 ) -> Result<(), fidl::Error>;
44 type GetTypeGuidResponseFut: std::future::Future<Output = Result<(i32, Option<Box<Guid>>), fidl::Error>>
45 + Send;
46 fn r#get_type_guid(&self) -> Self::GetTypeGuidResponseFut;
47 type GetInstanceGuidResponseFut: std::future::Future<Output = Result<(i32, Option<Box<Guid>>), fidl::Error>>
48 + Send;
49 fn r#get_instance_guid(&self) -> Self::GetInstanceGuidResponseFut;
50 type GetNameResponseFut: std::future::Future<Output = Result<(i32, Option<String>), fidl::Error>>
51 + Send;
52 fn r#get_name(&self) -> Self::GetNameResponseFut;
53 type GetMetadataResponseFut: std::future::Future<Output = Result<PartitionGetMetadataResult, fidl::Error>>
54 + Send;
55 fn r#get_metadata(&self) -> Self::GetMetadataResponseFut;
56}
57#[derive(Debug)]
58#[cfg(target_os = "fuchsia")]
59pub struct PartitionSynchronousProxy {
60 client: fidl::client::sync::Client,
61}
62
63#[cfg(target_os = "fuchsia")]
64impl fidl::endpoints::SynchronousProxy for PartitionSynchronousProxy {
65 type Proxy = PartitionProxy;
66 type Protocol = PartitionMarker;
67
68 fn from_channel(inner: fidl::Channel) -> Self {
69 Self::new(inner)
70 }
71
72 fn into_channel(self) -> fidl::Channel {
73 self.client.into_channel()
74 }
75
76 fn as_channel(&self) -> &fidl::Channel {
77 self.client.as_channel()
78 }
79}
80
81#[cfg(target_os = "fuchsia")]
82impl PartitionSynchronousProxy {
83 pub fn new(channel: fidl::Channel) -> Self {
84 let protocol_name = <PartitionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
85 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
86 }
87
88 pub fn into_channel(self) -> fidl::Channel {
89 self.client.into_channel()
90 }
91
92 pub fn wait_for_event(
95 &self,
96 deadline: zx::MonotonicInstant,
97 ) -> Result<PartitionEvent, fidl::Error> {
98 PartitionEvent::decode(self.client.wait_for_event(deadline)?)
99 }
100
101 pub fn r#get_info(
103 &self,
104 ___deadline: zx::MonotonicInstant,
105 ) -> Result<fidl_fuchsia_hardware_block::BlockGetInfoResult, fidl::Error> {
106 let _response =
107 self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::ResultType<
108 fidl_fuchsia_hardware_block::BlockGetInfoResponse,
109 i32,
110 >>(
111 (),
112 0x79df1a5cdb6cc6a3,
113 fidl::encoding::DynamicFlags::empty(),
114 ___deadline,
115 )?;
116 Ok(_response.map(|x| x.info))
117 }
118
119 pub fn r#open_session(
121 &self,
122 mut session: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_block::SessionMarker>,
123 ) -> Result<(), fidl::Error> {
124 self.client.send::<fidl_fuchsia_hardware_block::BlockOpenSessionRequest>(
125 (session,),
126 0x7241c68d17614a31,
127 fidl::encoding::DynamicFlags::empty(),
128 )
129 }
130
131 pub fn r#open_session_with_offset_map(
151 &self,
152 mut session: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_block::SessionMarker>,
153 mut offset_map: Option<
154 fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_block::OffsetMapMarker>,
155 >,
156 mut initial_mappings: Option<&[fidl_fuchsia_hardware_block::BlockOffsetMapping]>,
157 ) -> Result<(), fidl::Error> {
158 self.client.send::<fidl_fuchsia_hardware_block::BlockOpenSessionWithOffsetMapRequest>(
159 (session, offset_map, initial_mappings),
160 0x7a8d3ba3d8bfa10f,
161 fidl::encoding::DynamicFlags::empty(),
162 )
163 }
164
165 pub fn r#get_type_guid(
168 &self,
169 ___deadline: zx::MonotonicInstant,
170 ) -> Result<(i32, Option<Box<Guid>>), fidl::Error> {
171 let _response =
172 self.client.send_query::<fidl::encoding::EmptyPayload, PartitionGetTypeGuidResponse>(
173 (),
174 0x111843d737a9b847,
175 fidl::encoding::DynamicFlags::empty(),
176 ___deadline,
177 )?;
178 Ok((_response.status, _response.guid))
179 }
180
181 pub fn r#get_instance_guid(
184 &self,
185 ___deadline: zx::MonotonicInstant,
186 ) -> Result<(i32, Option<Box<Guid>>), fidl::Error> {
187 let _response = self
188 .client
189 .send_query::<fidl::encoding::EmptyPayload, PartitionGetInstanceGuidResponse>(
190 (),
191 0x14a5a573b275d435,
192 fidl::encoding::DynamicFlags::empty(),
193 ___deadline,
194 )?;
195 Ok((_response.status, _response.guid))
196 }
197
198 pub fn r#get_name(
201 &self,
202 ___deadline: zx::MonotonicInstant,
203 ) -> Result<(i32, Option<String>), fidl::Error> {
204 let _response =
205 self.client.send_query::<fidl::encoding::EmptyPayload, PartitionGetNameResponse>(
206 (),
207 0x7e3c6f0b0937fc02,
208 fidl::encoding::DynamicFlags::empty(),
209 ___deadline,
210 )?;
211 Ok((_response.status, _response.name))
212 }
213
214 pub fn r#get_metadata(
218 &self,
219 ___deadline: zx::MonotonicInstant,
220 ) -> Result<PartitionGetMetadataResult, fidl::Error> {
221 let _response = self.client.send_query::<
222 fidl::encoding::EmptyPayload,
223 fidl::encoding::ResultType<PartitionGetMetadataResponse, i32>,
224 >(
225 (),
226 0x42d1464c96c3f3ff,
227 fidl::encoding::DynamicFlags::empty(),
228 ___deadline,
229 )?;
230 Ok(_response.map(|x| x))
231 }
232}
233
234#[cfg(target_os = "fuchsia")]
235impl From<PartitionSynchronousProxy> for zx::Handle {
236 fn from(value: PartitionSynchronousProxy) -> Self {
237 value.into_channel().into()
238 }
239}
240
241#[cfg(target_os = "fuchsia")]
242impl From<fidl::Channel> for PartitionSynchronousProxy {
243 fn from(value: fidl::Channel) -> Self {
244 Self::new(value)
245 }
246}
247
248#[cfg(target_os = "fuchsia")]
249impl fidl::endpoints::FromClient for PartitionSynchronousProxy {
250 type Protocol = PartitionMarker;
251
252 fn from_client(value: fidl::endpoints::ClientEnd<PartitionMarker>) -> Self {
253 Self::new(value.into_channel())
254 }
255}
256
257#[derive(Debug, Clone)]
258pub struct PartitionProxy {
259 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
260}
261
262impl fidl::endpoints::Proxy for PartitionProxy {
263 type Protocol = PartitionMarker;
264
265 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
266 Self::new(inner)
267 }
268
269 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
270 self.client.into_channel().map_err(|client| Self { client })
271 }
272
273 fn as_channel(&self) -> &::fidl::AsyncChannel {
274 self.client.as_channel()
275 }
276}
277
278impl PartitionProxy {
279 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
281 let protocol_name = <PartitionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
282 Self { client: fidl::client::Client::new(channel, protocol_name) }
283 }
284
285 pub fn take_event_stream(&self) -> PartitionEventStream {
291 PartitionEventStream { event_receiver: self.client.take_event_receiver() }
292 }
293
294 pub fn r#get_info(
296 &self,
297 ) -> fidl::client::QueryResponseFut<
298 fidl_fuchsia_hardware_block::BlockGetInfoResult,
299 fidl::encoding::DefaultFuchsiaResourceDialect,
300 > {
301 PartitionProxyInterface::r#get_info(self)
302 }
303
304 pub fn r#open_session(
306 &self,
307 mut session: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_block::SessionMarker>,
308 ) -> Result<(), fidl::Error> {
309 PartitionProxyInterface::r#open_session(self, session)
310 }
311
312 pub fn r#open_session_with_offset_map(
332 &self,
333 mut session: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_block::SessionMarker>,
334 mut offset_map: Option<
335 fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_block::OffsetMapMarker>,
336 >,
337 mut initial_mappings: Option<&[fidl_fuchsia_hardware_block::BlockOffsetMapping]>,
338 ) -> Result<(), fidl::Error> {
339 PartitionProxyInterface::r#open_session_with_offset_map(
340 self,
341 session,
342 offset_map,
343 initial_mappings,
344 )
345 }
346
347 pub fn r#get_type_guid(
350 &self,
351 ) -> fidl::client::QueryResponseFut<
352 (i32, Option<Box<Guid>>),
353 fidl::encoding::DefaultFuchsiaResourceDialect,
354 > {
355 PartitionProxyInterface::r#get_type_guid(self)
356 }
357
358 pub fn r#get_instance_guid(
361 &self,
362 ) -> fidl::client::QueryResponseFut<
363 (i32, Option<Box<Guid>>),
364 fidl::encoding::DefaultFuchsiaResourceDialect,
365 > {
366 PartitionProxyInterface::r#get_instance_guid(self)
367 }
368
369 pub fn r#get_name(
372 &self,
373 ) -> fidl::client::QueryResponseFut<
374 (i32, Option<String>),
375 fidl::encoding::DefaultFuchsiaResourceDialect,
376 > {
377 PartitionProxyInterface::r#get_name(self)
378 }
379
380 pub fn r#get_metadata(
384 &self,
385 ) -> fidl::client::QueryResponseFut<
386 PartitionGetMetadataResult,
387 fidl::encoding::DefaultFuchsiaResourceDialect,
388 > {
389 PartitionProxyInterface::r#get_metadata(self)
390 }
391}
392
393impl PartitionProxyInterface for PartitionProxy {
394 type GetInfoResponseFut = fidl::client::QueryResponseFut<
395 fidl_fuchsia_hardware_block::BlockGetInfoResult,
396 fidl::encoding::DefaultFuchsiaResourceDialect,
397 >;
398 fn r#get_info(&self) -> Self::GetInfoResponseFut {
399 fn _decode(
400 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
401 ) -> Result<fidl_fuchsia_hardware_block::BlockGetInfoResult, fidl::Error> {
402 let _response = fidl::client::decode_transaction_body::<
403 fidl::encoding::ResultType<fidl_fuchsia_hardware_block::BlockGetInfoResponse, i32>,
404 fidl::encoding::DefaultFuchsiaResourceDialect,
405 0x79df1a5cdb6cc6a3,
406 >(_buf?)?;
407 Ok(_response.map(|x| x.info))
408 }
409 self.client.send_query_and_decode::<
410 fidl::encoding::EmptyPayload,
411 fidl_fuchsia_hardware_block::BlockGetInfoResult,
412 >(
413 (),
414 0x79df1a5cdb6cc6a3,
415 fidl::encoding::DynamicFlags::empty(),
416 _decode,
417 )
418 }
419
420 fn r#open_session(
421 &self,
422 mut session: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_block::SessionMarker>,
423 ) -> Result<(), fidl::Error> {
424 self.client.send::<fidl_fuchsia_hardware_block::BlockOpenSessionRequest>(
425 (session,),
426 0x7241c68d17614a31,
427 fidl::encoding::DynamicFlags::empty(),
428 )
429 }
430
431 fn r#open_session_with_offset_map(
432 &self,
433 mut session: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_block::SessionMarker>,
434 mut offset_map: Option<
435 fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_block::OffsetMapMarker>,
436 >,
437 mut initial_mappings: Option<&[fidl_fuchsia_hardware_block::BlockOffsetMapping]>,
438 ) -> Result<(), fidl::Error> {
439 self.client.send::<fidl_fuchsia_hardware_block::BlockOpenSessionWithOffsetMapRequest>(
440 (session, offset_map, initial_mappings),
441 0x7a8d3ba3d8bfa10f,
442 fidl::encoding::DynamicFlags::empty(),
443 )
444 }
445
446 type GetTypeGuidResponseFut = fidl::client::QueryResponseFut<
447 (i32, Option<Box<Guid>>),
448 fidl::encoding::DefaultFuchsiaResourceDialect,
449 >;
450 fn r#get_type_guid(&self) -> Self::GetTypeGuidResponseFut {
451 fn _decode(
452 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
453 ) -> Result<(i32, Option<Box<Guid>>), fidl::Error> {
454 let _response = fidl::client::decode_transaction_body::<
455 PartitionGetTypeGuidResponse,
456 fidl::encoding::DefaultFuchsiaResourceDialect,
457 0x111843d737a9b847,
458 >(_buf?)?;
459 Ok((_response.status, _response.guid))
460 }
461 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, (i32, Option<Box<Guid>>)>(
462 (),
463 0x111843d737a9b847,
464 fidl::encoding::DynamicFlags::empty(),
465 _decode,
466 )
467 }
468
469 type GetInstanceGuidResponseFut = fidl::client::QueryResponseFut<
470 (i32, Option<Box<Guid>>),
471 fidl::encoding::DefaultFuchsiaResourceDialect,
472 >;
473 fn r#get_instance_guid(&self) -> Self::GetInstanceGuidResponseFut {
474 fn _decode(
475 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
476 ) -> Result<(i32, Option<Box<Guid>>), fidl::Error> {
477 let _response = fidl::client::decode_transaction_body::<
478 PartitionGetInstanceGuidResponse,
479 fidl::encoding::DefaultFuchsiaResourceDialect,
480 0x14a5a573b275d435,
481 >(_buf?)?;
482 Ok((_response.status, _response.guid))
483 }
484 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, (i32, Option<Box<Guid>>)>(
485 (),
486 0x14a5a573b275d435,
487 fidl::encoding::DynamicFlags::empty(),
488 _decode,
489 )
490 }
491
492 type GetNameResponseFut = fidl::client::QueryResponseFut<
493 (i32, Option<String>),
494 fidl::encoding::DefaultFuchsiaResourceDialect,
495 >;
496 fn r#get_name(&self) -> Self::GetNameResponseFut {
497 fn _decode(
498 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
499 ) -> Result<(i32, Option<String>), fidl::Error> {
500 let _response = fidl::client::decode_transaction_body::<
501 PartitionGetNameResponse,
502 fidl::encoding::DefaultFuchsiaResourceDialect,
503 0x7e3c6f0b0937fc02,
504 >(_buf?)?;
505 Ok((_response.status, _response.name))
506 }
507 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, (i32, Option<String>)>(
508 (),
509 0x7e3c6f0b0937fc02,
510 fidl::encoding::DynamicFlags::empty(),
511 _decode,
512 )
513 }
514
515 type GetMetadataResponseFut = fidl::client::QueryResponseFut<
516 PartitionGetMetadataResult,
517 fidl::encoding::DefaultFuchsiaResourceDialect,
518 >;
519 fn r#get_metadata(&self) -> Self::GetMetadataResponseFut {
520 fn _decode(
521 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
522 ) -> Result<PartitionGetMetadataResult, fidl::Error> {
523 let _response = fidl::client::decode_transaction_body::<
524 fidl::encoding::ResultType<PartitionGetMetadataResponse, i32>,
525 fidl::encoding::DefaultFuchsiaResourceDialect,
526 0x42d1464c96c3f3ff,
527 >(_buf?)?;
528 Ok(_response.map(|x| x))
529 }
530 self.client
531 .send_query_and_decode::<fidl::encoding::EmptyPayload, PartitionGetMetadataResult>(
532 (),
533 0x42d1464c96c3f3ff,
534 fidl::encoding::DynamicFlags::empty(),
535 _decode,
536 )
537 }
538}
539
540pub struct PartitionEventStream {
541 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
542}
543
544impl std::marker::Unpin for PartitionEventStream {}
545
546impl futures::stream::FusedStream for PartitionEventStream {
547 fn is_terminated(&self) -> bool {
548 self.event_receiver.is_terminated()
549 }
550}
551
552impl futures::Stream for PartitionEventStream {
553 type Item = Result<PartitionEvent, fidl::Error>;
554
555 fn poll_next(
556 mut self: std::pin::Pin<&mut Self>,
557 cx: &mut std::task::Context<'_>,
558 ) -> std::task::Poll<Option<Self::Item>> {
559 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
560 &mut self.event_receiver,
561 cx
562 )?) {
563 Some(buf) => std::task::Poll::Ready(Some(PartitionEvent::decode(buf))),
564 None => std::task::Poll::Ready(None),
565 }
566 }
567}
568
569#[derive(Debug)]
570pub enum PartitionEvent {}
571
572impl PartitionEvent {
573 fn decode(
575 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
576 ) -> Result<PartitionEvent, fidl::Error> {
577 let (bytes, _handles) = buf.split_mut();
578 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
579 debug_assert_eq!(tx_header.tx_id, 0);
580 match tx_header.ordinal {
581 _ => Err(fidl::Error::UnknownOrdinal {
582 ordinal: tx_header.ordinal,
583 protocol_name: <PartitionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
584 }),
585 }
586 }
587}
588
589pub struct PartitionRequestStream {
591 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
592 is_terminated: bool,
593}
594
595impl std::marker::Unpin for PartitionRequestStream {}
596
597impl futures::stream::FusedStream for PartitionRequestStream {
598 fn is_terminated(&self) -> bool {
599 self.is_terminated
600 }
601}
602
603impl fidl::endpoints::RequestStream for PartitionRequestStream {
604 type Protocol = PartitionMarker;
605 type ControlHandle = PartitionControlHandle;
606
607 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
608 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
609 }
610
611 fn control_handle(&self) -> Self::ControlHandle {
612 PartitionControlHandle { inner: self.inner.clone() }
613 }
614
615 fn into_inner(
616 self,
617 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
618 {
619 (self.inner, self.is_terminated)
620 }
621
622 fn from_inner(
623 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
624 is_terminated: bool,
625 ) -> Self {
626 Self { inner, is_terminated }
627 }
628}
629
630impl futures::Stream for PartitionRequestStream {
631 type Item = Result<PartitionRequest, fidl::Error>;
632
633 fn poll_next(
634 mut self: std::pin::Pin<&mut Self>,
635 cx: &mut std::task::Context<'_>,
636 ) -> std::task::Poll<Option<Self::Item>> {
637 let this = &mut *self;
638 if this.inner.check_shutdown(cx) {
639 this.is_terminated = true;
640 return std::task::Poll::Ready(None);
641 }
642 if this.is_terminated {
643 panic!("polled PartitionRequestStream after completion");
644 }
645 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
646 |bytes, handles| {
647 match this.inner.channel().read_etc(cx, bytes, handles) {
648 std::task::Poll::Ready(Ok(())) => {}
649 std::task::Poll::Pending => return std::task::Poll::Pending,
650 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
651 this.is_terminated = true;
652 return std::task::Poll::Ready(None);
653 }
654 std::task::Poll::Ready(Err(e)) => {
655 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
656 e.into(),
657 ))))
658 }
659 }
660
661 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
663
664 std::task::Poll::Ready(Some(match header.ordinal {
665 0x79df1a5cdb6cc6a3 => {
666 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
667 let mut req = fidl::new_empty!(
668 fidl::encoding::EmptyPayload,
669 fidl::encoding::DefaultFuchsiaResourceDialect
670 );
671 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
672 let control_handle = PartitionControlHandle { inner: this.inner.clone() };
673 Ok(PartitionRequest::GetInfo {
674 responder: PartitionGetInfoResponder {
675 control_handle: std::mem::ManuallyDrop::new(control_handle),
676 tx_id: header.tx_id,
677 },
678 })
679 }
680 0x7241c68d17614a31 => {
681 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
682 let mut req = fidl::new_empty!(
683 fidl_fuchsia_hardware_block::BlockOpenSessionRequest,
684 fidl::encoding::DefaultFuchsiaResourceDialect
685 );
686 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl_fuchsia_hardware_block::BlockOpenSessionRequest>(&header, _body_bytes, handles, &mut req)?;
687 let control_handle = PartitionControlHandle { inner: this.inner.clone() };
688 Ok(PartitionRequest::OpenSession { session: req.session, control_handle })
689 }
690 0x7a8d3ba3d8bfa10f => {
691 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
692 let mut req = fidl::new_empty!(
693 fidl_fuchsia_hardware_block::BlockOpenSessionWithOffsetMapRequest,
694 fidl::encoding::DefaultFuchsiaResourceDialect
695 );
696 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl_fuchsia_hardware_block::BlockOpenSessionWithOffsetMapRequest>(&header, _body_bytes, handles, &mut req)?;
697 let control_handle = PartitionControlHandle { inner: this.inner.clone() };
698 Ok(PartitionRequest::OpenSessionWithOffsetMap {
699 session: req.session,
700 offset_map: req.offset_map,
701 initial_mappings: req.initial_mappings,
702
703 control_handle,
704 })
705 }
706 0x111843d737a9b847 => {
707 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
708 let mut req = fidl::new_empty!(
709 fidl::encoding::EmptyPayload,
710 fidl::encoding::DefaultFuchsiaResourceDialect
711 );
712 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
713 let control_handle = PartitionControlHandle { inner: this.inner.clone() };
714 Ok(PartitionRequest::GetTypeGuid {
715 responder: PartitionGetTypeGuidResponder {
716 control_handle: std::mem::ManuallyDrop::new(control_handle),
717 tx_id: header.tx_id,
718 },
719 })
720 }
721 0x14a5a573b275d435 => {
722 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
723 let mut req = fidl::new_empty!(
724 fidl::encoding::EmptyPayload,
725 fidl::encoding::DefaultFuchsiaResourceDialect
726 );
727 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
728 let control_handle = PartitionControlHandle { inner: this.inner.clone() };
729 Ok(PartitionRequest::GetInstanceGuid {
730 responder: PartitionGetInstanceGuidResponder {
731 control_handle: std::mem::ManuallyDrop::new(control_handle),
732 tx_id: header.tx_id,
733 },
734 })
735 }
736 0x7e3c6f0b0937fc02 => {
737 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
738 let mut req = fidl::new_empty!(
739 fidl::encoding::EmptyPayload,
740 fidl::encoding::DefaultFuchsiaResourceDialect
741 );
742 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
743 let control_handle = PartitionControlHandle { inner: this.inner.clone() };
744 Ok(PartitionRequest::GetName {
745 responder: PartitionGetNameResponder {
746 control_handle: std::mem::ManuallyDrop::new(control_handle),
747 tx_id: header.tx_id,
748 },
749 })
750 }
751 0x42d1464c96c3f3ff => {
752 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
753 let mut req = fidl::new_empty!(
754 fidl::encoding::EmptyPayload,
755 fidl::encoding::DefaultFuchsiaResourceDialect
756 );
757 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
758 let control_handle = PartitionControlHandle { inner: this.inner.clone() };
759 Ok(PartitionRequest::GetMetadata {
760 responder: PartitionGetMetadataResponder {
761 control_handle: std::mem::ManuallyDrop::new(control_handle),
762 tx_id: header.tx_id,
763 },
764 })
765 }
766 _ => Err(fidl::Error::UnknownOrdinal {
767 ordinal: header.ordinal,
768 protocol_name:
769 <PartitionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
770 }),
771 }))
772 },
773 )
774 }
775}
776
777#[derive(Debug)]
780pub enum PartitionRequest {
781 GetInfo { responder: PartitionGetInfoResponder },
783 OpenSession {
785 session: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_block::SessionMarker>,
786 control_handle: PartitionControlHandle,
787 },
788 OpenSessionWithOffsetMap {
808 session: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_block::SessionMarker>,
809 offset_map:
810 Option<fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_block::OffsetMapMarker>>,
811 initial_mappings: Option<Vec<fidl_fuchsia_hardware_block::BlockOffsetMapping>>,
812 control_handle: PartitionControlHandle,
813 },
814 GetTypeGuid { responder: PartitionGetTypeGuidResponder },
817 GetInstanceGuid { responder: PartitionGetInstanceGuidResponder },
820 GetName { responder: PartitionGetNameResponder },
823 GetMetadata { responder: PartitionGetMetadataResponder },
827}
828
829impl PartitionRequest {
830 #[allow(irrefutable_let_patterns)]
831 pub fn into_get_info(self) -> Option<(PartitionGetInfoResponder)> {
832 if let PartitionRequest::GetInfo { responder } = self {
833 Some((responder))
834 } else {
835 None
836 }
837 }
838
839 #[allow(irrefutable_let_patterns)]
840 pub fn into_open_session(
841 self,
842 ) -> Option<(
843 fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_block::SessionMarker>,
844 PartitionControlHandle,
845 )> {
846 if let PartitionRequest::OpenSession { session, control_handle } = self {
847 Some((session, control_handle))
848 } else {
849 None
850 }
851 }
852
853 #[allow(irrefutable_let_patterns)]
854 pub fn into_open_session_with_offset_map(
855 self,
856 ) -> Option<(
857 fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_block::SessionMarker>,
858 Option<fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_block::OffsetMapMarker>>,
859 Option<Vec<fidl_fuchsia_hardware_block::BlockOffsetMapping>>,
860 PartitionControlHandle,
861 )> {
862 if let PartitionRequest::OpenSessionWithOffsetMap {
863 session,
864 offset_map,
865 initial_mappings,
866 control_handle,
867 } = self
868 {
869 Some((session, offset_map, initial_mappings, control_handle))
870 } else {
871 None
872 }
873 }
874
875 #[allow(irrefutable_let_patterns)]
876 pub fn into_get_type_guid(self) -> Option<(PartitionGetTypeGuidResponder)> {
877 if let PartitionRequest::GetTypeGuid { responder } = self {
878 Some((responder))
879 } else {
880 None
881 }
882 }
883
884 #[allow(irrefutable_let_patterns)]
885 pub fn into_get_instance_guid(self) -> Option<(PartitionGetInstanceGuidResponder)> {
886 if let PartitionRequest::GetInstanceGuid { responder } = self {
887 Some((responder))
888 } else {
889 None
890 }
891 }
892
893 #[allow(irrefutable_let_patterns)]
894 pub fn into_get_name(self) -> Option<(PartitionGetNameResponder)> {
895 if let PartitionRequest::GetName { responder } = self {
896 Some((responder))
897 } else {
898 None
899 }
900 }
901
902 #[allow(irrefutable_let_patterns)]
903 pub fn into_get_metadata(self) -> Option<(PartitionGetMetadataResponder)> {
904 if let PartitionRequest::GetMetadata { responder } = self {
905 Some((responder))
906 } else {
907 None
908 }
909 }
910
911 pub fn method_name(&self) -> &'static str {
913 match *self {
914 PartitionRequest::GetInfo { .. } => "get_info",
915 PartitionRequest::OpenSession { .. } => "open_session",
916 PartitionRequest::OpenSessionWithOffsetMap { .. } => "open_session_with_offset_map",
917 PartitionRequest::GetTypeGuid { .. } => "get_type_guid",
918 PartitionRequest::GetInstanceGuid { .. } => "get_instance_guid",
919 PartitionRequest::GetName { .. } => "get_name",
920 PartitionRequest::GetMetadata { .. } => "get_metadata",
921 }
922 }
923}
924
925#[derive(Debug, Clone)]
926pub struct PartitionControlHandle {
927 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
928}
929
930impl fidl::endpoints::ControlHandle for PartitionControlHandle {
931 fn shutdown(&self) {
932 self.inner.shutdown()
933 }
934 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
935 self.inner.shutdown_with_epitaph(status)
936 }
937
938 fn is_closed(&self) -> bool {
939 self.inner.channel().is_closed()
940 }
941 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
942 self.inner.channel().on_closed()
943 }
944
945 #[cfg(target_os = "fuchsia")]
946 fn signal_peer(
947 &self,
948 clear_mask: zx::Signals,
949 set_mask: zx::Signals,
950 ) -> Result<(), zx_status::Status> {
951 use fidl::Peered;
952 self.inner.channel().signal_peer(clear_mask, set_mask)
953 }
954}
955
956impl PartitionControlHandle {}
957
958#[must_use = "FIDL methods require a response to be sent"]
959#[derive(Debug)]
960pub struct PartitionGetInfoResponder {
961 control_handle: std::mem::ManuallyDrop<PartitionControlHandle>,
962 tx_id: u32,
963}
964
965impl std::ops::Drop for PartitionGetInfoResponder {
969 fn drop(&mut self) {
970 self.control_handle.shutdown();
971 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
973 }
974}
975
976impl fidl::endpoints::Responder for PartitionGetInfoResponder {
977 type ControlHandle = PartitionControlHandle;
978
979 fn control_handle(&self) -> &PartitionControlHandle {
980 &self.control_handle
981 }
982
983 fn drop_without_shutdown(mut self) {
984 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
986 std::mem::forget(self);
988 }
989}
990
991impl PartitionGetInfoResponder {
992 pub fn send(
996 self,
997 mut result: Result<&fidl_fuchsia_hardware_block::BlockInfo, i32>,
998 ) -> Result<(), fidl::Error> {
999 let _result = self.send_raw(result);
1000 if _result.is_err() {
1001 self.control_handle.shutdown();
1002 }
1003 self.drop_without_shutdown();
1004 _result
1005 }
1006
1007 pub fn send_no_shutdown_on_err(
1009 self,
1010 mut result: Result<&fidl_fuchsia_hardware_block::BlockInfo, i32>,
1011 ) -> Result<(), fidl::Error> {
1012 let _result = self.send_raw(result);
1013 self.drop_without_shutdown();
1014 _result
1015 }
1016
1017 fn send_raw(
1018 &self,
1019 mut result: Result<&fidl_fuchsia_hardware_block::BlockInfo, i32>,
1020 ) -> Result<(), fidl::Error> {
1021 self.control_handle.inner.send::<fidl::encoding::ResultType<
1022 fidl_fuchsia_hardware_block::BlockGetInfoResponse,
1023 i32,
1024 >>(
1025 result.map(|info| (info,)),
1026 self.tx_id,
1027 0x79df1a5cdb6cc6a3,
1028 fidl::encoding::DynamicFlags::empty(),
1029 )
1030 }
1031}
1032
1033#[must_use = "FIDL methods require a response to be sent"]
1034#[derive(Debug)]
1035pub struct PartitionGetTypeGuidResponder {
1036 control_handle: std::mem::ManuallyDrop<PartitionControlHandle>,
1037 tx_id: u32,
1038}
1039
1040impl std::ops::Drop for PartitionGetTypeGuidResponder {
1044 fn drop(&mut self) {
1045 self.control_handle.shutdown();
1046 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1048 }
1049}
1050
1051impl fidl::endpoints::Responder for PartitionGetTypeGuidResponder {
1052 type ControlHandle = PartitionControlHandle;
1053
1054 fn control_handle(&self) -> &PartitionControlHandle {
1055 &self.control_handle
1056 }
1057
1058 fn drop_without_shutdown(mut self) {
1059 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1061 std::mem::forget(self);
1063 }
1064}
1065
1066impl PartitionGetTypeGuidResponder {
1067 pub fn send(self, mut status: i32, mut guid: Option<&Guid>) -> Result<(), fidl::Error> {
1071 let _result = self.send_raw(status, guid);
1072 if _result.is_err() {
1073 self.control_handle.shutdown();
1074 }
1075 self.drop_without_shutdown();
1076 _result
1077 }
1078
1079 pub fn send_no_shutdown_on_err(
1081 self,
1082 mut status: i32,
1083 mut guid: Option<&Guid>,
1084 ) -> Result<(), fidl::Error> {
1085 let _result = self.send_raw(status, guid);
1086 self.drop_without_shutdown();
1087 _result
1088 }
1089
1090 fn send_raw(&self, mut status: i32, mut guid: Option<&Guid>) -> Result<(), fidl::Error> {
1091 self.control_handle.inner.send::<PartitionGetTypeGuidResponse>(
1092 (status, guid),
1093 self.tx_id,
1094 0x111843d737a9b847,
1095 fidl::encoding::DynamicFlags::empty(),
1096 )
1097 }
1098}
1099
1100#[must_use = "FIDL methods require a response to be sent"]
1101#[derive(Debug)]
1102pub struct PartitionGetInstanceGuidResponder {
1103 control_handle: std::mem::ManuallyDrop<PartitionControlHandle>,
1104 tx_id: u32,
1105}
1106
1107impl std::ops::Drop for PartitionGetInstanceGuidResponder {
1111 fn drop(&mut self) {
1112 self.control_handle.shutdown();
1113 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1115 }
1116}
1117
1118impl fidl::endpoints::Responder for PartitionGetInstanceGuidResponder {
1119 type ControlHandle = PartitionControlHandle;
1120
1121 fn control_handle(&self) -> &PartitionControlHandle {
1122 &self.control_handle
1123 }
1124
1125 fn drop_without_shutdown(mut self) {
1126 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1128 std::mem::forget(self);
1130 }
1131}
1132
1133impl PartitionGetInstanceGuidResponder {
1134 pub fn send(self, mut status: i32, mut guid: Option<&Guid>) -> Result<(), fidl::Error> {
1138 let _result = self.send_raw(status, guid);
1139 if _result.is_err() {
1140 self.control_handle.shutdown();
1141 }
1142 self.drop_without_shutdown();
1143 _result
1144 }
1145
1146 pub fn send_no_shutdown_on_err(
1148 self,
1149 mut status: i32,
1150 mut guid: Option<&Guid>,
1151 ) -> Result<(), fidl::Error> {
1152 let _result = self.send_raw(status, guid);
1153 self.drop_without_shutdown();
1154 _result
1155 }
1156
1157 fn send_raw(&self, mut status: i32, mut guid: Option<&Guid>) -> Result<(), fidl::Error> {
1158 self.control_handle.inner.send::<PartitionGetInstanceGuidResponse>(
1159 (status, guid),
1160 self.tx_id,
1161 0x14a5a573b275d435,
1162 fidl::encoding::DynamicFlags::empty(),
1163 )
1164 }
1165}
1166
1167#[must_use = "FIDL methods require a response to be sent"]
1168#[derive(Debug)]
1169pub struct PartitionGetNameResponder {
1170 control_handle: std::mem::ManuallyDrop<PartitionControlHandle>,
1171 tx_id: u32,
1172}
1173
1174impl std::ops::Drop for PartitionGetNameResponder {
1178 fn drop(&mut self) {
1179 self.control_handle.shutdown();
1180 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1182 }
1183}
1184
1185impl fidl::endpoints::Responder for PartitionGetNameResponder {
1186 type ControlHandle = PartitionControlHandle;
1187
1188 fn control_handle(&self) -> &PartitionControlHandle {
1189 &self.control_handle
1190 }
1191
1192 fn drop_without_shutdown(mut self) {
1193 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1195 std::mem::forget(self);
1197 }
1198}
1199
1200impl PartitionGetNameResponder {
1201 pub fn send(self, mut status: i32, mut name: Option<&str>) -> Result<(), fidl::Error> {
1205 let _result = self.send_raw(status, name);
1206 if _result.is_err() {
1207 self.control_handle.shutdown();
1208 }
1209 self.drop_without_shutdown();
1210 _result
1211 }
1212
1213 pub fn send_no_shutdown_on_err(
1215 self,
1216 mut status: i32,
1217 mut name: Option<&str>,
1218 ) -> Result<(), fidl::Error> {
1219 let _result = self.send_raw(status, name);
1220 self.drop_without_shutdown();
1221 _result
1222 }
1223
1224 fn send_raw(&self, mut status: i32, mut name: Option<&str>) -> Result<(), fidl::Error> {
1225 self.control_handle.inner.send::<PartitionGetNameResponse>(
1226 (status, name),
1227 self.tx_id,
1228 0x7e3c6f0b0937fc02,
1229 fidl::encoding::DynamicFlags::empty(),
1230 )
1231 }
1232}
1233
1234#[must_use = "FIDL methods require a response to be sent"]
1235#[derive(Debug)]
1236pub struct PartitionGetMetadataResponder {
1237 control_handle: std::mem::ManuallyDrop<PartitionControlHandle>,
1238 tx_id: u32,
1239}
1240
1241impl std::ops::Drop for PartitionGetMetadataResponder {
1245 fn drop(&mut self) {
1246 self.control_handle.shutdown();
1247 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1249 }
1250}
1251
1252impl fidl::endpoints::Responder for PartitionGetMetadataResponder {
1253 type ControlHandle = PartitionControlHandle;
1254
1255 fn control_handle(&self) -> &PartitionControlHandle {
1256 &self.control_handle
1257 }
1258
1259 fn drop_without_shutdown(mut self) {
1260 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1262 std::mem::forget(self);
1264 }
1265}
1266
1267impl PartitionGetMetadataResponder {
1268 pub fn send(
1272 self,
1273 mut result: Result<&PartitionGetMetadataResponse, i32>,
1274 ) -> Result<(), fidl::Error> {
1275 let _result = self.send_raw(result);
1276 if _result.is_err() {
1277 self.control_handle.shutdown();
1278 }
1279 self.drop_without_shutdown();
1280 _result
1281 }
1282
1283 pub fn send_no_shutdown_on_err(
1285 self,
1286 mut result: Result<&PartitionGetMetadataResponse, i32>,
1287 ) -> Result<(), fidl::Error> {
1288 let _result = self.send_raw(result);
1289 self.drop_without_shutdown();
1290 _result
1291 }
1292
1293 fn send_raw(
1294 &self,
1295 mut result: Result<&PartitionGetMetadataResponse, i32>,
1296 ) -> Result<(), fidl::Error> {
1297 self.control_handle
1298 .inner
1299 .send::<fidl::encoding::ResultType<PartitionGetMetadataResponse, i32>>(
1300 result,
1301 self.tx_id,
1302 0x42d1464c96c3f3ff,
1303 fidl::encoding::DynamicFlags::empty(),
1304 )
1305 }
1306}
1307
1308mod internal {
1309 use super::*;
1310}