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