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