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_erofs_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Default, PartialEq)]
15pub struct ErofsServeRequest {
16 pub backing_vmo: Option<fidl::Vmo>,
19 pub root: Option<fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>>,
22 #[doc(hidden)]
23 pub __source_breaking: fidl::marker::SourceBreaking,
24}
25
26impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ErofsServeRequest {}
27
28#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
29pub struct ErofsMarker;
30
31impl fidl::endpoints::ProtocolMarker for ErofsMarker {
32 type Proxy = ErofsProxy;
33 type RequestStream = ErofsRequestStream;
34 #[cfg(target_os = "fuchsia")]
35 type SynchronousProxy = ErofsSynchronousProxy;
36
37 const DEBUG_NAME: &'static str = "fuchsia.erofs.Erofs";
38}
39impl fidl::endpoints::DiscoverableProtocolMarker for ErofsMarker {}
40pub type ErofsServeResult = Result<(), i32>;
41
42pub trait ErofsProxyInterface: Send + Sync {
43 type ServeResponseFut: std::future::Future<Output = Result<ErofsServeResult, fidl::Error>>
44 + Send;
45 fn r#serve(&self, payload: ErofsServeRequest) -> Self::ServeResponseFut;
46}
47#[derive(Debug)]
48#[cfg(target_os = "fuchsia")]
49pub struct ErofsSynchronousProxy {
50 client: fidl::client::sync::Client,
51}
52
53#[cfg(target_os = "fuchsia")]
54impl fidl::endpoints::SynchronousProxy for ErofsSynchronousProxy {
55 type Proxy = ErofsProxy;
56 type Protocol = ErofsMarker;
57
58 fn from_channel(inner: fidl::Channel) -> Self {
59 Self::new(inner)
60 }
61
62 fn into_channel(self) -> fidl::Channel {
63 self.client.into_channel()
64 }
65
66 fn as_channel(&self) -> &fidl::Channel {
67 self.client.as_channel()
68 }
69}
70
71#[cfg(target_os = "fuchsia")]
72impl ErofsSynchronousProxy {
73 pub fn new(channel: fidl::Channel) -> Self {
74 Self { client: fidl::client::sync::Client::new(channel) }
75 }
76
77 pub fn into_channel(self) -> fidl::Channel {
78 self.client.into_channel()
79 }
80
81 pub fn wait_for_event(
84 &self,
85 deadline: zx::MonotonicInstant,
86 ) -> Result<ErofsEvent, fidl::Error> {
87 ErofsEvent::decode(self.client.wait_for_event::<ErofsMarker>(deadline)?)
88 }
89
90 pub fn r#serve(
94 &self,
95 mut payload: ErofsServeRequest,
96 ___deadline: zx::MonotonicInstant,
97 ) -> Result<ErofsServeResult, fidl::Error> {
98 let _response = self.client.send_query::<
99 ErofsServeRequest,
100 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
101 ErofsMarker,
102 >(
103 &mut payload,
104 0x5fb0caf6fcd41317,
105 fidl::encoding::DynamicFlags::FLEXIBLE,
106 ___deadline,
107 )?
108 .into_result::<ErofsMarker>("serve")?;
109 Ok(_response.map(|x| x))
110 }
111}
112
113#[cfg(target_os = "fuchsia")]
114impl From<ErofsSynchronousProxy> for zx::NullableHandle {
115 fn from(value: ErofsSynchronousProxy) -> Self {
116 value.into_channel().into()
117 }
118}
119
120#[cfg(target_os = "fuchsia")]
121impl From<fidl::Channel> for ErofsSynchronousProxy {
122 fn from(value: fidl::Channel) -> Self {
123 Self::new(value)
124 }
125}
126
127#[cfg(target_os = "fuchsia")]
128impl fidl::endpoints::FromClient for ErofsSynchronousProxy {
129 type Protocol = ErofsMarker;
130
131 fn from_client(value: fidl::endpoints::ClientEnd<ErofsMarker>) -> Self {
132 Self::new(value.into_channel())
133 }
134}
135
136#[derive(Debug, Clone)]
137pub struct ErofsProxy {
138 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
139}
140
141impl fidl::endpoints::Proxy for ErofsProxy {
142 type Protocol = ErofsMarker;
143
144 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
145 Self::new(inner)
146 }
147
148 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
149 self.client.into_channel().map_err(|client| Self { client })
150 }
151
152 fn as_channel(&self) -> &::fidl::AsyncChannel {
153 self.client.as_channel()
154 }
155}
156
157impl ErofsProxy {
158 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
160 let protocol_name = <ErofsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
161 Self { client: fidl::client::Client::new(channel, protocol_name) }
162 }
163
164 pub fn take_event_stream(&self) -> ErofsEventStream {
170 ErofsEventStream { event_receiver: self.client.take_event_receiver() }
171 }
172
173 pub fn r#serve(
177 &self,
178 mut payload: ErofsServeRequest,
179 ) -> fidl::client::QueryResponseFut<
180 ErofsServeResult,
181 fidl::encoding::DefaultFuchsiaResourceDialect,
182 > {
183 ErofsProxyInterface::r#serve(self, payload)
184 }
185}
186
187impl ErofsProxyInterface for ErofsProxy {
188 type ServeResponseFut = fidl::client::QueryResponseFut<
189 ErofsServeResult,
190 fidl::encoding::DefaultFuchsiaResourceDialect,
191 >;
192 fn r#serve(&self, mut payload: ErofsServeRequest) -> Self::ServeResponseFut {
193 fn _decode(
194 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
195 ) -> Result<ErofsServeResult, fidl::Error> {
196 let _response = fidl::client::decode_transaction_body::<
197 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
198 fidl::encoding::DefaultFuchsiaResourceDialect,
199 0x5fb0caf6fcd41317,
200 >(_buf?)?
201 .into_result::<ErofsMarker>("serve")?;
202 Ok(_response.map(|x| x))
203 }
204 self.client.send_query_and_decode::<ErofsServeRequest, ErofsServeResult>(
205 &mut payload,
206 0x5fb0caf6fcd41317,
207 fidl::encoding::DynamicFlags::FLEXIBLE,
208 _decode,
209 )
210 }
211}
212
213pub struct ErofsEventStream {
214 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
215}
216
217impl std::marker::Unpin for ErofsEventStream {}
218
219impl futures::stream::FusedStream for ErofsEventStream {
220 fn is_terminated(&self) -> bool {
221 self.event_receiver.is_terminated()
222 }
223}
224
225impl futures::Stream for ErofsEventStream {
226 type Item = Result<ErofsEvent, fidl::Error>;
227
228 fn poll_next(
229 mut self: std::pin::Pin<&mut Self>,
230 cx: &mut std::task::Context<'_>,
231 ) -> std::task::Poll<Option<Self::Item>> {
232 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
233 &mut self.event_receiver,
234 cx
235 )?) {
236 Some(buf) => std::task::Poll::Ready(Some(ErofsEvent::decode(buf))),
237 None => std::task::Poll::Ready(None),
238 }
239 }
240}
241
242#[derive(Debug)]
243pub enum ErofsEvent {
244 #[non_exhaustive]
245 _UnknownEvent {
246 ordinal: u64,
248 },
249}
250
251impl ErofsEvent {
252 fn decode(
254 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
255 ) -> Result<ErofsEvent, fidl::Error> {
256 let (bytes, _handles) = buf.split_mut();
257 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
258 debug_assert_eq!(tx_header.tx_id, 0);
259 match tx_header.ordinal {
260 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
261 Ok(ErofsEvent::_UnknownEvent { ordinal: tx_header.ordinal })
262 }
263 _ => Err(fidl::Error::UnknownOrdinal {
264 ordinal: tx_header.ordinal,
265 protocol_name: <ErofsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
266 }),
267 }
268 }
269}
270
271pub struct ErofsRequestStream {
273 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
274 is_terminated: bool,
275}
276
277impl std::marker::Unpin for ErofsRequestStream {}
278
279impl futures::stream::FusedStream for ErofsRequestStream {
280 fn is_terminated(&self) -> bool {
281 self.is_terminated
282 }
283}
284
285impl fidl::endpoints::RequestStream for ErofsRequestStream {
286 type Protocol = ErofsMarker;
287 type ControlHandle = ErofsControlHandle;
288
289 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
290 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
291 }
292
293 fn control_handle(&self) -> Self::ControlHandle {
294 ErofsControlHandle { inner: self.inner.clone() }
295 }
296
297 fn into_inner(
298 self,
299 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
300 {
301 (self.inner, self.is_terminated)
302 }
303
304 fn from_inner(
305 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
306 is_terminated: bool,
307 ) -> Self {
308 Self { inner, is_terminated }
309 }
310}
311
312impl futures::Stream for ErofsRequestStream {
313 type Item = Result<ErofsRequest, fidl::Error>;
314
315 fn poll_next(
316 mut self: std::pin::Pin<&mut Self>,
317 cx: &mut std::task::Context<'_>,
318 ) -> std::task::Poll<Option<Self::Item>> {
319 let this = &mut *self;
320 if this.inner.check_shutdown(cx) {
321 this.is_terminated = true;
322 return std::task::Poll::Ready(None);
323 }
324 if this.is_terminated {
325 panic!("polled ErofsRequestStream after completion");
326 }
327 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
328 |bytes, handles| {
329 match this.inner.channel().read_etc(cx, bytes, handles) {
330 std::task::Poll::Ready(Ok(())) => {}
331 std::task::Poll::Pending => return std::task::Poll::Pending,
332 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
333 this.is_terminated = true;
334 return std::task::Poll::Ready(None);
335 }
336 std::task::Poll::Ready(Err(e)) => {
337 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
338 e.into(),
339 ))));
340 }
341 }
342
343 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
345
346 std::task::Poll::Ready(Some(match header.ordinal {
347 0x5fb0caf6fcd41317 => {
348 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
349 let mut req = fidl::new_empty!(
350 ErofsServeRequest,
351 fidl::encoding::DefaultFuchsiaResourceDialect
352 );
353 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ErofsServeRequest>(&header, _body_bytes, handles, &mut req)?;
354 let control_handle = ErofsControlHandle { inner: this.inner.clone() };
355 Ok(ErofsRequest::Serve {
356 payload: req,
357 responder: ErofsServeResponder {
358 control_handle: std::mem::ManuallyDrop::new(control_handle),
359 tx_id: header.tx_id,
360 },
361 })
362 }
363 _ if header.tx_id == 0
364 && header
365 .dynamic_flags()
366 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
367 {
368 Ok(ErofsRequest::_UnknownMethod {
369 ordinal: header.ordinal,
370 control_handle: ErofsControlHandle { inner: this.inner.clone() },
371 method_type: fidl::MethodType::OneWay,
372 })
373 }
374 _ if header
375 .dynamic_flags()
376 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
377 {
378 this.inner.send_framework_err(
379 fidl::encoding::FrameworkErr::UnknownMethod,
380 header.tx_id,
381 header.ordinal,
382 header.dynamic_flags(),
383 (bytes, handles),
384 )?;
385 Ok(ErofsRequest::_UnknownMethod {
386 ordinal: header.ordinal,
387 control_handle: ErofsControlHandle { inner: this.inner.clone() },
388 method_type: fidl::MethodType::TwoWay,
389 })
390 }
391 _ => Err(fidl::Error::UnknownOrdinal {
392 ordinal: header.ordinal,
393 protocol_name: <ErofsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
394 }),
395 }))
396 },
397 )
398 }
399}
400
401#[derive(Debug)]
403pub enum ErofsRequest {
404 Serve { payload: ErofsServeRequest, responder: ErofsServeResponder },
408 #[non_exhaustive]
410 _UnknownMethod {
411 ordinal: u64,
413 control_handle: ErofsControlHandle,
414 method_type: fidl::MethodType,
415 },
416}
417
418impl ErofsRequest {
419 #[allow(irrefutable_let_patterns)]
420 pub fn into_serve(self) -> Option<(ErofsServeRequest, ErofsServeResponder)> {
421 if let ErofsRequest::Serve { payload, responder } = self {
422 Some((payload, responder))
423 } else {
424 None
425 }
426 }
427
428 pub fn method_name(&self) -> &'static str {
430 match *self {
431 ErofsRequest::Serve { .. } => "serve",
432 ErofsRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
433 "unknown one-way method"
434 }
435 ErofsRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
436 "unknown two-way method"
437 }
438 }
439 }
440}
441
442#[derive(Debug, Clone)]
443pub struct ErofsControlHandle {
444 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
445}
446
447impl fidl::endpoints::ControlHandle for ErofsControlHandle {
448 fn shutdown(&self) {
449 self.inner.shutdown()
450 }
451
452 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
453 self.inner.shutdown_with_epitaph(status)
454 }
455
456 fn is_closed(&self) -> bool {
457 self.inner.channel().is_closed()
458 }
459 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
460 self.inner.channel().on_closed()
461 }
462
463 #[cfg(target_os = "fuchsia")]
464 fn signal_peer(
465 &self,
466 clear_mask: zx::Signals,
467 set_mask: zx::Signals,
468 ) -> Result<(), zx_status::Status> {
469 use fidl::Peered;
470 self.inner.channel().signal_peer(clear_mask, set_mask)
471 }
472}
473
474impl ErofsControlHandle {}
475
476#[must_use = "FIDL methods require a response to be sent"]
477#[derive(Debug)]
478pub struct ErofsServeResponder {
479 control_handle: std::mem::ManuallyDrop<ErofsControlHandle>,
480 tx_id: u32,
481}
482
483impl std::ops::Drop for ErofsServeResponder {
487 fn drop(&mut self) {
488 self.control_handle.shutdown();
489 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
491 }
492}
493
494impl fidl::endpoints::Responder for ErofsServeResponder {
495 type ControlHandle = ErofsControlHandle;
496
497 fn control_handle(&self) -> &ErofsControlHandle {
498 &self.control_handle
499 }
500
501 fn drop_without_shutdown(mut self) {
502 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
504 std::mem::forget(self);
506 }
507}
508
509impl ErofsServeResponder {
510 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
514 let _result = self.send_raw(result);
515 if _result.is_err() {
516 self.control_handle.shutdown();
517 }
518 self.drop_without_shutdown();
519 _result
520 }
521
522 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
524 let _result = self.send_raw(result);
525 self.drop_without_shutdown();
526 _result
527 }
528
529 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
530 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
531 fidl::encoding::EmptyStruct,
532 i32,
533 >>(
534 fidl::encoding::FlexibleResult::new(result),
535 self.tx_id,
536 0x5fb0caf6fcd41317,
537 fidl::encoding::DynamicFlags::FLEXIBLE,
538 )
539 }
540}
541
542mod internal {
543 use super::*;
544
545 impl ErofsServeRequest {
546 #[inline(always)]
547 fn max_ordinal_present(&self) -> u64 {
548 if let Some(_) = self.root {
549 return 3;
550 }
551 if let Some(_) = self.backing_vmo {
552 return 1;
553 }
554 0
555 }
556 }
557
558 impl fidl::encoding::ResourceTypeMarker for ErofsServeRequest {
559 type Borrowed<'a> = &'a mut Self;
560 fn take_or_borrow<'a>(
561 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
562 ) -> Self::Borrowed<'a> {
563 value
564 }
565 }
566
567 unsafe impl fidl::encoding::TypeMarker for ErofsServeRequest {
568 type Owned = Self;
569
570 #[inline(always)]
571 fn inline_align(_context: fidl::encoding::Context) -> usize {
572 8
573 }
574
575 #[inline(always)]
576 fn inline_size(_context: fidl::encoding::Context) -> usize {
577 16
578 }
579 }
580
581 unsafe impl
582 fidl::encoding::Encode<ErofsServeRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
583 for &mut ErofsServeRequest
584 {
585 unsafe fn encode(
586 self,
587 encoder: &mut fidl::encoding::Encoder<
588 '_,
589 fidl::encoding::DefaultFuchsiaResourceDialect,
590 >,
591 offset: usize,
592 mut depth: fidl::encoding::Depth,
593 ) -> fidl::Result<()> {
594 encoder.debug_check_bounds::<ErofsServeRequest>(offset);
595 let max_ordinal: u64 = self.max_ordinal_present();
597 encoder.write_num(max_ordinal, offset);
598 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
599 if max_ordinal == 0 {
601 return Ok(());
602 }
603 depth.increment()?;
604 let envelope_size = 8;
605 let bytes_len = max_ordinal as usize * envelope_size;
606 #[allow(unused_variables)]
607 let offset = encoder.out_of_line_offset(bytes_len);
608 let mut _prev_end_offset: usize = 0;
609 if 1 > max_ordinal {
610 return Ok(());
611 }
612
613 let cur_offset: usize = (1 - 1) * envelope_size;
616
617 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
619
620 fidl::encoding::encode_in_envelope_optional::<
625 fidl::encoding::HandleType<
626 fidl::Vmo,
627 { fidl::ObjectType::VMO.into_raw() },
628 2147483648,
629 >,
630 fidl::encoding::DefaultFuchsiaResourceDialect,
631 >(
632 self.backing_vmo.as_mut().map(
633 <fidl::encoding::HandleType<
634 fidl::Vmo,
635 { fidl::ObjectType::VMO.into_raw() },
636 2147483648,
637 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
638 ),
639 encoder,
640 offset + cur_offset,
641 depth,
642 )?;
643
644 _prev_end_offset = cur_offset + envelope_size;
645 if 3 > max_ordinal {
646 return Ok(());
647 }
648
649 let cur_offset: usize = (3 - 1) * envelope_size;
652
653 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
655
656 fidl::encoding::encode_in_envelope_optional::<
661 fidl::encoding::Endpoint<
662 fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
663 >,
664 fidl::encoding::DefaultFuchsiaResourceDialect,
665 >(
666 self.root.as_mut().map(
667 <fidl::encoding::Endpoint<
668 fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
669 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
670 ),
671 encoder,
672 offset + cur_offset,
673 depth,
674 )?;
675
676 _prev_end_offset = cur_offset + envelope_size;
677
678 Ok(())
679 }
680 }
681
682 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
683 for ErofsServeRequest
684 {
685 #[inline(always)]
686 fn new_empty() -> Self {
687 Self::default()
688 }
689
690 unsafe fn decode(
691 &mut self,
692 decoder: &mut fidl::encoding::Decoder<
693 '_,
694 fidl::encoding::DefaultFuchsiaResourceDialect,
695 >,
696 offset: usize,
697 mut depth: fidl::encoding::Depth,
698 ) -> fidl::Result<()> {
699 decoder.debug_check_bounds::<Self>(offset);
700 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
701 None => return Err(fidl::Error::NotNullable),
702 Some(len) => len,
703 };
704 if len == 0 {
706 return Ok(());
707 };
708 depth.increment()?;
709 let envelope_size = 8;
710 let bytes_len = len * envelope_size;
711 let offset = decoder.out_of_line_offset(bytes_len)?;
712 let mut _next_ordinal_to_read = 0;
714 let mut next_offset = offset;
715 let end_offset = offset + bytes_len;
716 _next_ordinal_to_read += 1;
717 if next_offset >= end_offset {
718 return Ok(());
719 }
720
721 while _next_ordinal_to_read < 1 {
723 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
724 _next_ordinal_to_read += 1;
725 next_offset += envelope_size;
726 }
727
728 let next_out_of_line = decoder.next_out_of_line();
729 let handles_before = decoder.remaining_handles();
730 if let Some((inlined, num_bytes, num_handles)) =
731 fidl::encoding::decode_envelope_header(decoder, next_offset)?
732 {
733 let member_inline_size = <fidl::encoding::HandleType<
734 fidl::Vmo,
735 { fidl::ObjectType::VMO.into_raw() },
736 2147483648,
737 > as fidl::encoding::TypeMarker>::inline_size(
738 decoder.context
739 );
740 if inlined != (member_inline_size <= 4) {
741 return Err(fidl::Error::InvalidInlineBitInEnvelope);
742 }
743 let inner_offset;
744 let mut inner_depth = depth.clone();
745 if inlined {
746 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
747 inner_offset = next_offset;
748 } else {
749 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
750 inner_depth.increment()?;
751 }
752 let val_ref =
753 self.backing_vmo.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
754 fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
755 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
756 {
757 return Err(fidl::Error::InvalidNumBytesInEnvelope);
758 }
759 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
760 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
761 }
762 }
763
764 next_offset += envelope_size;
765 _next_ordinal_to_read += 1;
766 if next_offset >= end_offset {
767 return Ok(());
768 }
769
770 while _next_ordinal_to_read < 3 {
772 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
773 _next_ordinal_to_read += 1;
774 next_offset += envelope_size;
775 }
776
777 let next_out_of_line = decoder.next_out_of_line();
778 let handles_before = decoder.remaining_handles();
779 if let Some((inlined, num_bytes, num_handles)) =
780 fidl::encoding::decode_envelope_header(decoder, next_offset)?
781 {
782 let member_inline_size = <fidl::encoding::Endpoint<
783 fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
784 > as fidl::encoding::TypeMarker>::inline_size(
785 decoder.context
786 );
787 if inlined != (member_inline_size <= 4) {
788 return Err(fidl::Error::InvalidInlineBitInEnvelope);
789 }
790 let inner_offset;
791 let mut inner_depth = depth.clone();
792 if inlined {
793 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
794 inner_offset = next_offset;
795 } else {
796 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
797 inner_depth.increment()?;
798 }
799 let val_ref = self.root.get_or_insert_with(|| {
800 fidl::new_empty!(
801 fidl::encoding::Endpoint<
802 fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
803 >,
804 fidl::encoding::DefaultFuchsiaResourceDialect
805 )
806 });
807 fidl::decode!(
808 fidl::encoding::Endpoint<
809 fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
810 >,
811 fidl::encoding::DefaultFuchsiaResourceDialect,
812 val_ref,
813 decoder,
814 inner_offset,
815 inner_depth
816 )?;
817 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
818 {
819 return Err(fidl::Error::InvalidNumBytesInEnvelope);
820 }
821 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
822 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
823 }
824 }
825
826 next_offset += envelope_size;
827
828 while next_offset < end_offset {
830 _next_ordinal_to_read += 1;
831 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
832 next_offset += envelope_size;
833 }
834
835 Ok(())
836 }
837 }
838}