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 {
786 Some((responder))
787 } else {
788 None
789 }
790 }
791
792 #[allow(irrefutable_let_patterns)]
793 pub fn into_open_session(
794 self,
795 ) -> Option<(
796 fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_block::SessionMarker>,
797 PartitionControlHandle,
798 )> {
799 if let PartitionRequest::OpenSession { session, control_handle } = self {
800 Some((session, control_handle))
801 } else {
802 None
803 }
804 }
805
806 #[allow(irrefutable_let_patterns)]
807 pub fn into_open_session_with_offset_map(
808 self,
809 ) -> Option<(
810 fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_block::SessionMarker>,
811 fidl_fuchsia_hardware_block::BlockOffsetMapping,
812 PartitionControlHandle,
813 )> {
814 if let PartitionRequest::OpenSessionWithOffsetMap { session, mapping, control_handle } =
815 self
816 {
817 Some((session, mapping, control_handle))
818 } else {
819 None
820 }
821 }
822
823 #[allow(irrefutable_let_patterns)]
824 pub fn into_get_type_guid(self) -> Option<(PartitionGetTypeGuidResponder)> {
825 if let PartitionRequest::GetTypeGuid { responder } = self {
826 Some((responder))
827 } else {
828 None
829 }
830 }
831
832 #[allow(irrefutable_let_patterns)]
833 pub fn into_get_instance_guid(self) -> Option<(PartitionGetInstanceGuidResponder)> {
834 if let PartitionRequest::GetInstanceGuid { responder } = self {
835 Some((responder))
836 } else {
837 None
838 }
839 }
840
841 #[allow(irrefutable_let_patterns)]
842 pub fn into_get_name(self) -> Option<(PartitionGetNameResponder)> {
843 if let PartitionRequest::GetName { responder } = self {
844 Some((responder))
845 } else {
846 None
847 }
848 }
849
850 #[allow(irrefutable_let_patterns)]
851 pub fn into_get_metadata(self) -> Option<(PartitionGetMetadataResponder)> {
852 if let PartitionRequest::GetMetadata { responder } = self {
853 Some((responder))
854 } else {
855 None
856 }
857 }
858
859 pub fn method_name(&self) -> &'static str {
861 match *self {
862 PartitionRequest::GetInfo { .. } => "get_info",
863 PartitionRequest::OpenSession { .. } => "open_session",
864 PartitionRequest::OpenSessionWithOffsetMap { .. } => "open_session_with_offset_map",
865 PartitionRequest::GetTypeGuid { .. } => "get_type_guid",
866 PartitionRequest::GetInstanceGuid { .. } => "get_instance_guid",
867 PartitionRequest::GetName { .. } => "get_name",
868 PartitionRequest::GetMetadata { .. } => "get_metadata",
869 }
870 }
871}
872
873#[derive(Debug, Clone)]
874pub struct PartitionControlHandle {
875 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
876}
877
878impl fidl::endpoints::ControlHandle for PartitionControlHandle {
879 fn shutdown(&self) {
880 self.inner.shutdown()
881 }
882 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
883 self.inner.shutdown_with_epitaph(status)
884 }
885
886 fn is_closed(&self) -> bool {
887 self.inner.channel().is_closed()
888 }
889 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
890 self.inner.channel().on_closed()
891 }
892
893 #[cfg(target_os = "fuchsia")]
894 fn signal_peer(
895 &self,
896 clear_mask: zx::Signals,
897 set_mask: zx::Signals,
898 ) -> Result<(), zx_status::Status> {
899 use fidl::Peered;
900 self.inner.channel().signal_peer(clear_mask, set_mask)
901 }
902}
903
904impl PartitionControlHandle {}
905
906#[must_use = "FIDL methods require a response to be sent"]
907#[derive(Debug)]
908pub struct PartitionGetInfoResponder {
909 control_handle: std::mem::ManuallyDrop<PartitionControlHandle>,
910 tx_id: u32,
911}
912
913impl std::ops::Drop for PartitionGetInfoResponder {
917 fn drop(&mut self) {
918 self.control_handle.shutdown();
919 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
921 }
922}
923
924impl fidl::endpoints::Responder for PartitionGetInfoResponder {
925 type ControlHandle = PartitionControlHandle;
926
927 fn control_handle(&self) -> &PartitionControlHandle {
928 &self.control_handle
929 }
930
931 fn drop_without_shutdown(mut self) {
932 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
934 std::mem::forget(self);
936 }
937}
938
939impl PartitionGetInfoResponder {
940 pub fn send(
944 self,
945 mut result: Result<&fidl_fuchsia_hardware_block::BlockInfo, i32>,
946 ) -> Result<(), fidl::Error> {
947 let _result = self.send_raw(result);
948 if _result.is_err() {
949 self.control_handle.shutdown();
950 }
951 self.drop_without_shutdown();
952 _result
953 }
954
955 pub fn send_no_shutdown_on_err(
957 self,
958 mut result: Result<&fidl_fuchsia_hardware_block::BlockInfo, i32>,
959 ) -> Result<(), fidl::Error> {
960 let _result = self.send_raw(result);
961 self.drop_without_shutdown();
962 _result
963 }
964
965 fn send_raw(
966 &self,
967 mut result: Result<&fidl_fuchsia_hardware_block::BlockInfo, i32>,
968 ) -> Result<(), fidl::Error> {
969 self.control_handle.inner.send::<fidl::encoding::ResultType<
970 fidl_fuchsia_hardware_block::BlockGetInfoResponse,
971 i32,
972 >>(
973 result.map(|info| (info,)),
974 self.tx_id,
975 0x79df1a5cdb6cc6a3,
976 fidl::encoding::DynamicFlags::empty(),
977 )
978 }
979}
980
981#[must_use = "FIDL methods require a response to be sent"]
982#[derive(Debug)]
983pub struct PartitionGetTypeGuidResponder {
984 control_handle: std::mem::ManuallyDrop<PartitionControlHandle>,
985 tx_id: u32,
986}
987
988impl std::ops::Drop for PartitionGetTypeGuidResponder {
992 fn drop(&mut self) {
993 self.control_handle.shutdown();
994 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
996 }
997}
998
999impl fidl::endpoints::Responder for PartitionGetTypeGuidResponder {
1000 type ControlHandle = PartitionControlHandle;
1001
1002 fn control_handle(&self) -> &PartitionControlHandle {
1003 &self.control_handle
1004 }
1005
1006 fn drop_without_shutdown(mut self) {
1007 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1009 std::mem::forget(self);
1011 }
1012}
1013
1014impl PartitionGetTypeGuidResponder {
1015 pub fn send(self, mut status: i32, mut guid: Option<&Guid>) -> Result<(), fidl::Error> {
1019 let _result = self.send_raw(status, guid);
1020 if _result.is_err() {
1021 self.control_handle.shutdown();
1022 }
1023 self.drop_without_shutdown();
1024 _result
1025 }
1026
1027 pub fn send_no_shutdown_on_err(
1029 self,
1030 mut status: i32,
1031 mut guid: Option<&Guid>,
1032 ) -> Result<(), fidl::Error> {
1033 let _result = self.send_raw(status, guid);
1034 self.drop_without_shutdown();
1035 _result
1036 }
1037
1038 fn send_raw(&self, mut status: i32, mut guid: Option<&Guid>) -> Result<(), fidl::Error> {
1039 self.control_handle.inner.send::<PartitionGetTypeGuidResponse>(
1040 (status, guid),
1041 self.tx_id,
1042 0x111843d737a9b847,
1043 fidl::encoding::DynamicFlags::empty(),
1044 )
1045 }
1046}
1047
1048#[must_use = "FIDL methods require a response to be sent"]
1049#[derive(Debug)]
1050pub struct PartitionGetInstanceGuidResponder {
1051 control_handle: std::mem::ManuallyDrop<PartitionControlHandle>,
1052 tx_id: u32,
1053}
1054
1055impl std::ops::Drop for PartitionGetInstanceGuidResponder {
1059 fn drop(&mut self) {
1060 self.control_handle.shutdown();
1061 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1063 }
1064}
1065
1066impl fidl::endpoints::Responder for PartitionGetInstanceGuidResponder {
1067 type ControlHandle = PartitionControlHandle;
1068
1069 fn control_handle(&self) -> &PartitionControlHandle {
1070 &self.control_handle
1071 }
1072
1073 fn drop_without_shutdown(mut self) {
1074 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1076 std::mem::forget(self);
1078 }
1079}
1080
1081impl PartitionGetInstanceGuidResponder {
1082 pub fn send(self, mut status: i32, mut guid: Option<&Guid>) -> Result<(), fidl::Error> {
1086 let _result = self.send_raw(status, guid);
1087 if _result.is_err() {
1088 self.control_handle.shutdown();
1089 }
1090 self.drop_without_shutdown();
1091 _result
1092 }
1093
1094 pub fn send_no_shutdown_on_err(
1096 self,
1097 mut status: i32,
1098 mut guid: Option<&Guid>,
1099 ) -> Result<(), fidl::Error> {
1100 let _result = self.send_raw(status, guid);
1101 self.drop_without_shutdown();
1102 _result
1103 }
1104
1105 fn send_raw(&self, mut status: i32, mut guid: Option<&Guid>) -> Result<(), fidl::Error> {
1106 self.control_handle.inner.send::<PartitionGetInstanceGuidResponse>(
1107 (status, guid),
1108 self.tx_id,
1109 0x14a5a573b275d435,
1110 fidl::encoding::DynamicFlags::empty(),
1111 )
1112 }
1113}
1114
1115#[must_use = "FIDL methods require a response to be sent"]
1116#[derive(Debug)]
1117pub struct PartitionGetNameResponder {
1118 control_handle: std::mem::ManuallyDrop<PartitionControlHandle>,
1119 tx_id: u32,
1120}
1121
1122impl std::ops::Drop for PartitionGetNameResponder {
1126 fn drop(&mut self) {
1127 self.control_handle.shutdown();
1128 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1130 }
1131}
1132
1133impl fidl::endpoints::Responder for PartitionGetNameResponder {
1134 type ControlHandle = PartitionControlHandle;
1135
1136 fn control_handle(&self) -> &PartitionControlHandle {
1137 &self.control_handle
1138 }
1139
1140 fn drop_without_shutdown(mut self) {
1141 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1143 std::mem::forget(self);
1145 }
1146}
1147
1148impl PartitionGetNameResponder {
1149 pub fn send(self, mut status: i32, mut name: Option<&str>) -> Result<(), fidl::Error> {
1153 let _result = self.send_raw(status, name);
1154 if _result.is_err() {
1155 self.control_handle.shutdown();
1156 }
1157 self.drop_without_shutdown();
1158 _result
1159 }
1160
1161 pub fn send_no_shutdown_on_err(
1163 self,
1164 mut status: i32,
1165 mut name: Option<&str>,
1166 ) -> Result<(), fidl::Error> {
1167 let _result = self.send_raw(status, name);
1168 self.drop_without_shutdown();
1169 _result
1170 }
1171
1172 fn send_raw(&self, mut status: i32, mut name: Option<&str>) -> Result<(), fidl::Error> {
1173 self.control_handle.inner.send::<PartitionGetNameResponse>(
1174 (status, name),
1175 self.tx_id,
1176 0x7e3c6f0b0937fc02,
1177 fidl::encoding::DynamicFlags::empty(),
1178 )
1179 }
1180}
1181
1182#[must_use = "FIDL methods require a response to be sent"]
1183#[derive(Debug)]
1184pub struct PartitionGetMetadataResponder {
1185 control_handle: std::mem::ManuallyDrop<PartitionControlHandle>,
1186 tx_id: u32,
1187}
1188
1189impl std::ops::Drop for PartitionGetMetadataResponder {
1193 fn drop(&mut self) {
1194 self.control_handle.shutdown();
1195 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1197 }
1198}
1199
1200impl fidl::endpoints::Responder for PartitionGetMetadataResponder {
1201 type ControlHandle = PartitionControlHandle;
1202
1203 fn control_handle(&self) -> &PartitionControlHandle {
1204 &self.control_handle
1205 }
1206
1207 fn drop_without_shutdown(mut self) {
1208 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1210 std::mem::forget(self);
1212 }
1213}
1214
1215impl PartitionGetMetadataResponder {
1216 pub fn send(
1220 self,
1221 mut result: Result<&PartitionGetMetadataResponse, i32>,
1222 ) -> Result<(), fidl::Error> {
1223 let _result = self.send_raw(result);
1224 if _result.is_err() {
1225 self.control_handle.shutdown();
1226 }
1227 self.drop_without_shutdown();
1228 _result
1229 }
1230
1231 pub fn send_no_shutdown_on_err(
1233 self,
1234 mut result: Result<&PartitionGetMetadataResponse, i32>,
1235 ) -> Result<(), fidl::Error> {
1236 let _result = self.send_raw(result);
1237 self.drop_without_shutdown();
1238 _result
1239 }
1240
1241 fn send_raw(
1242 &self,
1243 mut result: Result<&PartitionGetMetadataResponse, i32>,
1244 ) -> Result<(), fidl::Error> {
1245 self.control_handle
1246 .inner
1247 .send::<fidl::encoding::ResultType<PartitionGetMetadataResponse, i32>>(
1248 result,
1249 self.tx_id,
1250 0x42d1464c96c3f3ff,
1251 fidl::encoding::DynamicFlags::empty(),
1252 )
1253 }
1254}
1255
1256mod internal {
1257 use super::*;
1258}