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