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_realm_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct ControllerCheckRequest {
16 pub device: fidl::endpoints::ClientEnd<fidl_fuchsia_device::ControllerMarker>,
17 pub name: String,
18}
19
20impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ControllerCheckRequest {}
21
22#[derive(Debug, PartialEq)]
23pub struct ControllerFormatRequest {
24 pub device: fidl::endpoints::ClientEnd<fidl_fuchsia_device::ControllerMarker>,
25 pub name: String,
26 pub options: FormatOptions,
27}
28
29impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ControllerFormatRequest {}
30
31#[derive(Debug, PartialEq)]
32pub struct ControllerMountRequest {
33 pub device: fidl::endpoints::ClientEnd<fidl_fuchsia_device::ControllerMarker>,
34 pub name: String,
35 pub options: MountOptions,
36}
37
38impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ControllerMountRequest {}
39
40#[derive(Debug, Default, PartialEq)]
41pub struct FormatOptions {
42 pub verbose: Option<bool>,
43 pub fvm_data_slices: Option<u32>,
44 #[doc(hidden)]
45 pub __source_breaking: fidl::marker::SourceBreaking,
46}
47
48impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for FormatOptions {}
49
50#[derive(Debug, Default, PartialEq)]
51pub struct MountOptions {
52 pub read_only: Option<bool>,
53 pub verbose: Option<bool>,
54 pub write_compression_algorithm: Option<String>,
55 #[doc(hidden)]
56 pub __source_breaking: fidl::marker::SourceBreaking,
57}
58
59impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for MountOptions {}
60
61#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
62pub struct ControllerMarker;
63
64impl fidl::endpoints::ProtocolMarker for ControllerMarker {
65 type Proxy = ControllerProxy;
66 type RequestStream = ControllerRequestStream;
67 #[cfg(target_os = "fuchsia")]
68 type SynchronousProxy = ControllerSynchronousProxy;
69
70 const DEBUG_NAME: &'static str = "fuchsia.fs.realm.Controller";
71}
72impl fidl::endpoints::DiscoverableProtocolMarker for ControllerMarker {}
73pub type ControllerMountResult = Result<(), i32>;
74pub type ControllerUnmountResult = Result<(), i32>;
75pub type ControllerFormatResult = Result<(), i32>;
76pub type ControllerCheckResult = Result<(), i32>;
77
78pub trait ControllerProxyInterface: Send + Sync {
79 type MountResponseFut: std::future::Future<Output = Result<ControllerMountResult, fidl::Error>>
80 + Send;
81 fn r#mount(
82 &self,
83 device: fidl::endpoints::ClientEnd<fidl_fuchsia_device::ControllerMarker>,
84 name: &str,
85 options: MountOptions,
86 ) -> Self::MountResponseFut;
87 type UnmountResponseFut: std::future::Future<Output = Result<ControllerUnmountResult, fidl::Error>>
88 + Send;
89 fn r#unmount(&self, name: &str) -> Self::UnmountResponseFut;
90 type FormatResponseFut: std::future::Future<Output = Result<ControllerFormatResult, fidl::Error>>
91 + Send;
92 fn r#format(
93 &self,
94 device: fidl::endpoints::ClientEnd<fidl_fuchsia_device::ControllerMarker>,
95 name: &str,
96 options: FormatOptions,
97 ) -> Self::FormatResponseFut;
98 type CheckResponseFut: std::future::Future<Output = Result<ControllerCheckResult, fidl::Error>>
99 + Send;
100 fn r#check(
101 &self,
102 device: fidl::endpoints::ClientEnd<fidl_fuchsia_device::ControllerMarker>,
103 name: &str,
104 ) -> Self::CheckResponseFut;
105}
106#[derive(Debug)]
107#[cfg(target_os = "fuchsia")]
108pub struct ControllerSynchronousProxy {
109 client: fidl::client::sync::Client,
110}
111
112#[cfg(target_os = "fuchsia")]
113impl fidl::endpoints::SynchronousProxy for ControllerSynchronousProxy {
114 type Proxy = ControllerProxy;
115 type Protocol = ControllerMarker;
116
117 fn from_channel(inner: fidl::Channel) -> Self {
118 Self::new(inner)
119 }
120
121 fn into_channel(self) -> fidl::Channel {
122 self.client.into_channel()
123 }
124
125 fn as_channel(&self) -> &fidl::Channel {
126 self.client.as_channel()
127 }
128}
129
130#[cfg(target_os = "fuchsia")]
131impl ControllerSynchronousProxy {
132 pub fn new(channel: fidl::Channel) -> Self {
133 let protocol_name = <ControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
134 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
135 }
136
137 pub fn into_channel(self) -> fidl::Channel {
138 self.client.into_channel()
139 }
140
141 pub fn wait_for_event(
144 &self,
145 deadline: zx::MonotonicInstant,
146 ) -> Result<ControllerEvent, fidl::Error> {
147 ControllerEvent::decode(self.client.wait_for_event(deadline)?)
148 }
149
150 pub fn r#mount(
152 &self,
153 mut device: fidl::endpoints::ClientEnd<fidl_fuchsia_device::ControllerMarker>,
154 mut name: &str,
155 mut options: MountOptions,
156 ___deadline: zx::MonotonicInstant,
157 ) -> Result<ControllerMountResult, fidl::Error> {
158 let _response = self.client.send_query::<
159 ControllerMountRequest,
160 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
161 >(
162 (device, name, &mut options,),
163 0x49300213a51ec7f7,
164 fidl::encoding::DynamicFlags::empty(),
165 ___deadline,
166 )?;
167 Ok(_response.map(|x| x))
168 }
169
170 pub fn r#unmount(
172 &self,
173 mut name: &str,
174 ___deadline: zx::MonotonicInstant,
175 ) -> Result<ControllerUnmountResult, fidl::Error> {
176 let _response = self.client.send_query::<
177 ControllerUnmountRequest,
178 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
179 >(
180 (name,),
181 0x2d994ee1a9364179,
182 fidl::encoding::DynamicFlags::empty(),
183 ___deadline,
184 )?;
185 Ok(_response.map(|x| x))
186 }
187
188 pub fn r#format(
190 &self,
191 mut device: fidl::endpoints::ClientEnd<fidl_fuchsia_device::ControllerMarker>,
192 mut name: &str,
193 mut options: FormatOptions,
194 ___deadline: zx::MonotonicInstant,
195 ) -> Result<ControllerFormatResult, fidl::Error> {
196 let _response = self.client.send_query::<
197 ControllerFormatRequest,
198 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
199 >(
200 (device, name, &mut options,),
201 0x52ce219e43664bf0,
202 fidl::encoding::DynamicFlags::empty(),
203 ___deadline,
204 )?;
205 Ok(_response.map(|x| x))
206 }
207
208 pub fn r#check(
211 &self,
212 mut device: fidl::endpoints::ClientEnd<fidl_fuchsia_device::ControllerMarker>,
213 mut name: &str,
214 ___deadline: zx::MonotonicInstant,
215 ) -> Result<ControllerCheckResult, fidl::Error> {
216 let _response = self.client.send_query::<
217 ControllerCheckRequest,
218 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
219 >(
220 (device, name,),
221 0x20d3ff7c33a9b863,
222 fidl::encoding::DynamicFlags::empty(),
223 ___deadline,
224 )?;
225 Ok(_response.map(|x| x))
226 }
227}
228
229#[cfg(target_os = "fuchsia")]
230impl From<ControllerSynchronousProxy> for zx::Handle {
231 fn from(value: ControllerSynchronousProxy) -> Self {
232 value.into_channel().into()
233 }
234}
235
236#[cfg(target_os = "fuchsia")]
237impl From<fidl::Channel> for ControllerSynchronousProxy {
238 fn from(value: fidl::Channel) -> Self {
239 Self::new(value)
240 }
241}
242
243#[derive(Debug, Clone)]
244pub struct ControllerProxy {
245 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
246}
247
248impl fidl::endpoints::Proxy for ControllerProxy {
249 type Protocol = ControllerMarker;
250
251 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
252 Self::new(inner)
253 }
254
255 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
256 self.client.into_channel().map_err(|client| Self { client })
257 }
258
259 fn as_channel(&self) -> &::fidl::AsyncChannel {
260 self.client.as_channel()
261 }
262}
263
264impl ControllerProxy {
265 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
267 let protocol_name = <ControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
268 Self { client: fidl::client::Client::new(channel, protocol_name) }
269 }
270
271 pub fn take_event_stream(&self) -> ControllerEventStream {
277 ControllerEventStream { event_receiver: self.client.take_event_receiver() }
278 }
279
280 pub fn r#mount(
282 &self,
283 mut device: fidl::endpoints::ClientEnd<fidl_fuchsia_device::ControllerMarker>,
284 mut name: &str,
285 mut options: MountOptions,
286 ) -> fidl::client::QueryResponseFut<
287 ControllerMountResult,
288 fidl::encoding::DefaultFuchsiaResourceDialect,
289 > {
290 ControllerProxyInterface::r#mount(self, device, name, options)
291 }
292
293 pub fn r#unmount(
295 &self,
296 mut name: &str,
297 ) -> fidl::client::QueryResponseFut<
298 ControllerUnmountResult,
299 fidl::encoding::DefaultFuchsiaResourceDialect,
300 > {
301 ControllerProxyInterface::r#unmount(self, name)
302 }
303
304 pub fn r#format(
306 &self,
307 mut device: fidl::endpoints::ClientEnd<fidl_fuchsia_device::ControllerMarker>,
308 mut name: &str,
309 mut options: FormatOptions,
310 ) -> fidl::client::QueryResponseFut<
311 ControllerFormatResult,
312 fidl::encoding::DefaultFuchsiaResourceDialect,
313 > {
314 ControllerProxyInterface::r#format(self, device, name, options)
315 }
316
317 pub fn r#check(
320 &self,
321 mut device: fidl::endpoints::ClientEnd<fidl_fuchsia_device::ControllerMarker>,
322 mut name: &str,
323 ) -> fidl::client::QueryResponseFut<
324 ControllerCheckResult,
325 fidl::encoding::DefaultFuchsiaResourceDialect,
326 > {
327 ControllerProxyInterface::r#check(self, device, name)
328 }
329}
330
331impl ControllerProxyInterface for ControllerProxy {
332 type MountResponseFut = fidl::client::QueryResponseFut<
333 ControllerMountResult,
334 fidl::encoding::DefaultFuchsiaResourceDialect,
335 >;
336 fn r#mount(
337 &self,
338 mut device: fidl::endpoints::ClientEnd<fidl_fuchsia_device::ControllerMarker>,
339 mut name: &str,
340 mut options: MountOptions,
341 ) -> Self::MountResponseFut {
342 fn _decode(
343 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
344 ) -> Result<ControllerMountResult, fidl::Error> {
345 let _response = fidl::client::decode_transaction_body::<
346 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
347 fidl::encoding::DefaultFuchsiaResourceDialect,
348 0x49300213a51ec7f7,
349 >(_buf?)?;
350 Ok(_response.map(|x| x))
351 }
352 self.client.send_query_and_decode::<ControllerMountRequest, ControllerMountResult>(
353 (device, name, &mut options),
354 0x49300213a51ec7f7,
355 fidl::encoding::DynamicFlags::empty(),
356 _decode,
357 )
358 }
359
360 type UnmountResponseFut = fidl::client::QueryResponseFut<
361 ControllerUnmountResult,
362 fidl::encoding::DefaultFuchsiaResourceDialect,
363 >;
364 fn r#unmount(&self, mut name: &str) -> Self::UnmountResponseFut {
365 fn _decode(
366 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
367 ) -> Result<ControllerUnmountResult, fidl::Error> {
368 let _response = fidl::client::decode_transaction_body::<
369 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
370 fidl::encoding::DefaultFuchsiaResourceDialect,
371 0x2d994ee1a9364179,
372 >(_buf?)?;
373 Ok(_response.map(|x| x))
374 }
375 self.client.send_query_and_decode::<ControllerUnmountRequest, ControllerUnmountResult>(
376 (name,),
377 0x2d994ee1a9364179,
378 fidl::encoding::DynamicFlags::empty(),
379 _decode,
380 )
381 }
382
383 type FormatResponseFut = fidl::client::QueryResponseFut<
384 ControllerFormatResult,
385 fidl::encoding::DefaultFuchsiaResourceDialect,
386 >;
387 fn r#format(
388 &self,
389 mut device: fidl::endpoints::ClientEnd<fidl_fuchsia_device::ControllerMarker>,
390 mut name: &str,
391 mut options: FormatOptions,
392 ) -> Self::FormatResponseFut {
393 fn _decode(
394 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
395 ) -> Result<ControllerFormatResult, fidl::Error> {
396 let _response = fidl::client::decode_transaction_body::<
397 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
398 fidl::encoding::DefaultFuchsiaResourceDialect,
399 0x52ce219e43664bf0,
400 >(_buf?)?;
401 Ok(_response.map(|x| x))
402 }
403 self.client.send_query_and_decode::<ControllerFormatRequest, ControllerFormatResult>(
404 (device, name, &mut options),
405 0x52ce219e43664bf0,
406 fidl::encoding::DynamicFlags::empty(),
407 _decode,
408 )
409 }
410
411 type CheckResponseFut = fidl::client::QueryResponseFut<
412 ControllerCheckResult,
413 fidl::encoding::DefaultFuchsiaResourceDialect,
414 >;
415 fn r#check(
416 &self,
417 mut device: fidl::endpoints::ClientEnd<fidl_fuchsia_device::ControllerMarker>,
418 mut name: &str,
419 ) -> Self::CheckResponseFut {
420 fn _decode(
421 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
422 ) -> Result<ControllerCheckResult, fidl::Error> {
423 let _response = fidl::client::decode_transaction_body::<
424 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
425 fidl::encoding::DefaultFuchsiaResourceDialect,
426 0x20d3ff7c33a9b863,
427 >(_buf?)?;
428 Ok(_response.map(|x| x))
429 }
430 self.client.send_query_and_decode::<ControllerCheckRequest, ControllerCheckResult>(
431 (device, name),
432 0x20d3ff7c33a9b863,
433 fidl::encoding::DynamicFlags::empty(),
434 _decode,
435 )
436 }
437}
438
439pub struct ControllerEventStream {
440 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
441}
442
443impl std::marker::Unpin for ControllerEventStream {}
444
445impl futures::stream::FusedStream for ControllerEventStream {
446 fn is_terminated(&self) -> bool {
447 self.event_receiver.is_terminated()
448 }
449}
450
451impl futures::Stream for ControllerEventStream {
452 type Item = Result<ControllerEvent, fidl::Error>;
453
454 fn poll_next(
455 mut self: std::pin::Pin<&mut Self>,
456 cx: &mut std::task::Context<'_>,
457 ) -> std::task::Poll<Option<Self::Item>> {
458 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
459 &mut self.event_receiver,
460 cx
461 )?) {
462 Some(buf) => std::task::Poll::Ready(Some(ControllerEvent::decode(buf))),
463 None => std::task::Poll::Ready(None),
464 }
465 }
466}
467
468#[derive(Debug)]
469pub enum ControllerEvent {}
470
471impl ControllerEvent {
472 fn decode(
474 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
475 ) -> Result<ControllerEvent, fidl::Error> {
476 let (bytes, _handles) = buf.split_mut();
477 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
478 debug_assert_eq!(tx_header.tx_id, 0);
479 match tx_header.ordinal {
480 _ => Err(fidl::Error::UnknownOrdinal {
481 ordinal: tx_header.ordinal,
482 protocol_name: <ControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
483 }),
484 }
485 }
486}
487
488pub struct ControllerRequestStream {
490 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
491 is_terminated: bool,
492}
493
494impl std::marker::Unpin for ControllerRequestStream {}
495
496impl futures::stream::FusedStream for ControllerRequestStream {
497 fn is_terminated(&self) -> bool {
498 self.is_terminated
499 }
500}
501
502impl fidl::endpoints::RequestStream for ControllerRequestStream {
503 type Protocol = ControllerMarker;
504 type ControlHandle = ControllerControlHandle;
505
506 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
507 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
508 }
509
510 fn control_handle(&self) -> Self::ControlHandle {
511 ControllerControlHandle { inner: self.inner.clone() }
512 }
513
514 fn into_inner(
515 self,
516 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
517 {
518 (self.inner, self.is_terminated)
519 }
520
521 fn from_inner(
522 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
523 is_terminated: bool,
524 ) -> Self {
525 Self { inner, is_terminated }
526 }
527}
528
529impl futures::Stream for ControllerRequestStream {
530 type Item = Result<ControllerRequest, fidl::Error>;
531
532 fn poll_next(
533 mut self: std::pin::Pin<&mut Self>,
534 cx: &mut std::task::Context<'_>,
535 ) -> std::task::Poll<Option<Self::Item>> {
536 let this = &mut *self;
537 if this.inner.check_shutdown(cx) {
538 this.is_terminated = true;
539 return std::task::Poll::Ready(None);
540 }
541 if this.is_terminated {
542 panic!("polled ControllerRequestStream after completion");
543 }
544 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
545 |bytes, handles| {
546 match this.inner.channel().read_etc(cx, bytes, handles) {
547 std::task::Poll::Ready(Ok(())) => {}
548 std::task::Poll::Pending => return std::task::Poll::Pending,
549 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
550 this.is_terminated = true;
551 return std::task::Poll::Ready(None);
552 }
553 std::task::Poll::Ready(Err(e)) => {
554 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
555 e.into(),
556 ))))
557 }
558 }
559
560 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
562
563 std::task::Poll::Ready(Some(match header.ordinal {
564 0x49300213a51ec7f7 => {
565 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
566 let mut req = fidl::new_empty!(
567 ControllerMountRequest,
568 fidl::encoding::DefaultFuchsiaResourceDialect
569 );
570 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControllerMountRequest>(&header, _body_bytes, handles, &mut req)?;
571 let control_handle = ControllerControlHandle { inner: this.inner.clone() };
572 Ok(ControllerRequest::Mount {
573 device: req.device,
574 name: req.name,
575 options: req.options,
576
577 responder: ControllerMountResponder {
578 control_handle: std::mem::ManuallyDrop::new(control_handle),
579 tx_id: header.tx_id,
580 },
581 })
582 }
583 0x2d994ee1a9364179 => {
584 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
585 let mut req = fidl::new_empty!(
586 ControllerUnmountRequest,
587 fidl::encoding::DefaultFuchsiaResourceDialect
588 );
589 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControllerUnmountRequest>(&header, _body_bytes, handles, &mut req)?;
590 let control_handle = ControllerControlHandle { inner: this.inner.clone() };
591 Ok(ControllerRequest::Unmount {
592 name: req.name,
593
594 responder: ControllerUnmountResponder {
595 control_handle: std::mem::ManuallyDrop::new(control_handle),
596 tx_id: header.tx_id,
597 },
598 })
599 }
600 0x52ce219e43664bf0 => {
601 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
602 let mut req = fidl::new_empty!(
603 ControllerFormatRequest,
604 fidl::encoding::DefaultFuchsiaResourceDialect
605 );
606 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControllerFormatRequest>(&header, _body_bytes, handles, &mut req)?;
607 let control_handle = ControllerControlHandle { inner: this.inner.clone() };
608 Ok(ControllerRequest::Format {
609 device: req.device,
610 name: req.name,
611 options: req.options,
612
613 responder: ControllerFormatResponder {
614 control_handle: std::mem::ManuallyDrop::new(control_handle),
615 tx_id: header.tx_id,
616 },
617 })
618 }
619 0x20d3ff7c33a9b863 => {
620 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
621 let mut req = fidl::new_empty!(
622 ControllerCheckRequest,
623 fidl::encoding::DefaultFuchsiaResourceDialect
624 );
625 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControllerCheckRequest>(&header, _body_bytes, handles, &mut req)?;
626 let control_handle = ControllerControlHandle { inner: this.inner.clone() };
627 Ok(ControllerRequest::Check {
628 device: req.device,
629 name: req.name,
630
631 responder: ControllerCheckResponder {
632 control_handle: std::mem::ManuallyDrop::new(control_handle),
633 tx_id: header.tx_id,
634 },
635 })
636 }
637 _ => Err(fidl::Error::UnknownOrdinal {
638 ordinal: header.ordinal,
639 protocol_name:
640 <ControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
641 }),
642 }))
643 },
644 )
645 }
646}
647
648#[derive(Debug)]
649pub enum ControllerRequest {
650 Mount {
652 device: fidl::endpoints::ClientEnd<fidl_fuchsia_device::ControllerMarker>,
653 name: String,
654 options: MountOptions,
655 responder: ControllerMountResponder,
656 },
657 Unmount { name: String, responder: ControllerUnmountResponder },
659 Format {
661 device: fidl::endpoints::ClientEnd<fidl_fuchsia_device::ControllerMarker>,
662 name: String,
663 options: FormatOptions,
664 responder: ControllerFormatResponder,
665 },
666 Check {
669 device: fidl::endpoints::ClientEnd<fidl_fuchsia_device::ControllerMarker>,
670 name: String,
671 responder: ControllerCheckResponder,
672 },
673}
674
675impl ControllerRequest {
676 #[allow(irrefutable_let_patterns)]
677 pub fn into_mount(
678 self,
679 ) -> Option<(
680 fidl::endpoints::ClientEnd<fidl_fuchsia_device::ControllerMarker>,
681 String,
682 MountOptions,
683 ControllerMountResponder,
684 )> {
685 if let ControllerRequest::Mount { device, name, options, responder } = self {
686 Some((device, name, options, responder))
687 } else {
688 None
689 }
690 }
691
692 #[allow(irrefutable_let_patterns)]
693 pub fn into_unmount(self) -> Option<(String, ControllerUnmountResponder)> {
694 if let ControllerRequest::Unmount { name, responder } = self {
695 Some((name, responder))
696 } else {
697 None
698 }
699 }
700
701 #[allow(irrefutable_let_patterns)]
702 pub fn into_format(
703 self,
704 ) -> Option<(
705 fidl::endpoints::ClientEnd<fidl_fuchsia_device::ControllerMarker>,
706 String,
707 FormatOptions,
708 ControllerFormatResponder,
709 )> {
710 if let ControllerRequest::Format { device, name, options, responder } = self {
711 Some((device, name, options, responder))
712 } else {
713 None
714 }
715 }
716
717 #[allow(irrefutable_let_patterns)]
718 pub fn into_check(
719 self,
720 ) -> Option<(
721 fidl::endpoints::ClientEnd<fidl_fuchsia_device::ControllerMarker>,
722 String,
723 ControllerCheckResponder,
724 )> {
725 if let ControllerRequest::Check { device, name, responder } = self {
726 Some((device, name, responder))
727 } else {
728 None
729 }
730 }
731
732 pub fn method_name(&self) -> &'static str {
734 match *self {
735 ControllerRequest::Mount { .. } => "mount",
736 ControllerRequest::Unmount { .. } => "unmount",
737 ControllerRequest::Format { .. } => "format",
738 ControllerRequest::Check { .. } => "check",
739 }
740 }
741}
742
743#[derive(Debug, Clone)]
744pub struct ControllerControlHandle {
745 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
746}
747
748impl fidl::endpoints::ControlHandle for ControllerControlHandle {
749 fn shutdown(&self) {
750 self.inner.shutdown()
751 }
752 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
753 self.inner.shutdown_with_epitaph(status)
754 }
755
756 fn is_closed(&self) -> bool {
757 self.inner.channel().is_closed()
758 }
759 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
760 self.inner.channel().on_closed()
761 }
762
763 #[cfg(target_os = "fuchsia")]
764 fn signal_peer(
765 &self,
766 clear_mask: zx::Signals,
767 set_mask: zx::Signals,
768 ) -> Result<(), zx_status::Status> {
769 use fidl::Peered;
770 self.inner.channel().signal_peer(clear_mask, set_mask)
771 }
772}
773
774impl ControllerControlHandle {}
775
776#[must_use = "FIDL methods require a response to be sent"]
777#[derive(Debug)]
778pub struct ControllerMountResponder {
779 control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
780 tx_id: u32,
781}
782
783impl std::ops::Drop for ControllerMountResponder {
787 fn drop(&mut self) {
788 self.control_handle.shutdown();
789 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
791 }
792}
793
794impl fidl::endpoints::Responder for ControllerMountResponder {
795 type ControlHandle = ControllerControlHandle;
796
797 fn control_handle(&self) -> &ControllerControlHandle {
798 &self.control_handle
799 }
800
801 fn drop_without_shutdown(mut self) {
802 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
804 std::mem::forget(self);
806 }
807}
808
809impl ControllerMountResponder {
810 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
814 let _result = self.send_raw(result);
815 if _result.is_err() {
816 self.control_handle.shutdown();
817 }
818 self.drop_without_shutdown();
819 _result
820 }
821
822 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
824 let _result = self.send_raw(result);
825 self.drop_without_shutdown();
826 _result
827 }
828
829 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
830 self.control_handle
831 .inner
832 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
833 result,
834 self.tx_id,
835 0x49300213a51ec7f7,
836 fidl::encoding::DynamicFlags::empty(),
837 )
838 }
839}
840
841#[must_use = "FIDL methods require a response to be sent"]
842#[derive(Debug)]
843pub struct ControllerUnmountResponder {
844 control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
845 tx_id: u32,
846}
847
848impl std::ops::Drop for ControllerUnmountResponder {
852 fn drop(&mut self) {
853 self.control_handle.shutdown();
854 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
856 }
857}
858
859impl fidl::endpoints::Responder for ControllerUnmountResponder {
860 type ControlHandle = ControllerControlHandle;
861
862 fn control_handle(&self) -> &ControllerControlHandle {
863 &self.control_handle
864 }
865
866 fn drop_without_shutdown(mut self) {
867 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
869 std::mem::forget(self);
871 }
872}
873
874impl ControllerUnmountResponder {
875 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
879 let _result = self.send_raw(result);
880 if _result.is_err() {
881 self.control_handle.shutdown();
882 }
883 self.drop_without_shutdown();
884 _result
885 }
886
887 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
889 let _result = self.send_raw(result);
890 self.drop_without_shutdown();
891 _result
892 }
893
894 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
895 self.control_handle
896 .inner
897 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
898 result,
899 self.tx_id,
900 0x2d994ee1a9364179,
901 fidl::encoding::DynamicFlags::empty(),
902 )
903 }
904}
905
906#[must_use = "FIDL methods require a response to be sent"]
907#[derive(Debug)]
908pub struct ControllerFormatResponder {
909 control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
910 tx_id: u32,
911}
912
913impl std::ops::Drop for ControllerFormatResponder {
917 fn drop(&mut self) {
918 self.control_handle.shutdown();
919 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
921 }
922}
923
924impl fidl::endpoints::Responder for ControllerFormatResponder {
925 type ControlHandle = ControllerControlHandle;
926
927 fn control_handle(&self) -> &ControllerControlHandle {
928 &self.control_handle
929 }
930
931 fn drop_without_shutdown(mut self) {
932 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
934 std::mem::forget(self);
936 }
937}
938
939impl ControllerFormatResponder {
940 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
944 let _result = self.send_raw(result);
945 if _result.is_err() {
946 self.control_handle.shutdown();
947 }
948 self.drop_without_shutdown();
949 _result
950 }
951
952 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
954 let _result = self.send_raw(result);
955 self.drop_without_shutdown();
956 _result
957 }
958
959 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
960 self.control_handle
961 .inner
962 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
963 result,
964 self.tx_id,
965 0x52ce219e43664bf0,
966 fidl::encoding::DynamicFlags::empty(),
967 )
968 }
969}
970
971#[must_use = "FIDL methods require a response to be sent"]
972#[derive(Debug)]
973pub struct ControllerCheckResponder {
974 control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
975 tx_id: u32,
976}
977
978impl std::ops::Drop for ControllerCheckResponder {
982 fn drop(&mut self) {
983 self.control_handle.shutdown();
984 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
986 }
987}
988
989impl fidl::endpoints::Responder for ControllerCheckResponder {
990 type ControlHandle = ControllerControlHandle;
991
992 fn control_handle(&self) -> &ControllerControlHandle {
993 &self.control_handle
994 }
995
996 fn drop_without_shutdown(mut self) {
997 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
999 std::mem::forget(self);
1001 }
1002}
1003
1004impl ControllerCheckResponder {
1005 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1009 let _result = self.send_raw(result);
1010 if _result.is_err() {
1011 self.control_handle.shutdown();
1012 }
1013 self.drop_without_shutdown();
1014 _result
1015 }
1016
1017 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1019 let _result = self.send_raw(result);
1020 self.drop_without_shutdown();
1021 _result
1022 }
1023
1024 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1025 self.control_handle
1026 .inner
1027 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1028 result,
1029 self.tx_id,
1030 0x20d3ff7c33a9b863,
1031 fidl::encoding::DynamicFlags::empty(),
1032 )
1033 }
1034}
1035
1036mod internal {
1037 use super::*;
1038
1039 impl fidl::encoding::ResourceTypeMarker for ControllerCheckRequest {
1040 type Borrowed<'a> = &'a mut Self;
1041 fn take_or_borrow<'a>(
1042 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1043 ) -> Self::Borrowed<'a> {
1044 value
1045 }
1046 }
1047
1048 unsafe impl fidl::encoding::TypeMarker for ControllerCheckRequest {
1049 type Owned = Self;
1050
1051 #[inline(always)]
1052 fn inline_align(_context: fidl::encoding::Context) -> usize {
1053 8
1054 }
1055
1056 #[inline(always)]
1057 fn inline_size(_context: fidl::encoding::Context) -> usize {
1058 24
1059 }
1060 }
1061
1062 unsafe impl
1063 fidl::encoding::Encode<
1064 ControllerCheckRequest,
1065 fidl::encoding::DefaultFuchsiaResourceDialect,
1066 > for &mut ControllerCheckRequest
1067 {
1068 #[inline]
1069 unsafe fn encode(
1070 self,
1071 encoder: &mut fidl::encoding::Encoder<
1072 '_,
1073 fidl::encoding::DefaultFuchsiaResourceDialect,
1074 >,
1075 offset: usize,
1076 _depth: fidl::encoding::Depth,
1077 ) -> fidl::Result<()> {
1078 encoder.debug_check_bounds::<ControllerCheckRequest>(offset);
1079 fidl::encoding::Encode::<
1081 ControllerCheckRequest,
1082 fidl::encoding::DefaultFuchsiaResourceDialect,
1083 >::encode(
1084 (
1085 <fidl::encoding::Endpoint<
1086 fidl::endpoints::ClientEnd<fidl_fuchsia_device::ControllerMarker>,
1087 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1088 &mut self.device
1089 ),
1090 <fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(
1091 &self.name,
1092 ),
1093 ),
1094 encoder,
1095 offset,
1096 _depth,
1097 )
1098 }
1099 }
1100 unsafe impl<
1101 T0: fidl::encoding::Encode<
1102 fidl::encoding::Endpoint<
1103 fidl::endpoints::ClientEnd<fidl_fuchsia_device::ControllerMarker>,
1104 >,
1105 fidl::encoding::DefaultFuchsiaResourceDialect,
1106 >,
1107 T1: fidl::encoding::Encode<
1108 fidl::encoding::BoundedString<255>,
1109 fidl::encoding::DefaultFuchsiaResourceDialect,
1110 >,
1111 >
1112 fidl::encoding::Encode<
1113 ControllerCheckRequest,
1114 fidl::encoding::DefaultFuchsiaResourceDialect,
1115 > for (T0, T1)
1116 {
1117 #[inline]
1118 unsafe fn encode(
1119 self,
1120 encoder: &mut fidl::encoding::Encoder<
1121 '_,
1122 fidl::encoding::DefaultFuchsiaResourceDialect,
1123 >,
1124 offset: usize,
1125 depth: fidl::encoding::Depth,
1126 ) -> fidl::Result<()> {
1127 encoder.debug_check_bounds::<ControllerCheckRequest>(offset);
1128 unsafe {
1131 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
1132 (ptr as *mut u64).write_unaligned(0);
1133 }
1134 self.0.encode(encoder, offset + 0, depth)?;
1136 self.1.encode(encoder, offset + 8, depth)?;
1137 Ok(())
1138 }
1139 }
1140
1141 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1142 for ControllerCheckRequest
1143 {
1144 #[inline(always)]
1145 fn new_empty() -> Self {
1146 Self {
1147 device: fidl::new_empty!(
1148 fidl::encoding::Endpoint<
1149 fidl::endpoints::ClientEnd<fidl_fuchsia_device::ControllerMarker>,
1150 >,
1151 fidl::encoding::DefaultFuchsiaResourceDialect
1152 ),
1153 name: fidl::new_empty!(
1154 fidl::encoding::BoundedString<255>,
1155 fidl::encoding::DefaultFuchsiaResourceDialect
1156 ),
1157 }
1158 }
1159
1160 #[inline]
1161 unsafe fn decode(
1162 &mut self,
1163 decoder: &mut fidl::encoding::Decoder<
1164 '_,
1165 fidl::encoding::DefaultFuchsiaResourceDialect,
1166 >,
1167 offset: usize,
1168 _depth: fidl::encoding::Depth,
1169 ) -> fidl::Result<()> {
1170 decoder.debug_check_bounds::<Self>(offset);
1171 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
1173 let padval = unsafe { (ptr as *const u64).read_unaligned() };
1174 let mask = 0xffffffff00000000u64;
1175 let maskedval = padval & mask;
1176 if maskedval != 0 {
1177 return Err(fidl::Error::NonZeroPadding {
1178 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
1179 });
1180 }
1181 fidl::decode!(
1182 fidl::encoding::Endpoint<
1183 fidl::endpoints::ClientEnd<fidl_fuchsia_device::ControllerMarker>,
1184 >,
1185 fidl::encoding::DefaultFuchsiaResourceDialect,
1186 &mut self.device,
1187 decoder,
1188 offset + 0,
1189 _depth
1190 )?;
1191 fidl::decode!(
1192 fidl::encoding::BoundedString<255>,
1193 fidl::encoding::DefaultFuchsiaResourceDialect,
1194 &mut self.name,
1195 decoder,
1196 offset + 8,
1197 _depth
1198 )?;
1199 Ok(())
1200 }
1201 }
1202
1203 impl fidl::encoding::ResourceTypeMarker for ControllerFormatRequest {
1204 type Borrowed<'a> = &'a mut Self;
1205 fn take_or_borrow<'a>(
1206 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1207 ) -> Self::Borrowed<'a> {
1208 value
1209 }
1210 }
1211
1212 unsafe impl fidl::encoding::TypeMarker for ControllerFormatRequest {
1213 type Owned = Self;
1214
1215 #[inline(always)]
1216 fn inline_align(_context: fidl::encoding::Context) -> usize {
1217 8
1218 }
1219
1220 #[inline(always)]
1221 fn inline_size(_context: fidl::encoding::Context) -> usize {
1222 40
1223 }
1224 }
1225
1226 unsafe impl
1227 fidl::encoding::Encode<
1228 ControllerFormatRequest,
1229 fidl::encoding::DefaultFuchsiaResourceDialect,
1230 > for &mut ControllerFormatRequest
1231 {
1232 #[inline]
1233 unsafe fn encode(
1234 self,
1235 encoder: &mut fidl::encoding::Encoder<
1236 '_,
1237 fidl::encoding::DefaultFuchsiaResourceDialect,
1238 >,
1239 offset: usize,
1240 _depth: fidl::encoding::Depth,
1241 ) -> fidl::Result<()> {
1242 encoder.debug_check_bounds::<ControllerFormatRequest>(offset);
1243 fidl::encoding::Encode::<
1245 ControllerFormatRequest,
1246 fidl::encoding::DefaultFuchsiaResourceDialect,
1247 >::encode(
1248 (
1249 <fidl::encoding::Endpoint<
1250 fidl::endpoints::ClientEnd<fidl_fuchsia_device::ControllerMarker>,
1251 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1252 &mut self.device
1253 ),
1254 <fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(
1255 &self.name,
1256 ),
1257 <FormatOptions as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1258 &mut self.options,
1259 ),
1260 ),
1261 encoder,
1262 offset,
1263 _depth,
1264 )
1265 }
1266 }
1267 unsafe impl<
1268 T0: fidl::encoding::Encode<
1269 fidl::encoding::Endpoint<
1270 fidl::endpoints::ClientEnd<fidl_fuchsia_device::ControllerMarker>,
1271 >,
1272 fidl::encoding::DefaultFuchsiaResourceDialect,
1273 >,
1274 T1: fidl::encoding::Encode<
1275 fidl::encoding::BoundedString<255>,
1276 fidl::encoding::DefaultFuchsiaResourceDialect,
1277 >,
1278 T2: fidl::encoding::Encode<FormatOptions, fidl::encoding::DefaultFuchsiaResourceDialect>,
1279 >
1280 fidl::encoding::Encode<
1281 ControllerFormatRequest,
1282 fidl::encoding::DefaultFuchsiaResourceDialect,
1283 > for (T0, T1, T2)
1284 {
1285 #[inline]
1286 unsafe fn encode(
1287 self,
1288 encoder: &mut fidl::encoding::Encoder<
1289 '_,
1290 fidl::encoding::DefaultFuchsiaResourceDialect,
1291 >,
1292 offset: usize,
1293 depth: fidl::encoding::Depth,
1294 ) -> fidl::Result<()> {
1295 encoder.debug_check_bounds::<ControllerFormatRequest>(offset);
1296 unsafe {
1299 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
1300 (ptr as *mut u64).write_unaligned(0);
1301 }
1302 self.0.encode(encoder, offset + 0, depth)?;
1304 self.1.encode(encoder, offset + 8, depth)?;
1305 self.2.encode(encoder, offset + 24, depth)?;
1306 Ok(())
1307 }
1308 }
1309
1310 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1311 for ControllerFormatRequest
1312 {
1313 #[inline(always)]
1314 fn new_empty() -> Self {
1315 Self {
1316 device: fidl::new_empty!(
1317 fidl::encoding::Endpoint<
1318 fidl::endpoints::ClientEnd<fidl_fuchsia_device::ControllerMarker>,
1319 >,
1320 fidl::encoding::DefaultFuchsiaResourceDialect
1321 ),
1322 name: fidl::new_empty!(
1323 fidl::encoding::BoundedString<255>,
1324 fidl::encoding::DefaultFuchsiaResourceDialect
1325 ),
1326 options: fidl::new_empty!(
1327 FormatOptions,
1328 fidl::encoding::DefaultFuchsiaResourceDialect
1329 ),
1330 }
1331 }
1332
1333 #[inline]
1334 unsafe fn decode(
1335 &mut self,
1336 decoder: &mut fidl::encoding::Decoder<
1337 '_,
1338 fidl::encoding::DefaultFuchsiaResourceDialect,
1339 >,
1340 offset: usize,
1341 _depth: fidl::encoding::Depth,
1342 ) -> fidl::Result<()> {
1343 decoder.debug_check_bounds::<Self>(offset);
1344 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
1346 let padval = unsafe { (ptr as *const u64).read_unaligned() };
1347 let mask = 0xffffffff00000000u64;
1348 let maskedval = padval & mask;
1349 if maskedval != 0 {
1350 return Err(fidl::Error::NonZeroPadding {
1351 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
1352 });
1353 }
1354 fidl::decode!(
1355 fidl::encoding::Endpoint<
1356 fidl::endpoints::ClientEnd<fidl_fuchsia_device::ControllerMarker>,
1357 >,
1358 fidl::encoding::DefaultFuchsiaResourceDialect,
1359 &mut self.device,
1360 decoder,
1361 offset + 0,
1362 _depth
1363 )?;
1364 fidl::decode!(
1365 fidl::encoding::BoundedString<255>,
1366 fidl::encoding::DefaultFuchsiaResourceDialect,
1367 &mut self.name,
1368 decoder,
1369 offset + 8,
1370 _depth
1371 )?;
1372 fidl::decode!(
1373 FormatOptions,
1374 fidl::encoding::DefaultFuchsiaResourceDialect,
1375 &mut self.options,
1376 decoder,
1377 offset + 24,
1378 _depth
1379 )?;
1380 Ok(())
1381 }
1382 }
1383
1384 impl fidl::encoding::ResourceTypeMarker for ControllerMountRequest {
1385 type Borrowed<'a> = &'a mut Self;
1386 fn take_or_borrow<'a>(
1387 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1388 ) -> Self::Borrowed<'a> {
1389 value
1390 }
1391 }
1392
1393 unsafe impl fidl::encoding::TypeMarker for ControllerMountRequest {
1394 type Owned = Self;
1395
1396 #[inline(always)]
1397 fn inline_align(_context: fidl::encoding::Context) -> usize {
1398 8
1399 }
1400
1401 #[inline(always)]
1402 fn inline_size(_context: fidl::encoding::Context) -> usize {
1403 40
1404 }
1405 }
1406
1407 unsafe impl
1408 fidl::encoding::Encode<
1409 ControllerMountRequest,
1410 fidl::encoding::DefaultFuchsiaResourceDialect,
1411 > for &mut ControllerMountRequest
1412 {
1413 #[inline]
1414 unsafe fn encode(
1415 self,
1416 encoder: &mut fidl::encoding::Encoder<
1417 '_,
1418 fidl::encoding::DefaultFuchsiaResourceDialect,
1419 >,
1420 offset: usize,
1421 _depth: fidl::encoding::Depth,
1422 ) -> fidl::Result<()> {
1423 encoder.debug_check_bounds::<ControllerMountRequest>(offset);
1424 fidl::encoding::Encode::<
1426 ControllerMountRequest,
1427 fidl::encoding::DefaultFuchsiaResourceDialect,
1428 >::encode(
1429 (
1430 <fidl::encoding::Endpoint<
1431 fidl::endpoints::ClientEnd<fidl_fuchsia_device::ControllerMarker>,
1432 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1433 &mut self.device
1434 ),
1435 <fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(
1436 &self.name,
1437 ),
1438 <MountOptions as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1439 &mut self.options,
1440 ),
1441 ),
1442 encoder,
1443 offset,
1444 _depth,
1445 )
1446 }
1447 }
1448 unsafe impl<
1449 T0: fidl::encoding::Encode<
1450 fidl::encoding::Endpoint<
1451 fidl::endpoints::ClientEnd<fidl_fuchsia_device::ControllerMarker>,
1452 >,
1453 fidl::encoding::DefaultFuchsiaResourceDialect,
1454 >,
1455 T1: fidl::encoding::Encode<
1456 fidl::encoding::BoundedString<255>,
1457 fidl::encoding::DefaultFuchsiaResourceDialect,
1458 >,
1459 T2: fidl::encoding::Encode<MountOptions, fidl::encoding::DefaultFuchsiaResourceDialect>,
1460 >
1461 fidl::encoding::Encode<
1462 ControllerMountRequest,
1463 fidl::encoding::DefaultFuchsiaResourceDialect,
1464 > for (T0, T1, T2)
1465 {
1466 #[inline]
1467 unsafe fn encode(
1468 self,
1469 encoder: &mut fidl::encoding::Encoder<
1470 '_,
1471 fidl::encoding::DefaultFuchsiaResourceDialect,
1472 >,
1473 offset: usize,
1474 depth: fidl::encoding::Depth,
1475 ) -> fidl::Result<()> {
1476 encoder.debug_check_bounds::<ControllerMountRequest>(offset);
1477 unsafe {
1480 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
1481 (ptr as *mut u64).write_unaligned(0);
1482 }
1483 self.0.encode(encoder, offset + 0, depth)?;
1485 self.1.encode(encoder, offset + 8, depth)?;
1486 self.2.encode(encoder, offset + 24, depth)?;
1487 Ok(())
1488 }
1489 }
1490
1491 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1492 for ControllerMountRequest
1493 {
1494 #[inline(always)]
1495 fn new_empty() -> Self {
1496 Self {
1497 device: fidl::new_empty!(
1498 fidl::encoding::Endpoint<
1499 fidl::endpoints::ClientEnd<fidl_fuchsia_device::ControllerMarker>,
1500 >,
1501 fidl::encoding::DefaultFuchsiaResourceDialect
1502 ),
1503 name: fidl::new_empty!(
1504 fidl::encoding::BoundedString<255>,
1505 fidl::encoding::DefaultFuchsiaResourceDialect
1506 ),
1507 options: fidl::new_empty!(
1508 MountOptions,
1509 fidl::encoding::DefaultFuchsiaResourceDialect
1510 ),
1511 }
1512 }
1513
1514 #[inline]
1515 unsafe fn decode(
1516 &mut self,
1517 decoder: &mut fidl::encoding::Decoder<
1518 '_,
1519 fidl::encoding::DefaultFuchsiaResourceDialect,
1520 >,
1521 offset: usize,
1522 _depth: fidl::encoding::Depth,
1523 ) -> fidl::Result<()> {
1524 decoder.debug_check_bounds::<Self>(offset);
1525 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
1527 let padval = unsafe { (ptr as *const u64).read_unaligned() };
1528 let mask = 0xffffffff00000000u64;
1529 let maskedval = padval & mask;
1530 if maskedval != 0 {
1531 return Err(fidl::Error::NonZeroPadding {
1532 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
1533 });
1534 }
1535 fidl::decode!(
1536 fidl::encoding::Endpoint<
1537 fidl::endpoints::ClientEnd<fidl_fuchsia_device::ControllerMarker>,
1538 >,
1539 fidl::encoding::DefaultFuchsiaResourceDialect,
1540 &mut self.device,
1541 decoder,
1542 offset + 0,
1543 _depth
1544 )?;
1545 fidl::decode!(
1546 fidl::encoding::BoundedString<255>,
1547 fidl::encoding::DefaultFuchsiaResourceDialect,
1548 &mut self.name,
1549 decoder,
1550 offset + 8,
1551 _depth
1552 )?;
1553 fidl::decode!(
1554 MountOptions,
1555 fidl::encoding::DefaultFuchsiaResourceDialect,
1556 &mut self.options,
1557 decoder,
1558 offset + 24,
1559 _depth
1560 )?;
1561 Ok(())
1562 }
1563 }
1564
1565 impl FormatOptions {
1566 #[inline(always)]
1567 fn max_ordinal_present(&self) -> u64 {
1568 if let Some(_) = self.fvm_data_slices {
1569 return 2;
1570 }
1571 if let Some(_) = self.verbose {
1572 return 1;
1573 }
1574 0
1575 }
1576 }
1577
1578 impl fidl::encoding::ResourceTypeMarker for FormatOptions {
1579 type Borrowed<'a> = &'a mut Self;
1580 fn take_or_borrow<'a>(
1581 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1582 ) -> Self::Borrowed<'a> {
1583 value
1584 }
1585 }
1586
1587 unsafe impl fidl::encoding::TypeMarker for FormatOptions {
1588 type Owned = Self;
1589
1590 #[inline(always)]
1591 fn inline_align(_context: fidl::encoding::Context) -> usize {
1592 8
1593 }
1594
1595 #[inline(always)]
1596 fn inline_size(_context: fidl::encoding::Context) -> usize {
1597 16
1598 }
1599 }
1600
1601 unsafe impl fidl::encoding::Encode<FormatOptions, fidl::encoding::DefaultFuchsiaResourceDialect>
1602 for &mut FormatOptions
1603 {
1604 unsafe fn encode(
1605 self,
1606 encoder: &mut fidl::encoding::Encoder<
1607 '_,
1608 fidl::encoding::DefaultFuchsiaResourceDialect,
1609 >,
1610 offset: usize,
1611 mut depth: fidl::encoding::Depth,
1612 ) -> fidl::Result<()> {
1613 encoder.debug_check_bounds::<FormatOptions>(offset);
1614 let max_ordinal: u64 = self.max_ordinal_present();
1616 encoder.write_num(max_ordinal, offset);
1617 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1618 if max_ordinal == 0 {
1620 return Ok(());
1621 }
1622 depth.increment()?;
1623 let envelope_size = 8;
1624 let bytes_len = max_ordinal as usize * envelope_size;
1625 #[allow(unused_variables)]
1626 let offset = encoder.out_of_line_offset(bytes_len);
1627 let mut _prev_end_offset: usize = 0;
1628 if 1 > max_ordinal {
1629 return Ok(());
1630 }
1631
1632 let cur_offset: usize = (1 - 1) * envelope_size;
1635
1636 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1638
1639 fidl::encoding::encode_in_envelope_optional::<
1644 bool,
1645 fidl::encoding::DefaultFuchsiaResourceDialect,
1646 >(
1647 self.verbose.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
1648 encoder,
1649 offset + cur_offset,
1650 depth,
1651 )?;
1652
1653 _prev_end_offset = cur_offset + envelope_size;
1654 if 2 > max_ordinal {
1655 return Ok(());
1656 }
1657
1658 let cur_offset: usize = (2 - 1) * envelope_size;
1661
1662 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1664
1665 fidl::encoding::encode_in_envelope_optional::<
1670 u32,
1671 fidl::encoding::DefaultFuchsiaResourceDialect,
1672 >(
1673 self.fvm_data_slices.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
1674 encoder,
1675 offset + cur_offset,
1676 depth,
1677 )?;
1678
1679 _prev_end_offset = cur_offset + envelope_size;
1680
1681 Ok(())
1682 }
1683 }
1684
1685 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for FormatOptions {
1686 #[inline(always)]
1687 fn new_empty() -> Self {
1688 Self::default()
1689 }
1690
1691 unsafe fn decode(
1692 &mut self,
1693 decoder: &mut fidl::encoding::Decoder<
1694 '_,
1695 fidl::encoding::DefaultFuchsiaResourceDialect,
1696 >,
1697 offset: usize,
1698 mut depth: fidl::encoding::Depth,
1699 ) -> fidl::Result<()> {
1700 decoder.debug_check_bounds::<Self>(offset);
1701 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1702 None => return Err(fidl::Error::NotNullable),
1703 Some(len) => len,
1704 };
1705 if len == 0 {
1707 return Ok(());
1708 };
1709 depth.increment()?;
1710 let envelope_size = 8;
1711 let bytes_len = len * envelope_size;
1712 let offset = decoder.out_of_line_offset(bytes_len)?;
1713 let mut _next_ordinal_to_read = 0;
1715 let mut next_offset = offset;
1716 let end_offset = offset + bytes_len;
1717 _next_ordinal_to_read += 1;
1718 if next_offset >= end_offset {
1719 return Ok(());
1720 }
1721
1722 while _next_ordinal_to_read < 1 {
1724 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1725 _next_ordinal_to_read += 1;
1726 next_offset += envelope_size;
1727 }
1728
1729 let next_out_of_line = decoder.next_out_of_line();
1730 let handles_before = decoder.remaining_handles();
1731 if let Some((inlined, num_bytes, num_handles)) =
1732 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1733 {
1734 let member_inline_size =
1735 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1736 if inlined != (member_inline_size <= 4) {
1737 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1738 }
1739 let inner_offset;
1740 let mut inner_depth = depth.clone();
1741 if inlined {
1742 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1743 inner_offset = next_offset;
1744 } else {
1745 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1746 inner_depth.increment()?;
1747 }
1748 let val_ref = self.verbose.get_or_insert_with(|| {
1749 fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
1750 });
1751 fidl::decode!(
1752 bool,
1753 fidl::encoding::DefaultFuchsiaResourceDialect,
1754 val_ref,
1755 decoder,
1756 inner_offset,
1757 inner_depth
1758 )?;
1759 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1760 {
1761 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1762 }
1763 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1764 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1765 }
1766 }
1767
1768 next_offset += envelope_size;
1769 _next_ordinal_to_read += 1;
1770 if next_offset >= end_offset {
1771 return Ok(());
1772 }
1773
1774 while _next_ordinal_to_read < 2 {
1776 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1777 _next_ordinal_to_read += 1;
1778 next_offset += envelope_size;
1779 }
1780
1781 let next_out_of_line = decoder.next_out_of_line();
1782 let handles_before = decoder.remaining_handles();
1783 if let Some((inlined, num_bytes, num_handles)) =
1784 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1785 {
1786 let member_inline_size =
1787 <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1788 if inlined != (member_inline_size <= 4) {
1789 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1790 }
1791 let inner_offset;
1792 let mut inner_depth = depth.clone();
1793 if inlined {
1794 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1795 inner_offset = next_offset;
1796 } else {
1797 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1798 inner_depth.increment()?;
1799 }
1800 let val_ref = self.fvm_data_slices.get_or_insert_with(|| {
1801 fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect)
1802 });
1803 fidl::decode!(
1804 u32,
1805 fidl::encoding::DefaultFuchsiaResourceDialect,
1806 val_ref,
1807 decoder,
1808 inner_offset,
1809 inner_depth
1810 )?;
1811 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1812 {
1813 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1814 }
1815 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1816 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1817 }
1818 }
1819
1820 next_offset += envelope_size;
1821
1822 while next_offset < end_offset {
1824 _next_ordinal_to_read += 1;
1825 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1826 next_offset += envelope_size;
1827 }
1828
1829 Ok(())
1830 }
1831 }
1832
1833 impl MountOptions {
1834 #[inline(always)]
1835 fn max_ordinal_present(&self) -> u64 {
1836 if let Some(_) = self.write_compression_algorithm {
1837 return 3;
1838 }
1839 if let Some(_) = self.verbose {
1840 return 2;
1841 }
1842 if let Some(_) = self.read_only {
1843 return 1;
1844 }
1845 0
1846 }
1847 }
1848
1849 impl fidl::encoding::ResourceTypeMarker for MountOptions {
1850 type Borrowed<'a> = &'a mut Self;
1851 fn take_or_borrow<'a>(
1852 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1853 ) -> Self::Borrowed<'a> {
1854 value
1855 }
1856 }
1857
1858 unsafe impl fidl::encoding::TypeMarker for MountOptions {
1859 type Owned = Self;
1860
1861 #[inline(always)]
1862 fn inline_align(_context: fidl::encoding::Context) -> usize {
1863 8
1864 }
1865
1866 #[inline(always)]
1867 fn inline_size(_context: fidl::encoding::Context) -> usize {
1868 16
1869 }
1870 }
1871
1872 unsafe impl fidl::encoding::Encode<MountOptions, fidl::encoding::DefaultFuchsiaResourceDialect>
1873 for &mut MountOptions
1874 {
1875 unsafe fn encode(
1876 self,
1877 encoder: &mut fidl::encoding::Encoder<
1878 '_,
1879 fidl::encoding::DefaultFuchsiaResourceDialect,
1880 >,
1881 offset: usize,
1882 mut depth: fidl::encoding::Depth,
1883 ) -> fidl::Result<()> {
1884 encoder.debug_check_bounds::<MountOptions>(offset);
1885 let max_ordinal: u64 = self.max_ordinal_present();
1887 encoder.write_num(max_ordinal, offset);
1888 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1889 if max_ordinal == 0 {
1891 return Ok(());
1892 }
1893 depth.increment()?;
1894 let envelope_size = 8;
1895 let bytes_len = max_ordinal as usize * envelope_size;
1896 #[allow(unused_variables)]
1897 let offset = encoder.out_of_line_offset(bytes_len);
1898 let mut _prev_end_offset: usize = 0;
1899 if 1 > max_ordinal {
1900 return Ok(());
1901 }
1902
1903 let cur_offset: usize = (1 - 1) * envelope_size;
1906
1907 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1909
1910 fidl::encoding::encode_in_envelope_optional::<
1915 bool,
1916 fidl::encoding::DefaultFuchsiaResourceDialect,
1917 >(
1918 self.read_only.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
1919 encoder,
1920 offset + cur_offset,
1921 depth,
1922 )?;
1923
1924 _prev_end_offset = cur_offset + envelope_size;
1925 if 2 > max_ordinal {
1926 return Ok(());
1927 }
1928
1929 let cur_offset: usize = (2 - 1) * envelope_size;
1932
1933 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1935
1936 fidl::encoding::encode_in_envelope_optional::<
1941 bool,
1942 fidl::encoding::DefaultFuchsiaResourceDialect,
1943 >(
1944 self.verbose.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
1945 encoder,
1946 offset + cur_offset,
1947 depth,
1948 )?;
1949
1950 _prev_end_offset = cur_offset + envelope_size;
1951 if 3 > max_ordinal {
1952 return Ok(());
1953 }
1954
1955 let cur_offset: usize = (3 - 1) * envelope_size;
1958
1959 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1961
1962 fidl::encoding::encode_in_envelope_optional::<
1967 fidl::encoding::BoundedString<32>,
1968 fidl::encoding::DefaultFuchsiaResourceDialect,
1969 >(
1970 self.write_compression_algorithm.as_ref().map(
1971 <fidl::encoding::BoundedString<32> as fidl::encoding::ValueTypeMarker>::borrow,
1972 ),
1973 encoder,
1974 offset + cur_offset,
1975 depth,
1976 )?;
1977
1978 _prev_end_offset = cur_offset + envelope_size;
1979
1980 Ok(())
1981 }
1982 }
1983
1984 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for MountOptions {
1985 #[inline(always)]
1986 fn new_empty() -> Self {
1987 Self::default()
1988 }
1989
1990 unsafe fn decode(
1991 &mut self,
1992 decoder: &mut fidl::encoding::Decoder<
1993 '_,
1994 fidl::encoding::DefaultFuchsiaResourceDialect,
1995 >,
1996 offset: usize,
1997 mut depth: fidl::encoding::Depth,
1998 ) -> fidl::Result<()> {
1999 decoder.debug_check_bounds::<Self>(offset);
2000 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2001 None => return Err(fidl::Error::NotNullable),
2002 Some(len) => len,
2003 };
2004 if len == 0 {
2006 return Ok(());
2007 };
2008 depth.increment()?;
2009 let envelope_size = 8;
2010 let bytes_len = len * envelope_size;
2011 let offset = decoder.out_of_line_offset(bytes_len)?;
2012 let mut _next_ordinal_to_read = 0;
2014 let mut next_offset = offset;
2015 let end_offset = offset + bytes_len;
2016 _next_ordinal_to_read += 1;
2017 if next_offset >= end_offset {
2018 return Ok(());
2019 }
2020
2021 while _next_ordinal_to_read < 1 {
2023 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2024 _next_ordinal_to_read += 1;
2025 next_offset += envelope_size;
2026 }
2027
2028 let next_out_of_line = decoder.next_out_of_line();
2029 let handles_before = decoder.remaining_handles();
2030 if let Some((inlined, num_bytes, num_handles)) =
2031 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2032 {
2033 let member_inline_size =
2034 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2035 if inlined != (member_inline_size <= 4) {
2036 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2037 }
2038 let inner_offset;
2039 let mut inner_depth = depth.clone();
2040 if inlined {
2041 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2042 inner_offset = next_offset;
2043 } else {
2044 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2045 inner_depth.increment()?;
2046 }
2047 let val_ref = self.read_only.get_or_insert_with(|| {
2048 fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
2049 });
2050 fidl::decode!(
2051 bool,
2052 fidl::encoding::DefaultFuchsiaResourceDialect,
2053 val_ref,
2054 decoder,
2055 inner_offset,
2056 inner_depth
2057 )?;
2058 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2059 {
2060 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2061 }
2062 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2063 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2064 }
2065 }
2066
2067 next_offset += envelope_size;
2068 _next_ordinal_to_read += 1;
2069 if next_offset >= end_offset {
2070 return Ok(());
2071 }
2072
2073 while _next_ordinal_to_read < 2 {
2075 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2076 _next_ordinal_to_read += 1;
2077 next_offset += envelope_size;
2078 }
2079
2080 let next_out_of_line = decoder.next_out_of_line();
2081 let handles_before = decoder.remaining_handles();
2082 if let Some((inlined, num_bytes, num_handles)) =
2083 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2084 {
2085 let member_inline_size =
2086 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2087 if inlined != (member_inline_size <= 4) {
2088 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2089 }
2090 let inner_offset;
2091 let mut inner_depth = depth.clone();
2092 if inlined {
2093 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2094 inner_offset = next_offset;
2095 } else {
2096 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2097 inner_depth.increment()?;
2098 }
2099 let val_ref = self.verbose.get_or_insert_with(|| {
2100 fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
2101 });
2102 fidl::decode!(
2103 bool,
2104 fidl::encoding::DefaultFuchsiaResourceDialect,
2105 val_ref,
2106 decoder,
2107 inner_offset,
2108 inner_depth
2109 )?;
2110 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2111 {
2112 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2113 }
2114 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2115 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2116 }
2117 }
2118
2119 next_offset += envelope_size;
2120 _next_ordinal_to_read += 1;
2121 if next_offset >= end_offset {
2122 return Ok(());
2123 }
2124
2125 while _next_ordinal_to_read < 3 {
2127 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2128 _next_ordinal_to_read += 1;
2129 next_offset += envelope_size;
2130 }
2131
2132 let next_out_of_line = decoder.next_out_of_line();
2133 let handles_before = decoder.remaining_handles();
2134 if let Some((inlined, num_bytes, num_handles)) =
2135 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2136 {
2137 let member_inline_size =
2138 <fidl::encoding::BoundedString<32> as fidl::encoding::TypeMarker>::inline_size(
2139 decoder.context,
2140 );
2141 if inlined != (member_inline_size <= 4) {
2142 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2143 }
2144 let inner_offset;
2145 let mut inner_depth = depth.clone();
2146 if inlined {
2147 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2148 inner_offset = next_offset;
2149 } else {
2150 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2151 inner_depth.increment()?;
2152 }
2153 let val_ref = self.write_compression_algorithm.get_or_insert_with(|| {
2154 fidl::new_empty!(
2155 fidl::encoding::BoundedString<32>,
2156 fidl::encoding::DefaultFuchsiaResourceDialect
2157 )
2158 });
2159 fidl::decode!(
2160 fidl::encoding::BoundedString<32>,
2161 fidl::encoding::DefaultFuchsiaResourceDialect,
2162 val_ref,
2163 decoder,
2164 inner_offset,
2165 inner_depth
2166 )?;
2167 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2168 {
2169 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2170 }
2171 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2172 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2173 }
2174 }
2175
2176 next_offset += envelope_size;
2177
2178 while next_offset < end_offset {
2180 _next_ordinal_to_read += 1;
2181 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2182 next_offset += envelope_size;
2183 }
2184
2185 Ok(())
2186 }
2187 }
2188}