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