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 mapping: &fidl_fuchsia_hardware_block::BlockOffsetMapping,
40 ) -> Result<(), fidl::Error>;
41 type GetTypeGuidResponseFut: std::future::Future<Output = Result<(i32, Option<Box<Guid>>), fidl::Error>>
42 + Send;
43 fn r#get_type_guid(&self) -> Self::GetTypeGuidResponseFut;
44 type GetInstanceGuidResponseFut: std::future::Future<Output = Result<(i32, Option<Box<Guid>>), fidl::Error>>
45 + Send;
46 fn r#get_instance_guid(&self) -> Self::GetInstanceGuidResponseFut;
47 type GetNameResponseFut: std::future::Future<Output = Result<(i32, Option<String>), fidl::Error>>
48 + Send;
49 fn r#get_name(&self) -> Self::GetNameResponseFut;
50 type GetMetadataResponseFut: std::future::Future<Output = Result<PartitionGetMetadataResult, fidl::Error>>
51 + Send;
52 fn r#get_metadata(&self) -> Self::GetMetadataResponseFut;
53}
54#[derive(Debug)]
55#[cfg(target_os = "fuchsia")]
56pub struct PartitionSynchronousProxy {
57 client: fidl::client::sync::Client,
58}
59
60#[cfg(target_os = "fuchsia")]
61impl fidl::endpoints::SynchronousProxy for PartitionSynchronousProxy {
62 type Proxy = PartitionProxy;
63 type Protocol = PartitionMarker;
64
65 fn from_channel(inner: fidl::Channel) -> Self {
66 Self::new(inner)
67 }
68
69 fn into_channel(self) -> fidl::Channel {
70 self.client.into_channel()
71 }
72
73 fn as_channel(&self) -> &fidl::Channel {
74 self.client.as_channel()
75 }
76}
77
78#[cfg(target_os = "fuchsia")]
79impl PartitionSynchronousProxy {
80 pub fn new(channel: fidl::Channel) -> Self {
81 let protocol_name = <PartitionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
82 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
83 }
84
85 pub fn into_channel(self) -> fidl::Channel {
86 self.client.into_channel()
87 }
88
89 pub fn wait_for_event(
92 &self,
93 deadline: zx::MonotonicInstant,
94 ) -> Result<PartitionEvent, fidl::Error> {
95 PartitionEvent::decode(self.client.wait_for_event(deadline)?)
96 }
97
98 pub fn r#get_info(
100 &self,
101 ___deadline: zx::MonotonicInstant,
102 ) -> Result<fidl_fuchsia_hardware_block::BlockGetInfoResult, fidl::Error> {
103 let _response =
104 self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::ResultType<
105 fidl_fuchsia_hardware_block::BlockGetInfoResponse,
106 i32,
107 >>(
108 (),
109 0x79df1a5cdb6cc6a3,
110 fidl::encoding::DynamicFlags::empty(),
111 ___deadline,
112 )?;
113 Ok(_response.map(|x| x.info))
114 }
115
116 pub fn r#open_session(
118 &self,
119 mut session: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_block::SessionMarker>,
120 ) -> Result<(), fidl::Error> {
121 self.client.send::<fidl_fuchsia_hardware_block::BlockOpenSessionRequest>(
122 (session,),
123 0x7241c68d17614a31,
124 fidl::encoding::DynamicFlags::empty(),
125 )
126 }
127
128 pub fn r#open_session_with_offset_map(
139 &self,
140 mut session: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_block::SessionMarker>,
141 mut mapping: &fidl_fuchsia_hardware_block::BlockOffsetMapping,
142 ) -> Result<(), fidl::Error> {
143 self.client.send::<fidl_fuchsia_hardware_block::BlockOpenSessionWithOffsetMapRequest>(
144 (session, mapping),
145 0x7a8d3ba3d8bfa10f,
146 fidl::encoding::DynamicFlags::empty(),
147 )
148 }
149
150 pub fn r#get_type_guid(
153 &self,
154 ___deadline: zx::MonotonicInstant,
155 ) -> Result<(i32, Option<Box<Guid>>), fidl::Error> {
156 let _response =
157 self.client.send_query::<fidl::encoding::EmptyPayload, PartitionGetTypeGuidResponse>(
158 (),
159 0x111843d737a9b847,
160 fidl::encoding::DynamicFlags::empty(),
161 ___deadline,
162 )?;
163 Ok((_response.status, _response.guid))
164 }
165
166 pub fn r#get_instance_guid(
169 &self,
170 ___deadline: zx::MonotonicInstant,
171 ) -> Result<(i32, Option<Box<Guid>>), fidl::Error> {
172 let _response = self
173 .client
174 .send_query::<fidl::encoding::EmptyPayload, PartitionGetInstanceGuidResponse>(
175 (),
176 0x14a5a573b275d435,
177 fidl::encoding::DynamicFlags::empty(),
178 ___deadline,
179 )?;
180 Ok((_response.status, _response.guid))
181 }
182
183 pub fn r#get_name(
186 &self,
187 ___deadline: zx::MonotonicInstant,
188 ) -> Result<(i32, Option<String>), fidl::Error> {
189 let _response =
190 self.client.send_query::<fidl::encoding::EmptyPayload, PartitionGetNameResponse>(
191 (),
192 0x7e3c6f0b0937fc02,
193 fidl::encoding::DynamicFlags::empty(),
194 ___deadline,
195 )?;
196 Ok((_response.status, _response.name))
197 }
198
199 pub fn r#get_metadata(
203 &self,
204 ___deadline: zx::MonotonicInstant,
205 ) -> Result<PartitionGetMetadataResult, fidl::Error> {
206 let _response = self.client.send_query::<
207 fidl::encoding::EmptyPayload,
208 fidl::encoding::ResultType<PartitionGetMetadataResponse, i32>,
209 >(
210 (),
211 0x42d1464c96c3f3ff,
212 fidl::encoding::DynamicFlags::empty(),
213 ___deadline,
214 )?;
215 Ok(_response.map(|x| x))
216 }
217}
218
219#[cfg(target_os = "fuchsia")]
220impl From<PartitionSynchronousProxy> for zx::Handle {
221 fn from(value: PartitionSynchronousProxy) -> Self {
222 value.into_channel().into()
223 }
224}
225
226#[cfg(target_os = "fuchsia")]
227impl From<fidl::Channel> for PartitionSynchronousProxy {
228 fn from(value: fidl::Channel) -> Self {
229 Self::new(value)
230 }
231}
232
233#[cfg(target_os = "fuchsia")]
234impl fidl::endpoints::FromClient for PartitionSynchronousProxy {
235 type Protocol = PartitionMarker;
236
237 fn from_client(value: fidl::endpoints::ClientEnd<PartitionMarker>) -> Self {
238 Self::new(value.into_channel())
239 }
240}
241
242#[derive(Debug, Clone)]
243pub struct PartitionProxy {
244 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
245}
246
247impl fidl::endpoints::Proxy for PartitionProxy {
248 type Protocol = PartitionMarker;
249
250 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
251 Self::new(inner)
252 }
253
254 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
255 self.client.into_channel().map_err(|client| Self { client })
256 }
257
258 fn as_channel(&self) -> &::fidl::AsyncChannel {
259 self.client.as_channel()
260 }
261}
262
263impl PartitionProxy {
264 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
266 let protocol_name = <PartitionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
267 Self { client: fidl::client::Client::new(channel, protocol_name) }
268 }
269
270 pub fn take_event_stream(&self) -> PartitionEventStream {
276 PartitionEventStream { event_receiver: self.client.take_event_receiver() }
277 }
278
279 pub fn r#get_info(
281 &self,
282 ) -> fidl::client::QueryResponseFut<
283 fidl_fuchsia_hardware_block::BlockGetInfoResult,
284 fidl::encoding::DefaultFuchsiaResourceDialect,
285 > {
286 PartitionProxyInterface::r#get_info(self)
287 }
288
289 pub fn r#open_session(
291 &self,
292 mut session: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_block::SessionMarker>,
293 ) -> Result<(), fidl::Error> {
294 PartitionProxyInterface::r#open_session(self, session)
295 }
296
297 pub fn r#open_session_with_offset_map(
308 &self,
309 mut session: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_block::SessionMarker>,
310 mut mapping: &fidl_fuchsia_hardware_block::BlockOffsetMapping,
311 ) -> Result<(), fidl::Error> {
312 PartitionProxyInterface::r#open_session_with_offset_map(self, session, mapping)
313 }
314
315 pub fn r#get_type_guid(
318 &self,
319 ) -> fidl::client::QueryResponseFut<
320 (i32, Option<Box<Guid>>),
321 fidl::encoding::DefaultFuchsiaResourceDialect,
322 > {
323 PartitionProxyInterface::r#get_type_guid(self)
324 }
325
326 pub fn r#get_instance_guid(
329 &self,
330 ) -> fidl::client::QueryResponseFut<
331 (i32, Option<Box<Guid>>),
332 fidl::encoding::DefaultFuchsiaResourceDialect,
333 > {
334 PartitionProxyInterface::r#get_instance_guid(self)
335 }
336
337 pub fn r#get_name(
340 &self,
341 ) -> fidl::client::QueryResponseFut<
342 (i32, Option<String>),
343 fidl::encoding::DefaultFuchsiaResourceDialect,
344 > {
345 PartitionProxyInterface::r#get_name(self)
346 }
347
348 pub fn r#get_metadata(
352 &self,
353 ) -> fidl::client::QueryResponseFut<
354 PartitionGetMetadataResult,
355 fidl::encoding::DefaultFuchsiaResourceDialect,
356 > {
357 PartitionProxyInterface::r#get_metadata(self)
358 }
359}
360
361impl PartitionProxyInterface for PartitionProxy {
362 type GetInfoResponseFut = fidl::client::QueryResponseFut<
363 fidl_fuchsia_hardware_block::BlockGetInfoResult,
364 fidl::encoding::DefaultFuchsiaResourceDialect,
365 >;
366 fn r#get_info(&self) -> Self::GetInfoResponseFut {
367 fn _decode(
368 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
369 ) -> Result<fidl_fuchsia_hardware_block::BlockGetInfoResult, fidl::Error> {
370 let _response = fidl::client::decode_transaction_body::<
371 fidl::encoding::ResultType<fidl_fuchsia_hardware_block::BlockGetInfoResponse, i32>,
372 fidl::encoding::DefaultFuchsiaResourceDialect,
373 0x79df1a5cdb6cc6a3,
374 >(_buf?)?;
375 Ok(_response.map(|x| x.info))
376 }
377 self.client.send_query_and_decode::<
378 fidl::encoding::EmptyPayload,
379 fidl_fuchsia_hardware_block::BlockGetInfoResult,
380 >(
381 (),
382 0x79df1a5cdb6cc6a3,
383 fidl::encoding::DynamicFlags::empty(),
384 _decode,
385 )
386 }
387
388 fn r#open_session(
389 &self,
390 mut session: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_block::SessionMarker>,
391 ) -> Result<(), fidl::Error> {
392 self.client.send::<fidl_fuchsia_hardware_block::BlockOpenSessionRequest>(
393 (session,),
394 0x7241c68d17614a31,
395 fidl::encoding::DynamicFlags::empty(),
396 )
397 }
398
399 fn r#open_session_with_offset_map(
400 &self,
401 mut session: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_block::SessionMarker>,
402 mut mapping: &fidl_fuchsia_hardware_block::BlockOffsetMapping,
403 ) -> Result<(), fidl::Error> {
404 self.client.send::<fidl_fuchsia_hardware_block::BlockOpenSessionWithOffsetMapRequest>(
405 (session, mapping),
406 0x7a8d3ba3d8bfa10f,
407 fidl::encoding::DynamicFlags::empty(),
408 )
409 }
410
411 type GetTypeGuidResponseFut = fidl::client::QueryResponseFut<
412 (i32, Option<Box<Guid>>),
413 fidl::encoding::DefaultFuchsiaResourceDialect,
414 >;
415 fn r#get_type_guid(&self) -> Self::GetTypeGuidResponseFut {
416 fn _decode(
417 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
418 ) -> Result<(i32, Option<Box<Guid>>), fidl::Error> {
419 let _response = fidl::client::decode_transaction_body::<
420 PartitionGetTypeGuidResponse,
421 fidl::encoding::DefaultFuchsiaResourceDialect,
422 0x111843d737a9b847,
423 >(_buf?)?;
424 Ok((_response.status, _response.guid))
425 }
426 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, (i32, Option<Box<Guid>>)>(
427 (),
428 0x111843d737a9b847,
429 fidl::encoding::DynamicFlags::empty(),
430 _decode,
431 )
432 }
433
434 type GetInstanceGuidResponseFut = fidl::client::QueryResponseFut<
435 (i32, Option<Box<Guid>>),
436 fidl::encoding::DefaultFuchsiaResourceDialect,
437 >;
438 fn r#get_instance_guid(&self) -> Self::GetInstanceGuidResponseFut {
439 fn _decode(
440 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
441 ) -> Result<(i32, Option<Box<Guid>>), fidl::Error> {
442 let _response = fidl::client::decode_transaction_body::<
443 PartitionGetInstanceGuidResponse,
444 fidl::encoding::DefaultFuchsiaResourceDialect,
445 0x14a5a573b275d435,
446 >(_buf?)?;
447 Ok((_response.status, _response.guid))
448 }
449 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, (i32, Option<Box<Guid>>)>(
450 (),
451 0x14a5a573b275d435,
452 fidl::encoding::DynamicFlags::empty(),
453 _decode,
454 )
455 }
456
457 type GetNameResponseFut = fidl::client::QueryResponseFut<
458 (i32, Option<String>),
459 fidl::encoding::DefaultFuchsiaResourceDialect,
460 >;
461 fn r#get_name(&self) -> Self::GetNameResponseFut {
462 fn _decode(
463 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
464 ) -> Result<(i32, Option<String>), fidl::Error> {
465 let _response = fidl::client::decode_transaction_body::<
466 PartitionGetNameResponse,
467 fidl::encoding::DefaultFuchsiaResourceDialect,
468 0x7e3c6f0b0937fc02,
469 >(_buf?)?;
470 Ok((_response.status, _response.name))
471 }
472 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, (i32, Option<String>)>(
473 (),
474 0x7e3c6f0b0937fc02,
475 fidl::encoding::DynamicFlags::empty(),
476 _decode,
477 )
478 }
479
480 type GetMetadataResponseFut = fidl::client::QueryResponseFut<
481 PartitionGetMetadataResult,
482 fidl::encoding::DefaultFuchsiaResourceDialect,
483 >;
484 fn r#get_metadata(&self) -> Self::GetMetadataResponseFut {
485 fn _decode(
486 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
487 ) -> Result<PartitionGetMetadataResult, fidl::Error> {
488 let _response = fidl::client::decode_transaction_body::<
489 fidl::encoding::ResultType<PartitionGetMetadataResponse, i32>,
490 fidl::encoding::DefaultFuchsiaResourceDialect,
491 0x42d1464c96c3f3ff,
492 >(_buf?)?;
493 Ok(_response.map(|x| x))
494 }
495 self.client
496 .send_query_and_decode::<fidl::encoding::EmptyPayload, PartitionGetMetadataResult>(
497 (),
498 0x42d1464c96c3f3ff,
499 fidl::encoding::DynamicFlags::empty(),
500 _decode,
501 )
502 }
503}
504
505pub struct PartitionEventStream {
506 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
507}
508
509impl std::marker::Unpin for PartitionEventStream {}
510
511impl futures::stream::FusedStream for PartitionEventStream {
512 fn is_terminated(&self) -> bool {
513 self.event_receiver.is_terminated()
514 }
515}
516
517impl futures::Stream for PartitionEventStream {
518 type Item = Result<PartitionEvent, fidl::Error>;
519
520 fn poll_next(
521 mut self: std::pin::Pin<&mut Self>,
522 cx: &mut std::task::Context<'_>,
523 ) -> std::task::Poll<Option<Self::Item>> {
524 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
525 &mut self.event_receiver,
526 cx
527 )?) {
528 Some(buf) => std::task::Poll::Ready(Some(PartitionEvent::decode(buf))),
529 None => std::task::Poll::Ready(None),
530 }
531 }
532}
533
534#[derive(Debug)]
535pub enum PartitionEvent {}
536
537impl PartitionEvent {
538 fn decode(
540 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
541 ) -> Result<PartitionEvent, fidl::Error> {
542 let (bytes, _handles) = buf.split_mut();
543 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
544 debug_assert_eq!(tx_header.tx_id, 0);
545 match tx_header.ordinal {
546 _ => Err(fidl::Error::UnknownOrdinal {
547 ordinal: tx_header.ordinal,
548 protocol_name: <PartitionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
549 }),
550 }
551 }
552}
553
554pub struct PartitionRequestStream {
556 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
557 is_terminated: bool,
558}
559
560impl std::marker::Unpin for PartitionRequestStream {}
561
562impl futures::stream::FusedStream for PartitionRequestStream {
563 fn is_terminated(&self) -> bool {
564 self.is_terminated
565 }
566}
567
568impl fidl::endpoints::RequestStream for PartitionRequestStream {
569 type Protocol = PartitionMarker;
570 type ControlHandle = PartitionControlHandle;
571
572 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
573 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
574 }
575
576 fn control_handle(&self) -> Self::ControlHandle {
577 PartitionControlHandle { inner: self.inner.clone() }
578 }
579
580 fn into_inner(
581 self,
582 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
583 {
584 (self.inner, self.is_terminated)
585 }
586
587 fn from_inner(
588 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
589 is_terminated: bool,
590 ) -> Self {
591 Self { inner, is_terminated }
592 }
593}
594
595impl futures::Stream for PartitionRequestStream {
596 type Item = Result<PartitionRequest, fidl::Error>;
597
598 fn poll_next(
599 mut self: std::pin::Pin<&mut Self>,
600 cx: &mut std::task::Context<'_>,
601 ) -> std::task::Poll<Option<Self::Item>> {
602 let this = &mut *self;
603 if this.inner.check_shutdown(cx) {
604 this.is_terminated = true;
605 return std::task::Poll::Ready(None);
606 }
607 if this.is_terminated {
608 panic!("polled PartitionRequestStream after completion");
609 }
610 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
611 |bytes, handles| {
612 match this.inner.channel().read_etc(cx, bytes, handles) {
613 std::task::Poll::Ready(Ok(())) => {}
614 std::task::Poll::Pending => return std::task::Poll::Pending,
615 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
616 this.is_terminated = true;
617 return std::task::Poll::Ready(None);
618 }
619 std::task::Poll::Ready(Err(e)) => {
620 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
621 e.into(),
622 ))));
623 }
624 }
625
626 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
628
629 std::task::Poll::Ready(Some(match header.ordinal {
630 0x79df1a5cdb6cc6a3 => {
631 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
632 let mut req = fidl::new_empty!(
633 fidl::encoding::EmptyPayload,
634 fidl::encoding::DefaultFuchsiaResourceDialect
635 );
636 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
637 let control_handle = PartitionControlHandle { inner: this.inner.clone() };
638 Ok(PartitionRequest::GetInfo {
639 responder: PartitionGetInfoResponder {
640 control_handle: std::mem::ManuallyDrop::new(control_handle),
641 tx_id: header.tx_id,
642 },
643 })
644 }
645 0x7241c68d17614a31 => {
646 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
647 let mut req = fidl::new_empty!(
648 fidl_fuchsia_hardware_block::BlockOpenSessionRequest,
649 fidl::encoding::DefaultFuchsiaResourceDialect
650 );
651 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl_fuchsia_hardware_block::BlockOpenSessionRequest>(&header, _body_bytes, handles, &mut req)?;
652 let control_handle = PartitionControlHandle { inner: this.inner.clone() };
653 Ok(PartitionRequest::OpenSession { session: req.session, control_handle })
654 }
655 0x7a8d3ba3d8bfa10f => {
656 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
657 let mut req = fidl::new_empty!(
658 fidl_fuchsia_hardware_block::BlockOpenSessionWithOffsetMapRequest,
659 fidl::encoding::DefaultFuchsiaResourceDialect
660 );
661 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl_fuchsia_hardware_block::BlockOpenSessionWithOffsetMapRequest>(&header, _body_bytes, handles, &mut req)?;
662 let control_handle = PartitionControlHandle { inner: this.inner.clone() };
663 Ok(PartitionRequest::OpenSessionWithOffsetMap {
664 session: req.session,
665 mapping: req.mapping,
666
667 control_handle,
668 })
669 }
670 0x111843d737a9b847 => {
671 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
672 let mut req = fidl::new_empty!(
673 fidl::encoding::EmptyPayload,
674 fidl::encoding::DefaultFuchsiaResourceDialect
675 );
676 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
677 let control_handle = PartitionControlHandle { inner: this.inner.clone() };
678 Ok(PartitionRequest::GetTypeGuid {
679 responder: PartitionGetTypeGuidResponder {
680 control_handle: std::mem::ManuallyDrop::new(control_handle),
681 tx_id: header.tx_id,
682 },
683 })
684 }
685 0x14a5a573b275d435 => {
686 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
687 let mut req = fidl::new_empty!(
688 fidl::encoding::EmptyPayload,
689 fidl::encoding::DefaultFuchsiaResourceDialect
690 );
691 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
692 let control_handle = PartitionControlHandle { inner: this.inner.clone() };
693 Ok(PartitionRequest::GetInstanceGuid {
694 responder: PartitionGetInstanceGuidResponder {
695 control_handle: std::mem::ManuallyDrop::new(control_handle),
696 tx_id: header.tx_id,
697 },
698 })
699 }
700 0x7e3c6f0b0937fc02 => {
701 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
702 let mut req = fidl::new_empty!(
703 fidl::encoding::EmptyPayload,
704 fidl::encoding::DefaultFuchsiaResourceDialect
705 );
706 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
707 let control_handle = PartitionControlHandle { inner: this.inner.clone() };
708 Ok(PartitionRequest::GetName {
709 responder: PartitionGetNameResponder {
710 control_handle: std::mem::ManuallyDrop::new(control_handle),
711 tx_id: header.tx_id,
712 },
713 })
714 }
715 0x42d1464c96c3f3ff => {
716 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
717 let mut req = fidl::new_empty!(
718 fidl::encoding::EmptyPayload,
719 fidl::encoding::DefaultFuchsiaResourceDialect
720 );
721 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
722 let control_handle = PartitionControlHandle { inner: this.inner.clone() };
723 Ok(PartitionRequest::GetMetadata {
724 responder: PartitionGetMetadataResponder {
725 control_handle: std::mem::ManuallyDrop::new(control_handle),
726 tx_id: header.tx_id,
727 },
728 })
729 }
730 _ => Err(fidl::Error::UnknownOrdinal {
731 ordinal: header.ordinal,
732 protocol_name:
733 <PartitionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
734 }),
735 }))
736 },
737 )
738 }
739}
740
741#[derive(Debug)]
744pub enum PartitionRequest {
745 GetInfo { responder: PartitionGetInfoResponder },
747 OpenSession {
749 session: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_block::SessionMarker>,
750 control_handle: PartitionControlHandle,
751 },
752 OpenSessionWithOffsetMap {
763 session: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_block::SessionMarker>,
764 mapping: fidl_fuchsia_hardware_block::BlockOffsetMapping,
765 control_handle: PartitionControlHandle,
766 },
767 GetTypeGuid { responder: PartitionGetTypeGuidResponder },
770 GetInstanceGuid { responder: PartitionGetInstanceGuidResponder },
773 GetName { responder: PartitionGetNameResponder },
776 GetMetadata { responder: PartitionGetMetadataResponder },
780}
781
782impl PartitionRequest {
783 #[allow(irrefutable_let_patterns)]
784 pub fn into_get_info(self) -> Option<(PartitionGetInfoResponder)> {
785 if let PartitionRequest::GetInfo { responder } = self { Some((responder)) } else { None }
786 }
787
788 #[allow(irrefutable_let_patterns)]
789 pub fn into_open_session(
790 self,
791 ) -> Option<(
792 fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_block::SessionMarker>,
793 PartitionControlHandle,
794 )> {
795 if let PartitionRequest::OpenSession { session, control_handle } = self {
796 Some((session, control_handle))
797 } else {
798 None
799 }
800 }
801
802 #[allow(irrefutable_let_patterns)]
803 pub fn into_open_session_with_offset_map(
804 self,
805 ) -> Option<(
806 fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_block::SessionMarker>,
807 fidl_fuchsia_hardware_block::BlockOffsetMapping,
808 PartitionControlHandle,
809 )> {
810 if let PartitionRequest::OpenSessionWithOffsetMap { session, mapping, control_handle } =
811 self
812 {
813 Some((session, mapping, control_handle))
814 } else {
815 None
816 }
817 }
818
819 #[allow(irrefutable_let_patterns)]
820 pub fn into_get_type_guid(self) -> Option<(PartitionGetTypeGuidResponder)> {
821 if let PartitionRequest::GetTypeGuid { responder } = self {
822 Some((responder))
823 } else {
824 None
825 }
826 }
827
828 #[allow(irrefutable_let_patterns)]
829 pub fn into_get_instance_guid(self) -> Option<(PartitionGetInstanceGuidResponder)> {
830 if let PartitionRequest::GetInstanceGuid { responder } = self {
831 Some((responder))
832 } else {
833 None
834 }
835 }
836
837 #[allow(irrefutable_let_patterns)]
838 pub fn into_get_name(self) -> Option<(PartitionGetNameResponder)> {
839 if let PartitionRequest::GetName { responder } = self { Some((responder)) } else { None }
840 }
841
842 #[allow(irrefutable_let_patterns)]
843 pub fn into_get_metadata(self) -> Option<(PartitionGetMetadataResponder)> {
844 if let PartitionRequest::GetMetadata { responder } = self {
845 Some((responder))
846 } else {
847 None
848 }
849 }
850
851 pub fn method_name(&self) -> &'static str {
853 match *self {
854 PartitionRequest::GetInfo { .. } => "get_info",
855 PartitionRequest::OpenSession { .. } => "open_session",
856 PartitionRequest::OpenSessionWithOffsetMap { .. } => "open_session_with_offset_map",
857 PartitionRequest::GetTypeGuid { .. } => "get_type_guid",
858 PartitionRequest::GetInstanceGuid { .. } => "get_instance_guid",
859 PartitionRequest::GetName { .. } => "get_name",
860 PartitionRequest::GetMetadata { .. } => "get_metadata",
861 }
862 }
863}
864
865#[derive(Debug, Clone)]
866pub struct PartitionControlHandle {
867 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
868}
869
870impl fidl::endpoints::ControlHandle for PartitionControlHandle {
871 fn shutdown(&self) {
872 self.inner.shutdown()
873 }
874 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
875 self.inner.shutdown_with_epitaph(status)
876 }
877
878 fn is_closed(&self) -> bool {
879 self.inner.channel().is_closed()
880 }
881 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
882 self.inner.channel().on_closed()
883 }
884
885 #[cfg(target_os = "fuchsia")]
886 fn signal_peer(
887 &self,
888 clear_mask: zx::Signals,
889 set_mask: zx::Signals,
890 ) -> Result<(), zx_status::Status> {
891 use fidl::Peered;
892 self.inner.channel().signal_peer(clear_mask, set_mask)
893 }
894}
895
896impl PartitionControlHandle {}
897
898#[must_use = "FIDL methods require a response to be sent"]
899#[derive(Debug)]
900pub struct PartitionGetInfoResponder {
901 control_handle: std::mem::ManuallyDrop<PartitionControlHandle>,
902 tx_id: u32,
903}
904
905impl std::ops::Drop for PartitionGetInfoResponder {
909 fn drop(&mut self) {
910 self.control_handle.shutdown();
911 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
913 }
914}
915
916impl fidl::endpoints::Responder for PartitionGetInfoResponder {
917 type ControlHandle = PartitionControlHandle;
918
919 fn control_handle(&self) -> &PartitionControlHandle {
920 &self.control_handle
921 }
922
923 fn drop_without_shutdown(mut self) {
924 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
926 std::mem::forget(self);
928 }
929}
930
931impl PartitionGetInfoResponder {
932 pub fn send(
936 self,
937 mut result: Result<&fidl_fuchsia_hardware_block::BlockInfo, i32>,
938 ) -> Result<(), fidl::Error> {
939 let _result = self.send_raw(result);
940 if _result.is_err() {
941 self.control_handle.shutdown();
942 }
943 self.drop_without_shutdown();
944 _result
945 }
946
947 pub fn send_no_shutdown_on_err(
949 self,
950 mut result: Result<&fidl_fuchsia_hardware_block::BlockInfo, i32>,
951 ) -> Result<(), fidl::Error> {
952 let _result = self.send_raw(result);
953 self.drop_without_shutdown();
954 _result
955 }
956
957 fn send_raw(
958 &self,
959 mut result: Result<&fidl_fuchsia_hardware_block::BlockInfo, i32>,
960 ) -> Result<(), fidl::Error> {
961 self.control_handle.inner.send::<fidl::encoding::ResultType<
962 fidl_fuchsia_hardware_block::BlockGetInfoResponse,
963 i32,
964 >>(
965 result.map(|info| (info,)),
966 self.tx_id,
967 0x79df1a5cdb6cc6a3,
968 fidl::encoding::DynamicFlags::empty(),
969 )
970 }
971}
972
973#[must_use = "FIDL methods require a response to be sent"]
974#[derive(Debug)]
975pub struct PartitionGetTypeGuidResponder {
976 control_handle: std::mem::ManuallyDrop<PartitionControlHandle>,
977 tx_id: u32,
978}
979
980impl std::ops::Drop for PartitionGetTypeGuidResponder {
984 fn drop(&mut self) {
985 self.control_handle.shutdown();
986 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
988 }
989}
990
991impl fidl::endpoints::Responder for PartitionGetTypeGuidResponder {
992 type ControlHandle = PartitionControlHandle;
993
994 fn control_handle(&self) -> &PartitionControlHandle {
995 &self.control_handle
996 }
997
998 fn drop_without_shutdown(mut self) {
999 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1001 std::mem::forget(self);
1003 }
1004}
1005
1006impl PartitionGetTypeGuidResponder {
1007 pub fn send(self, mut status: i32, mut guid: Option<&Guid>) -> Result<(), fidl::Error> {
1011 let _result = self.send_raw(status, guid);
1012 if _result.is_err() {
1013 self.control_handle.shutdown();
1014 }
1015 self.drop_without_shutdown();
1016 _result
1017 }
1018
1019 pub fn send_no_shutdown_on_err(
1021 self,
1022 mut status: i32,
1023 mut guid: Option<&Guid>,
1024 ) -> Result<(), fidl::Error> {
1025 let _result = self.send_raw(status, guid);
1026 self.drop_without_shutdown();
1027 _result
1028 }
1029
1030 fn send_raw(&self, mut status: i32, mut guid: Option<&Guid>) -> Result<(), fidl::Error> {
1031 self.control_handle.inner.send::<PartitionGetTypeGuidResponse>(
1032 (status, guid),
1033 self.tx_id,
1034 0x111843d737a9b847,
1035 fidl::encoding::DynamicFlags::empty(),
1036 )
1037 }
1038}
1039
1040#[must_use = "FIDL methods require a response to be sent"]
1041#[derive(Debug)]
1042pub struct PartitionGetInstanceGuidResponder {
1043 control_handle: std::mem::ManuallyDrop<PartitionControlHandle>,
1044 tx_id: u32,
1045}
1046
1047impl std::ops::Drop for PartitionGetInstanceGuidResponder {
1051 fn drop(&mut self) {
1052 self.control_handle.shutdown();
1053 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1055 }
1056}
1057
1058impl fidl::endpoints::Responder for PartitionGetInstanceGuidResponder {
1059 type ControlHandle = PartitionControlHandle;
1060
1061 fn control_handle(&self) -> &PartitionControlHandle {
1062 &self.control_handle
1063 }
1064
1065 fn drop_without_shutdown(mut self) {
1066 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1068 std::mem::forget(self);
1070 }
1071}
1072
1073impl PartitionGetInstanceGuidResponder {
1074 pub fn send(self, mut status: i32, mut guid: Option<&Guid>) -> Result<(), fidl::Error> {
1078 let _result = self.send_raw(status, guid);
1079 if _result.is_err() {
1080 self.control_handle.shutdown();
1081 }
1082 self.drop_without_shutdown();
1083 _result
1084 }
1085
1086 pub fn send_no_shutdown_on_err(
1088 self,
1089 mut status: i32,
1090 mut guid: Option<&Guid>,
1091 ) -> Result<(), fidl::Error> {
1092 let _result = self.send_raw(status, guid);
1093 self.drop_without_shutdown();
1094 _result
1095 }
1096
1097 fn send_raw(&self, mut status: i32, mut guid: Option<&Guid>) -> Result<(), fidl::Error> {
1098 self.control_handle.inner.send::<PartitionGetInstanceGuidResponse>(
1099 (status, guid),
1100 self.tx_id,
1101 0x14a5a573b275d435,
1102 fidl::encoding::DynamicFlags::empty(),
1103 )
1104 }
1105}
1106
1107#[must_use = "FIDL methods require a response to be sent"]
1108#[derive(Debug)]
1109pub struct PartitionGetNameResponder {
1110 control_handle: std::mem::ManuallyDrop<PartitionControlHandle>,
1111 tx_id: u32,
1112}
1113
1114impl std::ops::Drop for PartitionGetNameResponder {
1118 fn drop(&mut self) {
1119 self.control_handle.shutdown();
1120 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1122 }
1123}
1124
1125impl fidl::endpoints::Responder for PartitionGetNameResponder {
1126 type ControlHandle = PartitionControlHandle;
1127
1128 fn control_handle(&self) -> &PartitionControlHandle {
1129 &self.control_handle
1130 }
1131
1132 fn drop_without_shutdown(mut self) {
1133 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1135 std::mem::forget(self);
1137 }
1138}
1139
1140impl PartitionGetNameResponder {
1141 pub fn send(self, mut status: i32, mut name: Option<&str>) -> Result<(), fidl::Error> {
1145 let _result = self.send_raw(status, name);
1146 if _result.is_err() {
1147 self.control_handle.shutdown();
1148 }
1149 self.drop_without_shutdown();
1150 _result
1151 }
1152
1153 pub fn send_no_shutdown_on_err(
1155 self,
1156 mut status: i32,
1157 mut name: Option<&str>,
1158 ) -> Result<(), fidl::Error> {
1159 let _result = self.send_raw(status, name);
1160 self.drop_without_shutdown();
1161 _result
1162 }
1163
1164 fn send_raw(&self, mut status: i32, mut name: Option<&str>) -> Result<(), fidl::Error> {
1165 self.control_handle.inner.send::<PartitionGetNameResponse>(
1166 (status, name),
1167 self.tx_id,
1168 0x7e3c6f0b0937fc02,
1169 fidl::encoding::DynamicFlags::empty(),
1170 )
1171 }
1172}
1173
1174#[must_use = "FIDL methods require a response to be sent"]
1175#[derive(Debug)]
1176pub struct PartitionGetMetadataResponder {
1177 control_handle: std::mem::ManuallyDrop<PartitionControlHandle>,
1178 tx_id: u32,
1179}
1180
1181impl std::ops::Drop for PartitionGetMetadataResponder {
1185 fn drop(&mut self) {
1186 self.control_handle.shutdown();
1187 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1189 }
1190}
1191
1192impl fidl::endpoints::Responder for PartitionGetMetadataResponder {
1193 type ControlHandle = PartitionControlHandle;
1194
1195 fn control_handle(&self) -> &PartitionControlHandle {
1196 &self.control_handle
1197 }
1198
1199 fn drop_without_shutdown(mut self) {
1200 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1202 std::mem::forget(self);
1204 }
1205}
1206
1207impl PartitionGetMetadataResponder {
1208 pub fn send(
1212 self,
1213 mut result: Result<&PartitionGetMetadataResponse, i32>,
1214 ) -> Result<(), fidl::Error> {
1215 let _result = self.send_raw(result);
1216 if _result.is_err() {
1217 self.control_handle.shutdown();
1218 }
1219 self.drop_without_shutdown();
1220 _result
1221 }
1222
1223 pub fn send_no_shutdown_on_err(
1225 self,
1226 mut result: Result<&PartitionGetMetadataResponse, i32>,
1227 ) -> Result<(), fidl::Error> {
1228 let _result = self.send_raw(result);
1229 self.drop_without_shutdown();
1230 _result
1231 }
1232
1233 fn send_raw(
1234 &self,
1235 mut result: Result<&PartitionGetMetadataResponse, i32>,
1236 ) -> Result<(), fidl::Error> {
1237 self.control_handle
1238 .inner
1239 .send::<fidl::encoding::ResultType<PartitionGetMetadataResponse, i32>>(
1240 result,
1241 self.tx_id,
1242 0x42d1464c96c3f3ff,
1243 fidl::encoding::DynamicFlags::empty(),
1244 )
1245 }
1246}
1247
1248mod internal {
1249 use super::*;
1250}