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_ramdisk__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct ControllerCreateResponse {
16 pub outgoing: fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
17 pub lifeline: fidl::EventPair,
18}
19
20impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ControllerCreateResponse {}
21
22#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
23pub struct RamdiskControllerCreateFromVmoRequest {
24 pub vmo: fidl::Vmo,
25}
26
27impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
28 for RamdiskControllerCreateFromVmoRequest
29{
30}
31
32#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
33pub struct RamdiskControllerCreateFromVmoWithParamsRequest {
34 pub vmo: fidl::Vmo,
35 pub block_size: u64,
36 pub type_guid: Option<Box<Guid>>,
37}
38
39impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
40 for RamdiskControllerCreateFromVmoWithParamsRequest
41{
42}
43
44#[derive(Debug, Default, PartialEq)]
47pub struct Options {
48 pub block_size: Option<u32>,
50 pub block_count: Option<u64>,
52 pub type_guid: Option<Guid>,
54 pub vmo: Option<fidl::Vmo>,
56 pub publish: Option<bool>,
58 pub max_transfer_blocks: Option<u32>,
60 pub device_flags: Option<fidl_fuchsia_storage_block::DeviceFlag>,
62 #[doc(hidden)]
63 pub __source_breaking: fidl::marker::SourceBreaking,
64}
65
66impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for Options {}
67
68#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
69pub struct ControllerMarker;
70
71impl fidl::endpoints::ProtocolMarker for ControllerMarker {
72 type Proxy = ControllerProxy;
73 type RequestStream = ControllerRequestStream;
74 #[cfg(target_os = "fuchsia")]
75 type SynchronousProxy = ControllerSynchronousProxy;
76
77 const DEBUG_NAME: &'static str = "(anonymous) Controller";
78}
79pub type ControllerCreateResult =
80 Result<(fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>, fidl::EventPair), i32>;
81
82pub trait ControllerProxyInterface: Send + Sync {
83 type CreateResponseFut: std::future::Future<Output = Result<ControllerCreateResult, fidl::Error>>
84 + Send;
85 fn r#create(&self, payload: Options) -> Self::CreateResponseFut;
86}
87#[derive(Debug)]
88#[cfg(target_os = "fuchsia")]
89pub struct ControllerSynchronousProxy {
90 client: fidl::client::sync::Client,
91}
92
93#[cfg(target_os = "fuchsia")]
94impl fidl::endpoints::SynchronousProxy for ControllerSynchronousProxy {
95 type Proxy = ControllerProxy;
96 type Protocol = ControllerMarker;
97
98 fn from_channel(inner: fidl::Channel) -> Self {
99 Self::new(inner)
100 }
101
102 fn into_channel(self) -> fidl::Channel {
103 self.client.into_channel()
104 }
105
106 fn as_channel(&self) -> &fidl::Channel {
107 self.client.as_channel()
108 }
109}
110
111#[cfg(target_os = "fuchsia")]
112impl ControllerSynchronousProxy {
113 pub fn new(channel: fidl::Channel) -> Self {
114 Self { client: fidl::client::sync::Client::new(channel) }
115 }
116
117 pub fn into_channel(self) -> fidl::Channel {
118 self.client.into_channel()
119 }
120
121 pub fn wait_for_event(
124 &self,
125 deadline: zx::MonotonicInstant,
126 ) -> Result<ControllerEvent, fidl::Error> {
127 ControllerEvent::decode(self.client.wait_for_event::<ControllerMarker>(deadline)?)
128 }
129
130 pub fn r#create(
134 &self,
135 mut payload: Options,
136 ___deadline: zx::MonotonicInstant,
137 ) -> Result<ControllerCreateResult, fidl::Error> {
138 let _response = self.client.send_query::<
139 Options,
140 fidl::encoding::ResultType<ControllerCreateResponse, i32>,
141 ControllerMarker,
142 >(
143 &mut payload,
144 0x70c20e8a741fecb8,
145 fidl::encoding::DynamicFlags::empty(),
146 ___deadline,
147 )?;
148 Ok(_response.map(|x| (x.outgoing, x.lifeline)))
149 }
150}
151
152#[cfg(target_os = "fuchsia")]
153impl From<ControllerSynchronousProxy> for zx::NullableHandle {
154 fn from(value: ControllerSynchronousProxy) -> Self {
155 value.into_channel().into()
156 }
157}
158
159#[cfg(target_os = "fuchsia")]
160impl From<fidl::Channel> for ControllerSynchronousProxy {
161 fn from(value: fidl::Channel) -> Self {
162 Self::new(value)
163 }
164}
165
166#[cfg(target_os = "fuchsia")]
167impl fidl::endpoints::FromClient for ControllerSynchronousProxy {
168 type Protocol = ControllerMarker;
169
170 fn from_client(value: fidl::endpoints::ClientEnd<ControllerMarker>) -> Self {
171 Self::new(value.into_channel())
172 }
173}
174
175#[derive(Debug, Clone)]
176pub struct ControllerProxy {
177 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
178}
179
180impl fidl::endpoints::Proxy for ControllerProxy {
181 type Protocol = ControllerMarker;
182
183 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
184 Self::new(inner)
185 }
186
187 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
188 self.client.into_channel().map_err(|client| Self { client })
189 }
190
191 fn as_channel(&self) -> &::fidl::AsyncChannel {
192 self.client.as_channel()
193 }
194}
195
196impl ControllerProxy {
197 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
199 let protocol_name = <ControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
200 Self { client: fidl::client::Client::new(channel, protocol_name) }
201 }
202
203 pub fn take_event_stream(&self) -> ControllerEventStream {
209 ControllerEventStream { event_receiver: self.client.take_event_receiver() }
210 }
211
212 pub fn r#create(
216 &self,
217 mut payload: Options,
218 ) -> fidl::client::QueryResponseFut<
219 ControllerCreateResult,
220 fidl::encoding::DefaultFuchsiaResourceDialect,
221 > {
222 ControllerProxyInterface::r#create(self, payload)
223 }
224}
225
226impl ControllerProxyInterface for ControllerProxy {
227 type CreateResponseFut = fidl::client::QueryResponseFut<
228 ControllerCreateResult,
229 fidl::encoding::DefaultFuchsiaResourceDialect,
230 >;
231 fn r#create(&self, mut payload: Options) -> Self::CreateResponseFut {
232 fn _decode(
233 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
234 ) -> Result<ControllerCreateResult, fidl::Error> {
235 let _response = fidl::client::decode_transaction_body::<
236 fidl::encoding::ResultType<ControllerCreateResponse, i32>,
237 fidl::encoding::DefaultFuchsiaResourceDialect,
238 0x70c20e8a741fecb8,
239 >(_buf?)?;
240 Ok(_response.map(|x| (x.outgoing, x.lifeline)))
241 }
242 self.client.send_query_and_decode::<Options, ControllerCreateResult>(
243 &mut payload,
244 0x70c20e8a741fecb8,
245 fidl::encoding::DynamicFlags::empty(),
246 _decode,
247 )
248 }
249}
250
251pub struct ControllerEventStream {
252 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
253}
254
255impl std::marker::Unpin for ControllerEventStream {}
256
257impl futures::stream::FusedStream for ControllerEventStream {
258 fn is_terminated(&self) -> bool {
259 self.event_receiver.is_terminated()
260 }
261}
262
263impl futures::Stream for ControllerEventStream {
264 type Item = Result<ControllerEvent, fidl::Error>;
265
266 fn poll_next(
267 mut self: std::pin::Pin<&mut Self>,
268 cx: &mut std::task::Context<'_>,
269 ) -> std::task::Poll<Option<Self::Item>> {
270 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
271 &mut self.event_receiver,
272 cx
273 )?) {
274 Some(buf) => std::task::Poll::Ready(Some(ControllerEvent::decode(buf))),
275 None => std::task::Poll::Ready(None),
276 }
277 }
278}
279
280#[derive(Debug)]
281pub enum ControllerEvent {
282 #[non_exhaustive]
283 _UnknownEvent {
284 ordinal: u64,
286 },
287}
288
289impl ControllerEvent {
290 fn decode(
292 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
293 ) -> Result<ControllerEvent, fidl::Error> {
294 let (bytes, _handles) = buf.split_mut();
295 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
296 debug_assert_eq!(tx_header.tx_id, 0);
297 match tx_header.ordinal {
298 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
299 Ok(ControllerEvent::_UnknownEvent { ordinal: tx_header.ordinal })
300 }
301 _ => Err(fidl::Error::UnknownOrdinal {
302 ordinal: tx_header.ordinal,
303 protocol_name: <ControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
304 }),
305 }
306 }
307}
308
309pub struct ControllerRequestStream {
311 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
312 is_terminated: bool,
313}
314
315impl std::marker::Unpin for ControllerRequestStream {}
316
317impl futures::stream::FusedStream for ControllerRequestStream {
318 fn is_terminated(&self) -> bool {
319 self.is_terminated
320 }
321}
322
323impl fidl::endpoints::RequestStream for ControllerRequestStream {
324 type Protocol = ControllerMarker;
325 type ControlHandle = ControllerControlHandle;
326
327 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
328 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
329 }
330
331 fn control_handle(&self) -> Self::ControlHandle {
332 ControllerControlHandle { inner: self.inner.clone() }
333 }
334
335 fn into_inner(
336 self,
337 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
338 {
339 (self.inner, self.is_terminated)
340 }
341
342 fn from_inner(
343 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
344 is_terminated: bool,
345 ) -> Self {
346 Self { inner, is_terminated }
347 }
348}
349
350impl futures::Stream for ControllerRequestStream {
351 type Item = Result<ControllerRequest, fidl::Error>;
352
353 fn poll_next(
354 mut self: std::pin::Pin<&mut Self>,
355 cx: &mut std::task::Context<'_>,
356 ) -> std::task::Poll<Option<Self::Item>> {
357 let this = &mut *self;
358 if this.inner.check_shutdown(cx) {
359 this.is_terminated = true;
360 return std::task::Poll::Ready(None);
361 }
362 if this.is_terminated {
363 panic!("polled ControllerRequestStream after completion");
364 }
365 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
366 |bytes, handles| {
367 match this.inner.channel().read_etc(cx, bytes, handles) {
368 std::task::Poll::Ready(Ok(())) => {}
369 std::task::Poll::Pending => return std::task::Poll::Pending,
370 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
371 this.is_terminated = true;
372 return std::task::Poll::Ready(None);
373 }
374 std::task::Poll::Ready(Err(e)) => {
375 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
376 e.into(),
377 ))));
378 }
379 }
380
381 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
383
384 std::task::Poll::Ready(Some(match header.ordinal {
385 0x70c20e8a741fecb8 => {
386 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
387 let mut req = fidl::new_empty!(
388 Options,
389 fidl::encoding::DefaultFuchsiaResourceDialect
390 );
391 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Options>(&header, _body_bytes, handles, &mut req)?;
392 let control_handle = ControllerControlHandle { inner: this.inner.clone() };
393 Ok(ControllerRequest::Create {
394 payload: req,
395 responder: ControllerCreateResponder {
396 control_handle: std::mem::ManuallyDrop::new(control_handle),
397 tx_id: header.tx_id,
398 },
399 })
400 }
401 _ if header.tx_id == 0
402 && header
403 .dynamic_flags()
404 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
405 {
406 Ok(ControllerRequest::_UnknownMethod {
407 ordinal: header.ordinal,
408 control_handle: ControllerControlHandle { inner: this.inner.clone() },
409 method_type: fidl::MethodType::OneWay,
410 })
411 }
412 _ if header
413 .dynamic_flags()
414 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
415 {
416 this.inner.send_framework_err(
417 fidl::encoding::FrameworkErr::UnknownMethod,
418 header.tx_id,
419 header.ordinal,
420 header.dynamic_flags(),
421 (bytes, handles),
422 )?;
423 Ok(ControllerRequest::_UnknownMethod {
424 ordinal: header.ordinal,
425 control_handle: ControllerControlHandle { inner: this.inner.clone() },
426 method_type: fidl::MethodType::TwoWay,
427 })
428 }
429 _ => Err(fidl::Error::UnknownOrdinal {
430 ordinal: header.ordinal,
431 protocol_name:
432 <ControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
433 }),
434 }))
435 },
436 )
437 }
438}
439
440#[derive(Debug)]
441pub enum ControllerRequest {
442 Create { payload: Options, responder: ControllerCreateResponder },
446 #[non_exhaustive]
448 _UnknownMethod {
449 ordinal: u64,
451 control_handle: ControllerControlHandle,
452 method_type: fidl::MethodType,
453 },
454}
455
456impl ControllerRequest {
457 #[allow(irrefutable_let_patterns)]
458 pub fn into_create(self) -> Option<(Options, ControllerCreateResponder)> {
459 if let ControllerRequest::Create { payload, responder } = self {
460 Some((payload, responder))
461 } else {
462 None
463 }
464 }
465
466 pub fn method_name(&self) -> &'static str {
468 match *self {
469 ControllerRequest::Create { .. } => "create",
470 ControllerRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
471 "unknown one-way method"
472 }
473 ControllerRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
474 "unknown two-way method"
475 }
476 }
477 }
478}
479
480#[derive(Debug, Clone)]
481pub struct ControllerControlHandle {
482 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
483}
484
485impl fidl::endpoints::ControlHandle for ControllerControlHandle {
486 fn shutdown(&self) {
487 self.inner.shutdown()
488 }
489
490 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
491 self.inner.shutdown_with_epitaph(status)
492 }
493
494 fn is_closed(&self) -> bool {
495 self.inner.channel().is_closed()
496 }
497 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
498 self.inner.channel().on_closed()
499 }
500
501 #[cfg(target_os = "fuchsia")]
502 fn signal_peer(
503 &self,
504 clear_mask: zx::Signals,
505 set_mask: zx::Signals,
506 ) -> Result<(), zx_status::Status> {
507 use fidl::Peered;
508 self.inner.channel().signal_peer(clear_mask, set_mask)
509 }
510}
511
512impl ControllerControlHandle {}
513
514#[must_use = "FIDL methods require a response to be sent"]
515#[derive(Debug)]
516pub struct ControllerCreateResponder {
517 control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
518 tx_id: u32,
519}
520
521impl std::ops::Drop for ControllerCreateResponder {
525 fn drop(&mut self) {
526 self.control_handle.shutdown();
527 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
529 }
530}
531
532impl fidl::endpoints::Responder for ControllerCreateResponder {
533 type ControlHandle = ControllerControlHandle;
534
535 fn control_handle(&self) -> &ControllerControlHandle {
536 &self.control_handle
537 }
538
539 fn drop_without_shutdown(mut self) {
540 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
542 std::mem::forget(self);
544 }
545}
546
547impl ControllerCreateResponder {
548 pub fn send(
552 self,
553 mut result: Result<
554 (fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>, fidl::EventPair),
555 i32,
556 >,
557 ) -> Result<(), fidl::Error> {
558 let _result = self.send_raw(result);
559 if _result.is_err() {
560 self.control_handle.shutdown();
561 }
562 self.drop_without_shutdown();
563 _result
564 }
565
566 pub fn send_no_shutdown_on_err(
568 self,
569 mut result: Result<
570 (fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>, fidl::EventPair),
571 i32,
572 >,
573 ) -> Result<(), fidl::Error> {
574 let _result = self.send_raw(result);
575 self.drop_without_shutdown();
576 _result
577 }
578
579 fn send_raw(
580 &self,
581 mut result: Result<
582 (fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>, fidl::EventPair),
583 i32,
584 >,
585 ) -> Result<(), fidl::Error> {
586 self.control_handle.inner.send::<fidl::encoding::ResultType<ControllerCreateResponse, i32>>(
587 result,
588 self.tx_id,
589 0x70c20e8a741fecb8,
590 fidl::encoding::DynamicFlags::empty(),
591 )
592 }
593}
594
595#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
596pub struct RamdiskMarker;
597
598impl fidl::endpoints::ProtocolMarker for RamdiskMarker {
599 type Proxy = RamdiskProxy;
600 type RequestStream = RamdiskRequestStream;
601 #[cfg(target_os = "fuchsia")]
602 type SynchronousProxy = RamdiskSynchronousProxy;
603
604 const DEBUG_NAME: &'static str = "fuchsia.hardware.ramdisk.Ramdisk";
605}
606impl fidl::endpoints::DiscoverableProtocolMarker for RamdiskMarker {}
607
608pub trait RamdiskProxyInterface: Send + Sync {
609 type SetFlagsResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
610 fn r#set_flags(&self, flags: RamdiskFlag) -> Self::SetFlagsResponseFut;
611 type WakeResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
612 fn r#wake(&self) -> Self::WakeResponseFut;
613 type SleepAfterResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
614 fn r#sleep_after(&self, count: u64) -> Self::SleepAfterResponseFut;
615 type GetBlockCountsResponseFut: std::future::Future<Output = Result<BlockWriteCounts, fidl::Error>>
616 + Send;
617 fn r#get_block_counts(&self) -> Self::GetBlockCountsResponseFut;
618}
619#[derive(Debug)]
620#[cfg(target_os = "fuchsia")]
621pub struct RamdiskSynchronousProxy {
622 client: fidl::client::sync::Client,
623}
624
625#[cfg(target_os = "fuchsia")]
626impl fidl::endpoints::SynchronousProxy for RamdiskSynchronousProxy {
627 type Proxy = RamdiskProxy;
628 type Protocol = RamdiskMarker;
629
630 fn from_channel(inner: fidl::Channel) -> Self {
631 Self::new(inner)
632 }
633
634 fn into_channel(self) -> fidl::Channel {
635 self.client.into_channel()
636 }
637
638 fn as_channel(&self) -> &fidl::Channel {
639 self.client.as_channel()
640 }
641}
642
643#[cfg(target_os = "fuchsia")]
644impl RamdiskSynchronousProxy {
645 pub fn new(channel: fidl::Channel) -> Self {
646 Self { client: fidl::client::sync::Client::new(channel) }
647 }
648
649 pub fn into_channel(self) -> fidl::Channel {
650 self.client.into_channel()
651 }
652
653 pub fn wait_for_event(
656 &self,
657 deadline: zx::MonotonicInstant,
658 ) -> Result<RamdiskEvent, fidl::Error> {
659 RamdiskEvent::decode(self.client.wait_for_event::<RamdiskMarker>(deadline)?)
660 }
661
662 pub fn r#set_flags(
664 &self,
665 mut flags: RamdiskFlag,
666 ___deadline: zx::MonotonicInstant,
667 ) -> Result<(), fidl::Error> {
668 let _response = self
669 .client
670 .send_query::<RamdiskSetFlagsRequest, fidl::encoding::EmptyPayload, RamdiskMarker>(
671 (flags,),
672 0x1ac23f463dc2c8de,
673 fidl::encoding::DynamicFlags::empty(),
674 ___deadline,
675 )?;
676 Ok(_response)
677 }
678
679 pub fn r#wake(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
683 let _response = self.client.send_query::<
684 fidl::encoding::EmptyPayload,
685 fidl::encoding::EmptyPayload,
686 RamdiskMarker,
687 >(
688 (),
689 0x1b2142ad9617bde4,
690 fidl::encoding::DynamicFlags::empty(),
691 ___deadline,
692 )?;
693 Ok(_response)
694 }
695
696 pub fn r#sleep_after(
702 &self,
703 mut count: u64,
704 ___deadline: zx::MonotonicInstant,
705 ) -> Result<(), fidl::Error> {
706 let _response = self
707 .client
708 .send_query::<RamdiskSleepAfterRequest, fidl::encoding::EmptyPayload, RamdiskMarker>(
709 (count,),
710 0x38cafa087fbc1195,
711 fidl::encoding::DynamicFlags::empty(),
712 ___deadline,
713 )?;
714 Ok(_response)
715 }
716
717 pub fn r#get_block_counts(
720 &self,
721 ___deadline: zx::MonotonicInstant,
722 ) -> Result<BlockWriteCounts, fidl::Error> {
723 let _response = self.client.send_query::<
724 fidl::encoding::EmptyPayload,
725 RamdiskGetBlockCountsResponse,
726 RamdiskMarker,
727 >(
728 (),
729 0x346b0058ac937682,
730 fidl::encoding::DynamicFlags::empty(),
731 ___deadline,
732 )?;
733 Ok(_response.counts)
734 }
735}
736
737#[cfg(target_os = "fuchsia")]
738impl From<RamdiskSynchronousProxy> for zx::NullableHandle {
739 fn from(value: RamdiskSynchronousProxy) -> Self {
740 value.into_channel().into()
741 }
742}
743
744#[cfg(target_os = "fuchsia")]
745impl From<fidl::Channel> for RamdiskSynchronousProxy {
746 fn from(value: fidl::Channel) -> Self {
747 Self::new(value)
748 }
749}
750
751#[cfg(target_os = "fuchsia")]
752impl fidl::endpoints::FromClient for RamdiskSynchronousProxy {
753 type Protocol = RamdiskMarker;
754
755 fn from_client(value: fidl::endpoints::ClientEnd<RamdiskMarker>) -> Self {
756 Self::new(value.into_channel())
757 }
758}
759
760#[derive(Debug, Clone)]
761pub struct RamdiskProxy {
762 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
763}
764
765impl fidl::endpoints::Proxy for RamdiskProxy {
766 type Protocol = RamdiskMarker;
767
768 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
769 Self::new(inner)
770 }
771
772 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
773 self.client.into_channel().map_err(|client| Self { client })
774 }
775
776 fn as_channel(&self) -> &::fidl::AsyncChannel {
777 self.client.as_channel()
778 }
779}
780
781impl RamdiskProxy {
782 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
784 let protocol_name = <RamdiskMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
785 Self { client: fidl::client::Client::new(channel, protocol_name) }
786 }
787
788 pub fn take_event_stream(&self) -> RamdiskEventStream {
794 RamdiskEventStream { event_receiver: self.client.take_event_receiver() }
795 }
796
797 pub fn r#set_flags(
799 &self,
800 mut flags: RamdiskFlag,
801 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
802 RamdiskProxyInterface::r#set_flags(self, flags)
803 }
804
805 pub fn r#wake(
809 &self,
810 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
811 RamdiskProxyInterface::r#wake(self)
812 }
813
814 pub fn r#sleep_after(
820 &self,
821 mut count: u64,
822 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
823 RamdiskProxyInterface::r#sleep_after(self, count)
824 }
825
826 pub fn r#get_block_counts(
829 &self,
830 ) -> fidl::client::QueryResponseFut<
831 BlockWriteCounts,
832 fidl::encoding::DefaultFuchsiaResourceDialect,
833 > {
834 RamdiskProxyInterface::r#get_block_counts(self)
835 }
836}
837
838impl RamdiskProxyInterface for RamdiskProxy {
839 type SetFlagsResponseFut =
840 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
841 fn r#set_flags(&self, mut flags: RamdiskFlag) -> Self::SetFlagsResponseFut {
842 fn _decode(
843 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
844 ) -> Result<(), fidl::Error> {
845 let _response = fidl::client::decode_transaction_body::<
846 fidl::encoding::EmptyPayload,
847 fidl::encoding::DefaultFuchsiaResourceDialect,
848 0x1ac23f463dc2c8de,
849 >(_buf?)?;
850 Ok(_response)
851 }
852 self.client.send_query_and_decode::<RamdiskSetFlagsRequest, ()>(
853 (flags,),
854 0x1ac23f463dc2c8de,
855 fidl::encoding::DynamicFlags::empty(),
856 _decode,
857 )
858 }
859
860 type WakeResponseFut =
861 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
862 fn r#wake(&self) -> Self::WakeResponseFut {
863 fn _decode(
864 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
865 ) -> Result<(), fidl::Error> {
866 let _response = fidl::client::decode_transaction_body::<
867 fidl::encoding::EmptyPayload,
868 fidl::encoding::DefaultFuchsiaResourceDialect,
869 0x1b2142ad9617bde4,
870 >(_buf?)?;
871 Ok(_response)
872 }
873 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
874 (),
875 0x1b2142ad9617bde4,
876 fidl::encoding::DynamicFlags::empty(),
877 _decode,
878 )
879 }
880
881 type SleepAfterResponseFut =
882 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
883 fn r#sleep_after(&self, mut count: u64) -> Self::SleepAfterResponseFut {
884 fn _decode(
885 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
886 ) -> Result<(), fidl::Error> {
887 let _response = fidl::client::decode_transaction_body::<
888 fidl::encoding::EmptyPayload,
889 fidl::encoding::DefaultFuchsiaResourceDialect,
890 0x38cafa087fbc1195,
891 >(_buf?)?;
892 Ok(_response)
893 }
894 self.client.send_query_and_decode::<RamdiskSleepAfterRequest, ()>(
895 (count,),
896 0x38cafa087fbc1195,
897 fidl::encoding::DynamicFlags::empty(),
898 _decode,
899 )
900 }
901
902 type GetBlockCountsResponseFut = fidl::client::QueryResponseFut<
903 BlockWriteCounts,
904 fidl::encoding::DefaultFuchsiaResourceDialect,
905 >;
906 fn r#get_block_counts(&self) -> Self::GetBlockCountsResponseFut {
907 fn _decode(
908 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
909 ) -> Result<BlockWriteCounts, fidl::Error> {
910 let _response = fidl::client::decode_transaction_body::<
911 RamdiskGetBlockCountsResponse,
912 fidl::encoding::DefaultFuchsiaResourceDialect,
913 0x346b0058ac937682,
914 >(_buf?)?;
915 Ok(_response.counts)
916 }
917 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, BlockWriteCounts>(
918 (),
919 0x346b0058ac937682,
920 fidl::encoding::DynamicFlags::empty(),
921 _decode,
922 )
923 }
924}
925
926pub struct RamdiskEventStream {
927 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
928}
929
930impl std::marker::Unpin for RamdiskEventStream {}
931
932impl futures::stream::FusedStream for RamdiskEventStream {
933 fn is_terminated(&self) -> bool {
934 self.event_receiver.is_terminated()
935 }
936}
937
938impl futures::Stream for RamdiskEventStream {
939 type Item = Result<RamdiskEvent, fidl::Error>;
940
941 fn poll_next(
942 mut self: std::pin::Pin<&mut Self>,
943 cx: &mut std::task::Context<'_>,
944 ) -> std::task::Poll<Option<Self::Item>> {
945 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
946 &mut self.event_receiver,
947 cx
948 )?) {
949 Some(buf) => std::task::Poll::Ready(Some(RamdiskEvent::decode(buf))),
950 None => std::task::Poll::Ready(None),
951 }
952 }
953}
954
955#[derive(Debug)]
956pub enum RamdiskEvent {}
957
958impl RamdiskEvent {
959 fn decode(
961 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
962 ) -> Result<RamdiskEvent, fidl::Error> {
963 let (bytes, _handles) = buf.split_mut();
964 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
965 debug_assert_eq!(tx_header.tx_id, 0);
966 match tx_header.ordinal {
967 _ => Err(fidl::Error::UnknownOrdinal {
968 ordinal: tx_header.ordinal,
969 protocol_name: <RamdiskMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
970 }),
971 }
972 }
973}
974
975pub struct RamdiskRequestStream {
977 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
978 is_terminated: bool,
979}
980
981impl std::marker::Unpin for RamdiskRequestStream {}
982
983impl futures::stream::FusedStream for RamdiskRequestStream {
984 fn is_terminated(&self) -> bool {
985 self.is_terminated
986 }
987}
988
989impl fidl::endpoints::RequestStream for RamdiskRequestStream {
990 type Protocol = RamdiskMarker;
991 type ControlHandle = RamdiskControlHandle;
992
993 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
994 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
995 }
996
997 fn control_handle(&self) -> Self::ControlHandle {
998 RamdiskControlHandle { inner: self.inner.clone() }
999 }
1000
1001 fn into_inner(
1002 self,
1003 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1004 {
1005 (self.inner, self.is_terminated)
1006 }
1007
1008 fn from_inner(
1009 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1010 is_terminated: bool,
1011 ) -> Self {
1012 Self { inner, is_terminated }
1013 }
1014}
1015
1016impl futures::Stream for RamdiskRequestStream {
1017 type Item = Result<RamdiskRequest, fidl::Error>;
1018
1019 fn poll_next(
1020 mut self: std::pin::Pin<&mut Self>,
1021 cx: &mut std::task::Context<'_>,
1022 ) -> std::task::Poll<Option<Self::Item>> {
1023 let this = &mut *self;
1024 if this.inner.check_shutdown(cx) {
1025 this.is_terminated = true;
1026 return std::task::Poll::Ready(None);
1027 }
1028 if this.is_terminated {
1029 panic!("polled RamdiskRequestStream after completion");
1030 }
1031 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1032 |bytes, handles| {
1033 match this.inner.channel().read_etc(cx, bytes, handles) {
1034 std::task::Poll::Ready(Ok(())) => {}
1035 std::task::Poll::Pending => return std::task::Poll::Pending,
1036 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1037 this.is_terminated = true;
1038 return std::task::Poll::Ready(None);
1039 }
1040 std::task::Poll::Ready(Err(e)) => {
1041 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1042 e.into(),
1043 ))));
1044 }
1045 }
1046
1047 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1049
1050 std::task::Poll::Ready(Some(match header.ordinal {
1051 0x1ac23f463dc2c8de => {
1052 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1053 let mut req = fidl::new_empty!(
1054 RamdiskSetFlagsRequest,
1055 fidl::encoding::DefaultFuchsiaResourceDialect
1056 );
1057 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RamdiskSetFlagsRequest>(&header, _body_bytes, handles, &mut req)?;
1058 let control_handle = RamdiskControlHandle { inner: this.inner.clone() };
1059 Ok(RamdiskRequest::SetFlags {
1060 flags: req.flags,
1061
1062 responder: RamdiskSetFlagsResponder {
1063 control_handle: std::mem::ManuallyDrop::new(control_handle),
1064 tx_id: header.tx_id,
1065 },
1066 })
1067 }
1068 0x1b2142ad9617bde4 => {
1069 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1070 let mut req = fidl::new_empty!(
1071 fidl::encoding::EmptyPayload,
1072 fidl::encoding::DefaultFuchsiaResourceDialect
1073 );
1074 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1075 let control_handle = RamdiskControlHandle { inner: this.inner.clone() };
1076 Ok(RamdiskRequest::Wake {
1077 responder: RamdiskWakeResponder {
1078 control_handle: std::mem::ManuallyDrop::new(control_handle),
1079 tx_id: header.tx_id,
1080 },
1081 })
1082 }
1083 0x38cafa087fbc1195 => {
1084 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1085 let mut req = fidl::new_empty!(
1086 RamdiskSleepAfterRequest,
1087 fidl::encoding::DefaultFuchsiaResourceDialect
1088 );
1089 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RamdiskSleepAfterRequest>(&header, _body_bytes, handles, &mut req)?;
1090 let control_handle = RamdiskControlHandle { inner: this.inner.clone() };
1091 Ok(RamdiskRequest::SleepAfter {
1092 count: req.count,
1093
1094 responder: RamdiskSleepAfterResponder {
1095 control_handle: std::mem::ManuallyDrop::new(control_handle),
1096 tx_id: header.tx_id,
1097 },
1098 })
1099 }
1100 0x346b0058ac937682 => {
1101 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1102 let mut req = fidl::new_empty!(
1103 fidl::encoding::EmptyPayload,
1104 fidl::encoding::DefaultFuchsiaResourceDialect
1105 );
1106 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1107 let control_handle = RamdiskControlHandle { inner: this.inner.clone() };
1108 Ok(RamdiskRequest::GetBlockCounts {
1109 responder: RamdiskGetBlockCountsResponder {
1110 control_handle: std::mem::ManuallyDrop::new(control_handle),
1111 tx_id: header.tx_id,
1112 },
1113 })
1114 }
1115 _ => Err(fidl::Error::UnknownOrdinal {
1116 ordinal: header.ordinal,
1117 protocol_name:
1118 <RamdiskMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1119 }),
1120 }))
1121 },
1122 )
1123 }
1124}
1125
1126#[derive(Debug)]
1128pub enum RamdiskRequest {
1129 SetFlags { flags: RamdiskFlag, responder: RamdiskSetFlagsResponder },
1131 Wake { responder: RamdiskWakeResponder },
1135 SleepAfter { count: u64, responder: RamdiskSleepAfterResponder },
1141 GetBlockCounts { responder: RamdiskGetBlockCountsResponder },
1144}
1145
1146impl RamdiskRequest {
1147 #[allow(irrefutable_let_patterns)]
1148 pub fn into_set_flags(self) -> Option<(RamdiskFlag, RamdiskSetFlagsResponder)> {
1149 if let RamdiskRequest::SetFlags { flags, responder } = self {
1150 Some((flags, responder))
1151 } else {
1152 None
1153 }
1154 }
1155
1156 #[allow(irrefutable_let_patterns)]
1157 pub fn into_wake(self) -> Option<(RamdiskWakeResponder)> {
1158 if let RamdiskRequest::Wake { responder } = self { Some((responder)) } else { None }
1159 }
1160
1161 #[allow(irrefutable_let_patterns)]
1162 pub fn into_sleep_after(self) -> Option<(u64, RamdiskSleepAfterResponder)> {
1163 if let RamdiskRequest::SleepAfter { count, responder } = self {
1164 Some((count, responder))
1165 } else {
1166 None
1167 }
1168 }
1169
1170 #[allow(irrefutable_let_patterns)]
1171 pub fn into_get_block_counts(self) -> Option<(RamdiskGetBlockCountsResponder)> {
1172 if let RamdiskRequest::GetBlockCounts { responder } = self {
1173 Some((responder))
1174 } else {
1175 None
1176 }
1177 }
1178
1179 pub fn method_name(&self) -> &'static str {
1181 match *self {
1182 RamdiskRequest::SetFlags { .. } => "set_flags",
1183 RamdiskRequest::Wake { .. } => "wake",
1184 RamdiskRequest::SleepAfter { .. } => "sleep_after",
1185 RamdiskRequest::GetBlockCounts { .. } => "get_block_counts",
1186 }
1187 }
1188}
1189
1190#[derive(Debug, Clone)]
1191pub struct RamdiskControlHandle {
1192 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1193}
1194
1195impl fidl::endpoints::ControlHandle for RamdiskControlHandle {
1196 fn shutdown(&self) {
1197 self.inner.shutdown()
1198 }
1199
1200 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1201 self.inner.shutdown_with_epitaph(status)
1202 }
1203
1204 fn is_closed(&self) -> bool {
1205 self.inner.channel().is_closed()
1206 }
1207 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1208 self.inner.channel().on_closed()
1209 }
1210
1211 #[cfg(target_os = "fuchsia")]
1212 fn signal_peer(
1213 &self,
1214 clear_mask: zx::Signals,
1215 set_mask: zx::Signals,
1216 ) -> Result<(), zx_status::Status> {
1217 use fidl::Peered;
1218 self.inner.channel().signal_peer(clear_mask, set_mask)
1219 }
1220}
1221
1222impl RamdiskControlHandle {}
1223
1224#[must_use = "FIDL methods require a response to be sent"]
1225#[derive(Debug)]
1226pub struct RamdiskSetFlagsResponder {
1227 control_handle: std::mem::ManuallyDrop<RamdiskControlHandle>,
1228 tx_id: u32,
1229}
1230
1231impl std::ops::Drop for RamdiskSetFlagsResponder {
1235 fn drop(&mut self) {
1236 self.control_handle.shutdown();
1237 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1239 }
1240}
1241
1242impl fidl::endpoints::Responder for RamdiskSetFlagsResponder {
1243 type ControlHandle = RamdiskControlHandle;
1244
1245 fn control_handle(&self) -> &RamdiskControlHandle {
1246 &self.control_handle
1247 }
1248
1249 fn drop_without_shutdown(mut self) {
1250 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1252 std::mem::forget(self);
1254 }
1255}
1256
1257impl RamdiskSetFlagsResponder {
1258 pub fn send(self) -> Result<(), fidl::Error> {
1262 let _result = self.send_raw();
1263 if _result.is_err() {
1264 self.control_handle.shutdown();
1265 }
1266 self.drop_without_shutdown();
1267 _result
1268 }
1269
1270 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1272 let _result = self.send_raw();
1273 self.drop_without_shutdown();
1274 _result
1275 }
1276
1277 fn send_raw(&self) -> Result<(), fidl::Error> {
1278 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
1279 (),
1280 self.tx_id,
1281 0x1ac23f463dc2c8de,
1282 fidl::encoding::DynamicFlags::empty(),
1283 )
1284 }
1285}
1286
1287#[must_use = "FIDL methods require a response to be sent"]
1288#[derive(Debug)]
1289pub struct RamdiskWakeResponder {
1290 control_handle: std::mem::ManuallyDrop<RamdiskControlHandle>,
1291 tx_id: u32,
1292}
1293
1294impl std::ops::Drop for RamdiskWakeResponder {
1298 fn drop(&mut self) {
1299 self.control_handle.shutdown();
1300 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1302 }
1303}
1304
1305impl fidl::endpoints::Responder for RamdiskWakeResponder {
1306 type ControlHandle = RamdiskControlHandle;
1307
1308 fn control_handle(&self) -> &RamdiskControlHandle {
1309 &self.control_handle
1310 }
1311
1312 fn drop_without_shutdown(mut self) {
1313 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1315 std::mem::forget(self);
1317 }
1318}
1319
1320impl RamdiskWakeResponder {
1321 pub fn send(self) -> Result<(), fidl::Error> {
1325 let _result = self.send_raw();
1326 if _result.is_err() {
1327 self.control_handle.shutdown();
1328 }
1329 self.drop_without_shutdown();
1330 _result
1331 }
1332
1333 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1335 let _result = self.send_raw();
1336 self.drop_without_shutdown();
1337 _result
1338 }
1339
1340 fn send_raw(&self) -> Result<(), fidl::Error> {
1341 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
1342 (),
1343 self.tx_id,
1344 0x1b2142ad9617bde4,
1345 fidl::encoding::DynamicFlags::empty(),
1346 )
1347 }
1348}
1349
1350#[must_use = "FIDL methods require a response to be sent"]
1351#[derive(Debug)]
1352pub struct RamdiskSleepAfterResponder {
1353 control_handle: std::mem::ManuallyDrop<RamdiskControlHandle>,
1354 tx_id: u32,
1355}
1356
1357impl std::ops::Drop for RamdiskSleepAfterResponder {
1361 fn drop(&mut self) {
1362 self.control_handle.shutdown();
1363 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1365 }
1366}
1367
1368impl fidl::endpoints::Responder for RamdiskSleepAfterResponder {
1369 type ControlHandle = RamdiskControlHandle;
1370
1371 fn control_handle(&self) -> &RamdiskControlHandle {
1372 &self.control_handle
1373 }
1374
1375 fn drop_without_shutdown(mut self) {
1376 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1378 std::mem::forget(self);
1380 }
1381}
1382
1383impl RamdiskSleepAfterResponder {
1384 pub fn send(self) -> Result<(), fidl::Error> {
1388 let _result = self.send_raw();
1389 if _result.is_err() {
1390 self.control_handle.shutdown();
1391 }
1392 self.drop_without_shutdown();
1393 _result
1394 }
1395
1396 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1398 let _result = self.send_raw();
1399 self.drop_without_shutdown();
1400 _result
1401 }
1402
1403 fn send_raw(&self) -> Result<(), fidl::Error> {
1404 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
1405 (),
1406 self.tx_id,
1407 0x38cafa087fbc1195,
1408 fidl::encoding::DynamicFlags::empty(),
1409 )
1410 }
1411}
1412
1413#[must_use = "FIDL methods require a response to be sent"]
1414#[derive(Debug)]
1415pub struct RamdiskGetBlockCountsResponder {
1416 control_handle: std::mem::ManuallyDrop<RamdiskControlHandle>,
1417 tx_id: u32,
1418}
1419
1420impl std::ops::Drop for RamdiskGetBlockCountsResponder {
1424 fn drop(&mut self) {
1425 self.control_handle.shutdown();
1426 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1428 }
1429}
1430
1431impl fidl::endpoints::Responder for RamdiskGetBlockCountsResponder {
1432 type ControlHandle = RamdiskControlHandle;
1433
1434 fn control_handle(&self) -> &RamdiskControlHandle {
1435 &self.control_handle
1436 }
1437
1438 fn drop_without_shutdown(mut self) {
1439 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1441 std::mem::forget(self);
1443 }
1444}
1445
1446impl RamdiskGetBlockCountsResponder {
1447 pub fn send(self, mut counts: &BlockWriteCounts) -> Result<(), fidl::Error> {
1451 let _result = self.send_raw(counts);
1452 if _result.is_err() {
1453 self.control_handle.shutdown();
1454 }
1455 self.drop_without_shutdown();
1456 _result
1457 }
1458
1459 pub fn send_no_shutdown_on_err(self, mut counts: &BlockWriteCounts) -> Result<(), fidl::Error> {
1461 let _result = self.send_raw(counts);
1462 self.drop_without_shutdown();
1463 _result
1464 }
1465
1466 fn send_raw(&self, mut counts: &BlockWriteCounts) -> Result<(), fidl::Error> {
1467 self.control_handle.inner.send::<RamdiskGetBlockCountsResponse>(
1468 (counts,),
1469 self.tx_id,
1470 0x346b0058ac937682,
1471 fidl::encoding::DynamicFlags::empty(),
1472 )
1473 }
1474}
1475
1476#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1477pub struct RamdiskControllerMarker;
1478
1479impl fidl::endpoints::ProtocolMarker for RamdiskControllerMarker {
1480 type Proxy = RamdiskControllerProxy;
1481 type RequestStream = RamdiskControllerRequestStream;
1482 #[cfg(target_os = "fuchsia")]
1483 type SynchronousProxy = RamdiskControllerSynchronousProxy;
1484
1485 const DEBUG_NAME: &'static str = "(anonymous) RamdiskController";
1486}
1487pub type RamdiskControllerCreateResult = Result<Option<String>, i32>;
1488pub type RamdiskControllerCreateFromVmoResult = Result<Option<String>, i32>;
1489pub type RamdiskControllerCreateFromVmoWithParamsResult = Result<Option<String>, i32>;
1490
1491pub trait RamdiskControllerProxyInterface: Send + Sync {
1492 type CreateResponseFut: std::future::Future<Output = Result<RamdiskControllerCreateResult, fidl::Error>>
1493 + Send;
1494 fn r#create(
1495 &self,
1496 block_size: u64,
1497 block_count: u64,
1498 type_guid: Option<&Guid>,
1499 ) -> Self::CreateResponseFut;
1500 type CreateFromVmoResponseFut: std::future::Future<Output = Result<RamdiskControllerCreateFromVmoResult, fidl::Error>>
1501 + Send;
1502 fn r#create_from_vmo(&self, vmo: fidl::Vmo) -> Self::CreateFromVmoResponseFut;
1503 type CreateFromVmoWithParamsResponseFut: std::future::Future<
1504 Output = Result<RamdiskControllerCreateFromVmoWithParamsResult, fidl::Error>,
1505 > + Send;
1506 fn r#create_from_vmo_with_params(
1507 &self,
1508 vmo: fidl::Vmo,
1509 block_size: u64,
1510 type_guid: Option<&Guid>,
1511 ) -> Self::CreateFromVmoWithParamsResponseFut;
1512}
1513#[derive(Debug)]
1514#[cfg(target_os = "fuchsia")]
1515pub struct RamdiskControllerSynchronousProxy {
1516 client: fidl::client::sync::Client,
1517}
1518
1519#[cfg(target_os = "fuchsia")]
1520impl fidl::endpoints::SynchronousProxy for RamdiskControllerSynchronousProxy {
1521 type Proxy = RamdiskControllerProxy;
1522 type Protocol = RamdiskControllerMarker;
1523
1524 fn from_channel(inner: fidl::Channel) -> Self {
1525 Self::new(inner)
1526 }
1527
1528 fn into_channel(self) -> fidl::Channel {
1529 self.client.into_channel()
1530 }
1531
1532 fn as_channel(&self) -> &fidl::Channel {
1533 self.client.as_channel()
1534 }
1535}
1536
1537#[cfg(target_os = "fuchsia")]
1538impl RamdiskControllerSynchronousProxy {
1539 pub fn new(channel: fidl::Channel) -> Self {
1540 Self { client: fidl::client::sync::Client::new(channel) }
1541 }
1542
1543 pub fn into_channel(self) -> fidl::Channel {
1544 self.client.into_channel()
1545 }
1546
1547 pub fn wait_for_event(
1550 &self,
1551 deadline: zx::MonotonicInstant,
1552 ) -> Result<RamdiskControllerEvent, fidl::Error> {
1553 RamdiskControllerEvent::decode(
1554 self.client.wait_for_event::<RamdiskControllerMarker>(deadline)?,
1555 )
1556 }
1557
1558 pub fn r#create(
1561 &self,
1562 mut block_size: u64,
1563 mut block_count: u64,
1564 mut type_guid: Option<&Guid>,
1565 ___deadline: zx::MonotonicInstant,
1566 ) -> Result<RamdiskControllerCreateResult, fidl::Error> {
1567 let _response = self.client.send_query::<
1568 RamdiskControllerCreateRequest,
1569 fidl::encoding::ResultType<RamdiskControllerCreateResponse, i32>,
1570 RamdiskControllerMarker,
1571 >(
1572 (block_size, block_count, type_guid,),
1573 0x21cd800cc5ff7c3f,
1574 fidl::encoding::DynamicFlags::empty(),
1575 ___deadline,
1576 )?;
1577 Ok(_response.map(|x| x.name))
1578 }
1579
1580 pub fn r#create_from_vmo(
1583 &self,
1584 mut vmo: fidl::Vmo,
1585 ___deadline: zx::MonotonicInstant,
1586 ) -> Result<RamdiskControllerCreateFromVmoResult, fidl::Error> {
1587 let _response = self.client.send_query::<
1588 RamdiskControllerCreateFromVmoRequest,
1589 fidl::encoding::ResultType<RamdiskControllerCreateFromVmoResponse, i32>,
1590 RamdiskControllerMarker,
1591 >(
1592 (vmo,),
1593 0x5d37434da8f680b4,
1594 fidl::encoding::DynamicFlags::empty(),
1595 ___deadline,
1596 )?;
1597 Ok(_response.map(|x| x.name))
1598 }
1599
1600 pub fn r#create_from_vmo_with_params(
1603 &self,
1604 mut vmo: fidl::Vmo,
1605 mut block_size: u64,
1606 mut type_guid: Option<&Guid>,
1607 ___deadline: zx::MonotonicInstant,
1608 ) -> Result<RamdiskControllerCreateFromVmoWithParamsResult, fidl::Error> {
1609 let _response = self.client.send_query::<
1610 RamdiskControllerCreateFromVmoWithParamsRequest,
1611 fidl::encoding::ResultType<RamdiskControllerCreateFromVmoWithParamsResponse, i32>,
1612 RamdiskControllerMarker,
1613 >(
1614 (vmo, block_size, type_guid,),
1615 0x776dd021e9e6677e,
1616 fidl::encoding::DynamicFlags::empty(),
1617 ___deadline,
1618 )?;
1619 Ok(_response.map(|x| x.name))
1620 }
1621}
1622
1623#[cfg(target_os = "fuchsia")]
1624impl From<RamdiskControllerSynchronousProxy> for zx::NullableHandle {
1625 fn from(value: RamdiskControllerSynchronousProxy) -> Self {
1626 value.into_channel().into()
1627 }
1628}
1629
1630#[cfg(target_os = "fuchsia")]
1631impl From<fidl::Channel> for RamdiskControllerSynchronousProxy {
1632 fn from(value: fidl::Channel) -> Self {
1633 Self::new(value)
1634 }
1635}
1636
1637#[cfg(target_os = "fuchsia")]
1638impl fidl::endpoints::FromClient for RamdiskControllerSynchronousProxy {
1639 type Protocol = RamdiskControllerMarker;
1640
1641 fn from_client(value: fidl::endpoints::ClientEnd<RamdiskControllerMarker>) -> Self {
1642 Self::new(value.into_channel())
1643 }
1644}
1645
1646#[derive(Debug, Clone)]
1647pub struct RamdiskControllerProxy {
1648 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1649}
1650
1651impl fidl::endpoints::Proxy for RamdiskControllerProxy {
1652 type Protocol = RamdiskControllerMarker;
1653
1654 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1655 Self::new(inner)
1656 }
1657
1658 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1659 self.client.into_channel().map_err(|client| Self { client })
1660 }
1661
1662 fn as_channel(&self) -> &::fidl::AsyncChannel {
1663 self.client.as_channel()
1664 }
1665}
1666
1667impl RamdiskControllerProxy {
1668 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1670 let protocol_name =
1671 <RamdiskControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1672 Self { client: fidl::client::Client::new(channel, protocol_name) }
1673 }
1674
1675 pub fn take_event_stream(&self) -> RamdiskControllerEventStream {
1681 RamdiskControllerEventStream { event_receiver: self.client.take_event_receiver() }
1682 }
1683
1684 pub fn r#create(
1687 &self,
1688 mut block_size: u64,
1689 mut block_count: u64,
1690 mut type_guid: Option<&Guid>,
1691 ) -> fidl::client::QueryResponseFut<
1692 RamdiskControllerCreateResult,
1693 fidl::encoding::DefaultFuchsiaResourceDialect,
1694 > {
1695 RamdiskControllerProxyInterface::r#create(self, block_size, block_count, type_guid)
1696 }
1697
1698 pub fn r#create_from_vmo(
1701 &self,
1702 mut vmo: fidl::Vmo,
1703 ) -> fidl::client::QueryResponseFut<
1704 RamdiskControllerCreateFromVmoResult,
1705 fidl::encoding::DefaultFuchsiaResourceDialect,
1706 > {
1707 RamdiskControllerProxyInterface::r#create_from_vmo(self, vmo)
1708 }
1709
1710 pub fn r#create_from_vmo_with_params(
1713 &self,
1714 mut vmo: fidl::Vmo,
1715 mut block_size: u64,
1716 mut type_guid: Option<&Guid>,
1717 ) -> fidl::client::QueryResponseFut<
1718 RamdiskControllerCreateFromVmoWithParamsResult,
1719 fidl::encoding::DefaultFuchsiaResourceDialect,
1720 > {
1721 RamdiskControllerProxyInterface::r#create_from_vmo_with_params(
1722 self, vmo, block_size, type_guid,
1723 )
1724 }
1725}
1726
1727impl RamdiskControllerProxyInterface for RamdiskControllerProxy {
1728 type CreateResponseFut = fidl::client::QueryResponseFut<
1729 RamdiskControllerCreateResult,
1730 fidl::encoding::DefaultFuchsiaResourceDialect,
1731 >;
1732 fn r#create(
1733 &self,
1734 mut block_size: u64,
1735 mut block_count: u64,
1736 mut type_guid: Option<&Guid>,
1737 ) -> Self::CreateResponseFut {
1738 fn _decode(
1739 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1740 ) -> Result<RamdiskControllerCreateResult, fidl::Error> {
1741 let _response = fidl::client::decode_transaction_body::<
1742 fidl::encoding::ResultType<RamdiskControllerCreateResponse, i32>,
1743 fidl::encoding::DefaultFuchsiaResourceDialect,
1744 0x21cd800cc5ff7c3f,
1745 >(_buf?)?;
1746 Ok(_response.map(|x| x.name))
1747 }
1748 self.client
1749 .send_query_and_decode::<RamdiskControllerCreateRequest, RamdiskControllerCreateResult>(
1750 (block_size, block_count, type_guid),
1751 0x21cd800cc5ff7c3f,
1752 fidl::encoding::DynamicFlags::empty(),
1753 _decode,
1754 )
1755 }
1756
1757 type CreateFromVmoResponseFut = fidl::client::QueryResponseFut<
1758 RamdiskControllerCreateFromVmoResult,
1759 fidl::encoding::DefaultFuchsiaResourceDialect,
1760 >;
1761 fn r#create_from_vmo(&self, mut vmo: fidl::Vmo) -> Self::CreateFromVmoResponseFut {
1762 fn _decode(
1763 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1764 ) -> Result<RamdiskControllerCreateFromVmoResult, fidl::Error> {
1765 let _response = fidl::client::decode_transaction_body::<
1766 fidl::encoding::ResultType<RamdiskControllerCreateFromVmoResponse, i32>,
1767 fidl::encoding::DefaultFuchsiaResourceDialect,
1768 0x5d37434da8f680b4,
1769 >(_buf?)?;
1770 Ok(_response.map(|x| x.name))
1771 }
1772 self.client.send_query_and_decode::<
1773 RamdiskControllerCreateFromVmoRequest,
1774 RamdiskControllerCreateFromVmoResult,
1775 >(
1776 (vmo,),
1777 0x5d37434da8f680b4,
1778 fidl::encoding::DynamicFlags::empty(),
1779 _decode,
1780 )
1781 }
1782
1783 type CreateFromVmoWithParamsResponseFut = fidl::client::QueryResponseFut<
1784 RamdiskControllerCreateFromVmoWithParamsResult,
1785 fidl::encoding::DefaultFuchsiaResourceDialect,
1786 >;
1787 fn r#create_from_vmo_with_params(
1788 &self,
1789 mut vmo: fidl::Vmo,
1790 mut block_size: u64,
1791 mut type_guid: Option<&Guid>,
1792 ) -> Self::CreateFromVmoWithParamsResponseFut {
1793 fn _decode(
1794 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1795 ) -> Result<RamdiskControllerCreateFromVmoWithParamsResult, fidl::Error> {
1796 let _response = fidl::client::decode_transaction_body::<
1797 fidl::encoding::ResultType<RamdiskControllerCreateFromVmoWithParamsResponse, i32>,
1798 fidl::encoding::DefaultFuchsiaResourceDialect,
1799 0x776dd021e9e6677e,
1800 >(_buf?)?;
1801 Ok(_response.map(|x| x.name))
1802 }
1803 self.client.send_query_and_decode::<
1804 RamdiskControllerCreateFromVmoWithParamsRequest,
1805 RamdiskControllerCreateFromVmoWithParamsResult,
1806 >(
1807 (vmo, block_size, type_guid,),
1808 0x776dd021e9e6677e,
1809 fidl::encoding::DynamicFlags::empty(),
1810 _decode,
1811 )
1812 }
1813}
1814
1815pub struct RamdiskControllerEventStream {
1816 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1817}
1818
1819impl std::marker::Unpin for RamdiskControllerEventStream {}
1820
1821impl futures::stream::FusedStream for RamdiskControllerEventStream {
1822 fn is_terminated(&self) -> bool {
1823 self.event_receiver.is_terminated()
1824 }
1825}
1826
1827impl futures::Stream for RamdiskControllerEventStream {
1828 type Item = Result<RamdiskControllerEvent, fidl::Error>;
1829
1830 fn poll_next(
1831 mut self: std::pin::Pin<&mut Self>,
1832 cx: &mut std::task::Context<'_>,
1833 ) -> std::task::Poll<Option<Self::Item>> {
1834 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1835 &mut self.event_receiver,
1836 cx
1837 )?) {
1838 Some(buf) => std::task::Poll::Ready(Some(RamdiskControllerEvent::decode(buf))),
1839 None => std::task::Poll::Ready(None),
1840 }
1841 }
1842}
1843
1844#[derive(Debug)]
1845pub enum RamdiskControllerEvent {}
1846
1847impl RamdiskControllerEvent {
1848 fn decode(
1850 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1851 ) -> Result<RamdiskControllerEvent, fidl::Error> {
1852 let (bytes, _handles) = buf.split_mut();
1853 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1854 debug_assert_eq!(tx_header.tx_id, 0);
1855 match tx_header.ordinal {
1856 _ => Err(fidl::Error::UnknownOrdinal {
1857 ordinal: tx_header.ordinal,
1858 protocol_name:
1859 <RamdiskControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1860 }),
1861 }
1862 }
1863}
1864
1865pub struct RamdiskControllerRequestStream {
1867 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1868 is_terminated: bool,
1869}
1870
1871impl std::marker::Unpin for RamdiskControllerRequestStream {}
1872
1873impl futures::stream::FusedStream for RamdiskControllerRequestStream {
1874 fn is_terminated(&self) -> bool {
1875 self.is_terminated
1876 }
1877}
1878
1879impl fidl::endpoints::RequestStream for RamdiskControllerRequestStream {
1880 type Protocol = RamdiskControllerMarker;
1881 type ControlHandle = RamdiskControllerControlHandle;
1882
1883 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1884 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1885 }
1886
1887 fn control_handle(&self) -> Self::ControlHandle {
1888 RamdiskControllerControlHandle { inner: self.inner.clone() }
1889 }
1890
1891 fn into_inner(
1892 self,
1893 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1894 {
1895 (self.inner, self.is_terminated)
1896 }
1897
1898 fn from_inner(
1899 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1900 is_terminated: bool,
1901 ) -> Self {
1902 Self { inner, is_terminated }
1903 }
1904}
1905
1906impl futures::Stream for RamdiskControllerRequestStream {
1907 type Item = Result<RamdiskControllerRequest, fidl::Error>;
1908
1909 fn poll_next(
1910 mut self: std::pin::Pin<&mut Self>,
1911 cx: &mut std::task::Context<'_>,
1912 ) -> std::task::Poll<Option<Self::Item>> {
1913 let this = &mut *self;
1914 if this.inner.check_shutdown(cx) {
1915 this.is_terminated = true;
1916 return std::task::Poll::Ready(None);
1917 }
1918 if this.is_terminated {
1919 panic!("polled RamdiskControllerRequestStream after completion");
1920 }
1921 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1922 |bytes, handles| {
1923 match this.inner.channel().read_etc(cx, bytes, handles) {
1924 std::task::Poll::Ready(Ok(())) => {}
1925 std::task::Poll::Pending => return std::task::Poll::Pending,
1926 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1927 this.is_terminated = true;
1928 return std::task::Poll::Ready(None);
1929 }
1930 std::task::Poll::Ready(Err(e)) => {
1931 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1932 e.into(),
1933 ))));
1934 }
1935 }
1936
1937 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1939
1940 std::task::Poll::Ready(Some(match header.ordinal {
1941 0x21cd800cc5ff7c3f => {
1942 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1943 let mut req = fidl::new_empty!(
1944 RamdiskControllerCreateRequest,
1945 fidl::encoding::DefaultFuchsiaResourceDialect
1946 );
1947 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RamdiskControllerCreateRequest>(&header, _body_bytes, handles, &mut req)?;
1948 let control_handle =
1949 RamdiskControllerControlHandle { inner: this.inner.clone() };
1950 Ok(RamdiskControllerRequest::Create {
1951 block_size: req.block_size,
1952 block_count: req.block_count,
1953 type_guid: req.type_guid,
1954
1955 responder: RamdiskControllerCreateResponder {
1956 control_handle: std::mem::ManuallyDrop::new(control_handle),
1957 tx_id: header.tx_id,
1958 },
1959 })
1960 }
1961 0x5d37434da8f680b4 => {
1962 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1963 let mut req = fidl::new_empty!(
1964 RamdiskControllerCreateFromVmoRequest,
1965 fidl::encoding::DefaultFuchsiaResourceDialect
1966 );
1967 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RamdiskControllerCreateFromVmoRequest>(&header, _body_bytes, handles, &mut req)?;
1968 let control_handle =
1969 RamdiskControllerControlHandle { inner: this.inner.clone() };
1970 Ok(RamdiskControllerRequest::CreateFromVmo {
1971 vmo: req.vmo,
1972
1973 responder: RamdiskControllerCreateFromVmoResponder {
1974 control_handle: std::mem::ManuallyDrop::new(control_handle),
1975 tx_id: header.tx_id,
1976 },
1977 })
1978 }
1979 0x776dd021e9e6677e => {
1980 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1981 let mut req = fidl::new_empty!(
1982 RamdiskControllerCreateFromVmoWithParamsRequest,
1983 fidl::encoding::DefaultFuchsiaResourceDialect
1984 );
1985 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RamdiskControllerCreateFromVmoWithParamsRequest>(&header, _body_bytes, handles, &mut req)?;
1986 let control_handle =
1987 RamdiskControllerControlHandle { inner: this.inner.clone() };
1988 Ok(RamdiskControllerRequest::CreateFromVmoWithParams {
1989 vmo: req.vmo,
1990 block_size: req.block_size,
1991 type_guid: req.type_guid,
1992
1993 responder: RamdiskControllerCreateFromVmoWithParamsResponder {
1994 control_handle: std::mem::ManuallyDrop::new(control_handle),
1995 tx_id: header.tx_id,
1996 },
1997 })
1998 }
1999 _ => Err(fidl::Error::UnknownOrdinal {
2000 ordinal: header.ordinal,
2001 protocol_name:
2002 <RamdiskControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2003 }),
2004 }))
2005 },
2006 )
2007 }
2008}
2009
2010#[derive(Debug)]
2011pub enum RamdiskControllerRequest {
2012 Create {
2015 block_size: u64,
2016 block_count: u64,
2017 type_guid: Option<Box<Guid>>,
2018 responder: RamdiskControllerCreateResponder,
2019 },
2020 CreateFromVmo { vmo: fidl::Vmo, responder: RamdiskControllerCreateFromVmoResponder },
2023 CreateFromVmoWithParams {
2026 vmo: fidl::Vmo,
2027 block_size: u64,
2028 type_guid: Option<Box<Guid>>,
2029 responder: RamdiskControllerCreateFromVmoWithParamsResponder,
2030 },
2031}
2032
2033impl RamdiskControllerRequest {
2034 #[allow(irrefutable_let_patterns)]
2035 pub fn into_create(
2036 self,
2037 ) -> Option<(u64, u64, Option<Box<Guid>>, RamdiskControllerCreateResponder)> {
2038 if let RamdiskControllerRequest::Create { block_size, block_count, type_guid, responder } =
2039 self
2040 {
2041 Some((block_size, block_count, type_guid, responder))
2042 } else {
2043 None
2044 }
2045 }
2046
2047 #[allow(irrefutable_let_patterns)]
2048 pub fn into_create_from_vmo(
2049 self,
2050 ) -> Option<(fidl::Vmo, RamdiskControllerCreateFromVmoResponder)> {
2051 if let RamdiskControllerRequest::CreateFromVmo { vmo, responder } = self {
2052 Some((vmo, responder))
2053 } else {
2054 None
2055 }
2056 }
2057
2058 #[allow(irrefutable_let_patterns)]
2059 pub fn into_create_from_vmo_with_params(
2060 self,
2061 ) -> Option<(
2062 fidl::Vmo,
2063 u64,
2064 Option<Box<Guid>>,
2065 RamdiskControllerCreateFromVmoWithParamsResponder,
2066 )> {
2067 if let RamdiskControllerRequest::CreateFromVmoWithParams {
2068 vmo,
2069 block_size,
2070 type_guid,
2071 responder,
2072 } = self
2073 {
2074 Some((vmo, block_size, type_guid, responder))
2075 } else {
2076 None
2077 }
2078 }
2079
2080 pub fn method_name(&self) -> &'static str {
2082 match *self {
2083 RamdiskControllerRequest::Create { .. } => "create",
2084 RamdiskControllerRequest::CreateFromVmo { .. } => "create_from_vmo",
2085 RamdiskControllerRequest::CreateFromVmoWithParams { .. } => {
2086 "create_from_vmo_with_params"
2087 }
2088 }
2089 }
2090}
2091
2092#[derive(Debug, Clone)]
2093pub struct RamdiskControllerControlHandle {
2094 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2095}
2096
2097impl fidl::endpoints::ControlHandle for RamdiskControllerControlHandle {
2098 fn shutdown(&self) {
2099 self.inner.shutdown()
2100 }
2101
2102 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2103 self.inner.shutdown_with_epitaph(status)
2104 }
2105
2106 fn is_closed(&self) -> bool {
2107 self.inner.channel().is_closed()
2108 }
2109 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2110 self.inner.channel().on_closed()
2111 }
2112
2113 #[cfg(target_os = "fuchsia")]
2114 fn signal_peer(
2115 &self,
2116 clear_mask: zx::Signals,
2117 set_mask: zx::Signals,
2118 ) -> Result<(), zx_status::Status> {
2119 use fidl::Peered;
2120 self.inner.channel().signal_peer(clear_mask, set_mask)
2121 }
2122}
2123
2124impl RamdiskControllerControlHandle {}
2125
2126#[must_use = "FIDL methods require a response to be sent"]
2127#[derive(Debug)]
2128pub struct RamdiskControllerCreateResponder {
2129 control_handle: std::mem::ManuallyDrop<RamdiskControllerControlHandle>,
2130 tx_id: u32,
2131}
2132
2133impl std::ops::Drop for RamdiskControllerCreateResponder {
2137 fn drop(&mut self) {
2138 self.control_handle.shutdown();
2139 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2141 }
2142}
2143
2144impl fidl::endpoints::Responder for RamdiskControllerCreateResponder {
2145 type ControlHandle = RamdiskControllerControlHandle;
2146
2147 fn control_handle(&self) -> &RamdiskControllerControlHandle {
2148 &self.control_handle
2149 }
2150
2151 fn drop_without_shutdown(mut self) {
2152 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2154 std::mem::forget(self);
2156 }
2157}
2158
2159impl RamdiskControllerCreateResponder {
2160 pub fn send(self, mut result: Result<Option<&str>, i32>) -> Result<(), fidl::Error> {
2164 let _result = self.send_raw(result);
2165 if _result.is_err() {
2166 self.control_handle.shutdown();
2167 }
2168 self.drop_without_shutdown();
2169 _result
2170 }
2171
2172 pub fn send_no_shutdown_on_err(
2174 self,
2175 mut result: Result<Option<&str>, i32>,
2176 ) -> Result<(), fidl::Error> {
2177 let _result = self.send_raw(result);
2178 self.drop_without_shutdown();
2179 _result
2180 }
2181
2182 fn send_raw(&self, mut result: Result<Option<&str>, i32>) -> Result<(), fidl::Error> {
2183 self.control_handle
2184 .inner
2185 .send::<fidl::encoding::ResultType<RamdiskControllerCreateResponse, i32>>(
2186 result.map(|name| (name,)),
2187 self.tx_id,
2188 0x21cd800cc5ff7c3f,
2189 fidl::encoding::DynamicFlags::empty(),
2190 )
2191 }
2192}
2193
2194#[must_use = "FIDL methods require a response to be sent"]
2195#[derive(Debug)]
2196pub struct RamdiskControllerCreateFromVmoResponder {
2197 control_handle: std::mem::ManuallyDrop<RamdiskControllerControlHandle>,
2198 tx_id: u32,
2199}
2200
2201impl std::ops::Drop for RamdiskControllerCreateFromVmoResponder {
2205 fn drop(&mut self) {
2206 self.control_handle.shutdown();
2207 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2209 }
2210}
2211
2212impl fidl::endpoints::Responder for RamdiskControllerCreateFromVmoResponder {
2213 type ControlHandle = RamdiskControllerControlHandle;
2214
2215 fn control_handle(&self) -> &RamdiskControllerControlHandle {
2216 &self.control_handle
2217 }
2218
2219 fn drop_without_shutdown(mut self) {
2220 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2222 std::mem::forget(self);
2224 }
2225}
2226
2227impl RamdiskControllerCreateFromVmoResponder {
2228 pub fn send(self, mut result: Result<Option<&str>, i32>) -> Result<(), fidl::Error> {
2232 let _result = self.send_raw(result);
2233 if _result.is_err() {
2234 self.control_handle.shutdown();
2235 }
2236 self.drop_without_shutdown();
2237 _result
2238 }
2239
2240 pub fn send_no_shutdown_on_err(
2242 self,
2243 mut result: Result<Option<&str>, i32>,
2244 ) -> Result<(), fidl::Error> {
2245 let _result = self.send_raw(result);
2246 self.drop_without_shutdown();
2247 _result
2248 }
2249
2250 fn send_raw(&self, mut result: Result<Option<&str>, i32>) -> Result<(), fidl::Error> {
2251 self.control_handle.inner.send::<fidl::encoding::ResultType<
2252 RamdiskControllerCreateFromVmoResponse,
2253 i32,
2254 >>(
2255 result.map(|name| (name,)),
2256 self.tx_id,
2257 0x5d37434da8f680b4,
2258 fidl::encoding::DynamicFlags::empty(),
2259 )
2260 }
2261}
2262
2263#[must_use = "FIDL methods require a response to be sent"]
2264#[derive(Debug)]
2265pub struct RamdiskControllerCreateFromVmoWithParamsResponder {
2266 control_handle: std::mem::ManuallyDrop<RamdiskControllerControlHandle>,
2267 tx_id: u32,
2268}
2269
2270impl std::ops::Drop for RamdiskControllerCreateFromVmoWithParamsResponder {
2274 fn drop(&mut self) {
2275 self.control_handle.shutdown();
2276 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2278 }
2279}
2280
2281impl fidl::endpoints::Responder for RamdiskControllerCreateFromVmoWithParamsResponder {
2282 type ControlHandle = RamdiskControllerControlHandle;
2283
2284 fn control_handle(&self) -> &RamdiskControllerControlHandle {
2285 &self.control_handle
2286 }
2287
2288 fn drop_without_shutdown(mut self) {
2289 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2291 std::mem::forget(self);
2293 }
2294}
2295
2296impl RamdiskControllerCreateFromVmoWithParamsResponder {
2297 pub fn send(self, mut result: Result<Option<&str>, i32>) -> Result<(), fidl::Error> {
2301 let _result = self.send_raw(result);
2302 if _result.is_err() {
2303 self.control_handle.shutdown();
2304 }
2305 self.drop_without_shutdown();
2306 _result
2307 }
2308
2309 pub fn send_no_shutdown_on_err(
2311 self,
2312 mut result: Result<Option<&str>, i32>,
2313 ) -> Result<(), fidl::Error> {
2314 let _result = self.send_raw(result);
2315 self.drop_without_shutdown();
2316 _result
2317 }
2318
2319 fn send_raw(&self, mut result: Result<Option<&str>, i32>) -> Result<(), fidl::Error> {
2320 self.control_handle.inner.send::<fidl::encoding::ResultType<
2321 RamdiskControllerCreateFromVmoWithParamsResponse,
2322 i32,
2323 >>(
2324 result.map(|name| (name,)),
2325 self.tx_id,
2326 0x776dd021e9e6677e,
2327 fidl::encoding::DynamicFlags::empty(),
2328 )
2329 }
2330}
2331
2332#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2333pub struct ServiceMarker;
2334
2335#[cfg(target_os = "fuchsia")]
2336impl fidl::endpoints::ServiceMarker for ServiceMarker {
2337 type Proxy = ServiceProxy;
2338 type Request = ServiceRequest;
2339 const SERVICE_NAME: &'static str = "fuchsia.hardware.ramdisk.Service";
2340}
2341
2342#[cfg(target_os = "fuchsia")]
2346pub enum ServiceRequest {
2347 Controller(ControllerRequestStream),
2348}
2349
2350#[cfg(target_os = "fuchsia")]
2351impl fidl::endpoints::ServiceRequest for ServiceRequest {
2352 type Service = ServiceMarker;
2353
2354 fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
2355 match name {
2356 "controller" => Self::Controller(
2357 <ControllerRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
2358 ),
2359 _ => panic!("no such member protocol name for service Service"),
2360 }
2361 }
2362
2363 fn member_names() -> &'static [&'static str] {
2364 &["controller"]
2365 }
2366}
2367#[cfg(target_os = "fuchsia")]
2369pub struct ServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
2370
2371#[cfg(target_os = "fuchsia")]
2372impl fidl::endpoints::ServiceProxy for ServiceProxy {
2373 type Service = ServiceMarker;
2374
2375 fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
2376 Self(opener)
2377 }
2378}
2379
2380#[cfg(target_os = "fuchsia")]
2381impl ServiceProxy {
2382 pub fn connect_to_controller(&self) -> Result<ControllerProxy, fidl::Error> {
2383 let (proxy, server_end) = fidl::endpoints::create_proxy::<ControllerMarker>();
2384 self.connect_channel_to_controller(server_end)?;
2385 Ok(proxy)
2386 }
2387
2388 pub fn connect_to_controller_sync(&self) -> Result<ControllerSynchronousProxy, fidl::Error> {
2391 let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<ControllerMarker>();
2392 self.connect_channel_to_controller(server_end)?;
2393 Ok(proxy)
2394 }
2395
2396 pub fn connect_channel_to_controller(
2399 &self,
2400 server_end: fidl::endpoints::ServerEnd<ControllerMarker>,
2401 ) -> Result<(), fidl::Error> {
2402 self.0.open_member("controller", server_end.into_channel())
2403 }
2404
2405 pub fn instance_name(&self) -> &str {
2406 self.0.instance_name()
2407 }
2408}
2409
2410mod internal {
2411 use super::*;
2412
2413 impl fidl::encoding::ResourceTypeMarker for ControllerCreateResponse {
2414 type Borrowed<'a> = &'a mut Self;
2415 fn take_or_borrow<'a>(
2416 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2417 ) -> Self::Borrowed<'a> {
2418 value
2419 }
2420 }
2421
2422 unsafe impl fidl::encoding::TypeMarker for ControllerCreateResponse {
2423 type Owned = Self;
2424
2425 #[inline(always)]
2426 fn inline_align(_context: fidl::encoding::Context) -> usize {
2427 4
2428 }
2429
2430 #[inline(always)]
2431 fn inline_size(_context: fidl::encoding::Context) -> usize {
2432 8
2433 }
2434 }
2435
2436 unsafe impl
2437 fidl::encoding::Encode<
2438 ControllerCreateResponse,
2439 fidl::encoding::DefaultFuchsiaResourceDialect,
2440 > for &mut ControllerCreateResponse
2441 {
2442 #[inline]
2443 unsafe fn encode(
2444 self,
2445 encoder: &mut fidl::encoding::Encoder<
2446 '_,
2447 fidl::encoding::DefaultFuchsiaResourceDialect,
2448 >,
2449 offset: usize,
2450 _depth: fidl::encoding::Depth,
2451 ) -> fidl::Result<()> {
2452 encoder.debug_check_bounds::<ControllerCreateResponse>(offset);
2453 fidl::encoding::Encode::<
2455 ControllerCreateResponse,
2456 fidl::encoding::DefaultFuchsiaResourceDialect,
2457 >::encode(
2458 (
2459 <fidl::encoding::Endpoint<
2460 fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
2461 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2462 &mut self.outgoing
2463 ),
2464 <fidl::encoding::HandleType<
2465 fidl::EventPair,
2466 { fidl::ObjectType::EVENTPAIR.into_raw() },
2467 2147483648,
2468 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2469 &mut self.lifeline
2470 ),
2471 ),
2472 encoder,
2473 offset,
2474 _depth,
2475 )
2476 }
2477 }
2478 unsafe impl<
2479 T0: fidl::encoding::Encode<
2480 fidl::encoding::Endpoint<
2481 fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
2482 >,
2483 fidl::encoding::DefaultFuchsiaResourceDialect,
2484 >,
2485 T1: fidl::encoding::Encode<
2486 fidl::encoding::HandleType<
2487 fidl::EventPair,
2488 { fidl::ObjectType::EVENTPAIR.into_raw() },
2489 2147483648,
2490 >,
2491 fidl::encoding::DefaultFuchsiaResourceDialect,
2492 >,
2493 >
2494 fidl::encoding::Encode<
2495 ControllerCreateResponse,
2496 fidl::encoding::DefaultFuchsiaResourceDialect,
2497 > for (T0, T1)
2498 {
2499 #[inline]
2500 unsafe fn encode(
2501 self,
2502 encoder: &mut fidl::encoding::Encoder<
2503 '_,
2504 fidl::encoding::DefaultFuchsiaResourceDialect,
2505 >,
2506 offset: usize,
2507 depth: fidl::encoding::Depth,
2508 ) -> fidl::Result<()> {
2509 encoder.debug_check_bounds::<ControllerCreateResponse>(offset);
2510 self.0.encode(encoder, offset + 0, depth)?;
2514 self.1.encode(encoder, offset + 4, depth)?;
2515 Ok(())
2516 }
2517 }
2518
2519 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2520 for ControllerCreateResponse
2521 {
2522 #[inline(always)]
2523 fn new_empty() -> Self {
2524 Self {
2525 outgoing: fidl::new_empty!(
2526 fidl::encoding::Endpoint<
2527 fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
2528 >,
2529 fidl::encoding::DefaultFuchsiaResourceDialect
2530 ),
2531 lifeline: fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
2532 }
2533 }
2534
2535 #[inline]
2536 unsafe fn decode(
2537 &mut self,
2538 decoder: &mut fidl::encoding::Decoder<
2539 '_,
2540 fidl::encoding::DefaultFuchsiaResourceDialect,
2541 >,
2542 offset: usize,
2543 _depth: fidl::encoding::Depth,
2544 ) -> fidl::Result<()> {
2545 decoder.debug_check_bounds::<Self>(offset);
2546 fidl::decode!(
2548 fidl::encoding::Endpoint<
2549 fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
2550 >,
2551 fidl::encoding::DefaultFuchsiaResourceDialect,
2552 &mut self.outgoing,
2553 decoder,
2554 offset + 0,
2555 _depth
2556 )?;
2557 fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.lifeline, decoder, offset + 4, _depth)?;
2558 Ok(())
2559 }
2560 }
2561
2562 impl fidl::encoding::ResourceTypeMarker for RamdiskControllerCreateFromVmoRequest {
2563 type Borrowed<'a> = &'a mut Self;
2564 fn take_or_borrow<'a>(
2565 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2566 ) -> Self::Borrowed<'a> {
2567 value
2568 }
2569 }
2570
2571 unsafe impl fidl::encoding::TypeMarker for RamdiskControllerCreateFromVmoRequest {
2572 type Owned = Self;
2573
2574 #[inline(always)]
2575 fn inline_align(_context: fidl::encoding::Context) -> usize {
2576 4
2577 }
2578
2579 #[inline(always)]
2580 fn inline_size(_context: fidl::encoding::Context) -> usize {
2581 4
2582 }
2583 }
2584
2585 unsafe impl
2586 fidl::encoding::Encode<
2587 RamdiskControllerCreateFromVmoRequest,
2588 fidl::encoding::DefaultFuchsiaResourceDialect,
2589 > for &mut RamdiskControllerCreateFromVmoRequest
2590 {
2591 #[inline]
2592 unsafe fn encode(
2593 self,
2594 encoder: &mut fidl::encoding::Encoder<
2595 '_,
2596 fidl::encoding::DefaultFuchsiaResourceDialect,
2597 >,
2598 offset: usize,
2599 _depth: fidl::encoding::Depth,
2600 ) -> fidl::Result<()> {
2601 encoder.debug_check_bounds::<RamdiskControllerCreateFromVmoRequest>(offset);
2602 fidl::encoding::Encode::<
2604 RamdiskControllerCreateFromVmoRequest,
2605 fidl::encoding::DefaultFuchsiaResourceDialect,
2606 >::encode(
2607 (<fidl::encoding::HandleType<
2608 fidl::Vmo,
2609 { fidl::ObjectType::VMO.into_raw() },
2610 2147483648,
2611 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2612 &mut self.vmo
2613 ),),
2614 encoder,
2615 offset,
2616 _depth,
2617 )
2618 }
2619 }
2620 unsafe impl<
2621 T0: fidl::encoding::Encode<
2622 fidl::encoding::HandleType<
2623 fidl::Vmo,
2624 { fidl::ObjectType::VMO.into_raw() },
2625 2147483648,
2626 >,
2627 fidl::encoding::DefaultFuchsiaResourceDialect,
2628 >,
2629 >
2630 fidl::encoding::Encode<
2631 RamdiskControllerCreateFromVmoRequest,
2632 fidl::encoding::DefaultFuchsiaResourceDialect,
2633 > for (T0,)
2634 {
2635 #[inline]
2636 unsafe fn encode(
2637 self,
2638 encoder: &mut fidl::encoding::Encoder<
2639 '_,
2640 fidl::encoding::DefaultFuchsiaResourceDialect,
2641 >,
2642 offset: usize,
2643 depth: fidl::encoding::Depth,
2644 ) -> fidl::Result<()> {
2645 encoder.debug_check_bounds::<RamdiskControllerCreateFromVmoRequest>(offset);
2646 self.0.encode(encoder, offset + 0, depth)?;
2650 Ok(())
2651 }
2652 }
2653
2654 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2655 for RamdiskControllerCreateFromVmoRequest
2656 {
2657 #[inline(always)]
2658 fn new_empty() -> Self {
2659 Self {
2660 vmo: fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
2661 }
2662 }
2663
2664 #[inline]
2665 unsafe fn decode(
2666 &mut self,
2667 decoder: &mut fidl::encoding::Decoder<
2668 '_,
2669 fidl::encoding::DefaultFuchsiaResourceDialect,
2670 >,
2671 offset: usize,
2672 _depth: fidl::encoding::Depth,
2673 ) -> fidl::Result<()> {
2674 decoder.debug_check_bounds::<Self>(offset);
2675 fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.vmo, decoder, offset + 0, _depth)?;
2677 Ok(())
2678 }
2679 }
2680
2681 impl fidl::encoding::ResourceTypeMarker for RamdiskControllerCreateFromVmoWithParamsRequest {
2682 type Borrowed<'a> = &'a mut Self;
2683 fn take_or_borrow<'a>(
2684 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2685 ) -> Self::Borrowed<'a> {
2686 value
2687 }
2688 }
2689
2690 unsafe impl fidl::encoding::TypeMarker for RamdiskControllerCreateFromVmoWithParamsRequest {
2691 type Owned = Self;
2692
2693 #[inline(always)]
2694 fn inline_align(_context: fidl::encoding::Context) -> usize {
2695 8
2696 }
2697
2698 #[inline(always)]
2699 fn inline_size(_context: fidl::encoding::Context) -> usize {
2700 24
2701 }
2702 }
2703
2704 unsafe impl
2705 fidl::encoding::Encode<
2706 RamdiskControllerCreateFromVmoWithParamsRequest,
2707 fidl::encoding::DefaultFuchsiaResourceDialect,
2708 > for &mut RamdiskControllerCreateFromVmoWithParamsRequest
2709 {
2710 #[inline]
2711 unsafe fn encode(
2712 self,
2713 encoder: &mut fidl::encoding::Encoder<
2714 '_,
2715 fidl::encoding::DefaultFuchsiaResourceDialect,
2716 >,
2717 offset: usize,
2718 _depth: fidl::encoding::Depth,
2719 ) -> fidl::Result<()> {
2720 encoder.debug_check_bounds::<RamdiskControllerCreateFromVmoWithParamsRequest>(offset);
2721 fidl::encoding::Encode::<
2723 RamdiskControllerCreateFromVmoWithParamsRequest,
2724 fidl::encoding::DefaultFuchsiaResourceDialect,
2725 >::encode(
2726 (
2727 <fidl::encoding::HandleType<
2728 fidl::Vmo,
2729 { fidl::ObjectType::VMO.into_raw() },
2730 2147483648,
2731 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2732 &mut self.vmo
2733 ),
2734 <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.block_size),
2735 <fidl::encoding::Boxed<Guid> as fidl::encoding::ValueTypeMarker>::borrow(
2736 &self.type_guid,
2737 ),
2738 ),
2739 encoder,
2740 offset,
2741 _depth,
2742 )
2743 }
2744 }
2745 unsafe impl<
2746 T0: fidl::encoding::Encode<
2747 fidl::encoding::HandleType<
2748 fidl::Vmo,
2749 { fidl::ObjectType::VMO.into_raw() },
2750 2147483648,
2751 >,
2752 fidl::encoding::DefaultFuchsiaResourceDialect,
2753 >,
2754 T1: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
2755 T2: fidl::encoding::Encode<
2756 fidl::encoding::Boxed<Guid>,
2757 fidl::encoding::DefaultFuchsiaResourceDialect,
2758 >,
2759 >
2760 fidl::encoding::Encode<
2761 RamdiskControllerCreateFromVmoWithParamsRequest,
2762 fidl::encoding::DefaultFuchsiaResourceDialect,
2763 > for (T0, T1, T2)
2764 {
2765 #[inline]
2766 unsafe fn encode(
2767 self,
2768 encoder: &mut fidl::encoding::Encoder<
2769 '_,
2770 fidl::encoding::DefaultFuchsiaResourceDialect,
2771 >,
2772 offset: usize,
2773 depth: fidl::encoding::Depth,
2774 ) -> fidl::Result<()> {
2775 encoder.debug_check_bounds::<RamdiskControllerCreateFromVmoWithParamsRequest>(offset);
2776 unsafe {
2779 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
2780 (ptr as *mut u64).write_unaligned(0);
2781 }
2782 self.0.encode(encoder, offset + 0, depth)?;
2784 self.1.encode(encoder, offset + 8, depth)?;
2785 self.2.encode(encoder, offset + 16, depth)?;
2786 Ok(())
2787 }
2788 }
2789
2790 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2791 for RamdiskControllerCreateFromVmoWithParamsRequest
2792 {
2793 #[inline(always)]
2794 fn new_empty() -> Self {
2795 Self {
2796 vmo: fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
2797 block_size: fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect),
2798 type_guid: fidl::new_empty!(
2799 fidl::encoding::Boxed<Guid>,
2800 fidl::encoding::DefaultFuchsiaResourceDialect
2801 ),
2802 }
2803 }
2804
2805 #[inline]
2806 unsafe fn decode(
2807 &mut self,
2808 decoder: &mut fidl::encoding::Decoder<
2809 '_,
2810 fidl::encoding::DefaultFuchsiaResourceDialect,
2811 >,
2812 offset: usize,
2813 _depth: fidl::encoding::Depth,
2814 ) -> fidl::Result<()> {
2815 decoder.debug_check_bounds::<Self>(offset);
2816 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
2818 let padval = unsafe { (ptr as *const u64).read_unaligned() };
2819 let mask = 0xffffffff00000000u64;
2820 let maskedval = padval & mask;
2821 if maskedval != 0 {
2822 return Err(fidl::Error::NonZeroPadding {
2823 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
2824 });
2825 }
2826 fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.vmo, decoder, offset + 0, _depth)?;
2827 fidl::decode!(
2828 u64,
2829 fidl::encoding::DefaultFuchsiaResourceDialect,
2830 &mut self.block_size,
2831 decoder,
2832 offset + 8,
2833 _depth
2834 )?;
2835 fidl::decode!(
2836 fidl::encoding::Boxed<Guid>,
2837 fidl::encoding::DefaultFuchsiaResourceDialect,
2838 &mut self.type_guid,
2839 decoder,
2840 offset + 16,
2841 _depth
2842 )?;
2843 Ok(())
2844 }
2845 }
2846
2847 impl Options {
2848 #[inline(always)]
2849 fn max_ordinal_present(&self) -> u64 {
2850 if let Some(_) = self.device_flags {
2851 return 7;
2852 }
2853 if let Some(_) = self.max_transfer_blocks {
2854 return 6;
2855 }
2856 if let Some(_) = self.publish {
2857 return 5;
2858 }
2859 if let Some(_) = self.vmo {
2860 return 4;
2861 }
2862 if let Some(_) = self.type_guid {
2863 return 3;
2864 }
2865 if let Some(_) = self.block_count {
2866 return 2;
2867 }
2868 if let Some(_) = self.block_size {
2869 return 1;
2870 }
2871 0
2872 }
2873 }
2874
2875 impl fidl::encoding::ResourceTypeMarker for Options {
2876 type Borrowed<'a> = &'a mut Self;
2877 fn take_or_borrow<'a>(
2878 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2879 ) -> Self::Borrowed<'a> {
2880 value
2881 }
2882 }
2883
2884 unsafe impl fidl::encoding::TypeMarker for Options {
2885 type Owned = Self;
2886
2887 #[inline(always)]
2888 fn inline_align(_context: fidl::encoding::Context) -> usize {
2889 8
2890 }
2891
2892 #[inline(always)]
2893 fn inline_size(_context: fidl::encoding::Context) -> usize {
2894 16
2895 }
2896 }
2897
2898 unsafe impl fidl::encoding::Encode<Options, fidl::encoding::DefaultFuchsiaResourceDialect>
2899 for &mut Options
2900 {
2901 unsafe fn encode(
2902 self,
2903 encoder: &mut fidl::encoding::Encoder<
2904 '_,
2905 fidl::encoding::DefaultFuchsiaResourceDialect,
2906 >,
2907 offset: usize,
2908 mut depth: fidl::encoding::Depth,
2909 ) -> fidl::Result<()> {
2910 encoder.debug_check_bounds::<Options>(offset);
2911 let max_ordinal: u64 = self.max_ordinal_present();
2913 encoder.write_num(max_ordinal, offset);
2914 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2915 if max_ordinal == 0 {
2917 return Ok(());
2918 }
2919 depth.increment()?;
2920 let envelope_size = 8;
2921 let bytes_len = max_ordinal as usize * envelope_size;
2922 #[allow(unused_variables)]
2923 let offset = encoder.out_of_line_offset(bytes_len);
2924 let mut _prev_end_offset: usize = 0;
2925 if 1 > max_ordinal {
2926 return Ok(());
2927 }
2928
2929 let cur_offset: usize = (1 - 1) * envelope_size;
2932
2933 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2935
2936 fidl::encoding::encode_in_envelope_optional::<
2941 u32,
2942 fidl::encoding::DefaultFuchsiaResourceDialect,
2943 >(
2944 self.block_size.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
2945 encoder,
2946 offset + cur_offset,
2947 depth,
2948 )?;
2949
2950 _prev_end_offset = cur_offset + envelope_size;
2951 if 2 > max_ordinal {
2952 return Ok(());
2953 }
2954
2955 let cur_offset: usize = (2 - 1) * envelope_size;
2958
2959 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2961
2962 fidl::encoding::encode_in_envelope_optional::<
2967 u64,
2968 fidl::encoding::DefaultFuchsiaResourceDialect,
2969 >(
2970 self.block_count.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
2971 encoder,
2972 offset + cur_offset,
2973 depth,
2974 )?;
2975
2976 _prev_end_offset = cur_offset + envelope_size;
2977 if 3 > max_ordinal {
2978 return Ok(());
2979 }
2980
2981 let cur_offset: usize = (3 - 1) * envelope_size;
2984
2985 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2987
2988 fidl::encoding::encode_in_envelope_optional::<
2993 Guid,
2994 fidl::encoding::DefaultFuchsiaResourceDialect,
2995 >(
2996 self.type_guid.as_ref().map(<Guid as fidl::encoding::ValueTypeMarker>::borrow),
2997 encoder,
2998 offset + cur_offset,
2999 depth,
3000 )?;
3001
3002 _prev_end_offset = cur_offset + envelope_size;
3003 if 4 > max_ordinal {
3004 return Ok(());
3005 }
3006
3007 let cur_offset: usize = (4 - 1) * envelope_size;
3010
3011 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3013
3014 fidl::encoding::encode_in_envelope_optional::<
3019 fidl::encoding::HandleType<
3020 fidl::Vmo,
3021 { fidl::ObjectType::VMO.into_raw() },
3022 2147483648,
3023 >,
3024 fidl::encoding::DefaultFuchsiaResourceDialect,
3025 >(
3026 self.vmo.as_mut().map(
3027 <fidl::encoding::HandleType<
3028 fidl::Vmo,
3029 { fidl::ObjectType::VMO.into_raw() },
3030 2147483648,
3031 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
3032 ),
3033 encoder,
3034 offset + cur_offset,
3035 depth,
3036 )?;
3037
3038 _prev_end_offset = cur_offset + envelope_size;
3039 if 5 > max_ordinal {
3040 return Ok(());
3041 }
3042
3043 let cur_offset: usize = (5 - 1) * envelope_size;
3046
3047 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3049
3050 fidl::encoding::encode_in_envelope_optional::<
3055 bool,
3056 fidl::encoding::DefaultFuchsiaResourceDialect,
3057 >(
3058 self.publish.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
3059 encoder,
3060 offset + cur_offset,
3061 depth,
3062 )?;
3063
3064 _prev_end_offset = cur_offset + envelope_size;
3065 if 6 > max_ordinal {
3066 return Ok(());
3067 }
3068
3069 let cur_offset: usize = (6 - 1) * envelope_size;
3072
3073 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3075
3076 fidl::encoding::encode_in_envelope_optional::<
3081 u32,
3082 fidl::encoding::DefaultFuchsiaResourceDialect,
3083 >(
3084 self.max_transfer_blocks
3085 .as_ref()
3086 .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
3087 encoder,
3088 offset + cur_offset,
3089 depth,
3090 )?;
3091
3092 _prev_end_offset = cur_offset + envelope_size;
3093 if 7 > max_ordinal {
3094 return Ok(());
3095 }
3096
3097 let cur_offset: usize = (7 - 1) * envelope_size;
3100
3101 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3103
3104 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_storage_block::DeviceFlag, fidl::encoding::DefaultFuchsiaResourceDialect>(
3109 self.device_flags.as_ref().map(<fidl_fuchsia_storage_block::DeviceFlag as fidl::encoding::ValueTypeMarker>::borrow),
3110 encoder, offset + cur_offset, depth
3111 )?;
3112
3113 _prev_end_offset = cur_offset + envelope_size;
3114
3115 Ok(())
3116 }
3117 }
3118
3119 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for Options {
3120 #[inline(always)]
3121 fn new_empty() -> Self {
3122 Self::default()
3123 }
3124
3125 unsafe fn decode(
3126 &mut self,
3127 decoder: &mut fidl::encoding::Decoder<
3128 '_,
3129 fidl::encoding::DefaultFuchsiaResourceDialect,
3130 >,
3131 offset: usize,
3132 mut depth: fidl::encoding::Depth,
3133 ) -> fidl::Result<()> {
3134 decoder.debug_check_bounds::<Self>(offset);
3135 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3136 None => return Err(fidl::Error::NotNullable),
3137 Some(len) => len,
3138 };
3139 if len == 0 {
3141 return Ok(());
3142 };
3143 depth.increment()?;
3144 let envelope_size = 8;
3145 let bytes_len = len * envelope_size;
3146 let offset = decoder.out_of_line_offset(bytes_len)?;
3147 let mut _next_ordinal_to_read = 0;
3149 let mut next_offset = offset;
3150 let end_offset = offset + bytes_len;
3151 _next_ordinal_to_read += 1;
3152 if next_offset >= end_offset {
3153 return Ok(());
3154 }
3155
3156 while _next_ordinal_to_read < 1 {
3158 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3159 _next_ordinal_to_read += 1;
3160 next_offset += envelope_size;
3161 }
3162
3163 let next_out_of_line = decoder.next_out_of_line();
3164 let handles_before = decoder.remaining_handles();
3165 if let Some((inlined, num_bytes, num_handles)) =
3166 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3167 {
3168 let member_inline_size =
3169 <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3170 if inlined != (member_inline_size <= 4) {
3171 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3172 }
3173 let inner_offset;
3174 let mut inner_depth = depth.clone();
3175 if inlined {
3176 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3177 inner_offset = next_offset;
3178 } else {
3179 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3180 inner_depth.increment()?;
3181 }
3182 let val_ref = self.block_size.get_or_insert_with(|| {
3183 fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect)
3184 });
3185 fidl::decode!(
3186 u32,
3187 fidl::encoding::DefaultFuchsiaResourceDialect,
3188 val_ref,
3189 decoder,
3190 inner_offset,
3191 inner_depth
3192 )?;
3193 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3194 {
3195 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3196 }
3197 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3198 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3199 }
3200 }
3201
3202 next_offset += envelope_size;
3203 _next_ordinal_to_read += 1;
3204 if next_offset >= end_offset {
3205 return Ok(());
3206 }
3207
3208 while _next_ordinal_to_read < 2 {
3210 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3211 _next_ordinal_to_read += 1;
3212 next_offset += envelope_size;
3213 }
3214
3215 let next_out_of_line = decoder.next_out_of_line();
3216 let handles_before = decoder.remaining_handles();
3217 if let Some((inlined, num_bytes, num_handles)) =
3218 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3219 {
3220 let member_inline_size =
3221 <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3222 if inlined != (member_inline_size <= 4) {
3223 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3224 }
3225 let inner_offset;
3226 let mut inner_depth = depth.clone();
3227 if inlined {
3228 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3229 inner_offset = next_offset;
3230 } else {
3231 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3232 inner_depth.increment()?;
3233 }
3234 let val_ref = self.block_count.get_or_insert_with(|| {
3235 fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
3236 });
3237 fidl::decode!(
3238 u64,
3239 fidl::encoding::DefaultFuchsiaResourceDialect,
3240 val_ref,
3241 decoder,
3242 inner_offset,
3243 inner_depth
3244 )?;
3245 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3246 {
3247 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3248 }
3249 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3250 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3251 }
3252 }
3253
3254 next_offset += envelope_size;
3255 _next_ordinal_to_read += 1;
3256 if next_offset >= end_offset {
3257 return Ok(());
3258 }
3259
3260 while _next_ordinal_to_read < 3 {
3262 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3263 _next_ordinal_to_read += 1;
3264 next_offset += envelope_size;
3265 }
3266
3267 let next_out_of_line = decoder.next_out_of_line();
3268 let handles_before = decoder.remaining_handles();
3269 if let Some((inlined, num_bytes, num_handles)) =
3270 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3271 {
3272 let member_inline_size =
3273 <Guid as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3274 if inlined != (member_inline_size <= 4) {
3275 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3276 }
3277 let inner_offset;
3278 let mut inner_depth = depth.clone();
3279 if inlined {
3280 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3281 inner_offset = next_offset;
3282 } else {
3283 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3284 inner_depth.increment()?;
3285 }
3286 let val_ref = self.type_guid.get_or_insert_with(|| {
3287 fidl::new_empty!(Guid, fidl::encoding::DefaultFuchsiaResourceDialect)
3288 });
3289 fidl::decode!(
3290 Guid,
3291 fidl::encoding::DefaultFuchsiaResourceDialect,
3292 val_ref,
3293 decoder,
3294 inner_offset,
3295 inner_depth
3296 )?;
3297 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3298 {
3299 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3300 }
3301 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3302 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3303 }
3304 }
3305
3306 next_offset += envelope_size;
3307 _next_ordinal_to_read += 1;
3308 if next_offset >= end_offset {
3309 return Ok(());
3310 }
3311
3312 while _next_ordinal_to_read < 4 {
3314 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3315 _next_ordinal_to_read += 1;
3316 next_offset += envelope_size;
3317 }
3318
3319 let next_out_of_line = decoder.next_out_of_line();
3320 let handles_before = decoder.remaining_handles();
3321 if let Some((inlined, num_bytes, num_handles)) =
3322 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3323 {
3324 let member_inline_size = <fidl::encoding::HandleType<
3325 fidl::Vmo,
3326 { fidl::ObjectType::VMO.into_raw() },
3327 2147483648,
3328 > as fidl::encoding::TypeMarker>::inline_size(
3329 decoder.context
3330 );
3331 if inlined != (member_inline_size <= 4) {
3332 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3333 }
3334 let inner_offset;
3335 let mut inner_depth = depth.clone();
3336 if inlined {
3337 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3338 inner_offset = next_offset;
3339 } else {
3340 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3341 inner_depth.increment()?;
3342 }
3343 let val_ref =
3344 self.vmo.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
3345 fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
3346 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3347 {
3348 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3349 }
3350 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3351 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3352 }
3353 }
3354
3355 next_offset += envelope_size;
3356 _next_ordinal_to_read += 1;
3357 if next_offset >= end_offset {
3358 return Ok(());
3359 }
3360
3361 while _next_ordinal_to_read < 5 {
3363 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3364 _next_ordinal_to_read += 1;
3365 next_offset += envelope_size;
3366 }
3367
3368 let next_out_of_line = decoder.next_out_of_line();
3369 let handles_before = decoder.remaining_handles();
3370 if let Some((inlined, num_bytes, num_handles)) =
3371 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3372 {
3373 let member_inline_size =
3374 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3375 if inlined != (member_inline_size <= 4) {
3376 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3377 }
3378 let inner_offset;
3379 let mut inner_depth = depth.clone();
3380 if inlined {
3381 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3382 inner_offset = next_offset;
3383 } else {
3384 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3385 inner_depth.increment()?;
3386 }
3387 let val_ref = self.publish.get_or_insert_with(|| {
3388 fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
3389 });
3390 fidl::decode!(
3391 bool,
3392 fidl::encoding::DefaultFuchsiaResourceDialect,
3393 val_ref,
3394 decoder,
3395 inner_offset,
3396 inner_depth
3397 )?;
3398 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3399 {
3400 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3401 }
3402 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3403 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3404 }
3405 }
3406
3407 next_offset += envelope_size;
3408 _next_ordinal_to_read += 1;
3409 if next_offset >= end_offset {
3410 return Ok(());
3411 }
3412
3413 while _next_ordinal_to_read < 6 {
3415 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3416 _next_ordinal_to_read += 1;
3417 next_offset += envelope_size;
3418 }
3419
3420 let next_out_of_line = decoder.next_out_of_line();
3421 let handles_before = decoder.remaining_handles();
3422 if let Some((inlined, num_bytes, num_handles)) =
3423 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3424 {
3425 let member_inline_size =
3426 <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3427 if inlined != (member_inline_size <= 4) {
3428 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3429 }
3430 let inner_offset;
3431 let mut inner_depth = depth.clone();
3432 if inlined {
3433 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3434 inner_offset = next_offset;
3435 } else {
3436 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3437 inner_depth.increment()?;
3438 }
3439 let val_ref = self.max_transfer_blocks.get_or_insert_with(|| {
3440 fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect)
3441 });
3442 fidl::decode!(
3443 u32,
3444 fidl::encoding::DefaultFuchsiaResourceDialect,
3445 val_ref,
3446 decoder,
3447 inner_offset,
3448 inner_depth
3449 )?;
3450 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3451 {
3452 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3453 }
3454 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3455 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3456 }
3457 }
3458
3459 next_offset += envelope_size;
3460 _next_ordinal_to_read += 1;
3461 if next_offset >= end_offset {
3462 return Ok(());
3463 }
3464
3465 while _next_ordinal_to_read < 7 {
3467 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3468 _next_ordinal_to_read += 1;
3469 next_offset += envelope_size;
3470 }
3471
3472 let next_out_of_line = decoder.next_out_of_line();
3473 let handles_before = decoder.remaining_handles();
3474 if let Some((inlined, num_bytes, num_handles)) =
3475 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3476 {
3477 let member_inline_size = <fidl_fuchsia_storage_block::DeviceFlag as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3478 if inlined != (member_inline_size <= 4) {
3479 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3480 }
3481 let inner_offset;
3482 let mut inner_depth = depth.clone();
3483 if inlined {
3484 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3485 inner_offset = next_offset;
3486 } else {
3487 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3488 inner_depth.increment()?;
3489 }
3490 let val_ref = self.device_flags.get_or_insert_with(|| {
3491 fidl::new_empty!(
3492 fidl_fuchsia_storage_block::DeviceFlag,
3493 fidl::encoding::DefaultFuchsiaResourceDialect
3494 )
3495 });
3496 fidl::decode!(
3497 fidl_fuchsia_storage_block::DeviceFlag,
3498 fidl::encoding::DefaultFuchsiaResourceDialect,
3499 val_ref,
3500 decoder,
3501 inner_offset,
3502 inner_depth
3503 )?;
3504 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3505 {
3506 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3507 }
3508 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3509 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3510 }
3511 }
3512
3513 next_offset += envelope_size;
3514
3515 while next_offset < end_offset {
3517 _next_ordinal_to_read += 1;
3518 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3519 next_offset += envelope_size;
3520 }
3521
3522 Ok(())
3523 }
3524 }
3525}