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_fs_startup_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
16pub struct StartOptions {
17 pub read_only: bool,
19 pub verbose: bool,
21 pub fsck_after_every_transaction: bool,
24 pub write_compression_algorithm: CompressionAlgorithm,
27 pub write_compression_level: i32,
31 pub cache_eviction_policy_override: EvictionPolicyOverride,
34 pub startup_profiling_seconds: u32,
40}
41
42impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for StartOptions {}
43
44#[derive(Debug, PartialEq)]
45pub struct StartupCheckRequest {
46 pub device: fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_block::BlockMarker>,
47 pub options: CheckOptions,
48}
49
50impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for StartupCheckRequest {}
51
52#[derive(Debug, PartialEq)]
53pub struct StartupFormatRequest {
54 pub device: fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_block::BlockMarker>,
55 pub options: FormatOptions,
56}
57
58impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for StartupFormatRequest {}
59
60#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
61pub struct StartupStartRequest {
62 pub device: fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_block::BlockMarker>,
63 pub options: StartOptions,
64}
65
66impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for StartupStartRequest {}
67
68#[derive(Debug, PartialEq)]
69pub struct VolumeCheckRequest {
70 pub options: CheckOptions,
71}
72
73impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for VolumeCheckRequest {}
74
75#[derive(Debug, PartialEq)]
76pub struct VolumeMountRequest {
77 pub outgoing_directory: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
78 pub options: MountOptions,
79}
80
81impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for VolumeMountRequest {}
82
83#[derive(Debug, PartialEq)]
84pub struct VolumesCreateRequest {
85 pub name: String,
86 pub outgoing_directory: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
87 pub create_options: CreateOptions,
88 pub mount_options: MountOptions,
89}
90
91impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for VolumesCreateRequest {}
92
93#[derive(Debug, Default, PartialEq)]
95pub struct CheckOptions {
96 pub crypt: Option<fidl::endpoints::ClientEnd<fidl_fuchsia_fxfs::CryptMarker>>,
98 #[doc(hidden)]
99 pub __source_breaking: fidl::marker::SourceBreaking,
100}
101
102impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for CheckOptions {}
103
104#[derive(Debug, Default, PartialEq)]
107pub struct CreateOptions {
108 pub initial_size: Option<u64>,
111 pub guid: Option<[u8; 16]>,
113 pub type_guid: Option<[u8; 16]>,
116 #[doc(hidden)]
117 pub __source_breaking: fidl::marker::SourceBreaking,
118}
119
120impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for CreateOptions {}
121
122#[derive(Debug, Default, PartialEq)]
123pub struct MountOptions {
124 pub crypt: Option<fidl::endpoints::ClientEnd<fidl_fuchsia_fxfs::CryptMarker>>,
126 pub as_blob: Option<bool>,
128 pub uri: Option<String>,
133 #[doc(hidden)]
134 pub __source_breaking: fidl::marker::SourceBreaking,
135}
136
137impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for MountOptions {}
138
139#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
140pub struct StartupMarker;
141
142impl fidl::endpoints::ProtocolMarker for StartupMarker {
143 type Proxy = StartupProxy;
144 type RequestStream = StartupRequestStream;
145 #[cfg(target_os = "fuchsia")]
146 type SynchronousProxy = StartupSynchronousProxy;
147
148 const DEBUG_NAME: &'static str = "fuchsia.fs.startup.Startup";
149}
150impl fidl::endpoints::DiscoverableProtocolMarker for StartupMarker {}
151pub type StartupStartResult = Result<(), i32>;
152pub type StartupFormatResult = Result<(), i32>;
153pub type StartupCheckResult = Result<(), i32>;
154
155pub trait StartupProxyInterface: Send + Sync {
156 type StartResponseFut: std::future::Future<Output = Result<StartupStartResult, fidl::Error>>
157 + Send;
158 fn r#start(
159 &self,
160 device: fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_block::BlockMarker>,
161 options: StartOptions,
162 ) -> Self::StartResponseFut;
163 type FormatResponseFut: std::future::Future<Output = Result<StartupFormatResult, fidl::Error>>
164 + Send;
165 fn r#format(
166 &self,
167 device: fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_block::BlockMarker>,
168 options: &FormatOptions,
169 ) -> Self::FormatResponseFut;
170 type CheckResponseFut: std::future::Future<Output = Result<StartupCheckResult, fidl::Error>>
171 + Send;
172 fn r#check(
173 &self,
174 device: fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_block::BlockMarker>,
175 options: CheckOptions,
176 ) -> Self::CheckResponseFut;
177}
178#[derive(Debug)]
179#[cfg(target_os = "fuchsia")]
180pub struct StartupSynchronousProxy {
181 client: fidl::client::sync::Client,
182}
183
184#[cfg(target_os = "fuchsia")]
185impl fidl::endpoints::SynchronousProxy for StartupSynchronousProxy {
186 type Proxy = StartupProxy;
187 type Protocol = StartupMarker;
188
189 fn from_channel(inner: fidl::Channel) -> Self {
190 Self::new(inner)
191 }
192
193 fn into_channel(self) -> fidl::Channel {
194 self.client.into_channel()
195 }
196
197 fn as_channel(&self) -> &fidl::Channel {
198 self.client.as_channel()
199 }
200}
201
202#[cfg(target_os = "fuchsia")]
203impl StartupSynchronousProxy {
204 pub fn new(channel: fidl::Channel) -> Self {
205 let protocol_name = <StartupMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
206 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
207 }
208
209 pub fn into_channel(self) -> fidl::Channel {
210 self.client.into_channel()
211 }
212
213 pub fn wait_for_event(
216 &self,
217 deadline: zx::MonotonicInstant,
218 ) -> Result<StartupEvent, fidl::Error> {
219 StartupEvent::decode(self.client.wait_for_event(deadline)?)
220 }
221
222 pub fn r#start(
225 &self,
226 mut device: fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_block::BlockMarker>,
227 mut options: StartOptions,
228 ___deadline: zx::MonotonicInstant,
229 ) -> Result<StartupStartResult, fidl::Error> {
230 let _response = self.client.send_query::<
231 StartupStartRequest,
232 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
233 >(
234 (device, &mut options,),
235 0x317aa9458d3190c8,
236 fidl::encoding::DynamicFlags::empty(),
237 ___deadline,
238 )?;
239 Ok(_response.map(|x| x))
240 }
241
242 pub fn r#format(
244 &self,
245 mut device: fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_block::BlockMarker>,
246 mut options: &FormatOptions,
247 ___deadline: zx::MonotonicInstant,
248 ) -> Result<StartupFormatResult, fidl::Error> {
249 let _response = self.client.send_query::<
250 StartupFormatRequest,
251 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
252 >(
253 (device, options,),
254 0x3124676dd91933de,
255 fidl::encoding::DynamicFlags::empty(),
256 ___deadline,
257 )?;
258 Ok(_response.map(|x| x))
259 }
260
261 pub fn r#check(
265 &self,
266 mut device: fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_block::BlockMarker>,
267 mut options: CheckOptions,
268 ___deadline: zx::MonotonicInstant,
269 ) -> Result<StartupCheckResult, fidl::Error> {
270 let _response = self.client.send_query::<
271 StartupCheckRequest,
272 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
273 >(
274 (device, &mut options,),
275 0x81e85b3190e7db3,
276 fidl::encoding::DynamicFlags::empty(),
277 ___deadline,
278 )?;
279 Ok(_response.map(|x| x))
280 }
281}
282
283#[cfg(target_os = "fuchsia")]
284impl From<StartupSynchronousProxy> for zx::Handle {
285 fn from(value: StartupSynchronousProxy) -> Self {
286 value.into_channel().into()
287 }
288}
289
290#[cfg(target_os = "fuchsia")]
291impl From<fidl::Channel> for StartupSynchronousProxy {
292 fn from(value: fidl::Channel) -> Self {
293 Self::new(value)
294 }
295}
296
297#[derive(Debug, Clone)]
298pub struct StartupProxy {
299 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
300}
301
302impl fidl::endpoints::Proxy for StartupProxy {
303 type Protocol = StartupMarker;
304
305 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
306 Self::new(inner)
307 }
308
309 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
310 self.client.into_channel().map_err(|client| Self { client })
311 }
312
313 fn as_channel(&self) -> &::fidl::AsyncChannel {
314 self.client.as_channel()
315 }
316}
317
318impl StartupProxy {
319 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
321 let protocol_name = <StartupMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
322 Self { client: fidl::client::Client::new(channel, protocol_name) }
323 }
324
325 pub fn take_event_stream(&self) -> StartupEventStream {
331 StartupEventStream { event_receiver: self.client.take_event_receiver() }
332 }
333
334 pub fn r#start(
337 &self,
338 mut device: fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_block::BlockMarker>,
339 mut options: StartOptions,
340 ) -> fidl::client::QueryResponseFut<
341 StartupStartResult,
342 fidl::encoding::DefaultFuchsiaResourceDialect,
343 > {
344 StartupProxyInterface::r#start(self, device, options)
345 }
346
347 pub fn r#format(
349 &self,
350 mut device: fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_block::BlockMarker>,
351 mut options: &FormatOptions,
352 ) -> fidl::client::QueryResponseFut<
353 StartupFormatResult,
354 fidl::encoding::DefaultFuchsiaResourceDialect,
355 > {
356 StartupProxyInterface::r#format(self, device, options)
357 }
358
359 pub fn r#check(
363 &self,
364 mut device: fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_block::BlockMarker>,
365 mut options: CheckOptions,
366 ) -> fidl::client::QueryResponseFut<
367 StartupCheckResult,
368 fidl::encoding::DefaultFuchsiaResourceDialect,
369 > {
370 StartupProxyInterface::r#check(self, device, options)
371 }
372}
373
374impl StartupProxyInterface for StartupProxy {
375 type StartResponseFut = fidl::client::QueryResponseFut<
376 StartupStartResult,
377 fidl::encoding::DefaultFuchsiaResourceDialect,
378 >;
379 fn r#start(
380 &self,
381 mut device: fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_block::BlockMarker>,
382 mut options: StartOptions,
383 ) -> Self::StartResponseFut {
384 fn _decode(
385 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
386 ) -> Result<StartupStartResult, fidl::Error> {
387 let _response = fidl::client::decode_transaction_body::<
388 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
389 fidl::encoding::DefaultFuchsiaResourceDialect,
390 0x317aa9458d3190c8,
391 >(_buf?)?;
392 Ok(_response.map(|x| x))
393 }
394 self.client.send_query_and_decode::<StartupStartRequest, StartupStartResult>(
395 (device, &mut options),
396 0x317aa9458d3190c8,
397 fidl::encoding::DynamicFlags::empty(),
398 _decode,
399 )
400 }
401
402 type FormatResponseFut = fidl::client::QueryResponseFut<
403 StartupFormatResult,
404 fidl::encoding::DefaultFuchsiaResourceDialect,
405 >;
406 fn r#format(
407 &self,
408 mut device: fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_block::BlockMarker>,
409 mut options: &FormatOptions,
410 ) -> Self::FormatResponseFut {
411 fn _decode(
412 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
413 ) -> Result<StartupFormatResult, fidl::Error> {
414 let _response = fidl::client::decode_transaction_body::<
415 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
416 fidl::encoding::DefaultFuchsiaResourceDialect,
417 0x3124676dd91933de,
418 >(_buf?)?;
419 Ok(_response.map(|x| x))
420 }
421 self.client.send_query_and_decode::<StartupFormatRequest, StartupFormatResult>(
422 (device, options),
423 0x3124676dd91933de,
424 fidl::encoding::DynamicFlags::empty(),
425 _decode,
426 )
427 }
428
429 type CheckResponseFut = fidl::client::QueryResponseFut<
430 StartupCheckResult,
431 fidl::encoding::DefaultFuchsiaResourceDialect,
432 >;
433 fn r#check(
434 &self,
435 mut device: fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_block::BlockMarker>,
436 mut options: CheckOptions,
437 ) -> Self::CheckResponseFut {
438 fn _decode(
439 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
440 ) -> Result<StartupCheckResult, fidl::Error> {
441 let _response = fidl::client::decode_transaction_body::<
442 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
443 fidl::encoding::DefaultFuchsiaResourceDialect,
444 0x81e85b3190e7db3,
445 >(_buf?)?;
446 Ok(_response.map(|x| x))
447 }
448 self.client.send_query_and_decode::<StartupCheckRequest, StartupCheckResult>(
449 (device, &mut options),
450 0x81e85b3190e7db3,
451 fidl::encoding::DynamicFlags::empty(),
452 _decode,
453 )
454 }
455}
456
457pub struct StartupEventStream {
458 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
459}
460
461impl std::marker::Unpin for StartupEventStream {}
462
463impl futures::stream::FusedStream for StartupEventStream {
464 fn is_terminated(&self) -> bool {
465 self.event_receiver.is_terminated()
466 }
467}
468
469impl futures::Stream for StartupEventStream {
470 type Item = Result<StartupEvent, fidl::Error>;
471
472 fn poll_next(
473 mut self: std::pin::Pin<&mut Self>,
474 cx: &mut std::task::Context<'_>,
475 ) -> std::task::Poll<Option<Self::Item>> {
476 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
477 &mut self.event_receiver,
478 cx
479 )?) {
480 Some(buf) => std::task::Poll::Ready(Some(StartupEvent::decode(buf))),
481 None => std::task::Poll::Ready(None),
482 }
483 }
484}
485
486#[derive(Debug)]
487pub enum StartupEvent {}
488
489impl StartupEvent {
490 fn decode(
492 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
493 ) -> Result<StartupEvent, fidl::Error> {
494 let (bytes, _handles) = buf.split_mut();
495 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
496 debug_assert_eq!(tx_header.tx_id, 0);
497 match tx_header.ordinal {
498 _ => Err(fidl::Error::UnknownOrdinal {
499 ordinal: tx_header.ordinal,
500 protocol_name: <StartupMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
501 }),
502 }
503 }
504}
505
506pub struct StartupRequestStream {
508 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
509 is_terminated: bool,
510}
511
512impl std::marker::Unpin for StartupRequestStream {}
513
514impl futures::stream::FusedStream for StartupRequestStream {
515 fn is_terminated(&self) -> bool {
516 self.is_terminated
517 }
518}
519
520impl fidl::endpoints::RequestStream for StartupRequestStream {
521 type Protocol = StartupMarker;
522 type ControlHandle = StartupControlHandle;
523
524 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
525 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
526 }
527
528 fn control_handle(&self) -> Self::ControlHandle {
529 StartupControlHandle { inner: self.inner.clone() }
530 }
531
532 fn into_inner(
533 self,
534 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
535 {
536 (self.inner, self.is_terminated)
537 }
538
539 fn from_inner(
540 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
541 is_terminated: bool,
542 ) -> Self {
543 Self { inner, is_terminated }
544 }
545}
546
547impl futures::Stream for StartupRequestStream {
548 type Item = Result<StartupRequest, fidl::Error>;
549
550 fn poll_next(
551 mut self: std::pin::Pin<&mut Self>,
552 cx: &mut std::task::Context<'_>,
553 ) -> std::task::Poll<Option<Self::Item>> {
554 let this = &mut *self;
555 if this.inner.check_shutdown(cx) {
556 this.is_terminated = true;
557 return std::task::Poll::Ready(None);
558 }
559 if this.is_terminated {
560 panic!("polled StartupRequestStream after completion");
561 }
562 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
563 |bytes, handles| {
564 match this.inner.channel().read_etc(cx, bytes, handles) {
565 std::task::Poll::Ready(Ok(())) => {}
566 std::task::Poll::Pending => return std::task::Poll::Pending,
567 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
568 this.is_terminated = true;
569 return std::task::Poll::Ready(None);
570 }
571 std::task::Poll::Ready(Err(e)) => {
572 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
573 e.into(),
574 ))))
575 }
576 }
577
578 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
580
581 std::task::Poll::Ready(Some(match header.ordinal {
582 0x317aa9458d3190c8 => {
583 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
584 let mut req = fidl::new_empty!(
585 StartupStartRequest,
586 fidl::encoding::DefaultFuchsiaResourceDialect
587 );
588 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StartupStartRequest>(&header, _body_bytes, handles, &mut req)?;
589 let control_handle = StartupControlHandle { inner: this.inner.clone() };
590 Ok(StartupRequest::Start {
591 device: req.device,
592 options: req.options,
593
594 responder: StartupStartResponder {
595 control_handle: std::mem::ManuallyDrop::new(control_handle),
596 tx_id: header.tx_id,
597 },
598 })
599 }
600 0x3124676dd91933de => {
601 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
602 let mut req = fidl::new_empty!(
603 StartupFormatRequest,
604 fidl::encoding::DefaultFuchsiaResourceDialect
605 );
606 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StartupFormatRequest>(&header, _body_bytes, handles, &mut req)?;
607 let control_handle = StartupControlHandle { inner: this.inner.clone() };
608 Ok(StartupRequest::Format {
609 device: req.device,
610 options: req.options,
611
612 responder: StartupFormatResponder {
613 control_handle: std::mem::ManuallyDrop::new(control_handle),
614 tx_id: header.tx_id,
615 },
616 })
617 }
618 0x81e85b3190e7db3 => {
619 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
620 let mut req = fidl::new_empty!(
621 StartupCheckRequest,
622 fidl::encoding::DefaultFuchsiaResourceDialect
623 );
624 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StartupCheckRequest>(&header, _body_bytes, handles, &mut req)?;
625 let control_handle = StartupControlHandle { inner: this.inner.clone() };
626 Ok(StartupRequest::Check {
627 device: req.device,
628 options: req.options,
629
630 responder: StartupCheckResponder {
631 control_handle: std::mem::ManuallyDrop::new(control_handle),
632 tx_id: header.tx_id,
633 },
634 })
635 }
636 _ => Err(fidl::Error::UnknownOrdinal {
637 ordinal: header.ordinal,
638 protocol_name:
639 <StartupMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
640 }),
641 }))
642 },
643 )
644 }
645}
646
647#[derive(Debug)]
648pub enum StartupRequest {
649 Start {
652 device: fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_block::BlockMarker>,
653 options: StartOptions,
654 responder: StartupStartResponder,
655 },
656 Format {
658 device: fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_block::BlockMarker>,
659 options: FormatOptions,
660 responder: StartupFormatResponder,
661 },
662 Check {
666 device: fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_block::BlockMarker>,
667 options: CheckOptions,
668 responder: StartupCheckResponder,
669 },
670}
671
672impl StartupRequest {
673 #[allow(irrefutable_let_patterns)]
674 pub fn into_start(
675 self,
676 ) -> Option<(
677 fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_block::BlockMarker>,
678 StartOptions,
679 StartupStartResponder,
680 )> {
681 if let StartupRequest::Start { device, options, responder } = self {
682 Some((device, options, responder))
683 } else {
684 None
685 }
686 }
687
688 #[allow(irrefutable_let_patterns)]
689 pub fn into_format(
690 self,
691 ) -> Option<(
692 fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_block::BlockMarker>,
693 FormatOptions,
694 StartupFormatResponder,
695 )> {
696 if let StartupRequest::Format { device, options, responder } = self {
697 Some((device, options, responder))
698 } else {
699 None
700 }
701 }
702
703 #[allow(irrefutable_let_patterns)]
704 pub fn into_check(
705 self,
706 ) -> Option<(
707 fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_block::BlockMarker>,
708 CheckOptions,
709 StartupCheckResponder,
710 )> {
711 if let StartupRequest::Check { device, options, responder } = self {
712 Some((device, options, responder))
713 } else {
714 None
715 }
716 }
717
718 pub fn method_name(&self) -> &'static str {
720 match *self {
721 StartupRequest::Start { .. } => "start",
722 StartupRequest::Format { .. } => "format",
723 StartupRequest::Check { .. } => "check",
724 }
725 }
726}
727
728#[derive(Debug, Clone)]
729pub struct StartupControlHandle {
730 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
731}
732
733impl fidl::endpoints::ControlHandle for StartupControlHandle {
734 fn shutdown(&self) {
735 self.inner.shutdown()
736 }
737 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
738 self.inner.shutdown_with_epitaph(status)
739 }
740
741 fn is_closed(&self) -> bool {
742 self.inner.channel().is_closed()
743 }
744 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
745 self.inner.channel().on_closed()
746 }
747
748 #[cfg(target_os = "fuchsia")]
749 fn signal_peer(
750 &self,
751 clear_mask: zx::Signals,
752 set_mask: zx::Signals,
753 ) -> Result<(), zx_status::Status> {
754 use fidl::Peered;
755 self.inner.channel().signal_peer(clear_mask, set_mask)
756 }
757}
758
759impl StartupControlHandle {}
760
761#[must_use = "FIDL methods require a response to be sent"]
762#[derive(Debug)]
763pub struct StartupStartResponder {
764 control_handle: std::mem::ManuallyDrop<StartupControlHandle>,
765 tx_id: u32,
766}
767
768impl std::ops::Drop for StartupStartResponder {
772 fn drop(&mut self) {
773 self.control_handle.shutdown();
774 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
776 }
777}
778
779impl fidl::endpoints::Responder for StartupStartResponder {
780 type ControlHandle = StartupControlHandle;
781
782 fn control_handle(&self) -> &StartupControlHandle {
783 &self.control_handle
784 }
785
786 fn drop_without_shutdown(mut self) {
787 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
789 std::mem::forget(self);
791 }
792}
793
794impl StartupStartResponder {
795 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
799 let _result = self.send_raw(result);
800 if _result.is_err() {
801 self.control_handle.shutdown();
802 }
803 self.drop_without_shutdown();
804 _result
805 }
806
807 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
809 let _result = self.send_raw(result);
810 self.drop_without_shutdown();
811 _result
812 }
813
814 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
815 self.control_handle
816 .inner
817 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
818 result,
819 self.tx_id,
820 0x317aa9458d3190c8,
821 fidl::encoding::DynamicFlags::empty(),
822 )
823 }
824}
825
826#[must_use = "FIDL methods require a response to be sent"]
827#[derive(Debug)]
828pub struct StartupFormatResponder {
829 control_handle: std::mem::ManuallyDrop<StartupControlHandle>,
830 tx_id: u32,
831}
832
833impl std::ops::Drop for StartupFormatResponder {
837 fn drop(&mut self) {
838 self.control_handle.shutdown();
839 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
841 }
842}
843
844impl fidl::endpoints::Responder for StartupFormatResponder {
845 type ControlHandle = StartupControlHandle;
846
847 fn control_handle(&self) -> &StartupControlHandle {
848 &self.control_handle
849 }
850
851 fn drop_without_shutdown(mut self) {
852 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
854 std::mem::forget(self);
856 }
857}
858
859impl StartupFormatResponder {
860 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
864 let _result = self.send_raw(result);
865 if _result.is_err() {
866 self.control_handle.shutdown();
867 }
868 self.drop_without_shutdown();
869 _result
870 }
871
872 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
874 let _result = self.send_raw(result);
875 self.drop_without_shutdown();
876 _result
877 }
878
879 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
880 self.control_handle
881 .inner
882 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
883 result,
884 self.tx_id,
885 0x3124676dd91933de,
886 fidl::encoding::DynamicFlags::empty(),
887 )
888 }
889}
890
891#[must_use = "FIDL methods require a response to be sent"]
892#[derive(Debug)]
893pub struct StartupCheckResponder {
894 control_handle: std::mem::ManuallyDrop<StartupControlHandle>,
895 tx_id: u32,
896}
897
898impl std::ops::Drop for StartupCheckResponder {
902 fn drop(&mut self) {
903 self.control_handle.shutdown();
904 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
906 }
907}
908
909impl fidl::endpoints::Responder for StartupCheckResponder {
910 type ControlHandle = StartupControlHandle;
911
912 fn control_handle(&self) -> &StartupControlHandle {
913 &self.control_handle
914 }
915
916 fn drop_without_shutdown(mut self) {
917 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
919 std::mem::forget(self);
921 }
922}
923
924impl StartupCheckResponder {
925 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
929 let _result = self.send_raw(result);
930 if _result.is_err() {
931 self.control_handle.shutdown();
932 }
933 self.drop_without_shutdown();
934 _result
935 }
936
937 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
939 let _result = self.send_raw(result);
940 self.drop_without_shutdown();
941 _result
942 }
943
944 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
945 self.control_handle
946 .inner
947 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
948 result,
949 self.tx_id,
950 0x81e85b3190e7db3,
951 fidl::encoding::DynamicFlags::empty(),
952 )
953 }
954}
955
956#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
957pub struct VolumeMarker;
958
959impl fidl::endpoints::ProtocolMarker for VolumeMarker {
960 type Proxy = VolumeProxy;
961 type RequestStream = VolumeRequestStream;
962 #[cfg(target_os = "fuchsia")]
963 type SynchronousProxy = VolumeSynchronousProxy;
964
965 const DEBUG_NAME: &'static str = "(anonymous) Volume";
966}
967pub type VolumeMountResult = Result<(), i32>;
968pub type VolumeCheckResult = Result<(), i32>;
969pub type VolumeSetLimitResult = Result<(), i32>;
970pub type VolumeGetLimitResult = Result<u64, i32>;
971
972pub trait VolumeProxyInterface: Send + Sync {
973 type MountResponseFut: std::future::Future<Output = Result<VolumeMountResult, fidl::Error>>
974 + Send;
975 fn r#mount(
976 &self,
977 outgoing_directory: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
978 options: MountOptions,
979 ) -> Self::MountResponseFut;
980 type CheckResponseFut: std::future::Future<Output = Result<VolumeCheckResult, fidl::Error>>
981 + Send;
982 fn r#check(&self, options: CheckOptions) -> Self::CheckResponseFut;
983 type SetLimitResponseFut: std::future::Future<Output = Result<VolumeSetLimitResult, fidl::Error>>
984 + Send;
985 fn r#set_limit(&self, bytes: u64) -> Self::SetLimitResponseFut;
986 type GetLimitResponseFut: std::future::Future<Output = Result<VolumeGetLimitResult, fidl::Error>>
987 + Send;
988 fn r#get_limit(&self) -> Self::GetLimitResponseFut;
989}
990#[derive(Debug)]
991#[cfg(target_os = "fuchsia")]
992pub struct VolumeSynchronousProxy {
993 client: fidl::client::sync::Client,
994}
995
996#[cfg(target_os = "fuchsia")]
997impl fidl::endpoints::SynchronousProxy for VolumeSynchronousProxy {
998 type Proxy = VolumeProxy;
999 type Protocol = VolumeMarker;
1000
1001 fn from_channel(inner: fidl::Channel) -> Self {
1002 Self::new(inner)
1003 }
1004
1005 fn into_channel(self) -> fidl::Channel {
1006 self.client.into_channel()
1007 }
1008
1009 fn as_channel(&self) -> &fidl::Channel {
1010 self.client.as_channel()
1011 }
1012}
1013
1014#[cfg(target_os = "fuchsia")]
1015impl VolumeSynchronousProxy {
1016 pub fn new(channel: fidl::Channel) -> Self {
1017 let protocol_name = <VolumeMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1018 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1019 }
1020
1021 pub fn into_channel(self) -> fidl::Channel {
1022 self.client.into_channel()
1023 }
1024
1025 pub fn wait_for_event(
1028 &self,
1029 deadline: zx::MonotonicInstant,
1030 ) -> Result<VolumeEvent, fidl::Error> {
1031 VolumeEvent::decode(self.client.wait_for_event(deadline)?)
1032 }
1033
1034 pub fn r#mount(
1039 &self,
1040 mut outgoing_directory: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
1041 mut options: MountOptions,
1042 ___deadline: zx::MonotonicInstant,
1043 ) -> Result<VolumeMountResult, fidl::Error> {
1044 let _response = self.client.send_query::<
1045 VolumeMountRequest,
1046 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1047 >(
1048 (outgoing_directory, &mut options,),
1049 0x3470ab56d455af0,
1050 fidl::encoding::DynamicFlags::empty(),
1051 ___deadline,
1052 )?;
1053 Ok(_response.map(|x| x))
1054 }
1055
1056 pub fn r#check(
1059 &self,
1060 mut options: CheckOptions,
1061 ___deadline: zx::MonotonicInstant,
1062 ) -> Result<VolumeCheckResult, fidl::Error> {
1063 let _response = self.client.send_query::<
1064 VolumeCheckRequest,
1065 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1066 >(
1067 (&mut options,),
1068 0x5b638348f5e0418c,
1069 fidl::encoding::DynamicFlags::empty(),
1070 ___deadline,
1071 )?;
1072 Ok(_response.map(|x| x))
1073 }
1074
1075 pub fn r#set_limit(
1078 &self,
1079 mut bytes: u64,
1080 ___deadline: zx::MonotonicInstant,
1081 ) -> Result<VolumeSetLimitResult, fidl::Error> {
1082 let _response = self.client.send_query::<
1083 VolumeSetLimitRequest,
1084 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1085 >(
1086 (bytes,),
1087 0x19286d83eb3cd137,
1088 fidl::encoding::DynamicFlags::empty(),
1089 ___deadline,
1090 )?;
1091 Ok(_response.map(|x| x))
1092 }
1093
1094 pub fn r#get_limit(
1103 &self,
1104 ___deadline: zx::MonotonicInstant,
1105 ) -> Result<VolumeGetLimitResult, fidl::Error> {
1106 let _response = self.client.send_query::<
1107 fidl::encoding::EmptyPayload,
1108 fidl::encoding::ResultType<VolumeGetLimitResponse, i32>,
1109 >(
1110 (),
1111 0xb14e4950939f16,
1112 fidl::encoding::DynamicFlags::empty(),
1113 ___deadline,
1114 )?;
1115 Ok(_response.map(|x| x.bytes))
1116 }
1117}
1118
1119#[cfg(target_os = "fuchsia")]
1120impl From<VolumeSynchronousProxy> for zx::Handle {
1121 fn from(value: VolumeSynchronousProxy) -> Self {
1122 value.into_channel().into()
1123 }
1124}
1125
1126#[cfg(target_os = "fuchsia")]
1127impl From<fidl::Channel> for VolumeSynchronousProxy {
1128 fn from(value: fidl::Channel) -> Self {
1129 Self::new(value)
1130 }
1131}
1132
1133#[derive(Debug, Clone)]
1134pub struct VolumeProxy {
1135 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1136}
1137
1138impl fidl::endpoints::Proxy for VolumeProxy {
1139 type Protocol = VolumeMarker;
1140
1141 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1142 Self::new(inner)
1143 }
1144
1145 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1146 self.client.into_channel().map_err(|client| Self { client })
1147 }
1148
1149 fn as_channel(&self) -> &::fidl::AsyncChannel {
1150 self.client.as_channel()
1151 }
1152}
1153
1154impl VolumeProxy {
1155 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1157 let protocol_name = <VolumeMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1158 Self { client: fidl::client::Client::new(channel, protocol_name) }
1159 }
1160
1161 pub fn take_event_stream(&self) -> VolumeEventStream {
1167 VolumeEventStream { event_receiver: self.client.take_event_receiver() }
1168 }
1169
1170 pub fn r#mount(
1175 &self,
1176 mut outgoing_directory: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
1177 mut options: MountOptions,
1178 ) -> fidl::client::QueryResponseFut<
1179 VolumeMountResult,
1180 fidl::encoding::DefaultFuchsiaResourceDialect,
1181 > {
1182 VolumeProxyInterface::r#mount(self, outgoing_directory, options)
1183 }
1184
1185 pub fn r#check(
1188 &self,
1189 mut options: CheckOptions,
1190 ) -> fidl::client::QueryResponseFut<
1191 VolumeCheckResult,
1192 fidl::encoding::DefaultFuchsiaResourceDialect,
1193 > {
1194 VolumeProxyInterface::r#check(self, options)
1195 }
1196
1197 pub fn r#set_limit(
1200 &self,
1201 mut bytes: u64,
1202 ) -> fidl::client::QueryResponseFut<
1203 VolumeSetLimitResult,
1204 fidl::encoding::DefaultFuchsiaResourceDialect,
1205 > {
1206 VolumeProxyInterface::r#set_limit(self, bytes)
1207 }
1208
1209 pub fn r#get_limit(
1218 &self,
1219 ) -> fidl::client::QueryResponseFut<
1220 VolumeGetLimitResult,
1221 fidl::encoding::DefaultFuchsiaResourceDialect,
1222 > {
1223 VolumeProxyInterface::r#get_limit(self)
1224 }
1225}
1226
1227impl VolumeProxyInterface for VolumeProxy {
1228 type MountResponseFut = fidl::client::QueryResponseFut<
1229 VolumeMountResult,
1230 fidl::encoding::DefaultFuchsiaResourceDialect,
1231 >;
1232 fn r#mount(
1233 &self,
1234 mut outgoing_directory: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
1235 mut options: MountOptions,
1236 ) -> Self::MountResponseFut {
1237 fn _decode(
1238 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1239 ) -> Result<VolumeMountResult, fidl::Error> {
1240 let _response = fidl::client::decode_transaction_body::<
1241 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1242 fidl::encoding::DefaultFuchsiaResourceDialect,
1243 0x3470ab56d455af0,
1244 >(_buf?)?;
1245 Ok(_response.map(|x| x))
1246 }
1247 self.client.send_query_and_decode::<VolumeMountRequest, VolumeMountResult>(
1248 (outgoing_directory, &mut options),
1249 0x3470ab56d455af0,
1250 fidl::encoding::DynamicFlags::empty(),
1251 _decode,
1252 )
1253 }
1254
1255 type CheckResponseFut = fidl::client::QueryResponseFut<
1256 VolumeCheckResult,
1257 fidl::encoding::DefaultFuchsiaResourceDialect,
1258 >;
1259 fn r#check(&self, mut options: CheckOptions) -> Self::CheckResponseFut {
1260 fn _decode(
1261 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1262 ) -> Result<VolumeCheckResult, fidl::Error> {
1263 let _response = fidl::client::decode_transaction_body::<
1264 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1265 fidl::encoding::DefaultFuchsiaResourceDialect,
1266 0x5b638348f5e0418c,
1267 >(_buf?)?;
1268 Ok(_response.map(|x| x))
1269 }
1270 self.client.send_query_and_decode::<VolumeCheckRequest, VolumeCheckResult>(
1271 (&mut options,),
1272 0x5b638348f5e0418c,
1273 fidl::encoding::DynamicFlags::empty(),
1274 _decode,
1275 )
1276 }
1277
1278 type SetLimitResponseFut = fidl::client::QueryResponseFut<
1279 VolumeSetLimitResult,
1280 fidl::encoding::DefaultFuchsiaResourceDialect,
1281 >;
1282 fn r#set_limit(&self, mut bytes: u64) -> Self::SetLimitResponseFut {
1283 fn _decode(
1284 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1285 ) -> Result<VolumeSetLimitResult, fidl::Error> {
1286 let _response = fidl::client::decode_transaction_body::<
1287 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1288 fidl::encoding::DefaultFuchsiaResourceDialect,
1289 0x19286d83eb3cd137,
1290 >(_buf?)?;
1291 Ok(_response.map(|x| x))
1292 }
1293 self.client.send_query_and_decode::<VolumeSetLimitRequest, VolumeSetLimitResult>(
1294 (bytes,),
1295 0x19286d83eb3cd137,
1296 fidl::encoding::DynamicFlags::empty(),
1297 _decode,
1298 )
1299 }
1300
1301 type GetLimitResponseFut = fidl::client::QueryResponseFut<
1302 VolumeGetLimitResult,
1303 fidl::encoding::DefaultFuchsiaResourceDialect,
1304 >;
1305 fn r#get_limit(&self) -> Self::GetLimitResponseFut {
1306 fn _decode(
1307 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1308 ) -> Result<VolumeGetLimitResult, fidl::Error> {
1309 let _response = fidl::client::decode_transaction_body::<
1310 fidl::encoding::ResultType<VolumeGetLimitResponse, i32>,
1311 fidl::encoding::DefaultFuchsiaResourceDialect,
1312 0xb14e4950939f16,
1313 >(_buf?)?;
1314 Ok(_response.map(|x| x.bytes))
1315 }
1316 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, VolumeGetLimitResult>(
1317 (),
1318 0xb14e4950939f16,
1319 fidl::encoding::DynamicFlags::empty(),
1320 _decode,
1321 )
1322 }
1323}
1324
1325pub struct VolumeEventStream {
1326 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1327}
1328
1329impl std::marker::Unpin for VolumeEventStream {}
1330
1331impl futures::stream::FusedStream for VolumeEventStream {
1332 fn is_terminated(&self) -> bool {
1333 self.event_receiver.is_terminated()
1334 }
1335}
1336
1337impl futures::Stream for VolumeEventStream {
1338 type Item = Result<VolumeEvent, fidl::Error>;
1339
1340 fn poll_next(
1341 mut self: std::pin::Pin<&mut Self>,
1342 cx: &mut std::task::Context<'_>,
1343 ) -> std::task::Poll<Option<Self::Item>> {
1344 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1345 &mut self.event_receiver,
1346 cx
1347 )?) {
1348 Some(buf) => std::task::Poll::Ready(Some(VolumeEvent::decode(buf))),
1349 None => std::task::Poll::Ready(None),
1350 }
1351 }
1352}
1353
1354#[derive(Debug)]
1355pub enum VolumeEvent {}
1356
1357impl VolumeEvent {
1358 fn decode(
1360 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1361 ) -> Result<VolumeEvent, fidl::Error> {
1362 let (bytes, _handles) = buf.split_mut();
1363 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1364 debug_assert_eq!(tx_header.tx_id, 0);
1365 match tx_header.ordinal {
1366 _ => Err(fidl::Error::UnknownOrdinal {
1367 ordinal: tx_header.ordinal,
1368 protocol_name: <VolumeMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1369 }),
1370 }
1371 }
1372}
1373
1374pub struct VolumeRequestStream {
1376 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1377 is_terminated: bool,
1378}
1379
1380impl std::marker::Unpin for VolumeRequestStream {}
1381
1382impl futures::stream::FusedStream for VolumeRequestStream {
1383 fn is_terminated(&self) -> bool {
1384 self.is_terminated
1385 }
1386}
1387
1388impl fidl::endpoints::RequestStream for VolumeRequestStream {
1389 type Protocol = VolumeMarker;
1390 type ControlHandle = VolumeControlHandle;
1391
1392 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1393 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1394 }
1395
1396 fn control_handle(&self) -> Self::ControlHandle {
1397 VolumeControlHandle { inner: self.inner.clone() }
1398 }
1399
1400 fn into_inner(
1401 self,
1402 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1403 {
1404 (self.inner, self.is_terminated)
1405 }
1406
1407 fn from_inner(
1408 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1409 is_terminated: bool,
1410 ) -> Self {
1411 Self { inner, is_terminated }
1412 }
1413}
1414
1415impl futures::Stream for VolumeRequestStream {
1416 type Item = Result<VolumeRequest, fidl::Error>;
1417
1418 fn poll_next(
1419 mut self: std::pin::Pin<&mut Self>,
1420 cx: &mut std::task::Context<'_>,
1421 ) -> std::task::Poll<Option<Self::Item>> {
1422 let this = &mut *self;
1423 if this.inner.check_shutdown(cx) {
1424 this.is_terminated = true;
1425 return std::task::Poll::Ready(None);
1426 }
1427 if this.is_terminated {
1428 panic!("polled VolumeRequestStream after completion");
1429 }
1430 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1431 |bytes, handles| {
1432 match this.inner.channel().read_etc(cx, bytes, handles) {
1433 std::task::Poll::Ready(Ok(())) => {}
1434 std::task::Poll::Pending => return std::task::Poll::Pending,
1435 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1436 this.is_terminated = true;
1437 return std::task::Poll::Ready(None);
1438 }
1439 std::task::Poll::Ready(Err(e)) => {
1440 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1441 e.into(),
1442 ))))
1443 }
1444 }
1445
1446 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1448
1449 std::task::Poll::Ready(Some(match header.ordinal {
1450 0x3470ab56d455af0 => {
1451 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1452 let mut req = fidl::new_empty!(
1453 VolumeMountRequest,
1454 fidl::encoding::DefaultFuchsiaResourceDialect
1455 );
1456 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VolumeMountRequest>(&header, _body_bytes, handles, &mut req)?;
1457 let control_handle = VolumeControlHandle { inner: this.inner.clone() };
1458 Ok(VolumeRequest::Mount {
1459 outgoing_directory: req.outgoing_directory,
1460 options: req.options,
1461
1462 responder: VolumeMountResponder {
1463 control_handle: std::mem::ManuallyDrop::new(control_handle),
1464 tx_id: header.tx_id,
1465 },
1466 })
1467 }
1468 0x5b638348f5e0418c => {
1469 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1470 let mut req = fidl::new_empty!(
1471 VolumeCheckRequest,
1472 fidl::encoding::DefaultFuchsiaResourceDialect
1473 );
1474 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VolumeCheckRequest>(&header, _body_bytes, handles, &mut req)?;
1475 let control_handle = VolumeControlHandle { inner: this.inner.clone() };
1476 Ok(VolumeRequest::Check {
1477 options: req.options,
1478
1479 responder: VolumeCheckResponder {
1480 control_handle: std::mem::ManuallyDrop::new(control_handle),
1481 tx_id: header.tx_id,
1482 },
1483 })
1484 }
1485 0x19286d83eb3cd137 => {
1486 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1487 let mut req = fidl::new_empty!(
1488 VolumeSetLimitRequest,
1489 fidl::encoding::DefaultFuchsiaResourceDialect
1490 );
1491 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VolumeSetLimitRequest>(&header, _body_bytes, handles, &mut req)?;
1492 let control_handle = VolumeControlHandle { inner: this.inner.clone() };
1493 Ok(VolumeRequest::SetLimit {
1494 bytes: req.bytes,
1495
1496 responder: VolumeSetLimitResponder {
1497 control_handle: std::mem::ManuallyDrop::new(control_handle),
1498 tx_id: header.tx_id,
1499 },
1500 })
1501 }
1502 0xb14e4950939f16 => {
1503 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1504 let mut req = fidl::new_empty!(
1505 fidl::encoding::EmptyPayload,
1506 fidl::encoding::DefaultFuchsiaResourceDialect
1507 );
1508 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1509 let control_handle = VolumeControlHandle { inner: this.inner.clone() };
1510 Ok(VolumeRequest::GetLimit {
1511 responder: VolumeGetLimitResponder {
1512 control_handle: std::mem::ManuallyDrop::new(control_handle),
1513 tx_id: header.tx_id,
1514 },
1515 })
1516 }
1517 _ => Err(fidl::Error::UnknownOrdinal {
1518 ordinal: header.ordinal,
1519 protocol_name:
1520 <VolumeMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1521 }),
1522 }))
1523 },
1524 )
1525 }
1526}
1527
1528#[derive(Debug)]
1529pub enum VolumeRequest {
1530 Mount {
1535 outgoing_directory: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
1536 options: MountOptions,
1537 responder: VolumeMountResponder,
1538 },
1539 Check { options: CheckOptions, responder: VolumeCheckResponder },
1542 SetLimit { bytes: u64, responder: VolumeSetLimitResponder },
1545 GetLimit { responder: VolumeGetLimitResponder },
1554}
1555
1556impl VolumeRequest {
1557 #[allow(irrefutable_let_patterns)]
1558 pub fn into_mount(
1559 self,
1560 ) -> Option<(
1561 fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
1562 MountOptions,
1563 VolumeMountResponder,
1564 )> {
1565 if let VolumeRequest::Mount { outgoing_directory, options, responder } = self {
1566 Some((outgoing_directory, options, responder))
1567 } else {
1568 None
1569 }
1570 }
1571
1572 #[allow(irrefutable_let_patterns)]
1573 pub fn into_check(self) -> Option<(CheckOptions, VolumeCheckResponder)> {
1574 if let VolumeRequest::Check { options, responder } = self {
1575 Some((options, responder))
1576 } else {
1577 None
1578 }
1579 }
1580
1581 #[allow(irrefutable_let_patterns)]
1582 pub fn into_set_limit(self) -> Option<(u64, VolumeSetLimitResponder)> {
1583 if let VolumeRequest::SetLimit { bytes, responder } = self {
1584 Some((bytes, responder))
1585 } else {
1586 None
1587 }
1588 }
1589
1590 #[allow(irrefutable_let_patterns)]
1591 pub fn into_get_limit(self) -> Option<(VolumeGetLimitResponder)> {
1592 if let VolumeRequest::GetLimit { responder } = self {
1593 Some((responder))
1594 } else {
1595 None
1596 }
1597 }
1598
1599 pub fn method_name(&self) -> &'static str {
1601 match *self {
1602 VolumeRequest::Mount { .. } => "mount",
1603 VolumeRequest::Check { .. } => "check",
1604 VolumeRequest::SetLimit { .. } => "set_limit",
1605 VolumeRequest::GetLimit { .. } => "get_limit",
1606 }
1607 }
1608}
1609
1610#[derive(Debug, Clone)]
1611pub struct VolumeControlHandle {
1612 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1613}
1614
1615impl fidl::endpoints::ControlHandle for VolumeControlHandle {
1616 fn shutdown(&self) {
1617 self.inner.shutdown()
1618 }
1619 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1620 self.inner.shutdown_with_epitaph(status)
1621 }
1622
1623 fn is_closed(&self) -> bool {
1624 self.inner.channel().is_closed()
1625 }
1626 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1627 self.inner.channel().on_closed()
1628 }
1629
1630 #[cfg(target_os = "fuchsia")]
1631 fn signal_peer(
1632 &self,
1633 clear_mask: zx::Signals,
1634 set_mask: zx::Signals,
1635 ) -> Result<(), zx_status::Status> {
1636 use fidl::Peered;
1637 self.inner.channel().signal_peer(clear_mask, set_mask)
1638 }
1639}
1640
1641impl VolumeControlHandle {}
1642
1643#[must_use = "FIDL methods require a response to be sent"]
1644#[derive(Debug)]
1645pub struct VolumeMountResponder {
1646 control_handle: std::mem::ManuallyDrop<VolumeControlHandle>,
1647 tx_id: u32,
1648}
1649
1650impl std::ops::Drop for VolumeMountResponder {
1654 fn drop(&mut self) {
1655 self.control_handle.shutdown();
1656 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1658 }
1659}
1660
1661impl fidl::endpoints::Responder for VolumeMountResponder {
1662 type ControlHandle = VolumeControlHandle;
1663
1664 fn control_handle(&self) -> &VolumeControlHandle {
1665 &self.control_handle
1666 }
1667
1668 fn drop_without_shutdown(mut self) {
1669 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1671 std::mem::forget(self);
1673 }
1674}
1675
1676impl VolumeMountResponder {
1677 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1681 let _result = self.send_raw(result);
1682 if _result.is_err() {
1683 self.control_handle.shutdown();
1684 }
1685 self.drop_without_shutdown();
1686 _result
1687 }
1688
1689 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1691 let _result = self.send_raw(result);
1692 self.drop_without_shutdown();
1693 _result
1694 }
1695
1696 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1697 self.control_handle
1698 .inner
1699 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1700 result,
1701 self.tx_id,
1702 0x3470ab56d455af0,
1703 fidl::encoding::DynamicFlags::empty(),
1704 )
1705 }
1706}
1707
1708#[must_use = "FIDL methods require a response to be sent"]
1709#[derive(Debug)]
1710pub struct VolumeCheckResponder {
1711 control_handle: std::mem::ManuallyDrop<VolumeControlHandle>,
1712 tx_id: u32,
1713}
1714
1715impl std::ops::Drop for VolumeCheckResponder {
1719 fn drop(&mut self) {
1720 self.control_handle.shutdown();
1721 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1723 }
1724}
1725
1726impl fidl::endpoints::Responder for VolumeCheckResponder {
1727 type ControlHandle = VolumeControlHandle;
1728
1729 fn control_handle(&self) -> &VolumeControlHandle {
1730 &self.control_handle
1731 }
1732
1733 fn drop_without_shutdown(mut self) {
1734 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1736 std::mem::forget(self);
1738 }
1739}
1740
1741impl VolumeCheckResponder {
1742 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1746 let _result = self.send_raw(result);
1747 if _result.is_err() {
1748 self.control_handle.shutdown();
1749 }
1750 self.drop_without_shutdown();
1751 _result
1752 }
1753
1754 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1756 let _result = self.send_raw(result);
1757 self.drop_without_shutdown();
1758 _result
1759 }
1760
1761 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1762 self.control_handle
1763 .inner
1764 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1765 result,
1766 self.tx_id,
1767 0x5b638348f5e0418c,
1768 fidl::encoding::DynamicFlags::empty(),
1769 )
1770 }
1771}
1772
1773#[must_use = "FIDL methods require a response to be sent"]
1774#[derive(Debug)]
1775pub struct VolumeSetLimitResponder {
1776 control_handle: std::mem::ManuallyDrop<VolumeControlHandle>,
1777 tx_id: u32,
1778}
1779
1780impl std::ops::Drop for VolumeSetLimitResponder {
1784 fn drop(&mut self) {
1785 self.control_handle.shutdown();
1786 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1788 }
1789}
1790
1791impl fidl::endpoints::Responder for VolumeSetLimitResponder {
1792 type ControlHandle = VolumeControlHandle;
1793
1794 fn control_handle(&self) -> &VolumeControlHandle {
1795 &self.control_handle
1796 }
1797
1798 fn drop_without_shutdown(mut self) {
1799 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1801 std::mem::forget(self);
1803 }
1804}
1805
1806impl VolumeSetLimitResponder {
1807 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1811 let _result = self.send_raw(result);
1812 if _result.is_err() {
1813 self.control_handle.shutdown();
1814 }
1815 self.drop_without_shutdown();
1816 _result
1817 }
1818
1819 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1821 let _result = self.send_raw(result);
1822 self.drop_without_shutdown();
1823 _result
1824 }
1825
1826 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1827 self.control_handle
1828 .inner
1829 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1830 result,
1831 self.tx_id,
1832 0x19286d83eb3cd137,
1833 fidl::encoding::DynamicFlags::empty(),
1834 )
1835 }
1836}
1837
1838#[must_use = "FIDL methods require a response to be sent"]
1839#[derive(Debug)]
1840pub struct VolumeGetLimitResponder {
1841 control_handle: std::mem::ManuallyDrop<VolumeControlHandle>,
1842 tx_id: u32,
1843}
1844
1845impl std::ops::Drop for VolumeGetLimitResponder {
1849 fn drop(&mut self) {
1850 self.control_handle.shutdown();
1851 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1853 }
1854}
1855
1856impl fidl::endpoints::Responder for VolumeGetLimitResponder {
1857 type ControlHandle = VolumeControlHandle;
1858
1859 fn control_handle(&self) -> &VolumeControlHandle {
1860 &self.control_handle
1861 }
1862
1863 fn drop_without_shutdown(mut self) {
1864 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1866 std::mem::forget(self);
1868 }
1869}
1870
1871impl VolumeGetLimitResponder {
1872 pub fn send(self, mut result: Result<u64, i32>) -> Result<(), fidl::Error> {
1876 let _result = self.send_raw(result);
1877 if _result.is_err() {
1878 self.control_handle.shutdown();
1879 }
1880 self.drop_without_shutdown();
1881 _result
1882 }
1883
1884 pub fn send_no_shutdown_on_err(self, mut result: Result<u64, i32>) -> Result<(), fidl::Error> {
1886 let _result = self.send_raw(result);
1887 self.drop_without_shutdown();
1888 _result
1889 }
1890
1891 fn send_raw(&self, mut result: Result<u64, i32>) -> Result<(), fidl::Error> {
1892 self.control_handle.inner.send::<fidl::encoding::ResultType<VolumeGetLimitResponse, i32>>(
1893 result.map(|bytes| (bytes,)),
1894 self.tx_id,
1895 0xb14e4950939f16,
1896 fidl::encoding::DynamicFlags::empty(),
1897 )
1898 }
1899}
1900
1901#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1902pub struct VolumesMarker;
1903
1904impl fidl::endpoints::ProtocolMarker for VolumesMarker {
1905 type Proxy = VolumesProxy;
1906 type RequestStream = VolumesRequestStream;
1907 #[cfg(target_os = "fuchsia")]
1908 type SynchronousProxy = VolumesSynchronousProxy;
1909
1910 const DEBUG_NAME: &'static str = "fuchsia.fs.startup.Volumes";
1911}
1912impl fidl::endpoints::DiscoverableProtocolMarker for VolumesMarker {}
1913pub type VolumesCreateResult = Result<(), i32>;
1914pub type VolumesRemoveResult = Result<(), i32>;
1915
1916pub trait VolumesProxyInterface: Send + Sync {
1917 type CreateResponseFut: std::future::Future<Output = Result<VolumesCreateResult, fidl::Error>>
1918 + Send;
1919 fn r#create(
1920 &self,
1921 name: &str,
1922 outgoing_directory: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
1923 create_options: CreateOptions,
1924 mount_options: MountOptions,
1925 ) -> Self::CreateResponseFut;
1926 type RemoveResponseFut: std::future::Future<Output = Result<VolumesRemoveResult, fidl::Error>>
1927 + Send;
1928 fn r#remove(&self, name: &str) -> Self::RemoveResponseFut;
1929}
1930#[derive(Debug)]
1931#[cfg(target_os = "fuchsia")]
1932pub struct VolumesSynchronousProxy {
1933 client: fidl::client::sync::Client,
1934}
1935
1936#[cfg(target_os = "fuchsia")]
1937impl fidl::endpoints::SynchronousProxy for VolumesSynchronousProxy {
1938 type Proxy = VolumesProxy;
1939 type Protocol = VolumesMarker;
1940
1941 fn from_channel(inner: fidl::Channel) -> Self {
1942 Self::new(inner)
1943 }
1944
1945 fn into_channel(self) -> fidl::Channel {
1946 self.client.into_channel()
1947 }
1948
1949 fn as_channel(&self) -> &fidl::Channel {
1950 self.client.as_channel()
1951 }
1952}
1953
1954#[cfg(target_os = "fuchsia")]
1955impl VolumesSynchronousProxy {
1956 pub fn new(channel: fidl::Channel) -> Self {
1957 let protocol_name = <VolumesMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1958 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1959 }
1960
1961 pub fn into_channel(self) -> fidl::Channel {
1962 self.client.into_channel()
1963 }
1964
1965 pub fn wait_for_event(
1968 &self,
1969 deadline: zx::MonotonicInstant,
1970 ) -> Result<VolumesEvent, fidl::Error> {
1971 VolumesEvent::decode(self.client.wait_for_event(deadline)?)
1972 }
1973
1974 pub fn r#create(
1979 &self,
1980 mut name: &str,
1981 mut outgoing_directory: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
1982 mut create_options: CreateOptions,
1983 mut mount_options: MountOptions,
1984 ___deadline: zx::MonotonicInstant,
1985 ) -> Result<VolumesCreateResult, fidl::Error> {
1986 let _response = self.client.send_query::<
1987 VolumesCreateRequest,
1988 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1989 >(
1990 (name, outgoing_directory, &mut create_options, &mut mount_options,),
1991 0x11a55097834b38e8,
1992 fidl::encoding::DynamicFlags::empty(),
1993 ___deadline,
1994 )?;
1995 Ok(_response.map(|x| x))
1996 }
1997
1998 pub fn r#remove(
2001 &self,
2002 mut name: &str,
2003 ___deadline: zx::MonotonicInstant,
2004 ) -> Result<VolumesRemoveResult, fidl::Error> {
2005 let _response = self.client.send_query::<
2006 VolumesRemoveRequest,
2007 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
2008 >(
2009 (name,),
2010 0x70983b9344dc2292,
2011 fidl::encoding::DynamicFlags::empty(),
2012 ___deadline,
2013 )?;
2014 Ok(_response.map(|x| x))
2015 }
2016}
2017
2018#[cfg(target_os = "fuchsia")]
2019impl From<VolumesSynchronousProxy> for zx::Handle {
2020 fn from(value: VolumesSynchronousProxy) -> Self {
2021 value.into_channel().into()
2022 }
2023}
2024
2025#[cfg(target_os = "fuchsia")]
2026impl From<fidl::Channel> for VolumesSynchronousProxy {
2027 fn from(value: fidl::Channel) -> Self {
2028 Self::new(value)
2029 }
2030}
2031
2032#[derive(Debug, Clone)]
2033pub struct VolumesProxy {
2034 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2035}
2036
2037impl fidl::endpoints::Proxy for VolumesProxy {
2038 type Protocol = VolumesMarker;
2039
2040 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2041 Self::new(inner)
2042 }
2043
2044 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2045 self.client.into_channel().map_err(|client| Self { client })
2046 }
2047
2048 fn as_channel(&self) -> &::fidl::AsyncChannel {
2049 self.client.as_channel()
2050 }
2051}
2052
2053impl VolumesProxy {
2054 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2056 let protocol_name = <VolumesMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2057 Self { client: fidl::client::Client::new(channel, protocol_name) }
2058 }
2059
2060 pub fn take_event_stream(&self) -> VolumesEventStream {
2066 VolumesEventStream { event_receiver: self.client.take_event_receiver() }
2067 }
2068
2069 pub fn r#create(
2074 &self,
2075 mut name: &str,
2076 mut outgoing_directory: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
2077 mut create_options: CreateOptions,
2078 mut mount_options: MountOptions,
2079 ) -> fidl::client::QueryResponseFut<
2080 VolumesCreateResult,
2081 fidl::encoding::DefaultFuchsiaResourceDialect,
2082 > {
2083 VolumesProxyInterface::r#create(
2084 self,
2085 name,
2086 outgoing_directory,
2087 create_options,
2088 mount_options,
2089 )
2090 }
2091
2092 pub fn r#remove(
2095 &self,
2096 mut name: &str,
2097 ) -> fidl::client::QueryResponseFut<
2098 VolumesRemoveResult,
2099 fidl::encoding::DefaultFuchsiaResourceDialect,
2100 > {
2101 VolumesProxyInterface::r#remove(self, name)
2102 }
2103}
2104
2105impl VolumesProxyInterface for VolumesProxy {
2106 type CreateResponseFut = fidl::client::QueryResponseFut<
2107 VolumesCreateResult,
2108 fidl::encoding::DefaultFuchsiaResourceDialect,
2109 >;
2110 fn r#create(
2111 &self,
2112 mut name: &str,
2113 mut outgoing_directory: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
2114 mut create_options: CreateOptions,
2115 mut mount_options: MountOptions,
2116 ) -> Self::CreateResponseFut {
2117 fn _decode(
2118 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2119 ) -> Result<VolumesCreateResult, fidl::Error> {
2120 let _response = fidl::client::decode_transaction_body::<
2121 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
2122 fidl::encoding::DefaultFuchsiaResourceDialect,
2123 0x11a55097834b38e8,
2124 >(_buf?)?;
2125 Ok(_response.map(|x| x))
2126 }
2127 self.client.send_query_and_decode::<VolumesCreateRequest, VolumesCreateResult>(
2128 (name, outgoing_directory, &mut create_options, &mut mount_options),
2129 0x11a55097834b38e8,
2130 fidl::encoding::DynamicFlags::empty(),
2131 _decode,
2132 )
2133 }
2134
2135 type RemoveResponseFut = fidl::client::QueryResponseFut<
2136 VolumesRemoveResult,
2137 fidl::encoding::DefaultFuchsiaResourceDialect,
2138 >;
2139 fn r#remove(&self, mut name: &str) -> Self::RemoveResponseFut {
2140 fn _decode(
2141 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2142 ) -> Result<VolumesRemoveResult, fidl::Error> {
2143 let _response = fidl::client::decode_transaction_body::<
2144 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
2145 fidl::encoding::DefaultFuchsiaResourceDialect,
2146 0x70983b9344dc2292,
2147 >(_buf?)?;
2148 Ok(_response.map(|x| x))
2149 }
2150 self.client.send_query_and_decode::<VolumesRemoveRequest, VolumesRemoveResult>(
2151 (name,),
2152 0x70983b9344dc2292,
2153 fidl::encoding::DynamicFlags::empty(),
2154 _decode,
2155 )
2156 }
2157}
2158
2159pub struct VolumesEventStream {
2160 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2161}
2162
2163impl std::marker::Unpin for VolumesEventStream {}
2164
2165impl futures::stream::FusedStream for VolumesEventStream {
2166 fn is_terminated(&self) -> bool {
2167 self.event_receiver.is_terminated()
2168 }
2169}
2170
2171impl futures::Stream for VolumesEventStream {
2172 type Item = Result<VolumesEvent, fidl::Error>;
2173
2174 fn poll_next(
2175 mut self: std::pin::Pin<&mut Self>,
2176 cx: &mut std::task::Context<'_>,
2177 ) -> std::task::Poll<Option<Self::Item>> {
2178 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2179 &mut self.event_receiver,
2180 cx
2181 )?) {
2182 Some(buf) => std::task::Poll::Ready(Some(VolumesEvent::decode(buf))),
2183 None => std::task::Poll::Ready(None),
2184 }
2185 }
2186}
2187
2188#[derive(Debug)]
2189pub enum VolumesEvent {}
2190
2191impl VolumesEvent {
2192 fn decode(
2194 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2195 ) -> Result<VolumesEvent, fidl::Error> {
2196 let (bytes, _handles) = buf.split_mut();
2197 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2198 debug_assert_eq!(tx_header.tx_id, 0);
2199 match tx_header.ordinal {
2200 _ => Err(fidl::Error::UnknownOrdinal {
2201 ordinal: tx_header.ordinal,
2202 protocol_name: <VolumesMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2203 }),
2204 }
2205 }
2206}
2207
2208pub struct VolumesRequestStream {
2210 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2211 is_terminated: bool,
2212}
2213
2214impl std::marker::Unpin for VolumesRequestStream {}
2215
2216impl futures::stream::FusedStream for VolumesRequestStream {
2217 fn is_terminated(&self) -> bool {
2218 self.is_terminated
2219 }
2220}
2221
2222impl fidl::endpoints::RequestStream for VolumesRequestStream {
2223 type Protocol = VolumesMarker;
2224 type ControlHandle = VolumesControlHandle;
2225
2226 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2227 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2228 }
2229
2230 fn control_handle(&self) -> Self::ControlHandle {
2231 VolumesControlHandle { inner: self.inner.clone() }
2232 }
2233
2234 fn into_inner(
2235 self,
2236 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2237 {
2238 (self.inner, self.is_terminated)
2239 }
2240
2241 fn from_inner(
2242 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2243 is_terminated: bool,
2244 ) -> Self {
2245 Self { inner, is_terminated }
2246 }
2247}
2248
2249impl futures::Stream for VolumesRequestStream {
2250 type Item = Result<VolumesRequest, fidl::Error>;
2251
2252 fn poll_next(
2253 mut self: std::pin::Pin<&mut Self>,
2254 cx: &mut std::task::Context<'_>,
2255 ) -> std::task::Poll<Option<Self::Item>> {
2256 let this = &mut *self;
2257 if this.inner.check_shutdown(cx) {
2258 this.is_terminated = true;
2259 return std::task::Poll::Ready(None);
2260 }
2261 if this.is_terminated {
2262 panic!("polled VolumesRequestStream after completion");
2263 }
2264 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2265 |bytes, handles| {
2266 match this.inner.channel().read_etc(cx, bytes, handles) {
2267 std::task::Poll::Ready(Ok(())) => {}
2268 std::task::Poll::Pending => return std::task::Poll::Pending,
2269 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2270 this.is_terminated = true;
2271 return std::task::Poll::Ready(None);
2272 }
2273 std::task::Poll::Ready(Err(e)) => {
2274 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2275 e.into(),
2276 ))))
2277 }
2278 }
2279
2280 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2282
2283 std::task::Poll::Ready(Some(match header.ordinal {
2284 0x11a55097834b38e8 => {
2285 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2286 let mut req = fidl::new_empty!(
2287 VolumesCreateRequest,
2288 fidl::encoding::DefaultFuchsiaResourceDialect
2289 );
2290 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VolumesCreateRequest>(&header, _body_bytes, handles, &mut req)?;
2291 let control_handle = VolumesControlHandle { inner: this.inner.clone() };
2292 Ok(VolumesRequest::Create {
2293 name: req.name,
2294 outgoing_directory: req.outgoing_directory,
2295 create_options: req.create_options,
2296 mount_options: req.mount_options,
2297
2298 responder: VolumesCreateResponder {
2299 control_handle: std::mem::ManuallyDrop::new(control_handle),
2300 tx_id: header.tx_id,
2301 },
2302 })
2303 }
2304 0x70983b9344dc2292 => {
2305 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2306 let mut req = fidl::new_empty!(
2307 VolumesRemoveRequest,
2308 fidl::encoding::DefaultFuchsiaResourceDialect
2309 );
2310 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VolumesRemoveRequest>(&header, _body_bytes, handles, &mut req)?;
2311 let control_handle = VolumesControlHandle { inner: this.inner.clone() };
2312 Ok(VolumesRequest::Remove {
2313 name: req.name,
2314
2315 responder: VolumesRemoveResponder {
2316 control_handle: std::mem::ManuallyDrop::new(control_handle),
2317 tx_id: header.tx_id,
2318 },
2319 })
2320 }
2321 _ => Err(fidl::Error::UnknownOrdinal {
2322 ordinal: header.ordinal,
2323 protocol_name:
2324 <VolumesMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2325 }),
2326 }))
2327 },
2328 )
2329 }
2330}
2331
2332#[derive(Debug)]
2341pub enum VolumesRequest {
2342 Create {
2347 name: String,
2348 outgoing_directory: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
2349 create_options: CreateOptions,
2350 mount_options: MountOptions,
2351 responder: VolumesCreateResponder,
2352 },
2353 Remove { name: String, responder: VolumesRemoveResponder },
2356}
2357
2358impl VolumesRequest {
2359 #[allow(irrefutable_let_patterns)]
2360 pub fn into_create(
2361 self,
2362 ) -> Option<(
2363 String,
2364 fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
2365 CreateOptions,
2366 MountOptions,
2367 VolumesCreateResponder,
2368 )> {
2369 if let VolumesRequest::Create {
2370 name,
2371 outgoing_directory,
2372 create_options,
2373 mount_options,
2374 responder,
2375 } = self
2376 {
2377 Some((name, outgoing_directory, create_options, mount_options, responder))
2378 } else {
2379 None
2380 }
2381 }
2382
2383 #[allow(irrefutable_let_patterns)]
2384 pub fn into_remove(self) -> Option<(String, VolumesRemoveResponder)> {
2385 if let VolumesRequest::Remove { name, responder } = self {
2386 Some((name, responder))
2387 } else {
2388 None
2389 }
2390 }
2391
2392 pub fn method_name(&self) -> &'static str {
2394 match *self {
2395 VolumesRequest::Create { .. } => "create",
2396 VolumesRequest::Remove { .. } => "remove",
2397 }
2398 }
2399}
2400
2401#[derive(Debug, Clone)]
2402pub struct VolumesControlHandle {
2403 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2404}
2405
2406impl fidl::endpoints::ControlHandle for VolumesControlHandle {
2407 fn shutdown(&self) {
2408 self.inner.shutdown()
2409 }
2410 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2411 self.inner.shutdown_with_epitaph(status)
2412 }
2413
2414 fn is_closed(&self) -> bool {
2415 self.inner.channel().is_closed()
2416 }
2417 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2418 self.inner.channel().on_closed()
2419 }
2420
2421 #[cfg(target_os = "fuchsia")]
2422 fn signal_peer(
2423 &self,
2424 clear_mask: zx::Signals,
2425 set_mask: zx::Signals,
2426 ) -> Result<(), zx_status::Status> {
2427 use fidl::Peered;
2428 self.inner.channel().signal_peer(clear_mask, set_mask)
2429 }
2430}
2431
2432impl VolumesControlHandle {}
2433
2434#[must_use = "FIDL methods require a response to be sent"]
2435#[derive(Debug)]
2436pub struct VolumesCreateResponder {
2437 control_handle: std::mem::ManuallyDrop<VolumesControlHandle>,
2438 tx_id: u32,
2439}
2440
2441impl std::ops::Drop for VolumesCreateResponder {
2445 fn drop(&mut self) {
2446 self.control_handle.shutdown();
2447 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2449 }
2450}
2451
2452impl fidl::endpoints::Responder for VolumesCreateResponder {
2453 type ControlHandle = VolumesControlHandle;
2454
2455 fn control_handle(&self) -> &VolumesControlHandle {
2456 &self.control_handle
2457 }
2458
2459 fn drop_without_shutdown(mut self) {
2460 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2462 std::mem::forget(self);
2464 }
2465}
2466
2467impl VolumesCreateResponder {
2468 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2472 let _result = self.send_raw(result);
2473 if _result.is_err() {
2474 self.control_handle.shutdown();
2475 }
2476 self.drop_without_shutdown();
2477 _result
2478 }
2479
2480 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2482 let _result = self.send_raw(result);
2483 self.drop_without_shutdown();
2484 _result
2485 }
2486
2487 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2488 self.control_handle
2489 .inner
2490 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
2491 result,
2492 self.tx_id,
2493 0x11a55097834b38e8,
2494 fidl::encoding::DynamicFlags::empty(),
2495 )
2496 }
2497}
2498
2499#[must_use = "FIDL methods require a response to be sent"]
2500#[derive(Debug)]
2501pub struct VolumesRemoveResponder {
2502 control_handle: std::mem::ManuallyDrop<VolumesControlHandle>,
2503 tx_id: u32,
2504}
2505
2506impl std::ops::Drop for VolumesRemoveResponder {
2510 fn drop(&mut self) {
2511 self.control_handle.shutdown();
2512 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2514 }
2515}
2516
2517impl fidl::endpoints::Responder for VolumesRemoveResponder {
2518 type ControlHandle = VolumesControlHandle;
2519
2520 fn control_handle(&self) -> &VolumesControlHandle {
2521 &self.control_handle
2522 }
2523
2524 fn drop_without_shutdown(mut self) {
2525 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2527 std::mem::forget(self);
2529 }
2530}
2531
2532impl VolumesRemoveResponder {
2533 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2537 let _result = self.send_raw(result);
2538 if _result.is_err() {
2539 self.control_handle.shutdown();
2540 }
2541 self.drop_without_shutdown();
2542 _result
2543 }
2544
2545 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2547 let _result = self.send_raw(result);
2548 self.drop_without_shutdown();
2549 _result
2550 }
2551
2552 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2553 self.control_handle
2554 .inner
2555 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
2556 result,
2557 self.tx_id,
2558 0x70983b9344dc2292,
2559 fidl::encoding::DynamicFlags::empty(),
2560 )
2561 }
2562}
2563
2564mod internal {
2565 use super::*;
2566
2567 impl fidl::encoding::ResourceTypeMarker for StartOptions {
2568 type Borrowed<'a> = &'a mut Self;
2569 fn take_or_borrow<'a>(
2570 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2571 ) -> Self::Borrowed<'a> {
2572 value
2573 }
2574 }
2575
2576 unsafe impl fidl::encoding::TypeMarker for StartOptions {
2577 type Owned = Self;
2578
2579 #[inline(always)]
2580 fn inline_align(_context: fidl::encoding::Context) -> usize {
2581 4
2582 }
2583
2584 #[inline(always)]
2585 fn inline_size(_context: fidl::encoding::Context) -> usize {
2586 20
2587 }
2588 }
2589
2590 unsafe impl fidl::encoding::Encode<StartOptions, fidl::encoding::DefaultFuchsiaResourceDialect>
2591 for &mut StartOptions
2592 {
2593 #[inline]
2594 unsafe fn encode(
2595 self,
2596 encoder: &mut fidl::encoding::Encoder<
2597 '_,
2598 fidl::encoding::DefaultFuchsiaResourceDialect,
2599 >,
2600 offset: usize,
2601 _depth: fidl::encoding::Depth,
2602 ) -> fidl::Result<()> {
2603 encoder.debug_check_bounds::<StartOptions>(offset);
2604 fidl::encoding::Encode::<StartOptions, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2606 (
2607 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.read_only),
2608 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.verbose),
2609 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.fsck_after_every_transaction),
2610 <CompressionAlgorithm as fidl::encoding::ValueTypeMarker>::borrow(&self.write_compression_algorithm),
2611 <i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.write_compression_level),
2612 <EvictionPolicyOverride as fidl::encoding::ValueTypeMarker>::borrow(&self.cache_eviction_policy_override),
2613 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.startup_profiling_seconds),
2614 ),
2615 encoder, offset, _depth
2616 )
2617 }
2618 }
2619 unsafe impl<
2620 T0: fidl::encoding::Encode<bool, fidl::encoding::DefaultFuchsiaResourceDialect>,
2621 T1: fidl::encoding::Encode<bool, fidl::encoding::DefaultFuchsiaResourceDialect>,
2622 T2: fidl::encoding::Encode<bool, fidl::encoding::DefaultFuchsiaResourceDialect>,
2623 T3: fidl::encoding::Encode<
2624 CompressionAlgorithm,
2625 fidl::encoding::DefaultFuchsiaResourceDialect,
2626 >,
2627 T4: fidl::encoding::Encode<i32, fidl::encoding::DefaultFuchsiaResourceDialect>,
2628 T5: fidl::encoding::Encode<
2629 EvictionPolicyOverride,
2630 fidl::encoding::DefaultFuchsiaResourceDialect,
2631 >,
2632 T6: fidl::encoding::Encode<u32, fidl::encoding::DefaultFuchsiaResourceDialect>,
2633 > fidl::encoding::Encode<StartOptions, fidl::encoding::DefaultFuchsiaResourceDialect>
2634 for (T0, T1, T2, T3, T4, T5, T6)
2635 {
2636 #[inline]
2637 unsafe fn encode(
2638 self,
2639 encoder: &mut fidl::encoding::Encoder<
2640 '_,
2641 fidl::encoding::DefaultFuchsiaResourceDialect,
2642 >,
2643 offset: usize,
2644 depth: fidl::encoding::Depth,
2645 ) -> fidl::Result<()> {
2646 encoder.debug_check_bounds::<StartOptions>(offset);
2647 unsafe {
2650 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
2651 (ptr as *mut u32).write_unaligned(0);
2652 }
2653 self.0.encode(encoder, offset + 0, depth)?;
2655 self.1.encode(encoder, offset + 1, depth)?;
2656 self.2.encode(encoder, offset + 2, depth)?;
2657 self.3.encode(encoder, offset + 4, depth)?;
2658 self.4.encode(encoder, offset + 8, depth)?;
2659 self.5.encode(encoder, offset + 12, depth)?;
2660 self.6.encode(encoder, offset + 16, depth)?;
2661 Ok(())
2662 }
2663 }
2664
2665 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for StartOptions {
2666 #[inline(always)]
2667 fn new_empty() -> Self {
2668 Self {
2669 read_only: fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect),
2670 verbose: fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect),
2671 fsck_after_every_transaction: fidl::new_empty!(
2672 bool,
2673 fidl::encoding::DefaultFuchsiaResourceDialect
2674 ),
2675 write_compression_algorithm: fidl::new_empty!(
2676 CompressionAlgorithm,
2677 fidl::encoding::DefaultFuchsiaResourceDialect
2678 ),
2679 write_compression_level: fidl::new_empty!(
2680 i32,
2681 fidl::encoding::DefaultFuchsiaResourceDialect
2682 ),
2683 cache_eviction_policy_override: fidl::new_empty!(
2684 EvictionPolicyOverride,
2685 fidl::encoding::DefaultFuchsiaResourceDialect
2686 ),
2687 startup_profiling_seconds: fidl::new_empty!(
2688 u32,
2689 fidl::encoding::DefaultFuchsiaResourceDialect
2690 ),
2691 }
2692 }
2693
2694 #[inline]
2695 unsafe fn decode(
2696 &mut self,
2697 decoder: &mut fidl::encoding::Decoder<
2698 '_,
2699 fidl::encoding::DefaultFuchsiaResourceDialect,
2700 >,
2701 offset: usize,
2702 _depth: fidl::encoding::Depth,
2703 ) -> fidl::Result<()> {
2704 decoder.debug_check_bounds::<Self>(offset);
2705 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
2707 let padval = unsafe { (ptr as *const u32).read_unaligned() };
2708 let mask = 0xff000000u32;
2709 let maskedval = padval & mask;
2710 if maskedval != 0 {
2711 return Err(fidl::Error::NonZeroPadding {
2712 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
2713 });
2714 }
2715 fidl::decode!(
2716 bool,
2717 fidl::encoding::DefaultFuchsiaResourceDialect,
2718 &mut self.read_only,
2719 decoder,
2720 offset + 0,
2721 _depth
2722 )?;
2723 fidl::decode!(
2724 bool,
2725 fidl::encoding::DefaultFuchsiaResourceDialect,
2726 &mut self.verbose,
2727 decoder,
2728 offset + 1,
2729 _depth
2730 )?;
2731 fidl::decode!(
2732 bool,
2733 fidl::encoding::DefaultFuchsiaResourceDialect,
2734 &mut self.fsck_after_every_transaction,
2735 decoder,
2736 offset + 2,
2737 _depth
2738 )?;
2739 fidl::decode!(
2740 CompressionAlgorithm,
2741 fidl::encoding::DefaultFuchsiaResourceDialect,
2742 &mut self.write_compression_algorithm,
2743 decoder,
2744 offset + 4,
2745 _depth
2746 )?;
2747 fidl::decode!(
2748 i32,
2749 fidl::encoding::DefaultFuchsiaResourceDialect,
2750 &mut self.write_compression_level,
2751 decoder,
2752 offset + 8,
2753 _depth
2754 )?;
2755 fidl::decode!(
2756 EvictionPolicyOverride,
2757 fidl::encoding::DefaultFuchsiaResourceDialect,
2758 &mut self.cache_eviction_policy_override,
2759 decoder,
2760 offset + 12,
2761 _depth
2762 )?;
2763 fidl::decode!(
2764 u32,
2765 fidl::encoding::DefaultFuchsiaResourceDialect,
2766 &mut self.startup_profiling_seconds,
2767 decoder,
2768 offset + 16,
2769 _depth
2770 )?;
2771 Ok(())
2772 }
2773 }
2774
2775 impl fidl::encoding::ResourceTypeMarker for StartupCheckRequest {
2776 type Borrowed<'a> = &'a mut Self;
2777 fn take_or_borrow<'a>(
2778 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2779 ) -> Self::Borrowed<'a> {
2780 value
2781 }
2782 }
2783
2784 unsafe impl fidl::encoding::TypeMarker for StartupCheckRequest {
2785 type Owned = Self;
2786
2787 #[inline(always)]
2788 fn inline_align(_context: fidl::encoding::Context) -> usize {
2789 8
2790 }
2791
2792 #[inline(always)]
2793 fn inline_size(_context: fidl::encoding::Context) -> usize {
2794 24
2795 }
2796 }
2797
2798 unsafe impl
2799 fidl::encoding::Encode<StartupCheckRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
2800 for &mut StartupCheckRequest
2801 {
2802 #[inline]
2803 unsafe fn encode(
2804 self,
2805 encoder: &mut fidl::encoding::Encoder<
2806 '_,
2807 fidl::encoding::DefaultFuchsiaResourceDialect,
2808 >,
2809 offset: usize,
2810 _depth: fidl::encoding::Depth,
2811 ) -> fidl::Result<()> {
2812 encoder.debug_check_bounds::<StartupCheckRequest>(offset);
2813 fidl::encoding::Encode::<
2815 StartupCheckRequest,
2816 fidl::encoding::DefaultFuchsiaResourceDialect,
2817 >::encode(
2818 (
2819 <fidl::encoding::Endpoint<
2820 fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_block::BlockMarker>,
2821 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2822 &mut self.device
2823 ),
2824 <CheckOptions as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2825 &mut self.options,
2826 ),
2827 ),
2828 encoder,
2829 offset,
2830 _depth,
2831 )
2832 }
2833 }
2834 unsafe impl<
2835 T0: fidl::encoding::Encode<
2836 fidl::encoding::Endpoint<
2837 fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_block::BlockMarker>,
2838 >,
2839 fidl::encoding::DefaultFuchsiaResourceDialect,
2840 >,
2841 T1: fidl::encoding::Encode<CheckOptions, fidl::encoding::DefaultFuchsiaResourceDialect>,
2842 >
2843 fidl::encoding::Encode<StartupCheckRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
2844 for (T0, T1)
2845 {
2846 #[inline]
2847 unsafe fn encode(
2848 self,
2849 encoder: &mut fidl::encoding::Encoder<
2850 '_,
2851 fidl::encoding::DefaultFuchsiaResourceDialect,
2852 >,
2853 offset: usize,
2854 depth: fidl::encoding::Depth,
2855 ) -> fidl::Result<()> {
2856 encoder.debug_check_bounds::<StartupCheckRequest>(offset);
2857 unsafe {
2860 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
2861 (ptr as *mut u64).write_unaligned(0);
2862 }
2863 self.0.encode(encoder, offset + 0, depth)?;
2865 self.1.encode(encoder, offset + 8, depth)?;
2866 Ok(())
2867 }
2868 }
2869
2870 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2871 for StartupCheckRequest
2872 {
2873 #[inline(always)]
2874 fn new_empty() -> Self {
2875 Self {
2876 device: fidl::new_empty!(
2877 fidl::encoding::Endpoint<
2878 fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_block::BlockMarker>,
2879 >,
2880 fidl::encoding::DefaultFuchsiaResourceDialect
2881 ),
2882 options: fidl::new_empty!(
2883 CheckOptions,
2884 fidl::encoding::DefaultFuchsiaResourceDialect
2885 ),
2886 }
2887 }
2888
2889 #[inline]
2890 unsafe fn decode(
2891 &mut self,
2892 decoder: &mut fidl::encoding::Decoder<
2893 '_,
2894 fidl::encoding::DefaultFuchsiaResourceDialect,
2895 >,
2896 offset: usize,
2897 _depth: fidl::encoding::Depth,
2898 ) -> fidl::Result<()> {
2899 decoder.debug_check_bounds::<Self>(offset);
2900 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
2902 let padval = unsafe { (ptr as *const u64).read_unaligned() };
2903 let mask = 0xffffffff00000000u64;
2904 let maskedval = padval & mask;
2905 if maskedval != 0 {
2906 return Err(fidl::Error::NonZeroPadding {
2907 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
2908 });
2909 }
2910 fidl::decode!(
2911 fidl::encoding::Endpoint<
2912 fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_block::BlockMarker>,
2913 >,
2914 fidl::encoding::DefaultFuchsiaResourceDialect,
2915 &mut self.device,
2916 decoder,
2917 offset + 0,
2918 _depth
2919 )?;
2920 fidl::decode!(
2921 CheckOptions,
2922 fidl::encoding::DefaultFuchsiaResourceDialect,
2923 &mut self.options,
2924 decoder,
2925 offset + 8,
2926 _depth
2927 )?;
2928 Ok(())
2929 }
2930 }
2931
2932 impl fidl::encoding::ResourceTypeMarker for StartupFormatRequest {
2933 type Borrowed<'a> = &'a mut Self;
2934 fn take_or_borrow<'a>(
2935 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2936 ) -> Self::Borrowed<'a> {
2937 value
2938 }
2939 }
2940
2941 unsafe impl fidl::encoding::TypeMarker for StartupFormatRequest {
2942 type Owned = Self;
2943
2944 #[inline(always)]
2945 fn inline_align(_context: fidl::encoding::Context) -> usize {
2946 8
2947 }
2948
2949 #[inline(always)]
2950 fn inline_size(_context: fidl::encoding::Context) -> usize {
2951 24
2952 }
2953 }
2954
2955 unsafe impl
2956 fidl::encoding::Encode<StartupFormatRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
2957 for &mut StartupFormatRequest
2958 {
2959 #[inline]
2960 unsafe fn encode(
2961 self,
2962 encoder: &mut fidl::encoding::Encoder<
2963 '_,
2964 fidl::encoding::DefaultFuchsiaResourceDialect,
2965 >,
2966 offset: usize,
2967 _depth: fidl::encoding::Depth,
2968 ) -> fidl::Result<()> {
2969 encoder.debug_check_bounds::<StartupFormatRequest>(offset);
2970 fidl::encoding::Encode::<
2972 StartupFormatRequest,
2973 fidl::encoding::DefaultFuchsiaResourceDialect,
2974 >::encode(
2975 (
2976 <fidl::encoding::Endpoint<
2977 fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_block::BlockMarker>,
2978 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2979 &mut self.device
2980 ),
2981 <FormatOptions as fidl::encoding::ValueTypeMarker>::borrow(&self.options),
2982 ),
2983 encoder,
2984 offset,
2985 _depth,
2986 )
2987 }
2988 }
2989 unsafe impl<
2990 T0: fidl::encoding::Encode<
2991 fidl::encoding::Endpoint<
2992 fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_block::BlockMarker>,
2993 >,
2994 fidl::encoding::DefaultFuchsiaResourceDialect,
2995 >,
2996 T1: fidl::encoding::Encode<FormatOptions, fidl::encoding::DefaultFuchsiaResourceDialect>,
2997 >
2998 fidl::encoding::Encode<StartupFormatRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
2999 for (T0, T1)
3000 {
3001 #[inline]
3002 unsafe fn encode(
3003 self,
3004 encoder: &mut fidl::encoding::Encoder<
3005 '_,
3006 fidl::encoding::DefaultFuchsiaResourceDialect,
3007 >,
3008 offset: usize,
3009 depth: fidl::encoding::Depth,
3010 ) -> fidl::Result<()> {
3011 encoder.debug_check_bounds::<StartupFormatRequest>(offset);
3012 unsafe {
3015 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
3016 (ptr as *mut u64).write_unaligned(0);
3017 }
3018 self.0.encode(encoder, offset + 0, depth)?;
3020 self.1.encode(encoder, offset + 8, depth)?;
3021 Ok(())
3022 }
3023 }
3024
3025 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3026 for StartupFormatRequest
3027 {
3028 #[inline(always)]
3029 fn new_empty() -> Self {
3030 Self {
3031 device: fidl::new_empty!(
3032 fidl::encoding::Endpoint<
3033 fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_block::BlockMarker>,
3034 >,
3035 fidl::encoding::DefaultFuchsiaResourceDialect
3036 ),
3037 options: fidl::new_empty!(
3038 FormatOptions,
3039 fidl::encoding::DefaultFuchsiaResourceDialect
3040 ),
3041 }
3042 }
3043
3044 #[inline]
3045 unsafe fn decode(
3046 &mut self,
3047 decoder: &mut fidl::encoding::Decoder<
3048 '_,
3049 fidl::encoding::DefaultFuchsiaResourceDialect,
3050 >,
3051 offset: usize,
3052 _depth: fidl::encoding::Depth,
3053 ) -> fidl::Result<()> {
3054 decoder.debug_check_bounds::<Self>(offset);
3055 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
3057 let padval = unsafe { (ptr as *const u64).read_unaligned() };
3058 let mask = 0xffffffff00000000u64;
3059 let maskedval = padval & mask;
3060 if maskedval != 0 {
3061 return Err(fidl::Error::NonZeroPadding {
3062 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
3063 });
3064 }
3065 fidl::decode!(
3066 fidl::encoding::Endpoint<
3067 fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_block::BlockMarker>,
3068 >,
3069 fidl::encoding::DefaultFuchsiaResourceDialect,
3070 &mut self.device,
3071 decoder,
3072 offset + 0,
3073 _depth
3074 )?;
3075 fidl::decode!(
3076 FormatOptions,
3077 fidl::encoding::DefaultFuchsiaResourceDialect,
3078 &mut self.options,
3079 decoder,
3080 offset + 8,
3081 _depth
3082 )?;
3083 Ok(())
3084 }
3085 }
3086
3087 impl fidl::encoding::ResourceTypeMarker for StartupStartRequest {
3088 type Borrowed<'a> = &'a mut Self;
3089 fn take_or_borrow<'a>(
3090 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3091 ) -> Self::Borrowed<'a> {
3092 value
3093 }
3094 }
3095
3096 unsafe impl fidl::encoding::TypeMarker for StartupStartRequest {
3097 type Owned = Self;
3098
3099 #[inline(always)]
3100 fn inline_align(_context: fidl::encoding::Context) -> usize {
3101 4
3102 }
3103
3104 #[inline(always)]
3105 fn inline_size(_context: fidl::encoding::Context) -> usize {
3106 24
3107 }
3108 }
3109
3110 unsafe impl
3111 fidl::encoding::Encode<StartupStartRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
3112 for &mut StartupStartRequest
3113 {
3114 #[inline]
3115 unsafe fn encode(
3116 self,
3117 encoder: &mut fidl::encoding::Encoder<
3118 '_,
3119 fidl::encoding::DefaultFuchsiaResourceDialect,
3120 >,
3121 offset: usize,
3122 _depth: fidl::encoding::Depth,
3123 ) -> fidl::Result<()> {
3124 encoder.debug_check_bounds::<StartupStartRequest>(offset);
3125 fidl::encoding::Encode::<
3127 StartupStartRequest,
3128 fidl::encoding::DefaultFuchsiaResourceDialect,
3129 >::encode(
3130 (
3131 <fidl::encoding::Endpoint<
3132 fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_block::BlockMarker>,
3133 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
3134 &mut self.device
3135 ),
3136 <StartOptions as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
3137 &mut self.options,
3138 ),
3139 ),
3140 encoder,
3141 offset,
3142 _depth,
3143 )
3144 }
3145 }
3146 unsafe impl<
3147 T0: fidl::encoding::Encode<
3148 fidl::encoding::Endpoint<
3149 fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_block::BlockMarker>,
3150 >,
3151 fidl::encoding::DefaultFuchsiaResourceDialect,
3152 >,
3153 T1: fidl::encoding::Encode<StartOptions, fidl::encoding::DefaultFuchsiaResourceDialect>,
3154 >
3155 fidl::encoding::Encode<StartupStartRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
3156 for (T0, T1)
3157 {
3158 #[inline]
3159 unsafe fn encode(
3160 self,
3161 encoder: &mut fidl::encoding::Encoder<
3162 '_,
3163 fidl::encoding::DefaultFuchsiaResourceDialect,
3164 >,
3165 offset: usize,
3166 depth: fidl::encoding::Depth,
3167 ) -> fidl::Result<()> {
3168 encoder.debug_check_bounds::<StartupStartRequest>(offset);
3169 self.0.encode(encoder, offset + 0, depth)?;
3173 self.1.encode(encoder, offset + 4, depth)?;
3174 Ok(())
3175 }
3176 }
3177
3178 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3179 for StartupStartRequest
3180 {
3181 #[inline(always)]
3182 fn new_empty() -> Self {
3183 Self {
3184 device: fidl::new_empty!(
3185 fidl::encoding::Endpoint<
3186 fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_block::BlockMarker>,
3187 >,
3188 fidl::encoding::DefaultFuchsiaResourceDialect
3189 ),
3190 options: fidl::new_empty!(
3191 StartOptions,
3192 fidl::encoding::DefaultFuchsiaResourceDialect
3193 ),
3194 }
3195 }
3196
3197 #[inline]
3198 unsafe fn decode(
3199 &mut self,
3200 decoder: &mut fidl::encoding::Decoder<
3201 '_,
3202 fidl::encoding::DefaultFuchsiaResourceDialect,
3203 >,
3204 offset: usize,
3205 _depth: fidl::encoding::Depth,
3206 ) -> fidl::Result<()> {
3207 decoder.debug_check_bounds::<Self>(offset);
3208 fidl::decode!(
3210 fidl::encoding::Endpoint<
3211 fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_block::BlockMarker>,
3212 >,
3213 fidl::encoding::DefaultFuchsiaResourceDialect,
3214 &mut self.device,
3215 decoder,
3216 offset + 0,
3217 _depth
3218 )?;
3219 fidl::decode!(
3220 StartOptions,
3221 fidl::encoding::DefaultFuchsiaResourceDialect,
3222 &mut self.options,
3223 decoder,
3224 offset + 4,
3225 _depth
3226 )?;
3227 Ok(())
3228 }
3229 }
3230
3231 impl fidl::encoding::ResourceTypeMarker for VolumeCheckRequest {
3232 type Borrowed<'a> = &'a mut Self;
3233 fn take_or_borrow<'a>(
3234 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3235 ) -> Self::Borrowed<'a> {
3236 value
3237 }
3238 }
3239
3240 unsafe impl fidl::encoding::TypeMarker for VolumeCheckRequest {
3241 type Owned = Self;
3242
3243 #[inline(always)]
3244 fn inline_align(_context: fidl::encoding::Context) -> usize {
3245 8
3246 }
3247
3248 #[inline(always)]
3249 fn inline_size(_context: fidl::encoding::Context) -> usize {
3250 16
3251 }
3252 }
3253
3254 unsafe impl
3255 fidl::encoding::Encode<VolumeCheckRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
3256 for &mut VolumeCheckRequest
3257 {
3258 #[inline]
3259 unsafe fn encode(
3260 self,
3261 encoder: &mut fidl::encoding::Encoder<
3262 '_,
3263 fidl::encoding::DefaultFuchsiaResourceDialect,
3264 >,
3265 offset: usize,
3266 _depth: fidl::encoding::Depth,
3267 ) -> fidl::Result<()> {
3268 encoder.debug_check_bounds::<VolumeCheckRequest>(offset);
3269 fidl::encoding::Encode::<
3271 VolumeCheckRequest,
3272 fidl::encoding::DefaultFuchsiaResourceDialect,
3273 >::encode(
3274 (<CheckOptions as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
3275 &mut self.options,
3276 ),),
3277 encoder,
3278 offset,
3279 _depth,
3280 )
3281 }
3282 }
3283 unsafe impl<
3284 T0: fidl::encoding::Encode<CheckOptions, fidl::encoding::DefaultFuchsiaResourceDialect>,
3285 >
3286 fidl::encoding::Encode<VolumeCheckRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
3287 for (T0,)
3288 {
3289 #[inline]
3290 unsafe fn encode(
3291 self,
3292 encoder: &mut fidl::encoding::Encoder<
3293 '_,
3294 fidl::encoding::DefaultFuchsiaResourceDialect,
3295 >,
3296 offset: usize,
3297 depth: fidl::encoding::Depth,
3298 ) -> fidl::Result<()> {
3299 encoder.debug_check_bounds::<VolumeCheckRequest>(offset);
3300 self.0.encode(encoder, offset + 0, depth)?;
3304 Ok(())
3305 }
3306 }
3307
3308 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3309 for VolumeCheckRequest
3310 {
3311 #[inline(always)]
3312 fn new_empty() -> Self {
3313 Self {
3314 options: fidl::new_empty!(
3315 CheckOptions,
3316 fidl::encoding::DefaultFuchsiaResourceDialect
3317 ),
3318 }
3319 }
3320
3321 #[inline]
3322 unsafe fn decode(
3323 &mut self,
3324 decoder: &mut fidl::encoding::Decoder<
3325 '_,
3326 fidl::encoding::DefaultFuchsiaResourceDialect,
3327 >,
3328 offset: usize,
3329 _depth: fidl::encoding::Depth,
3330 ) -> fidl::Result<()> {
3331 decoder.debug_check_bounds::<Self>(offset);
3332 fidl::decode!(
3334 CheckOptions,
3335 fidl::encoding::DefaultFuchsiaResourceDialect,
3336 &mut self.options,
3337 decoder,
3338 offset + 0,
3339 _depth
3340 )?;
3341 Ok(())
3342 }
3343 }
3344
3345 impl fidl::encoding::ResourceTypeMarker for VolumeMountRequest {
3346 type Borrowed<'a> = &'a mut Self;
3347 fn take_or_borrow<'a>(
3348 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3349 ) -> Self::Borrowed<'a> {
3350 value
3351 }
3352 }
3353
3354 unsafe impl fidl::encoding::TypeMarker for VolumeMountRequest {
3355 type Owned = Self;
3356
3357 #[inline(always)]
3358 fn inline_align(_context: fidl::encoding::Context) -> usize {
3359 8
3360 }
3361
3362 #[inline(always)]
3363 fn inline_size(_context: fidl::encoding::Context) -> usize {
3364 24
3365 }
3366 }
3367
3368 unsafe impl
3369 fidl::encoding::Encode<VolumeMountRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
3370 for &mut VolumeMountRequest
3371 {
3372 #[inline]
3373 unsafe fn encode(
3374 self,
3375 encoder: &mut fidl::encoding::Encoder<
3376 '_,
3377 fidl::encoding::DefaultFuchsiaResourceDialect,
3378 >,
3379 offset: usize,
3380 _depth: fidl::encoding::Depth,
3381 ) -> fidl::Result<()> {
3382 encoder.debug_check_bounds::<VolumeMountRequest>(offset);
3383 fidl::encoding::Encode::<
3385 VolumeMountRequest,
3386 fidl::encoding::DefaultFuchsiaResourceDialect,
3387 >::encode(
3388 (
3389 <fidl::encoding::Endpoint<
3390 fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
3391 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
3392 &mut self.outgoing_directory,
3393 ),
3394 <MountOptions as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
3395 &mut self.options,
3396 ),
3397 ),
3398 encoder,
3399 offset,
3400 _depth,
3401 )
3402 }
3403 }
3404 unsafe impl<
3405 T0: fidl::encoding::Encode<
3406 fidl::encoding::Endpoint<
3407 fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
3408 >,
3409 fidl::encoding::DefaultFuchsiaResourceDialect,
3410 >,
3411 T1: fidl::encoding::Encode<MountOptions, fidl::encoding::DefaultFuchsiaResourceDialect>,
3412 >
3413 fidl::encoding::Encode<VolumeMountRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
3414 for (T0, T1)
3415 {
3416 #[inline]
3417 unsafe fn encode(
3418 self,
3419 encoder: &mut fidl::encoding::Encoder<
3420 '_,
3421 fidl::encoding::DefaultFuchsiaResourceDialect,
3422 >,
3423 offset: usize,
3424 depth: fidl::encoding::Depth,
3425 ) -> fidl::Result<()> {
3426 encoder.debug_check_bounds::<VolumeMountRequest>(offset);
3427 unsafe {
3430 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
3431 (ptr as *mut u64).write_unaligned(0);
3432 }
3433 self.0.encode(encoder, offset + 0, depth)?;
3435 self.1.encode(encoder, offset + 8, depth)?;
3436 Ok(())
3437 }
3438 }
3439
3440 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3441 for VolumeMountRequest
3442 {
3443 #[inline(always)]
3444 fn new_empty() -> Self {
3445 Self {
3446 outgoing_directory: fidl::new_empty!(
3447 fidl::encoding::Endpoint<
3448 fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
3449 >,
3450 fidl::encoding::DefaultFuchsiaResourceDialect
3451 ),
3452 options: fidl::new_empty!(
3453 MountOptions,
3454 fidl::encoding::DefaultFuchsiaResourceDialect
3455 ),
3456 }
3457 }
3458
3459 #[inline]
3460 unsafe fn decode(
3461 &mut self,
3462 decoder: &mut fidl::encoding::Decoder<
3463 '_,
3464 fidl::encoding::DefaultFuchsiaResourceDialect,
3465 >,
3466 offset: usize,
3467 _depth: fidl::encoding::Depth,
3468 ) -> fidl::Result<()> {
3469 decoder.debug_check_bounds::<Self>(offset);
3470 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
3472 let padval = unsafe { (ptr as *const u64).read_unaligned() };
3473 let mask = 0xffffffff00000000u64;
3474 let maskedval = padval & mask;
3475 if maskedval != 0 {
3476 return Err(fidl::Error::NonZeroPadding {
3477 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
3478 });
3479 }
3480 fidl::decode!(
3481 fidl::encoding::Endpoint<
3482 fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
3483 >,
3484 fidl::encoding::DefaultFuchsiaResourceDialect,
3485 &mut self.outgoing_directory,
3486 decoder,
3487 offset + 0,
3488 _depth
3489 )?;
3490 fidl::decode!(
3491 MountOptions,
3492 fidl::encoding::DefaultFuchsiaResourceDialect,
3493 &mut self.options,
3494 decoder,
3495 offset + 8,
3496 _depth
3497 )?;
3498 Ok(())
3499 }
3500 }
3501
3502 impl fidl::encoding::ResourceTypeMarker for VolumesCreateRequest {
3503 type Borrowed<'a> = &'a mut Self;
3504 fn take_or_borrow<'a>(
3505 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3506 ) -> Self::Borrowed<'a> {
3507 value
3508 }
3509 }
3510
3511 unsafe impl fidl::encoding::TypeMarker for VolumesCreateRequest {
3512 type Owned = Self;
3513
3514 #[inline(always)]
3515 fn inline_align(_context: fidl::encoding::Context) -> usize {
3516 8
3517 }
3518
3519 #[inline(always)]
3520 fn inline_size(_context: fidl::encoding::Context) -> usize {
3521 56
3522 }
3523 }
3524
3525 unsafe impl
3526 fidl::encoding::Encode<VolumesCreateRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
3527 for &mut VolumesCreateRequest
3528 {
3529 #[inline]
3530 unsafe fn encode(
3531 self,
3532 encoder: &mut fidl::encoding::Encoder<
3533 '_,
3534 fidl::encoding::DefaultFuchsiaResourceDialect,
3535 >,
3536 offset: usize,
3537 _depth: fidl::encoding::Depth,
3538 ) -> fidl::Result<()> {
3539 encoder.debug_check_bounds::<VolumesCreateRequest>(offset);
3540 fidl::encoding::Encode::<
3542 VolumesCreateRequest,
3543 fidl::encoding::DefaultFuchsiaResourceDialect,
3544 >::encode(
3545 (
3546 <fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(
3547 &self.name,
3548 ),
3549 <fidl::encoding::Endpoint<
3550 fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
3551 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
3552 &mut self.outgoing_directory,
3553 ),
3554 <CreateOptions as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
3555 &mut self.create_options,
3556 ),
3557 <MountOptions as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
3558 &mut self.mount_options,
3559 ),
3560 ),
3561 encoder,
3562 offset,
3563 _depth,
3564 )
3565 }
3566 }
3567 unsafe impl<
3568 T0: fidl::encoding::Encode<
3569 fidl::encoding::BoundedString<255>,
3570 fidl::encoding::DefaultFuchsiaResourceDialect,
3571 >,
3572 T1: fidl::encoding::Encode<
3573 fidl::encoding::Endpoint<
3574 fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
3575 >,
3576 fidl::encoding::DefaultFuchsiaResourceDialect,
3577 >,
3578 T2: fidl::encoding::Encode<CreateOptions, fidl::encoding::DefaultFuchsiaResourceDialect>,
3579 T3: fidl::encoding::Encode<MountOptions, fidl::encoding::DefaultFuchsiaResourceDialect>,
3580 >
3581 fidl::encoding::Encode<VolumesCreateRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
3582 for (T0, T1, T2, T3)
3583 {
3584 #[inline]
3585 unsafe fn encode(
3586 self,
3587 encoder: &mut fidl::encoding::Encoder<
3588 '_,
3589 fidl::encoding::DefaultFuchsiaResourceDialect,
3590 >,
3591 offset: usize,
3592 depth: fidl::encoding::Depth,
3593 ) -> fidl::Result<()> {
3594 encoder.debug_check_bounds::<VolumesCreateRequest>(offset);
3595 unsafe {
3598 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
3599 (ptr as *mut u64).write_unaligned(0);
3600 }
3601 self.0.encode(encoder, offset + 0, depth)?;
3603 self.1.encode(encoder, offset + 16, depth)?;
3604 self.2.encode(encoder, offset + 24, depth)?;
3605 self.3.encode(encoder, offset + 40, depth)?;
3606 Ok(())
3607 }
3608 }
3609
3610 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3611 for VolumesCreateRequest
3612 {
3613 #[inline(always)]
3614 fn new_empty() -> Self {
3615 Self {
3616 name: fidl::new_empty!(
3617 fidl::encoding::BoundedString<255>,
3618 fidl::encoding::DefaultFuchsiaResourceDialect
3619 ),
3620 outgoing_directory: fidl::new_empty!(
3621 fidl::encoding::Endpoint<
3622 fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
3623 >,
3624 fidl::encoding::DefaultFuchsiaResourceDialect
3625 ),
3626 create_options: fidl::new_empty!(
3627 CreateOptions,
3628 fidl::encoding::DefaultFuchsiaResourceDialect
3629 ),
3630 mount_options: fidl::new_empty!(
3631 MountOptions,
3632 fidl::encoding::DefaultFuchsiaResourceDialect
3633 ),
3634 }
3635 }
3636
3637 #[inline]
3638 unsafe fn decode(
3639 &mut self,
3640 decoder: &mut fidl::encoding::Decoder<
3641 '_,
3642 fidl::encoding::DefaultFuchsiaResourceDialect,
3643 >,
3644 offset: usize,
3645 _depth: fidl::encoding::Depth,
3646 ) -> fidl::Result<()> {
3647 decoder.debug_check_bounds::<Self>(offset);
3648 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
3650 let padval = unsafe { (ptr as *const u64).read_unaligned() };
3651 let mask = 0xffffffff00000000u64;
3652 let maskedval = padval & mask;
3653 if maskedval != 0 {
3654 return Err(fidl::Error::NonZeroPadding {
3655 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
3656 });
3657 }
3658 fidl::decode!(
3659 fidl::encoding::BoundedString<255>,
3660 fidl::encoding::DefaultFuchsiaResourceDialect,
3661 &mut self.name,
3662 decoder,
3663 offset + 0,
3664 _depth
3665 )?;
3666 fidl::decode!(
3667 fidl::encoding::Endpoint<
3668 fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
3669 >,
3670 fidl::encoding::DefaultFuchsiaResourceDialect,
3671 &mut self.outgoing_directory,
3672 decoder,
3673 offset + 16,
3674 _depth
3675 )?;
3676 fidl::decode!(
3677 CreateOptions,
3678 fidl::encoding::DefaultFuchsiaResourceDialect,
3679 &mut self.create_options,
3680 decoder,
3681 offset + 24,
3682 _depth
3683 )?;
3684 fidl::decode!(
3685 MountOptions,
3686 fidl::encoding::DefaultFuchsiaResourceDialect,
3687 &mut self.mount_options,
3688 decoder,
3689 offset + 40,
3690 _depth
3691 )?;
3692 Ok(())
3693 }
3694 }
3695
3696 impl CheckOptions {
3697 #[inline(always)]
3698 fn max_ordinal_present(&self) -> u64 {
3699 if let Some(_) = self.crypt {
3700 return 1;
3701 }
3702 0
3703 }
3704 }
3705
3706 impl fidl::encoding::ResourceTypeMarker for CheckOptions {
3707 type Borrowed<'a> = &'a mut Self;
3708 fn take_or_borrow<'a>(
3709 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3710 ) -> Self::Borrowed<'a> {
3711 value
3712 }
3713 }
3714
3715 unsafe impl fidl::encoding::TypeMarker for CheckOptions {
3716 type Owned = Self;
3717
3718 #[inline(always)]
3719 fn inline_align(_context: fidl::encoding::Context) -> usize {
3720 8
3721 }
3722
3723 #[inline(always)]
3724 fn inline_size(_context: fidl::encoding::Context) -> usize {
3725 16
3726 }
3727 }
3728
3729 unsafe impl fidl::encoding::Encode<CheckOptions, fidl::encoding::DefaultFuchsiaResourceDialect>
3730 for &mut CheckOptions
3731 {
3732 unsafe fn encode(
3733 self,
3734 encoder: &mut fidl::encoding::Encoder<
3735 '_,
3736 fidl::encoding::DefaultFuchsiaResourceDialect,
3737 >,
3738 offset: usize,
3739 mut depth: fidl::encoding::Depth,
3740 ) -> fidl::Result<()> {
3741 encoder.debug_check_bounds::<CheckOptions>(offset);
3742 let max_ordinal: u64 = self.max_ordinal_present();
3744 encoder.write_num(max_ordinal, offset);
3745 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3746 if max_ordinal == 0 {
3748 return Ok(());
3749 }
3750 depth.increment()?;
3751 let envelope_size = 8;
3752 let bytes_len = max_ordinal as usize * envelope_size;
3753 #[allow(unused_variables)]
3754 let offset = encoder.out_of_line_offset(bytes_len);
3755 let mut _prev_end_offset: usize = 0;
3756 if 1 > max_ordinal {
3757 return Ok(());
3758 }
3759
3760 let cur_offset: usize = (1 - 1) * envelope_size;
3763
3764 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3766
3767 fidl::encoding::encode_in_envelope_optional::<
3772 fidl::encoding::Endpoint<
3773 fidl::endpoints::ClientEnd<fidl_fuchsia_fxfs::CryptMarker>,
3774 >,
3775 fidl::encoding::DefaultFuchsiaResourceDialect,
3776 >(
3777 self.crypt.as_mut().map(
3778 <fidl::encoding::Endpoint<
3779 fidl::endpoints::ClientEnd<fidl_fuchsia_fxfs::CryptMarker>,
3780 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
3781 ),
3782 encoder,
3783 offset + cur_offset,
3784 depth,
3785 )?;
3786
3787 _prev_end_offset = cur_offset + envelope_size;
3788
3789 Ok(())
3790 }
3791 }
3792
3793 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for CheckOptions {
3794 #[inline(always)]
3795 fn new_empty() -> Self {
3796 Self::default()
3797 }
3798
3799 unsafe fn decode(
3800 &mut self,
3801 decoder: &mut fidl::encoding::Decoder<
3802 '_,
3803 fidl::encoding::DefaultFuchsiaResourceDialect,
3804 >,
3805 offset: usize,
3806 mut depth: fidl::encoding::Depth,
3807 ) -> fidl::Result<()> {
3808 decoder.debug_check_bounds::<Self>(offset);
3809 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3810 None => return Err(fidl::Error::NotNullable),
3811 Some(len) => len,
3812 };
3813 if len == 0 {
3815 return Ok(());
3816 };
3817 depth.increment()?;
3818 let envelope_size = 8;
3819 let bytes_len = len * envelope_size;
3820 let offset = decoder.out_of_line_offset(bytes_len)?;
3821 let mut _next_ordinal_to_read = 0;
3823 let mut next_offset = offset;
3824 let end_offset = offset + bytes_len;
3825 _next_ordinal_to_read += 1;
3826 if next_offset >= end_offset {
3827 return Ok(());
3828 }
3829
3830 while _next_ordinal_to_read < 1 {
3832 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3833 _next_ordinal_to_read += 1;
3834 next_offset += envelope_size;
3835 }
3836
3837 let next_out_of_line = decoder.next_out_of_line();
3838 let handles_before = decoder.remaining_handles();
3839 if let Some((inlined, num_bytes, num_handles)) =
3840 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3841 {
3842 let member_inline_size = <fidl::encoding::Endpoint<
3843 fidl::endpoints::ClientEnd<fidl_fuchsia_fxfs::CryptMarker>,
3844 > as fidl::encoding::TypeMarker>::inline_size(
3845 decoder.context
3846 );
3847 if inlined != (member_inline_size <= 4) {
3848 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3849 }
3850 let inner_offset;
3851 let mut inner_depth = depth.clone();
3852 if inlined {
3853 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3854 inner_offset = next_offset;
3855 } else {
3856 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3857 inner_depth.increment()?;
3858 }
3859 let val_ref = self.crypt.get_or_insert_with(|| {
3860 fidl::new_empty!(
3861 fidl::encoding::Endpoint<
3862 fidl::endpoints::ClientEnd<fidl_fuchsia_fxfs::CryptMarker>,
3863 >,
3864 fidl::encoding::DefaultFuchsiaResourceDialect
3865 )
3866 });
3867 fidl::decode!(
3868 fidl::encoding::Endpoint<
3869 fidl::endpoints::ClientEnd<fidl_fuchsia_fxfs::CryptMarker>,
3870 >,
3871 fidl::encoding::DefaultFuchsiaResourceDialect,
3872 val_ref,
3873 decoder,
3874 inner_offset,
3875 inner_depth
3876 )?;
3877 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3878 {
3879 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3880 }
3881 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3882 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3883 }
3884 }
3885
3886 next_offset += envelope_size;
3887
3888 while next_offset < end_offset {
3890 _next_ordinal_to_read += 1;
3891 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3892 next_offset += envelope_size;
3893 }
3894
3895 Ok(())
3896 }
3897 }
3898
3899 impl CreateOptions {
3900 #[inline(always)]
3901 fn max_ordinal_present(&self) -> u64 {
3902 if let Some(_) = self.type_guid {
3903 return 3;
3904 }
3905 if let Some(_) = self.guid {
3906 return 2;
3907 }
3908 if let Some(_) = self.initial_size {
3909 return 1;
3910 }
3911 0
3912 }
3913 }
3914
3915 impl fidl::encoding::ResourceTypeMarker for CreateOptions {
3916 type Borrowed<'a> = &'a mut Self;
3917 fn take_or_borrow<'a>(
3918 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3919 ) -> Self::Borrowed<'a> {
3920 value
3921 }
3922 }
3923
3924 unsafe impl fidl::encoding::TypeMarker for CreateOptions {
3925 type Owned = Self;
3926
3927 #[inline(always)]
3928 fn inline_align(_context: fidl::encoding::Context) -> usize {
3929 8
3930 }
3931
3932 #[inline(always)]
3933 fn inline_size(_context: fidl::encoding::Context) -> usize {
3934 16
3935 }
3936 }
3937
3938 unsafe impl fidl::encoding::Encode<CreateOptions, fidl::encoding::DefaultFuchsiaResourceDialect>
3939 for &mut CreateOptions
3940 {
3941 unsafe fn encode(
3942 self,
3943 encoder: &mut fidl::encoding::Encoder<
3944 '_,
3945 fidl::encoding::DefaultFuchsiaResourceDialect,
3946 >,
3947 offset: usize,
3948 mut depth: fidl::encoding::Depth,
3949 ) -> fidl::Result<()> {
3950 encoder.debug_check_bounds::<CreateOptions>(offset);
3951 let max_ordinal: u64 = self.max_ordinal_present();
3953 encoder.write_num(max_ordinal, offset);
3954 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3955 if max_ordinal == 0 {
3957 return Ok(());
3958 }
3959 depth.increment()?;
3960 let envelope_size = 8;
3961 let bytes_len = max_ordinal as usize * envelope_size;
3962 #[allow(unused_variables)]
3963 let offset = encoder.out_of_line_offset(bytes_len);
3964 let mut _prev_end_offset: usize = 0;
3965 if 1 > max_ordinal {
3966 return Ok(());
3967 }
3968
3969 let cur_offset: usize = (1 - 1) * envelope_size;
3972
3973 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3975
3976 fidl::encoding::encode_in_envelope_optional::<
3981 u64,
3982 fidl::encoding::DefaultFuchsiaResourceDialect,
3983 >(
3984 self.initial_size.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
3985 encoder,
3986 offset + cur_offset,
3987 depth,
3988 )?;
3989
3990 _prev_end_offset = cur_offset + envelope_size;
3991 if 2 > max_ordinal {
3992 return Ok(());
3993 }
3994
3995 let cur_offset: usize = (2 - 1) * envelope_size;
3998
3999 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4001
4002 fidl::encoding::encode_in_envelope_optional::<
4007 fidl::encoding::Array<u8, 16>,
4008 fidl::encoding::DefaultFuchsiaResourceDialect,
4009 >(
4010 self.guid.as_ref().map(
4011 <fidl::encoding::Array<u8, 16> as fidl::encoding::ValueTypeMarker>::borrow,
4012 ),
4013 encoder,
4014 offset + cur_offset,
4015 depth,
4016 )?;
4017
4018 _prev_end_offset = cur_offset + envelope_size;
4019 if 3 > max_ordinal {
4020 return Ok(());
4021 }
4022
4023 let cur_offset: usize = (3 - 1) * envelope_size;
4026
4027 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4029
4030 fidl::encoding::encode_in_envelope_optional::<
4035 fidl::encoding::Array<u8, 16>,
4036 fidl::encoding::DefaultFuchsiaResourceDialect,
4037 >(
4038 self.type_guid.as_ref().map(
4039 <fidl::encoding::Array<u8, 16> as fidl::encoding::ValueTypeMarker>::borrow,
4040 ),
4041 encoder,
4042 offset + cur_offset,
4043 depth,
4044 )?;
4045
4046 _prev_end_offset = cur_offset + envelope_size;
4047
4048 Ok(())
4049 }
4050 }
4051
4052 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for CreateOptions {
4053 #[inline(always)]
4054 fn new_empty() -> Self {
4055 Self::default()
4056 }
4057
4058 unsafe fn decode(
4059 &mut self,
4060 decoder: &mut fidl::encoding::Decoder<
4061 '_,
4062 fidl::encoding::DefaultFuchsiaResourceDialect,
4063 >,
4064 offset: usize,
4065 mut depth: fidl::encoding::Depth,
4066 ) -> fidl::Result<()> {
4067 decoder.debug_check_bounds::<Self>(offset);
4068 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4069 None => return Err(fidl::Error::NotNullable),
4070 Some(len) => len,
4071 };
4072 if len == 0 {
4074 return Ok(());
4075 };
4076 depth.increment()?;
4077 let envelope_size = 8;
4078 let bytes_len = len * envelope_size;
4079 let offset = decoder.out_of_line_offset(bytes_len)?;
4080 let mut _next_ordinal_to_read = 0;
4082 let mut next_offset = offset;
4083 let end_offset = offset + bytes_len;
4084 _next_ordinal_to_read += 1;
4085 if next_offset >= end_offset {
4086 return Ok(());
4087 }
4088
4089 while _next_ordinal_to_read < 1 {
4091 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4092 _next_ordinal_to_read += 1;
4093 next_offset += envelope_size;
4094 }
4095
4096 let next_out_of_line = decoder.next_out_of_line();
4097 let handles_before = decoder.remaining_handles();
4098 if let Some((inlined, num_bytes, num_handles)) =
4099 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4100 {
4101 let member_inline_size =
4102 <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4103 if inlined != (member_inline_size <= 4) {
4104 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4105 }
4106 let inner_offset;
4107 let mut inner_depth = depth.clone();
4108 if inlined {
4109 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4110 inner_offset = next_offset;
4111 } else {
4112 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4113 inner_depth.increment()?;
4114 }
4115 let val_ref = self.initial_size.get_or_insert_with(|| {
4116 fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
4117 });
4118 fidl::decode!(
4119 u64,
4120 fidl::encoding::DefaultFuchsiaResourceDialect,
4121 val_ref,
4122 decoder,
4123 inner_offset,
4124 inner_depth
4125 )?;
4126 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4127 {
4128 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4129 }
4130 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4131 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4132 }
4133 }
4134
4135 next_offset += envelope_size;
4136 _next_ordinal_to_read += 1;
4137 if next_offset >= end_offset {
4138 return Ok(());
4139 }
4140
4141 while _next_ordinal_to_read < 2 {
4143 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4144 _next_ordinal_to_read += 1;
4145 next_offset += envelope_size;
4146 }
4147
4148 let next_out_of_line = decoder.next_out_of_line();
4149 let handles_before = decoder.remaining_handles();
4150 if let Some((inlined, num_bytes, num_handles)) =
4151 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4152 {
4153 let member_inline_size =
4154 <fidl::encoding::Array<u8, 16> as fidl::encoding::TypeMarker>::inline_size(
4155 decoder.context,
4156 );
4157 if inlined != (member_inline_size <= 4) {
4158 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4159 }
4160 let inner_offset;
4161 let mut inner_depth = depth.clone();
4162 if inlined {
4163 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4164 inner_offset = next_offset;
4165 } else {
4166 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4167 inner_depth.increment()?;
4168 }
4169 let val_ref =
4170 self.guid.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Array<u8, 16>, fidl::encoding::DefaultFuchsiaResourceDialect));
4171 fidl::decode!(fidl::encoding::Array<u8, 16>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
4172 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4173 {
4174 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4175 }
4176 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4177 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4178 }
4179 }
4180
4181 next_offset += envelope_size;
4182 _next_ordinal_to_read += 1;
4183 if next_offset >= end_offset {
4184 return Ok(());
4185 }
4186
4187 while _next_ordinal_to_read < 3 {
4189 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4190 _next_ordinal_to_read += 1;
4191 next_offset += envelope_size;
4192 }
4193
4194 let next_out_of_line = decoder.next_out_of_line();
4195 let handles_before = decoder.remaining_handles();
4196 if let Some((inlined, num_bytes, num_handles)) =
4197 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4198 {
4199 let member_inline_size =
4200 <fidl::encoding::Array<u8, 16> as fidl::encoding::TypeMarker>::inline_size(
4201 decoder.context,
4202 );
4203 if inlined != (member_inline_size <= 4) {
4204 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4205 }
4206 let inner_offset;
4207 let mut inner_depth = depth.clone();
4208 if inlined {
4209 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4210 inner_offset = next_offset;
4211 } else {
4212 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4213 inner_depth.increment()?;
4214 }
4215 let val_ref =
4216 self.type_guid.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Array<u8, 16>, fidl::encoding::DefaultFuchsiaResourceDialect));
4217 fidl::decode!(fidl::encoding::Array<u8, 16>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
4218 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4219 {
4220 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4221 }
4222 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4223 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4224 }
4225 }
4226
4227 next_offset += envelope_size;
4228
4229 while next_offset < end_offset {
4231 _next_ordinal_to_read += 1;
4232 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4233 next_offset += envelope_size;
4234 }
4235
4236 Ok(())
4237 }
4238 }
4239
4240 impl MountOptions {
4241 #[inline(always)]
4242 fn max_ordinal_present(&self) -> u64 {
4243 if let Some(_) = self.uri {
4244 return 3;
4245 }
4246 if let Some(_) = self.as_blob {
4247 return 2;
4248 }
4249 if let Some(_) = self.crypt {
4250 return 1;
4251 }
4252 0
4253 }
4254 }
4255
4256 impl fidl::encoding::ResourceTypeMarker for MountOptions {
4257 type Borrowed<'a> = &'a mut Self;
4258 fn take_or_borrow<'a>(
4259 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4260 ) -> Self::Borrowed<'a> {
4261 value
4262 }
4263 }
4264
4265 unsafe impl fidl::encoding::TypeMarker for MountOptions {
4266 type Owned = Self;
4267
4268 #[inline(always)]
4269 fn inline_align(_context: fidl::encoding::Context) -> usize {
4270 8
4271 }
4272
4273 #[inline(always)]
4274 fn inline_size(_context: fidl::encoding::Context) -> usize {
4275 16
4276 }
4277 }
4278
4279 unsafe impl fidl::encoding::Encode<MountOptions, fidl::encoding::DefaultFuchsiaResourceDialect>
4280 for &mut MountOptions
4281 {
4282 unsafe fn encode(
4283 self,
4284 encoder: &mut fidl::encoding::Encoder<
4285 '_,
4286 fidl::encoding::DefaultFuchsiaResourceDialect,
4287 >,
4288 offset: usize,
4289 mut depth: fidl::encoding::Depth,
4290 ) -> fidl::Result<()> {
4291 encoder.debug_check_bounds::<MountOptions>(offset);
4292 let max_ordinal: u64 = self.max_ordinal_present();
4294 encoder.write_num(max_ordinal, offset);
4295 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4296 if max_ordinal == 0 {
4298 return Ok(());
4299 }
4300 depth.increment()?;
4301 let envelope_size = 8;
4302 let bytes_len = max_ordinal as usize * envelope_size;
4303 #[allow(unused_variables)]
4304 let offset = encoder.out_of_line_offset(bytes_len);
4305 let mut _prev_end_offset: usize = 0;
4306 if 1 > max_ordinal {
4307 return Ok(());
4308 }
4309
4310 let cur_offset: usize = (1 - 1) * envelope_size;
4313
4314 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4316
4317 fidl::encoding::encode_in_envelope_optional::<
4322 fidl::encoding::Endpoint<
4323 fidl::endpoints::ClientEnd<fidl_fuchsia_fxfs::CryptMarker>,
4324 >,
4325 fidl::encoding::DefaultFuchsiaResourceDialect,
4326 >(
4327 self.crypt.as_mut().map(
4328 <fidl::encoding::Endpoint<
4329 fidl::endpoints::ClientEnd<fidl_fuchsia_fxfs::CryptMarker>,
4330 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
4331 ),
4332 encoder,
4333 offset + cur_offset,
4334 depth,
4335 )?;
4336
4337 _prev_end_offset = cur_offset + envelope_size;
4338 if 2 > max_ordinal {
4339 return Ok(());
4340 }
4341
4342 let cur_offset: usize = (2 - 1) * envelope_size;
4345
4346 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4348
4349 fidl::encoding::encode_in_envelope_optional::<
4354 bool,
4355 fidl::encoding::DefaultFuchsiaResourceDialect,
4356 >(
4357 self.as_blob.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
4358 encoder,
4359 offset + cur_offset,
4360 depth,
4361 )?;
4362
4363 _prev_end_offset = cur_offset + envelope_size;
4364 if 3 > max_ordinal {
4365 return Ok(());
4366 }
4367
4368 let cur_offset: usize = (3 - 1) * envelope_size;
4371
4372 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4374
4375 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<1024>, fidl::encoding::DefaultFuchsiaResourceDialect>(
4380 self.uri.as_ref().map(<fidl::encoding::BoundedString<1024> as fidl::encoding::ValueTypeMarker>::borrow),
4381 encoder, offset + cur_offset, depth
4382 )?;
4383
4384 _prev_end_offset = cur_offset + envelope_size;
4385
4386 Ok(())
4387 }
4388 }
4389
4390 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for MountOptions {
4391 #[inline(always)]
4392 fn new_empty() -> Self {
4393 Self::default()
4394 }
4395
4396 unsafe fn decode(
4397 &mut self,
4398 decoder: &mut fidl::encoding::Decoder<
4399 '_,
4400 fidl::encoding::DefaultFuchsiaResourceDialect,
4401 >,
4402 offset: usize,
4403 mut depth: fidl::encoding::Depth,
4404 ) -> fidl::Result<()> {
4405 decoder.debug_check_bounds::<Self>(offset);
4406 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4407 None => return Err(fidl::Error::NotNullable),
4408 Some(len) => len,
4409 };
4410 if len == 0 {
4412 return Ok(());
4413 };
4414 depth.increment()?;
4415 let envelope_size = 8;
4416 let bytes_len = len * envelope_size;
4417 let offset = decoder.out_of_line_offset(bytes_len)?;
4418 let mut _next_ordinal_to_read = 0;
4420 let mut next_offset = offset;
4421 let end_offset = offset + bytes_len;
4422 _next_ordinal_to_read += 1;
4423 if next_offset >= end_offset {
4424 return Ok(());
4425 }
4426
4427 while _next_ordinal_to_read < 1 {
4429 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4430 _next_ordinal_to_read += 1;
4431 next_offset += envelope_size;
4432 }
4433
4434 let next_out_of_line = decoder.next_out_of_line();
4435 let handles_before = decoder.remaining_handles();
4436 if let Some((inlined, num_bytes, num_handles)) =
4437 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4438 {
4439 let member_inline_size = <fidl::encoding::Endpoint<
4440 fidl::endpoints::ClientEnd<fidl_fuchsia_fxfs::CryptMarker>,
4441 > as fidl::encoding::TypeMarker>::inline_size(
4442 decoder.context
4443 );
4444 if inlined != (member_inline_size <= 4) {
4445 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4446 }
4447 let inner_offset;
4448 let mut inner_depth = depth.clone();
4449 if inlined {
4450 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4451 inner_offset = next_offset;
4452 } else {
4453 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4454 inner_depth.increment()?;
4455 }
4456 let val_ref = self.crypt.get_or_insert_with(|| {
4457 fidl::new_empty!(
4458 fidl::encoding::Endpoint<
4459 fidl::endpoints::ClientEnd<fidl_fuchsia_fxfs::CryptMarker>,
4460 >,
4461 fidl::encoding::DefaultFuchsiaResourceDialect
4462 )
4463 });
4464 fidl::decode!(
4465 fidl::encoding::Endpoint<
4466 fidl::endpoints::ClientEnd<fidl_fuchsia_fxfs::CryptMarker>,
4467 >,
4468 fidl::encoding::DefaultFuchsiaResourceDialect,
4469 val_ref,
4470 decoder,
4471 inner_offset,
4472 inner_depth
4473 )?;
4474 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4475 {
4476 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4477 }
4478 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4479 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4480 }
4481 }
4482
4483 next_offset += envelope_size;
4484 _next_ordinal_to_read += 1;
4485 if next_offset >= end_offset {
4486 return Ok(());
4487 }
4488
4489 while _next_ordinal_to_read < 2 {
4491 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4492 _next_ordinal_to_read += 1;
4493 next_offset += envelope_size;
4494 }
4495
4496 let next_out_of_line = decoder.next_out_of_line();
4497 let handles_before = decoder.remaining_handles();
4498 if let Some((inlined, num_bytes, num_handles)) =
4499 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4500 {
4501 let member_inline_size =
4502 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4503 if inlined != (member_inline_size <= 4) {
4504 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4505 }
4506 let inner_offset;
4507 let mut inner_depth = depth.clone();
4508 if inlined {
4509 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4510 inner_offset = next_offset;
4511 } else {
4512 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4513 inner_depth.increment()?;
4514 }
4515 let val_ref = self.as_blob.get_or_insert_with(|| {
4516 fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
4517 });
4518 fidl::decode!(
4519 bool,
4520 fidl::encoding::DefaultFuchsiaResourceDialect,
4521 val_ref,
4522 decoder,
4523 inner_offset,
4524 inner_depth
4525 )?;
4526 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4527 {
4528 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4529 }
4530 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4531 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4532 }
4533 }
4534
4535 next_offset += envelope_size;
4536 _next_ordinal_to_read += 1;
4537 if next_offset >= end_offset {
4538 return Ok(());
4539 }
4540
4541 while _next_ordinal_to_read < 3 {
4543 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4544 _next_ordinal_to_read += 1;
4545 next_offset += envelope_size;
4546 }
4547
4548 let next_out_of_line = decoder.next_out_of_line();
4549 let handles_before = decoder.remaining_handles();
4550 if let Some((inlined, num_bytes, num_handles)) =
4551 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4552 {
4553 let member_inline_size = <fidl::encoding::BoundedString<1024> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4554 if inlined != (member_inline_size <= 4) {
4555 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4556 }
4557 let inner_offset;
4558 let mut inner_depth = depth.clone();
4559 if inlined {
4560 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4561 inner_offset = next_offset;
4562 } else {
4563 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4564 inner_depth.increment()?;
4565 }
4566 let val_ref = self.uri.get_or_insert_with(|| {
4567 fidl::new_empty!(
4568 fidl::encoding::BoundedString<1024>,
4569 fidl::encoding::DefaultFuchsiaResourceDialect
4570 )
4571 });
4572 fidl::decode!(
4573 fidl::encoding::BoundedString<1024>,
4574 fidl::encoding::DefaultFuchsiaResourceDialect,
4575 val_ref,
4576 decoder,
4577 inner_offset,
4578 inner_depth
4579 )?;
4580 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4581 {
4582 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4583 }
4584 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4585 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4586 }
4587 }
4588
4589 next_offset += envelope_size;
4590
4591 while next_offset < end_offset {
4593 _next_ordinal_to_read += 1;
4594 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4595 next_offset += envelope_size;
4596 }
4597
4598 Ok(())
4599 }
4600 }
4601}