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_inspect_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14pub type EscrowedVmo = fidl::Vmo;
15
16#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
17pub struct EscrowToken {
18 pub token: fidl::EventPair,
19}
20
21impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for EscrowToken {}
22
23#[derive(Debug, PartialEq)]
24pub struct TreeGetContentResponse {
25 pub content: TreeContent,
26}
27
28impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for TreeGetContentResponse {}
29
30#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
31pub struct TreeListChildNamesRequest {
32 pub tree_iterator: fidl::endpoints::ServerEnd<TreeNameIteratorMarker>,
33}
34
35impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for TreeListChildNamesRequest {}
36
37#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
38pub struct TreeOpenChildRequest {
39 pub child_name: String,
40 pub tree: fidl::endpoints::ServerEnd<TreeMarker>,
41}
42
43impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for TreeOpenChildRequest {}
44
45#[derive(Debug, Default, PartialEq)]
46pub struct InspectSinkEscrowRequest {
47 pub vmo: Option<fidl::Vmo>,
50 pub token: Option<EscrowToken>,
54 pub name: Option<String>,
58 pub tree: Option<u64>,
76 #[doc(hidden)]
77 pub __source_breaking: fidl::marker::SourceBreaking,
78}
79
80impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for InspectSinkEscrowRequest {}
81
82#[derive(Debug, Default, PartialEq)]
83pub struct InspectSinkFetchEscrowRequest {
84 pub token: Option<EscrowToken>,
89 pub tree: Option<fidl::endpoints::ClientEnd<TreeMarker>>,
98 #[doc(hidden)]
99 pub __source_breaking: fidl::marker::SourceBreaking,
100}
101
102impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
103 for InspectSinkFetchEscrowRequest
104{
105}
106
107#[derive(Debug, Default, PartialEq)]
108pub struct InspectSinkPublishRequest {
109 pub tree: Option<fidl::endpoints::ClientEnd<TreeMarker>>,
115 pub name: Option<String>,
122 #[doc(hidden)]
123 pub __source_breaking: fidl::marker::SourceBreaking,
124}
125
126impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for InspectSinkPublishRequest {}
127
128#[derive(Debug, Default, PartialEq)]
129pub struct InspectSinkFetchEscrowResponse {
130 pub vmo: Option<fidl::Vmo>,
131 #[doc(hidden)]
132 pub __source_breaking: fidl::marker::SourceBreaking,
133}
134
135impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
136 for InspectSinkFetchEscrowResponse
137{
138}
139
140#[derive(Debug, Default, PartialEq)]
142pub struct TreeContent {
143 pub buffer: Option<fidl_fuchsia_mem::Buffer>,
145 #[doc(hidden)]
146 pub __source_breaking: fidl::marker::SourceBreaking,
147}
148
149impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for TreeContent {}
150
151#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
152pub struct InspectSinkMarker;
153
154impl fidl::endpoints::ProtocolMarker for InspectSinkMarker {
155 type Proxy = InspectSinkProxy;
156 type RequestStream = InspectSinkRequestStream;
157 #[cfg(target_os = "fuchsia")]
158 type SynchronousProxy = InspectSinkSynchronousProxy;
159
160 const DEBUG_NAME: &'static str = "fuchsia.inspect.InspectSink";
161}
162impl fidl::endpoints::DiscoverableProtocolMarker for InspectSinkMarker {}
163
164pub trait InspectSinkProxyInterface: Send + Sync {
165 fn r#publish(&self, payload: InspectSinkPublishRequest) -> Result<(), fidl::Error>;
166 fn r#escrow(&self, payload: InspectSinkEscrowRequest) -> Result<(), fidl::Error>;
167 type FetchEscrowResponseFut: std::future::Future<Output = Result<InspectSinkFetchEscrowResponse, fidl::Error>>
168 + Send;
169 fn r#fetch_escrow(
170 &self,
171 payload: InspectSinkFetchEscrowRequest,
172 ) -> Self::FetchEscrowResponseFut;
173}
174#[derive(Debug)]
175#[cfg(target_os = "fuchsia")]
176pub struct InspectSinkSynchronousProxy {
177 client: fidl::client::sync::Client,
178}
179
180#[cfg(target_os = "fuchsia")]
181impl fidl::endpoints::SynchronousProxy for InspectSinkSynchronousProxy {
182 type Proxy = InspectSinkProxy;
183 type Protocol = InspectSinkMarker;
184
185 fn from_channel(inner: fidl::Channel) -> Self {
186 Self::new(inner)
187 }
188
189 fn into_channel(self) -> fidl::Channel {
190 self.client.into_channel()
191 }
192
193 fn as_channel(&self) -> &fidl::Channel {
194 self.client.as_channel()
195 }
196}
197
198#[cfg(target_os = "fuchsia")]
199impl InspectSinkSynchronousProxy {
200 pub fn new(channel: fidl::Channel) -> Self {
201 let protocol_name = <InspectSinkMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
202 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
203 }
204
205 pub fn into_channel(self) -> fidl::Channel {
206 self.client.into_channel()
207 }
208
209 pub fn wait_for_event(
212 &self,
213 deadline: zx::MonotonicInstant,
214 ) -> Result<InspectSinkEvent, fidl::Error> {
215 InspectSinkEvent::decode(self.client.wait_for_event(deadline)?)
216 }
217
218 pub fn r#publish(&self, mut payload: InspectSinkPublishRequest) -> Result<(), fidl::Error> {
221 self.client.send::<InspectSinkPublishRequest>(
222 &mut payload,
223 0xf9ceb1ab8ec6b4b,
224 fidl::encoding::DynamicFlags::FLEXIBLE,
225 )
226 }
227
228 pub fn r#escrow(&self, mut payload: InspectSinkEscrowRequest) -> Result<(), fidl::Error> {
249 self.client.send::<InspectSinkEscrowRequest>(
250 &mut payload,
251 0x4b683186a65d2d16,
252 fidl::encoding::DynamicFlags::FLEXIBLE,
253 )
254 }
255
256 pub fn r#fetch_escrow(
265 &self,
266 mut payload: InspectSinkFetchEscrowRequest,
267 ___deadline: zx::MonotonicInstant,
268 ) -> Result<InspectSinkFetchEscrowResponse, fidl::Error> {
269 let _response = self.client.send_query::<
270 InspectSinkFetchEscrowRequest,
271 fidl::encoding::FlexibleType<InspectSinkFetchEscrowResponse>,
272 >(
273 &mut payload,
274 0x7b9faa1a6f8e666a,
275 fidl::encoding::DynamicFlags::FLEXIBLE,
276 ___deadline,
277 )?
278 .into_result::<InspectSinkMarker>("fetch_escrow")?;
279 Ok(_response)
280 }
281}
282
283#[cfg(target_os = "fuchsia")]
284impl From<InspectSinkSynchronousProxy> for zx::Handle {
285 fn from(value: InspectSinkSynchronousProxy) -> Self {
286 value.into_channel().into()
287 }
288}
289
290#[cfg(target_os = "fuchsia")]
291impl From<fidl::Channel> for InspectSinkSynchronousProxy {
292 fn from(value: fidl::Channel) -> Self {
293 Self::new(value)
294 }
295}
296
297#[derive(Debug, Clone)]
298pub struct InspectSinkProxy {
299 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
300}
301
302impl fidl::endpoints::Proxy for InspectSinkProxy {
303 type Protocol = InspectSinkMarker;
304
305 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
306 Self::new(inner)
307 }
308
309 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
310 self.client.into_channel().map_err(|client| Self { client })
311 }
312
313 fn as_channel(&self) -> &::fidl::AsyncChannel {
314 self.client.as_channel()
315 }
316}
317
318impl InspectSinkProxy {
319 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
321 let protocol_name = <InspectSinkMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
322 Self { client: fidl::client::Client::new(channel, protocol_name) }
323 }
324
325 pub fn take_event_stream(&self) -> InspectSinkEventStream {
331 InspectSinkEventStream { event_receiver: self.client.take_event_receiver() }
332 }
333
334 pub fn r#publish(&self, mut payload: InspectSinkPublishRequest) -> Result<(), fidl::Error> {
337 InspectSinkProxyInterface::r#publish(self, payload)
338 }
339
340 pub fn r#escrow(&self, mut payload: InspectSinkEscrowRequest) -> Result<(), fidl::Error> {
361 InspectSinkProxyInterface::r#escrow(self, payload)
362 }
363
364 pub fn r#fetch_escrow(
373 &self,
374 mut payload: InspectSinkFetchEscrowRequest,
375 ) -> fidl::client::QueryResponseFut<
376 InspectSinkFetchEscrowResponse,
377 fidl::encoding::DefaultFuchsiaResourceDialect,
378 > {
379 InspectSinkProxyInterface::r#fetch_escrow(self, payload)
380 }
381}
382
383impl InspectSinkProxyInterface for InspectSinkProxy {
384 fn r#publish(&self, mut payload: InspectSinkPublishRequest) -> Result<(), fidl::Error> {
385 self.client.send::<InspectSinkPublishRequest>(
386 &mut payload,
387 0xf9ceb1ab8ec6b4b,
388 fidl::encoding::DynamicFlags::FLEXIBLE,
389 )
390 }
391
392 fn r#escrow(&self, mut payload: InspectSinkEscrowRequest) -> Result<(), fidl::Error> {
393 self.client.send::<InspectSinkEscrowRequest>(
394 &mut payload,
395 0x4b683186a65d2d16,
396 fidl::encoding::DynamicFlags::FLEXIBLE,
397 )
398 }
399
400 type FetchEscrowResponseFut = fidl::client::QueryResponseFut<
401 InspectSinkFetchEscrowResponse,
402 fidl::encoding::DefaultFuchsiaResourceDialect,
403 >;
404 fn r#fetch_escrow(
405 &self,
406 mut payload: InspectSinkFetchEscrowRequest,
407 ) -> Self::FetchEscrowResponseFut {
408 fn _decode(
409 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
410 ) -> Result<InspectSinkFetchEscrowResponse, fidl::Error> {
411 let _response = fidl::client::decode_transaction_body::<
412 fidl::encoding::FlexibleType<InspectSinkFetchEscrowResponse>,
413 fidl::encoding::DefaultFuchsiaResourceDialect,
414 0x7b9faa1a6f8e666a,
415 >(_buf?)?
416 .into_result::<InspectSinkMarker>("fetch_escrow")?;
417 Ok(_response)
418 }
419 self.client
420 .send_query_and_decode::<InspectSinkFetchEscrowRequest, InspectSinkFetchEscrowResponse>(
421 &mut payload,
422 0x7b9faa1a6f8e666a,
423 fidl::encoding::DynamicFlags::FLEXIBLE,
424 _decode,
425 )
426 }
427}
428
429pub struct InspectSinkEventStream {
430 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
431}
432
433impl std::marker::Unpin for InspectSinkEventStream {}
434
435impl futures::stream::FusedStream for InspectSinkEventStream {
436 fn is_terminated(&self) -> bool {
437 self.event_receiver.is_terminated()
438 }
439}
440
441impl futures::Stream for InspectSinkEventStream {
442 type Item = Result<InspectSinkEvent, fidl::Error>;
443
444 fn poll_next(
445 mut self: std::pin::Pin<&mut Self>,
446 cx: &mut std::task::Context<'_>,
447 ) -> std::task::Poll<Option<Self::Item>> {
448 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
449 &mut self.event_receiver,
450 cx
451 )?) {
452 Some(buf) => std::task::Poll::Ready(Some(InspectSinkEvent::decode(buf))),
453 None => std::task::Poll::Ready(None),
454 }
455 }
456}
457
458#[derive(Debug)]
459pub enum InspectSinkEvent {
460 #[non_exhaustive]
461 _UnknownEvent {
462 ordinal: u64,
464 },
465}
466
467impl InspectSinkEvent {
468 fn decode(
470 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
471 ) -> Result<InspectSinkEvent, fidl::Error> {
472 let (bytes, _handles) = buf.split_mut();
473 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
474 debug_assert_eq!(tx_header.tx_id, 0);
475 match tx_header.ordinal {
476 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
477 Ok(InspectSinkEvent::_UnknownEvent { ordinal: tx_header.ordinal })
478 }
479 _ => Err(fidl::Error::UnknownOrdinal {
480 ordinal: tx_header.ordinal,
481 protocol_name: <InspectSinkMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
482 }),
483 }
484 }
485}
486
487pub struct InspectSinkRequestStream {
489 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
490 is_terminated: bool,
491}
492
493impl std::marker::Unpin for InspectSinkRequestStream {}
494
495impl futures::stream::FusedStream for InspectSinkRequestStream {
496 fn is_terminated(&self) -> bool {
497 self.is_terminated
498 }
499}
500
501impl fidl::endpoints::RequestStream for InspectSinkRequestStream {
502 type Protocol = InspectSinkMarker;
503 type ControlHandle = InspectSinkControlHandle;
504
505 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
506 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
507 }
508
509 fn control_handle(&self) -> Self::ControlHandle {
510 InspectSinkControlHandle { inner: self.inner.clone() }
511 }
512
513 fn into_inner(
514 self,
515 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
516 {
517 (self.inner, self.is_terminated)
518 }
519
520 fn from_inner(
521 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
522 is_terminated: bool,
523 ) -> Self {
524 Self { inner, is_terminated }
525 }
526}
527
528impl futures::Stream for InspectSinkRequestStream {
529 type Item = Result<InspectSinkRequest, fidl::Error>;
530
531 fn poll_next(
532 mut self: std::pin::Pin<&mut Self>,
533 cx: &mut std::task::Context<'_>,
534 ) -> std::task::Poll<Option<Self::Item>> {
535 let this = &mut *self;
536 if this.inner.check_shutdown(cx) {
537 this.is_terminated = true;
538 return std::task::Poll::Ready(None);
539 }
540 if this.is_terminated {
541 panic!("polled InspectSinkRequestStream after completion");
542 }
543 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
544 |bytes, handles| {
545 match this.inner.channel().read_etc(cx, bytes, handles) {
546 std::task::Poll::Ready(Ok(())) => {}
547 std::task::Poll::Pending => return std::task::Poll::Pending,
548 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
549 this.is_terminated = true;
550 return std::task::Poll::Ready(None);
551 }
552 std::task::Poll::Ready(Err(e)) => {
553 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
554 e.into(),
555 ))))
556 }
557 }
558
559 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
561
562 std::task::Poll::Ready(Some(match header.ordinal {
563 0xf9ceb1ab8ec6b4b => {
564 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
565 let mut req = fidl::new_empty!(
566 InspectSinkPublishRequest,
567 fidl::encoding::DefaultFuchsiaResourceDialect
568 );
569 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InspectSinkPublishRequest>(&header, _body_bytes, handles, &mut req)?;
570 let control_handle = InspectSinkControlHandle { inner: this.inner.clone() };
571 Ok(InspectSinkRequest::Publish { payload: req, control_handle })
572 }
573 0x4b683186a65d2d16 => {
574 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
575 let mut req = fidl::new_empty!(
576 InspectSinkEscrowRequest,
577 fidl::encoding::DefaultFuchsiaResourceDialect
578 );
579 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InspectSinkEscrowRequest>(&header, _body_bytes, handles, &mut req)?;
580 let control_handle = InspectSinkControlHandle { inner: this.inner.clone() };
581 Ok(InspectSinkRequest::Escrow { payload: req, control_handle })
582 }
583 0x7b9faa1a6f8e666a => {
584 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
585 let mut req = fidl::new_empty!(
586 InspectSinkFetchEscrowRequest,
587 fidl::encoding::DefaultFuchsiaResourceDialect
588 );
589 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InspectSinkFetchEscrowRequest>(&header, _body_bytes, handles, &mut req)?;
590 let control_handle = InspectSinkControlHandle { inner: this.inner.clone() };
591 Ok(InspectSinkRequest::FetchEscrow {
592 payload: req,
593 responder: InspectSinkFetchEscrowResponder {
594 control_handle: std::mem::ManuallyDrop::new(control_handle),
595 tx_id: header.tx_id,
596 },
597 })
598 }
599 _ if header.tx_id == 0
600 && header
601 .dynamic_flags()
602 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
603 {
604 Ok(InspectSinkRequest::_UnknownMethod {
605 ordinal: header.ordinal,
606 control_handle: InspectSinkControlHandle { inner: this.inner.clone() },
607 method_type: fidl::MethodType::OneWay,
608 })
609 }
610 _ if header
611 .dynamic_flags()
612 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
613 {
614 this.inner.send_framework_err(
615 fidl::encoding::FrameworkErr::UnknownMethod,
616 header.tx_id,
617 header.ordinal,
618 header.dynamic_flags(),
619 (bytes, handles),
620 )?;
621 Ok(InspectSinkRequest::_UnknownMethod {
622 ordinal: header.ordinal,
623 control_handle: InspectSinkControlHandle { inner: this.inner.clone() },
624 method_type: fidl::MethodType::TwoWay,
625 })
626 }
627 _ => Err(fidl::Error::UnknownOrdinal {
628 ordinal: header.ordinal,
629 protocol_name:
630 <InspectSinkMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
631 }),
632 }))
633 },
634 )
635 }
636}
637
638#[derive(Debug)]
639pub enum InspectSinkRequest {
640 Publish { payload: InspectSinkPublishRequest, control_handle: InspectSinkControlHandle },
643 Escrow { payload: InspectSinkEscrowRequest, control_handle: InspectSinkControlHandle },
664 FetchEscrow {
673 payload: InspectSinkFetchEscrowRequest,
674 responder: InspectSinkFetchEscrowResponder,
675 },
676 #[non_exhaustive]
678 _UnknownMethod {
679 ordinal: u64,
681 control_handle: InspectSinkControlHandle,
682 method_type: fidl::MethodType,
683 },
684}
685
686impl InspectSinkRequest {
687 #[allow(irrefutable_let_patterns)]
688 pub fn into_publish(self) -> Option<(InspectSinkPublishRequest, InspectSinkControlHandle)> {
689 if let InspectSinkRequest::Publish { payload, control_handle } = self {
690 Some((payload, control_handle))
691 } else {
692 None
693 }
694 }
695
696 #[allow(irrefutable_let_patterns)]
697 pub fn into_escrow(self) -> Option<(InspectSinkEscrowRequest, InspectSinkControlHandle)> {
698 if let InspectSinkRequest::Escrow { payload, control_handle } = self {
699 Some((payload, control_handle))
700 } else {
701 None
702 }
703 }
704
705 #[allow(irrefutable_let_patterns)]
706 pub fn into_fetch_escrow(
707 self,
708 ) -> Option<(InspectSinkFetchEscrowRequest, InspectSinkFetchEscrowResponder)> {
709 if let InspectSinkRequest::FetchEscrow { payload, responder } = self {
710 Some((payload, responder))
711 } else {
712 None
713 }
714 }
715
716 pub fn method_name(&self) -> &'static str {
718 match *self {
719 InspectSinkRequest::Publish { .. } => "publish",
720 InspectSinkRequest::Escrow { .. } => "escrow",
721 InspectSinkRequest::FetchEscrow { .. } => "fetch_escrow",
722 InspectSinkRequest::_UnknownMethod {
723 method_type: fidl::MethodType::OneWay, ..
724 } => "unknown one-way method",
725 InspectSinkRequest::_UnknownMethod {
726 method_type: fidl::MethodType::TwoWay, ..
727 } => "unknown two-way method",
728 }
729 }
730}
731
732#[derive(Debug, Clone)]
733pub struct InspectSinkControlHandle {
734 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
735}
736
737impl fidl::endpoints::ControlHandle for InspectSinkControlHandle {
738 fn shutdown(&self) {
739 self.inner.shutdown()
740 }
741 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
742 self.inner.shutdown_with_epitaph(status)
743 }
744
745 fn is_closed(&self) -> bool {
746 self.inner.channel().is_closed()
747 }
748 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
749 self.inner.channel().on_closed()
750 }
751
752 #[cfg(target_os = "fuchsia")]
753 fn signal_peer(
754 &self,
755 clear_mask: zx::Signals,
756 set_mask: zx::Signals,
757 ) -> Result<(), zx_status::Status> {
758 use fidl::Peered;
759 self.inner.channel().signal_peer(clear_mask, set_mask)
760 }
761}
762
763impl InspectSinkControlHandle {}
764
765#[must_use = "FIDL methods require a response to be sent"]
766#[derive(Debug)]
767pub struct InspectSinkFetchEscrowResponder {
768 control_handle: std::mem::ManuallyDrop<InspectSinkControlHandle>,
769 tx_id: u32,
770}
771
772impl std::ops::Drop for InspectSinkFetchEscrowResponder {
776 fn drop(&mut self) {
777 self.control_handle.shutdown();
778 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
780 }
781}
782
783impl fidl::endpoints::Responder for InspectSinkFetchEscrowResponder {
784 type ControlHandle = InspectSinkControlHandle;
785
786 fn control_handle(&self) -> &InspectSinkControlHandle {
787 &self.control_handle
788 }
789
790 fn drop_without_shutdown(mut self) {
791 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
793 std::mem::forget(self);
795 }
796}
797
798impl InspectSinkFetchEscrowResponder {
799 pub fn send(self, mut payload: InspectSinkFetchEscrowResponse) -> Result<(), fidl::Error> {
803 let _result = self.send_raw(payload);
804 if _result.is_err() {
805 self.control_handle.shutdown();
806 }
807 self.drop_without_shutdown();
808 _result
809 }
810
811 pub fn send_no_shutdown_on_err(
813 self,
814 mut payload: InspectSinkFetchEscrowResponse,
815 ) -> Result<(), fidl::Error> {
816 let _result = self.send_raw(payload);
817 self.drop_without_shutdown();
818 _result
819 }
820
821 fn send_raw(&self, mut payload: InspectSinkFetchEscrowResponse) -> Result<(), fidl::Error> {
822 self.control_handle
823 .inner
824 .send::<fidl::encoding::FlexibleType<InspectSinkFetchEscrowResponse>>(
825 fidl::encoding::Flexible::new(&mut payload),
826 self.tx_id,
827 0x7b9faa1a6f8e666a,
828 fidl::encoding::DynamicFlags::FLEXIBLE,
829 )
830 }
831}
832
833#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
834pub struct TreeMarker;
835
836impl fidl::endpoints::ProtocolMarker for TreeMarker {
837 type Proxy = TreeProxy;
838 type RequestStream = TreeRequestStream;
839 #[cfg(target_os = "fuchsia")]
840 type SynchronousProxy = TreeSynchronousProxy;
841
842 const DEBUG_NAME: &'static str = "fuchsia.inspect.Tree";
843}
844impl fidl::endpoints::DiscoverableProtocolMarker for TreeMarker {}
845
846pub trait TreeProxyInterface: Send + Sync {
847 type GetContentResponseFut: std::future::Future<Output = Result<TreeContent, fidl::Error>>
848 + Send;
849 fn r#get_content(&self) -> Self::GetContentResponseFut;
850 fn r#list_child_names(
851 &self,
852 tree_iterator: fidl::endpoints::ServerEnd<TreeNameIteratorMarker>,
853 ) -> Result<(), fidl::Error>;
854 fn r#open_child(
855 &self,
856 child_name: &str,
857 tree: fidl::endpoints::ServerEnd<TreeMarker>,
858 ) -> Result<(), fidl::Error>;
859}
860#[derive(Debug)]
861#[cfg(target_os = "fuchsia")]
862pub struct TreeSynchronousProxy {
863 client: fidl::client::sync::Client,
864}
865
866#[cfg(target_os = "fuchsia")]
867impl fidl::endpoints::SynchronousProxy for TreeSynchronousProxy {
868 type Proxy = TreeProxy;
869 type Protocol = TreeMarker;
870
871 fn from_channel(inner: fidl::Channel) -> Self {
872 Self::new(inner)
873 }
874
875 fn into_channel(self) -> fidl::Channel {
876 self.client.into_channel()
877 }
878
879 fn as_channel(&self) -> &fidl::Channel {
880 self.client.as_channel()
881 }
882}
883
884#[cfg(target_os = "fuchsia")]
885impl TreeSynchronousProxy {
886 pub fn new(channel: fidl::Channel) -> Self {
887 let protocol_name = <TreeMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
888 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
889 }
890
891 pub fn into_channel(self) -> fidl::Channel {
892 self.client.into_channel()
893 }
894
895 pub fn wait_for_event(&self, deadline: zx::MonotonicInstant) -> Result<TreeEvent, fidl::Error> {
898 TreeEvent::decode(self.client.wait_for_event(deadline)?)
899 }
900
901 pub fn r#get_content(
911 &self,
912 ___deadline: zx::MonotonicInstant,
913 ) -> Result<TreeContent, fidl::Error> {
914 let _response =
915 self.client.send_query::<fidl::encoding::EmptyPayload, TreeGetContentResponse>(
916 (),
917 0x6ce0c1e42f903b47,
918 fidl::encoding::DynamicFlags::empty(),
919 ___deadline,
920 )?;
921 Ok(_response.content)
922 }
923
924 pub fn r#list_child_names(
929 &self,
930 mut tree_iterator: fidl::endpoints::ServerEnd<TreeNameIteratorMarker>,
931 ) -> Result<(), fidl::Error> {
932 self.client.send::<TreeListChildNamesRequest>(
933 (tree_iterator,),
934 0x577c988a830784a3,
935 fidl::encoding::DynamicFlags::empty(),
936 )
937 }
938
939 pub fn r#open_child(
943 &self,
944 mut child_name: &str,
945 mut tree: fidl::endpoints::ServerEnd<TreeMarker>,
946 ) -> Result<(), fidl::Error> {
947 self.client.send::<TreeOpenChildRequest>(
948 (child_name, tree),
949 0x526e35326e80a1b3,
950 fidl::encoding::DynamicFlags::empty(),
951 )
952 }
953}
954
955#[cfg(target_os = "fuchsia")]
956impl From<TreeSynchronousProxy> for zx::Handle {
957 fn from(value: TreeSynchronousProxy) -> Self {
958 value.into_channel().into()
959 }
960}
961
962#[cfg(target_os = "fuchsia")]
963impl From<fidl::Channel> for TreeSynchronousProxy {
964 fn from(value: fidl::Channel) -> Self {
965 Self::new(value)
966 }
967}
968
969#[derive(Debug, Clone)]
970pub struct TreeProxy {
971 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
972}
973
974impl fidl::endpoints::Proxy for TreeProxy {
975 type Protocol = TreeMarker;
976
977 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
978 Self::new(inner)
979 }
980
981 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
982 self.client.into_channel().map_err(|client| Self { client })
983 }
984
985 fn as_channel(&self) -> &::fidl::AsyncChannel {
986 self.client.as_channel()
987 }
988}
989
990impl TreeProxy {
991 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
993 let protocol_name = <TreeMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
994 Self { client: fidl::client::Client::new(channel, protocol_name) }
995 }
996
997 pub fn take_event_stream(&self) -> TreeEventStream {
1003 TreeEventStream { event_receiver: self.client.take_event_receiver() }
1004 }
1005
1006 pub fn r#get_content(
1016 &self,
1017 ) -> fidl::client::QueryResponseFut<TreeContent, fidl::encoding::DefaultFuchsiaResourceDialect>
1018 {
1019 TreeProxyInterface::r#get_content(self)
1020 }
1021
1022 pub fn r#list_child_names(
1027 &self,
1028 mut tree_iterator: fidl::endpoints::ServerEnd<TreeNameIteratorMarker>,
1029 ) -> Result<(), fidl::Error> {
1030 TreeProxyInterface::r#list_child_names(self, tree_iterator)
1031 }
1032
1033 pub fn r#open_child(
1037 &self,
1038 mut child_name: &str,
1039 mut tree: fidl::endpoints::ServerEnd<TreeMarker>,
1040 ) -> Result<(), fidl::Error> {
1041 TreeProxyInterface::r#open_child(self, child_name, tree)
1042 }
1043}
1044
1045impl TreeProxyInterface for TreeProxy {
1046 type GetContentResponseFut =
1047 fidl::client::QueryResponseFut<TreeContent, fidl::encoding::DefaultFuchsiaResourceDialect>;
1048 fn r#get_content(&self) -> Self::GetContentResponseFut {
1049 fn _decode(
1050 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1051 ) -> Result<TreeContent, fidl::Error> {
1052 let _response = fidl::client::decode_transaction_body::<
1053 TreeGetContentResponse,
1054 fidl::encoding::DefaultFuchsiaResourceDialect,
1055 0x6ce0c1e42f903b47,
1056 >(_buf?)?;
1057 Ok(_response.content)
1058 }
1059 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, TreeContent>(
1060 (),
1061 0x6ce0c1e42f903b47,
1062 fidl::encoding::DynamicFlags::empty(),
1063 _decode,
1064 )
1065 }
1066
1067 fn r#list_child_names(
1068 &self,
1069 mut tree_iterator: fidl::endpoints::ServerEnd<TreeNameIteratorMarker>,
1070 ) -> Result<(), fidl::Error> {
1071 self.client.send::<TreeListChildNamesRequest>(
1072 (tree_iterator,),
1073 0x577c988a830784a3,
1074 fidl::encoding::DynamicFlags::empty(),
1075 )
1076 }
1077
1078 fn r#open_child(
1079 &self,
1080 mut child_name: &str,
1081 mut tree: fidl::endpoints::ServerEnd<TreeMarker>,
1082 ) -> Result<(), fidl::Error> {
1083 self.client.send::<TreeOpenChildRequest>(
1084 (child_name, tree),
1085 0x526e35326e80a1b3,
1086 fidl::encoding::DynamicFlags::empty(),
1087 )
1088 }
1089}
1090
1091pub struct TreeEventStream {
1092 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1093}
1094
1095impl std::marker::Unpin for TreeEventStream {}
1096
1097impl futures::stream::FusedStream for TreeEventStream {
1098 fn is_terminated(&self) -> bool {
1099 self.event_receiver.is_terminated()
1100 }
1101}
1102
1103impl futures::Stream for TreeEventStream {
1104 type Item = Result<TreeEvent, fidl::Error>;
1105
1106 fn poll_next(
1107 mut self: std::pin::Pin<&mut Self>,
1108 cx: &mut std::task::Context<'_>,
1109 ) -> std::task::Poll<Option<Self::Item>> {
1110 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1111 &mut self.event_receiver,
1112 cx
1113 )?) {
1114 Some(buf) => std::task::Poll::Ready(Some(TreeEvent::decode(buf))),
1115 None => std::task::Poll::Ready(None),
1116 }
1117 }
1118}
1119
1120#[derive(Debug)]
1121pub enum TreeEvent {
1122 #[non_exhaustive]
1123 _UnknownEvent {
1124 ordinal: u64,
1126 },
1127}
1128
1129impl TreeEvent {
1130 fn decode(
1132 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1133 ) -> Result<TreeEvent, fidl::Error> {
1134 let (bytes, _handles) = buf.split_mut();
1135 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1136 debug_assert_eq!(tx_header.tx_id, 0);
1137 match tx_header.ordinal {
1138 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1139 Ok(TreeEvent::_UnknownEvent { ordinal: tx_header.ordinal })
1140 }
1141 _ => Err(fidl::Error::UnknownOrdinal {
1142 ordinal: tx_header.ordinal,
1143 protocol_name: <TreeMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1144 }),
1145 }
1146 }
1147}
1148
1149pub struct TreeRequestStream {
1151 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1152 is_terminated: bool,
1153}
1154
1155impl std::marker::Unpin for TreeRequestStream {}
1156
1157impl futures::stream::FusedStream for TreeRequestStream {
1158 fn is_terminated(&self) -> bool {
1159 self.is_terminated
1160 }
1161}
1162
1163impl fidl::endpoints::RequestStream for TreeRequestStream {
1164 type Protocol = TreeMarker;
1165 type ControlHandle = TreeControlHandle;
1166
1167 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1168 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1169 }
1170
1171 fn control_handle(&self) -> Self::ControlHandle {
1172 TreeControlHandle { inner: self.inner.clone() }
1173 }
1174
1175 fn into_inner(
1176 self,
1177 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1178 {
1179 (self.inner, self.is_terminated)
1180 }
1181
1182 fn from_inner(
1183 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1184 is_terminated: bool,
1185 ) -> Self {
1186 Self { inner, is_terminated }
1187 }
1188}
1189
1190impl futures::Stream for TreeRequestStream {
1191 type Item = Result<TreeRequest, fidl::Error>;
1192
1193 fn poll_next(
1194 mut self: std::pin::Pin<&mut Self>,
1195 cx: &mut std::task::Context<'_>,
1196 ) -> std::task::Poll<Option<Self::Item>> {
1197 let this = &mut *self;
1198 if this.inner.check_shutdown(cx) {
1199 this.is_terminated = true;
1200 return std::task::Poll::Ready(None);
1201 }
1202 if this.is_terminated {
1203 panic!("polled TreeRequestStream after completion");
1204 }
1205 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1206 |bytes, handles| {
1207 match this.inner.channel().read_etc(cx, bytes, handles) {
1208 std::task::Poll::Ready(Ok(())) => {}
1209 std::task::Poll::Pending => return std::task::Poll::Pending,
1210 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1211 this.is_terminated = true;
1212 return std::task::Poll::Ready(None);
1213 }
1214 std::task::Poll::Ready(Err(e)) => {
1215 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1216 e.into(),
1217 ))))
1218 }
1219 }
1220
1221 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1223
1224 std::task::Poll::Ready(Some(match header.ordinal {
1225 0x6ce0c1e42f903b47 => {
1226 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1227 let mut req = fidl::new_empty!(
1228 fidl::encoding::EmptyPayload,
1229 fidl::encoding::DefaultFuchsiaResourceDialect
1230 );
1231 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1232 let control_handle = TreeControlHandle { inner: this.inner.clone() };
1233 Ok(TreeRequest::GetContent {
1234 responder: TreeGetContentResponder {
1235 control_handle: std::mem::ManuallyDrop::new(control_handle),
1236 tx_id: header.tx_id,
1237 },
1238 })
1239 }
1240 0x577c988a830784a3 => {
1241 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1242 let mut req = fidl::new_empty!(
1243 TreeListChildNamesRequest,
1244 fidl::encoding::DefaultFuchsiaResourceDialect
1245 );
1246 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TreeListChildNamesRequest>(&header, _body_bytes, handles, &mut req)?;
1247 let control_handle = TreeControlHandle { inner: this.inner.clone() };
1248 Ok(TreeRequest::ListChildNames {
1249 tree_iterator: req.tree_iterator,
1250
1251 control_handle,
1252 })
1253 }
1254 0x526e35326e80a1b3 => {
1255 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1256 let mut req = fidl::new_empty!(
1257 TreeOpenChildRequest,
1258 fidl::encoding::DefaultFuchsiaResourceDialect
1259 );
1260 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TreeOpenChildRequest>(&header, _body_bytes, handles, &mut req)?;
1261 let control_handle = TreeControlHandle { inner: this.inner.clone() };
1262 Ok(TreeRequest::OpenChild {
1263 child_name: req.child_name,
1264 tree: req.tree,
1265
1266 control_handle,
1267 })
1268 }
1269 _ if header.tx_id == 0
1270 && header
1271 .dynamic_flags()
1272 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1273 {
1274 Ok(TreeRequest::_UnknownMethod {
1275 ordinal: header.ordinal,
1276 control_handle: TreeControlHandle { inner: this.inner.clone() },
1277 method_type: fidl::MethodType::OneWay,
1278 })
1279 }
1280 _ if header
1281 .dynamic_flags()
1282 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1283 {
1284 this.inner.send_framework_err(
1285 fidl::encoding::FrameworkErr::UnknownMethod,
1286 header.tx_id,
1287 header.ordinal,
1288 header.dynamic_flags(),
1289 (bytes, handles),
1290 )?;
1291 Ok(TreeRequest::_UnknownMethod {
1292 ordinal: header.ordinal,
1293 control_handle: TreeControlHandle { inner: this.inner.clone() },
1294 method_type: fidl::MethodType::TwoWay,
1295 })
1296 }
1297 _ => Err(fidl::Error::UnknownOrdinal {
1298 ordinal: header.ordinal,
1299 protocol_name: <TreeMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1300 }),
1301 }))
1302 },
1303 )
1304 }
1305}
1306
1307#[derive(Debug)]
1319pub enum TreeRequest {
1320 GetContent { responder: TreeGetContentResponder },
1330 ListChildNames {
1335 tree_iterator: fidl::endpoints::ServerEnd<TreeNameIteratorMarker>,
1336 control_handle: TreeControlHandle,
1337 },
1338 OpenChild {
1342 child_name: String,
1343 tree: fidl::endpoints::ServerEnd<TreeMarker>,
1344 control_handle: TreeControlHandle,
1345 },
1346 #[non_exhaustive]
1348 _UnknownMethod {
1349 ordinal: u64,
1351 control_handle: TreeControlHandle,
1352 method_type: fidl::MethodType,
1353 },
1354}
1355
1356impl TreeRequest {
1357 #[allow(irrefutable_let_patterns)]
1358 pub fn into_get_content(self) -> Option<(TreeGetContentResponder)> {
1359 if let TreeRequest::GetContent { responder } = self {
1360 Some((responder))
1361 } else {
1362 None
1363 }
1364 }
1365
1366 #[allow(irrefutable_let_patterns)]
1367 pub fn into_list_child_names(
1368 self,
1369 ) -> Option<(fidl::endpoints::ServerEnd<TreeNameIteratorMarker>, TreeControlHandle)> {
1370 if let TreeRequest::ListChildNames { tree_iterator, control_handle } = self {
1371 Some((tree_iterator, control_handle))
1372 } else {
1373 None
1374 }
1375 }
1376
1377 #[allow(irrefutable_let_patterns)]
1378 pub fn into_open_child(
1379 self,
1380 ) -> Option<(String, fidl::endpoints::ServerEnd<TreeMarker>, TreeControlHandle)> {
1381 if let TreeRequest::OpenChild { child_name, tree, control_handle } = self {
1382 Some((child_name, tree, control_handle))
1383 } else {
1384 None
1385 }
1386 }
1387
1388 pub fn method_name(&self) -> &'static str {
1390 match *self {
1391 TreeRequest::GetContent { .. } => "get_content",
1392 TreeRequest::ListChildNames { .. } => "list_child_names",
1393 TreeRequest::OpenChild { .. } => "open_child",
1394 TreeRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
1395 "unknown one-way method"
1396 }
1397 TreeRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
1398 "unknown two-way method"
1399 }
1400 }
1401 }
1402}
1403
1404#[derive(Debug, Clone)]
1405pub struct TreeControlHandle {
1406 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1407}
1408
1409impl fidl::endpoints::ControlHandle for TreeControlHandle {
1410 fn shutdown(&self) {
1411 self.inner.shutdown()
1412 }
1413 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1414 self.inner.shutdown_with_epitaph(status)
1415 }
1416
1417 fn is_closed(&self) -> bool {
1418 self.inner.channel().is_closed()
1419 }
1420 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1421 self.inner.channel().on_closed()
1422 }
1423
1424 #[cfg(target_os = "fuchsia")]
1425 fn signal_peer(
1426 &self,
1427 clear_mask: zx::Signals,
1428 set_mask: zx::Signals,
1429 ) -> Result<(), zx_status::Status> {
1430 use fidl::Peered;
1431 self.inner.channel().signal_peer(clear_mask, set_mask)
1432 }
1433}
1434
1435impl TreeControlHandle {}
1436
1437#[must_use = "FIDL methods require a response to be sent"]
1438#[derive(Debug)]
1439pub struct TreeGetContentResponder {
1440 control_handle: std::mem::ManuallyDrop<TreeControlHandle>,
1441 tx_id: u32,
1442}
1443
1444impl std::ops::Drop for TreeGetContentResponder {
1448 fn drop(&mut self) {
1449 self.control_handle.shutdown();
1450 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1452 }
1453}
1454
1455impl fidl::endpoints::Responder for TreeGetContentResponder {
1456 type ControlHandle = TreeControlHandle;
1457
1458 fn control_handle(&self) -> &TreeControlHandle {
1459 &self.control_handle
1460 }
1461
1462 fn drop_without_shutdown(mut self) {
1463 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1465 std::mem::forget(self);
1467 }
1468}
1469
1470impl TreeGetContentResponder {
1471 pub fn send(self, mut content: TreeContent) -> Result<(), fidl::Error> {
1475 let _result = self.send_raw(content);
1476 if _result.is_err() {
1477 self.control_handle.shutdown();
1478 }
1479 self.drop_without_shutdown();
1480 _result
1481 }
1482
1483 pub fn send_no_shutdown_on_err(self, mut content: TreeContent) -> Result<(), fidl::Error> {
1485 let _result = self.send_raw(content);
1486 self.drop_without_shutdown();
1487 _result
1488 }
1489
1490 fn send_raw(&self, mut content: TreeContent) -> Result<(), fidl::Error> {
1491 self.control_handle.inner.send::<TreeGetContentResponse>(
1492 (&mut content,),
1493 self.tx_id,
1494 0x6ce0c1e42f903b47,
1495 fidl::encoding::DynamicFlags::empty(),
1496 )
1497 }
1498}
1499
1500#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1501pub struct TreeNameIteratorMarker;
1502
1503impl fidl::endpoints::ProtocolMarker for TreeNameIteratorMarker {
1504 type Proxy = TreeNameIteratorProxy;
1505 type RequestStream = TreeNameIteratorRequestStream;
1506 #[cfg(target_os = "fuchsia")]
1507 type SynchronousProxy = TreeNameIteratorSynchronousProxy;
1508
1509 const DEBUG_NAME: &'static str = "(anonymous) TreeNameIterator";
1510}
1511
1512pub trait TreeNameIteratorProxyInterface: Send + Sync {
1513 type GetNextResponseFut: std::future::Future<Output = Result<Vec<String>, fidl::Error>> + Send;
1514 fn r#get_next(&self) -> Self::GetNextResponseFut;
1515}
1516#[derive(Debug)]
1517#[cfg(target_os = "fuchsia")]
1518pub struct TreeNameIteratorSynchronousProxy {
1519 client: fidl::client::sync::Client,
1520}
1521
1522#[cfg(target_os = "fuchsia")]
1523impl fidl::endpoints::SynchronousProxy for TreeNameIteratorSynchronousProxy {
1524 type Proxy = TreeNameIteratorProxy;
1525 type Protocol = TreeNameIteratorMarker;
1526
1527 fn from_channel(inner: fidl::Channel) -> Self {
1528 Self::new(inner)
1529 }
1530
1531 fn into_channel(self) -> fidl::Channel {
1532 self.client.into_channel()
1533 }
1534
1535 fn as_channel(&self) -> &fidl::Channel {
1536 self.client.as_channel()
1537 }
1538}
1539
1540#[cfg(target_os = "fuchsia")]
1541impl TreeNameIteratorSynchronousProxy {
1542 pub fn new(channel: fidl::Channel) -> Self {
1543 let protocol_name = <TreeNameIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1544 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1545 }
1546
1547 pub fn into_channel(self) -> fidl::Channel {
1548 self.client.into_channel()
1549 }
1550
1551 pub fn wait_for_event(
1554 &self,
1555 deadline: zx::MonotonicInstant,
1556 ) -> Result<TreeNameIteratorEvent, fidl::Error> {
1557 TreeNameIteratorEvent::decode(self.client.wait_for_event(deadline)?)
1558 }
1559
1560 pub fn r#get_next(
1565 &self,
1566 ___deadline: zx::MonotonicInstant,
1567 ) -> Result<Vec<String>, fidl::Error> {
1568 let _response = self
1569 .client
1570 .send_query::<fidl::encoding::EmptyPayload, TreeNameIteratorGetNextResponse>(
1571 (),
1572 0x6a7d7af5a325c8ac,
1573 fidl::encoding::DynamicFlags::empty(),
1574 ___deadline,
1575 )?;
1576 Ok(_response.name)
1577 }
1578}
1579
1580#[cfg(target_os = "fuchsia")]
1581impl From<TreeNameIteratorSynchronousProxy> for zx::Handle {
1582 fn from(value: TreeNameIteratorSynchronousProxy) -> Self {
1583 value.into_channel().into()
1584 }
1585}
1586
1587#[cfg(target_os = "fuchsia")]
1588impl From<fidl::Channel> for TreeNameIteratorSynchronousProxy {
1589 fn from(value: fidl::Channel) -> Self {
1590 Self::new(value)
1591 }
1592}
1593
1594#[derive(Debug, Clone)]
1595pub struct TreeNameIteratorProxy {
1596 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1597}
1598
1599impl fidl::endpoints::Proxy for TreeNameIteratorProxy {
1600 type Protocol = TreeNameIteratorMarker;
1601
1602 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1603 Self::new(inner)
1604 }
1605
1606 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1607 self.client.into_channel().map_err(|client| Self { client })
1608 }
1609
1610 fn as_channel(&self) -> &::fidl::AsyncChannel {
1611 self.client.as_channel()
1612 }
1613}
1614
1615impl TreeNameIteratorProxy {
1616 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1618 let protocol_name = <TreeNameIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1619 Self { client: fidl::client::Client::new(channel, protocol_name) }
1620 }
1621
1622 pub fn take_event_stream(&self) -> TreeNameIteratorEventStream {
1628 TreeNameIteratorEventStream { event_receiver: self.client.take_event_receiver() }
1629 }
1630
1631 pub fn r#get_next(
1636 &self,
1637 ) -> fidl::client::QueryResponseFut<Vec<String>, fidl::encoding::DefaultFuchsiaResourceDialect>
1638 {
1639 TreeNameIteratorProxyInterface::r#get_next(self)
1640 }
1641}
1642
1643impl TreeNameIteratorProxyInterface for TreeNameIteratorProxy {
1644 type GetNextResponseFut =
1645 fidl::client::QueryResponseFut<Vec<String>, fidl::encoding::DefaultFuchsiaResourceDialect>;
1646 fn r#get_next(&self) -> Self::GetNextResponseFut {
1647 fn _decode(
1648 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1649 ) -> Result<Vec<String>, fidl::Error> {
1650 let _response = fidl::client::decode_transaction_body::<
1651 TreeNameIteratorGetNextResponse,
1652 fidl::encoding::DefaultFuchsiaResourceDialect,
1653 0x6a7d7af5a325c8ac,
1654 >(_buf?)?;
1655 Ok(_response.name)
1656 }
1657 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<String>>(
1658 (),
1659 0x6a7d7af5a325c8ac,
1660 fidl::encoding::DynamicFlags::empty(),
1661 _decode,
1662 )
1663 }
1664}
1665
1666pub struct TreeNameIteratorEventStream {
1667 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1668}
1669
1670impl std::marker::Unpin for TreeNameIteratorEventStream {}
1671
1672impl futures::stream::FusedStream for TreeNameIteratorEventStream {
1673 fn is_terminated(&self) -> bool {
1674 self.event_receiver.is_terminated()
1675 }
1676}
1677
1678impl futures::Stream for TreeNameIteratorEventStream {
1679 type Item = Result<TreeNameIteratorEvent, fidl::Error>;
1680
1681 fn poll_next(
1682 mut self: std::pin::Pin<&mut Self>,
1683 cx: &mut std::task::Context<'_>,
1684 ) -> std::task::Poll<Option<Self::Item>> {
1685 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1686 &mut self.event_receiver,
1687 cx
1688 )?) {
1689 Some(buf) => std::task::Poll::Ready(Some(TreeNameIteratorEvent::decode(buf))),
1690 None => std::task::Poll::Ready(None),
1691 }
1692 }
1693}
1694
1695#[derive(Debug)]
1696pub enum TreeNameIteratorEvent {
1697 #[non_exhaustive]
1698 _UnknownEvent {
1699 ordinal: u64,
1701 },
1702}
1703
1704impl TreeNameIteratorEvent {
1705 fn decode(
1707 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1708 ) -> Result<TreeNameIteratorEvent, fidl::Error> {
1709 let (bytes, _handles) = buf.split_mut();
1710 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1711 debug_assert_eq!(tx_header.tx_id, 0);
1712 match tx_header.ordinal {
1713 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1714 Ok(TreeNameIteratorEvent::_UnknownEvent { ordinal: tx_header.ordinal })
1715 }
1716 _ => Err(fidl::Error::UnknownOrdinal {
1717 ordinal: tx_header.ordinal,
1718 protocol_name:
1719 <TreeNameIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1720 }),
1721 }
1722 }
1723}
1724
1725pub struct TreeNameIteratorRequestStream {
1727 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1728 is_terminated: bool,
1729}
1730
1731impl std::marker::Unpin for TreeNameIteratorRequestStream {}
1732
1733impl futures::stream::FusedStream for TreeNameIteratorRequestStream {
1734 fn is_terminated(&self) -> bool {
1735 self.is_terminated
1736 }
1737}
1738
1739impl fidl::endpoints::RequestStream for TreeNameIteratorRequestStream {
1740 type Protocol = TreeNameIteratorMarker;
1741 type ControlHandle = TreeNameIteratorControlHandle;
1742
1743 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1744 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1745 }
1746
1747 fn control_handle(&self) -> Self::ControlHandle {
1748 TreeNameIteratorControlHandle { inner: self.inner.clone() }
1749 }
1750
1751 fn into_inner(
1752 self,
1753 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1754 {
1755 (self.inner, self.is_terminated)
1756 }
1757
1758 fn from_inner(
1759 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1760 is_terminated: bool,
1761 ) -> Self {
1762 Self { inner, is_terminated }
1763 }
1764}
1765
1766impl futures::Stream for TreeNameIteratorRequestStream {
1767 type Item = Result<TreeNameIteratorRequest, fidl::Error>;
1768
1769 fn poll_next(
1770 mut self: std::pin::Pin<&mut Self>,
1771 cx: &mut std::task::Context<'_>,
1772 ) -> std::task::Poll<Option<Self::Item>> {
1773 let this = &mut *self;
1774 if this.inner.check_shutdown(cx) {
1775 this.is_terminated = true;
1776 return std::task::Poll::Ready(None);
1777 }
1778 if this.is_terminated {
1779 panic!("polled TreeNameIteratorRequestStream after completion");
1780 }
1781 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1782 |bytes, handles| {
1783 match this.inner.channel().read_etc(cx, bytes, handles) {
1784 std::task::Poll::Ready(Ok(())) => {}
1785 std::task::Poll::Pending => return std::task::Poll::Pending,
1786 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1787 this.is_terminated = true;
1788 return std::task::Poll::Ready(None);
1789 }
1790 std::task::Poll::Ready(Err(e)) => {
1791 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1792 e.into(),
1793 ))))
1794 }
1795 }
1796
1797 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1799
1800 std::task::Poll::Ready(Some(match header.ordinal {
1801 0x6a7d7af5a325c8ac => {
1802 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1803 let mut req = fidl::new_empty!(
1804 fidl::encoding::EmptyPayload,
1805 fidl::encoding::DefaultFuchsiaResourceDialect
1806 );
1807 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1808 let control_handle =
1809 TreeNameIteratorControlHandle { inner: this.inner.clone() };
1810 Ok(TreeNameIteratorRequest::GetNext {
1811 responder: TreeNameIteratorGetNextResponder {
1812 control_handle: std::mem::ManuallyDrop::new(control_handle),
1813 tx_id: header.tx_id,
1814 },
1815 })
1816 }
1817 _ if header.tx_id == 0
1818 && header
1819 .dynamic_flags()
1820 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1821 {
1822 Ok(TreeNameIteratorRequest::_UnknownMethod {
1823 ordinal: header.ordinal,
1824 control_handle: TreeNameIteratorControlHandle {
1825 inner: this.inner.clone(),
1826 },
1827 method_type: fidl::MethodType::OneWay,
1828 })
1829 }
1830 _ if header
1831 .dynamic_flags()
1832 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1833 {
1834 this.inner.send_framework_err(
1835 fidl::encoding::FrameworkErr::UnknownMethod,
1836 header.tx_id,
1837 header.ordinal,
1838 header.dynamic_flags(),
1839 (bytes, handles),
1840 )?;
1841 Ok(TreeNameIteratorRequest::_UnknownMethod {
1842 ordinal: header.ordinal,
1843 control_handle: TreeNameIteratorControlHandle {
1844 inner: this.inner.clone(),
1845 },
1846 method_type: fidl::MethodType::TwoWay,
1847 })
1848 }
1849 _ => Err(fidl::Error::UnknownOrdinal {
1850 ordinal: header.ordinal,
1851 protocol_name:
1852 <TreeNameIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1853 }),
1854 }))
1855 },
1856 )
1857 }
1858}
1859
1860#[derive(Debug)]
1862pub enum TreeNameIteratorRequest {
1863 GetNext { responder: TreeNameIteratorGetNextResponder },
1868 #[non_exhaustive]
1870 _UnknownMethod {
1871 ordinal: u64,
1873 control_handle: TreeNameIteratorControlHandle,
1874 method_type: fidl::MethodType,
1875 },
1876}
1877
1878impl TreeNameIteratorRequest {
1879 #[allow(irrefutable_let_patterns)]
1880 pub fn into_get_next(self) -> Option<(TreeNameIteratorGetNextResponder)> {
1881 if let TreeNameIteratorRequest::GetNext { responder } = self {
1882 Some((responder))
1883 } else {
1884 None
1885 }
1886 }
1887
1888 pub fn method_name(&self) -> &'static str {
1890 match *self {
1891 TreeNameIteratorRequest::GetNext { .. } => "get_next",
1892 TreeNameIteratorRequest::_UnknownMethod {
1893 method_type: fidl::MethodType::OneWay,
1894 ..
1895 } => "unknown one-way method",
1896 TreeNameIteratorRequest::_UnknownMethod {
1897 method_type: fidl::MethodType::TwoWay,
1898 ..
1899 } => "unknown two-way method",
1900 }
1901 }
1902}
1903
1904#[derive(Debug, Clone)]
1905pub struct TreeNameIteratorControlHandle {
1906 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1907}
1908
1909impl fidl::endpoints::ControlHandle for TreeNameIteratorControlHandle {
1910 fn shutdown(&self) {
1911 self.inner.shutdown()
1912 }
1913 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1914 self.inner.shutdown_with_epitaph(status)
1915 }
1916
1917 fn is_closed(&self) -> bool {
1918 self.inner.channel().is_closed()
1919 }
1920 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1921 self.inner.channel().on_closed()
1922 }
1923
1924 #[cfg(target_os = "fuchsia")]
1925 fn signal_peer(
1926 &self,
1927 clear_mask: zx::Signals,
1928 set_mask: zx::Signals,
1929 ) -> Result<(), zx_status::Status> {
1930 use fidl::Peered;
1931 self.inner.channel().signal_peer(clear_mask, set_mask)
1932 }
1933}
1934
1935impl TreeNameIteratorControlHandle {}
1936
1937#[must_use = "FIDL methods require a response to be sent"]
1938#[derive(Debug)]
1939pub struct TreeNameIteratorGetNextResponder {
1940 control_handle: std::mem::ManuallyDrop<TreeNameIteratorControlHandle>,
1941 tx_id: u32,
1942}
1943
1944impl std::ops::Drop for TreeNameIteratorGetNextResponder {
1948 fn drop(&mut self) {
1949 self.control_handle.shutdown();
1950 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1952 }
1953}
1954
1955impl fidl::endpoints::Responder for TreeNameIteratorGetNextResponder {
1956 type ControlHandle = TreeNameIteratorControlHandle;
1957
1958 fn control_handle(&self) -> &TreeNameIteratorControlHandle {
1959 &self.control_handle
1960 }
1961
1962 fn drop_without_shutdown(mut self) {
1963 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1965 std::mem::forget(self);
1967 }
1968}
1969
1970impl TreeNameIteratorGetNextResponder {
1971 pub fn send(self, mut name: &[String]) -> Result<(), fidl::Error> {
1975 let _result = self.send_raw(name);
1976 if _result.is_err() {
1977 self.control_handle.shutdown();
1978 }
1979 self.drop_without_shutdown();
1980 _result
1981 }
1982
1983 pub fn send_no_shutdown_on_err(self, mut name: &[String]) -> Result<(), fidl::Error> {
1985 let _result = self.send_raw(name);
1986 self.drop_without_shutdown();
1987 _result
1988 }
1989
1990 fn send_raw(&self, mut name: &[String]) -> Result<(), fidl::Error> {
1991 self.control_handle.inner.send::<TreeNameIteratorGetNextResponse>(
1992 (name,),
1993 self.tx_id,
1994 0x6a7d7af5a325c8ac,
1995 fidl::encoding::DynamicFlags::empty(),
1996 )
1997 }
1998}
1999
2000mod internal {
2001 use super::*;
2002
2003 impl fidl::encoding::ResourceTypeMarker for EscrowToken {
2004 type Borrowed<'a> = &'a mut Self;
2005 fn take_or_borrow<'a>(
2006 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2007 ) -> Self::Borrowed<'a> {
2008 value
2009 }
2010 }
2011
2012 unsafe impl fidl::encoding::TypeMarker for EscrowToken {
2013 type Owned = Self;
2014
2015 #[inline(always)]
2016 fn inline_align(_context: fidl::encoding::Context) -> usize {
2017 4
2018 }
2019
2020 #[inline(always)]
2021 fn inline_size(_context: fidl::encoding::Context) -> usize {
2022 4
2023 }
2024 }
2025
2026 unsafe impl fidl::encoding::Encode<EscrowToken, fidl::encoding::DefaultFuchsiaResourceDialect>
2027 for &mut EscrowToken
2028 {
2029 #[inline]
2030 unsafe fn encode(
2031 self,
2032 encoder: &mut fidl::encoding::Encoder<
2033 '_,
2034 fidl::encoding::DefaultFuchsiaResourceDialect,
2035 >,
2036 offset: usize,
2037 _depth: fidl::encoding::Depth,
2038 ) -> fidl::Result<()> {
2039 encoder.debug_check_bounds::<EscrowToken>(offset);
2040 fidl::encoding::Encode::<EscrowToken, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2042 (
2043 <fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 49152> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.token),
2044 ),
2045 encoder, offset, _depth
2046 )
2047 }
2048 }
2049 unsafe impl<
2050 T0: fidl::encoding::Encode<
2051 fidl::encoding::HandleType<
2052 fidl::EventPair,
2053 { fidl::ObjectType::EVENTPAIR.into_raw() },
2054 49152,
2055 >,
2056 fidl::encoding::DefaultFuchsiaResourceDialect,
2057 >,
2058 > fidl::encoding::Encode<EscrowToken, fidl::encoding::DefaultFuchsiaResourceDialect>
2059 for (T0,)
2060 {
2061 #[inline]
2062 unsafe fn encode(
2063 self,
2064 encoder: &mut fidl::encoding::Encoder<
2065 '_,
2066 fidl::encoding::DefaultFuchsiaResourceDialect,
2067 >,
2068 offset: usize,
2069 depth: fidl::encoding::Depth,
2070 ) -> fidl::Result<()> {
2071 encoder.debug_check_bounds::<EscrowToken>(offset);
2072 self.0.encode(encoder, offset + 0, depth)?;
2076 Ok(())
2077 }
2078 }
2079
2080 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for EscrowToken {
2081 #[inline(always)]
2082 fn new_empty() -> Self {
2083 Self {
2084 token: fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 49152>, fidl::encoding::DefaultFuchsiaResourceDialect),
2085 }
2086 }
2087
2088 #[inline]
2089 unsafe fn decode(
2090 &mut self,
2091 decoder: &mut fidl::encoding::Decoder<
2092 '_,
2093 fidl::encoding::DefaultFuchsiaResourceDialect,
2094 >,
2095 offset: usize,
2096 _depth: fidl::encoding::Depth,
2097 ) -> fidl::Result<()> {
2098 decoder.debug_check_bounds::<Self>(offset);
2099 fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 49152>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.token, decoder, offset + 0, _depth)?;
2101 Ok(())
2102 }
2103 }
2104
2105 impl fidl::encoding::ResourceTypeMarker for TreeGetContentResponse {
2106 type Borrowed<'a> = &'a mut Self;
2107 fn take_or_borrow<'a>(
2108 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2109 ) -> Self::Borrowed<'a> {
2110 value
2111 }
2112 }
2113
2114 unsafe impl fidl::encoding::TypeMarker for TreeGetContentResponse {
2115 type Owned = Self;
2116
2117 #[inline(always)]
2118 fn inline_align(_context: fidl::encoding::Context) -> usize {
2119 8
2120 }
2121
2122 #[inline(always)]
2123 fn inline_size(_context: fidl::encoding::Context) -> usize {
2124 16
2125 }
2126 }
2127
2128 unsafe impl
2129 fidl::encoding::Encode<
2130 TreeGetContentResponse,
2131 fidl::encoding::DefaultFuchsiaResourceDialect,
2132 > for &mut TreeGetContentResponse
2133 {
2134 #[inline]
2135 unsafe fn encode(
2136 self,
2137 encoder: &mut fidl::encoding::Encoder<
2138 '_,
2139 fidl::encoding::DefaultFuchsiaResourceDialect,
2140 >,
2141 offset: usize,
2142 _depth: fidl::encoding::Depth,
2143 ) -> fidl::Result<()> {
2144 encoder.debug_check_bounds::<TreeGetContentResponse>(offset);
2145 fidl::encoding::Encode::<
2147 TreeGetContentResponse,
2148 fidl::encoding::DefaultFuchsiaResourceDialect,
2149 >::encode(
2150 (<TreeContent as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2151 &mut self.content,
2152 ),),
2153 encoder,
2154 offset,
2155 _depth,
2156 )
2157 }
2158 }
2159 unsafe impl<
2160 T0: fidl::encoding::Encode<TreeContent, fidl::encoding::DefaultFuchsiaResourceDialect>,
2161 >
2162 fidl::encoding::Encode<
2163 TreeGetContentResponse,
2164 fidl::encoding::DefaultFuchsiaResourceDialect,
2165 > for (T0,)
2166 {
2167 #[inline]
2168 unsafe fn encode(
2169 self,
2170 encoder: &mut fidl::encoding::Encoder<
2171 '_,
2172 fidl::encoding::DefaultFuchsiaResourceDialect,
2173 >,
2174 offset: usize,
2175 depth: fidl::encoding::Depth,
2176 ) -> fidl::Result<()> {
2177 encoder.debug_check_bounds::<TreeGetContentResponse>(offset);
2178 self.0.encode(encoder, offset + 0, depth)?;
2182 Ok(())
2183 }
2184 }
2185
2186 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2187 for TreeGetContentResponse
2188 {
2189 #[inline(always)]
2190 fn new_empty() -> Self {
2191 Self {
2192 content: fidl::new_empty!(
2193 TreeContent,
2194 fidl::encoding::DefaultFuchsiaResourceDialect
2195 ),
2196 }
2197 }
2198
2199 #[inline]
2200 unsafe fn decode(
2201 &mut self,
2202 decoder: &mut fidl::encoding::Decoder<
2203 '_,
2204 fidl::encoding::DefaultFuchsiaResourceDialect,
2205 >,
2206 offset: usize,
2207 _depth: fidl::encoding::Depth,
2208 ) -> fidl::Result<()> {
2209 decoder.debug_check_bounds::<Self>(offset);
2210 fidl::decode!(
2212 TreeContent,
2213 fidl::encoding::DefaultFuchsiaResourceDialect,
2214 &mut self.content,
2215 decoder,
2216 offset + 0,
2217 _depth
2218 )?;
2219 Ok(())
2220 }
2221 }
2222
2223 impl fidl::encoding::ResourceTypeMarker for TreeListChildNamesRequest {
2224 type Borrowed<'a> = &'a mut Self;
2225 fn take_or_borrow<'a>(
2226 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2227 ) -> Self::Borrowed<'a> {
2228 value
2229 }
2230 }
2231
2232 unsafe impl fidl::encoding::TypeMarker for TreeListChildNamesRequest {
2233 type Owned = Self;
2234
2235 #[inline(always)]
2236 fn inline_align(_context: fidl::encoding::Context) -> usize {
2237 4
2238 }
2239
2240 #[inline(always)]
2241 fn inline_size(_context: fidl::encoding::Context) -> usize {
2242 4
2243 }
2244 }
2245
2246 unsafe impl
2247 fidl::encoding::Encode<
2248 TreeListChildNamesRequest,
2249 fidl::encoding::DefaultFuchsiaResourceDialect,
2250 > for &mut TreeListChildNamesRequest
2251 {
2252 #[inline]
2253 unsafe fn encode(
2254 self,
2255 encoder: &mut fidl::encoding::Encoder<
2256 '_,
2257 fidl::encoding::DefaultFuchsiaResourceDialect,
2258 >,
2259 offset: usize,
2260 _depth: fidl::encoding::Depth,
2261 ) -> fidl::Result<()> {
2262 encoder.debug_check_bounds::<TreeListChildNamesRequest>(offset);
2263 fidl::encoding::Encode::<TreeListChildNamesRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2265 (
2266 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<TreeNameIteratorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.tree_iterator),
2267 ),
2268 encoder, offset, _depth
2269 )
2270 }
2271 }
2272 unsafe impl<
2273 T0: fidl::encoding::Encode<
2274 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<TreeNameIteratorMarker>>,
2275 fidl::encoding::DefaultFuchsiaResourceDialect,
2276 >,
2277 >
2278 fidl::encoding::Encode<
2279 TreeListChildNamesRequest,
2280 fidl::encoding::DefaultFuchsiaResourceDialect,
2281 > for (T0,)
2282 {
2283 #[inline]
2284 unsafe fn encode(
2285 self,
2286 encoder: &mut fidl::encoding::Encoder<
2287 '_,
2288 fidl::encoding::DefaultFuchsiaResourceDialect,
2289 >,
2290 offset: usize,
2291 depth: fidl::encoding::Depth,
2292 ) -> fidl::Result<()> {
2293 encoder.debug_check_bounds::<TreeListChildNamesRequest>(offset);
2294 self.0.encode(encoder, offset + 0, depth)?;
2298 Ok(())
2299 }
2300 }
2301
2302 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2303 for TreeListChildNamesRequest
2304 {
2305 #[inline(always)]
2306 fn new_empty() -> Self {
2307 Self {
2308 tree_iterator: fidl::new_empty!(
2309 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<TreeNameIteratorMarker>>,
2310 fidl::encoding::DefaultFuchsiaResourceDialect
2311 ),
2312 }
2313 }
2314
2315 #[inline]
2316 unsafe fn decode(
2317 &mut self,
2318 decoder: &mut fidl::encoding::Decoder<
2319 '_,
2320 fidl::encoding::DefaultFuchsiaResourceDialect,
2321 >,
2322 offset: usize,
2323 _depth: fidl::encoding::Depth,
2324 ) -> fidl::Result<()> {
2325 decoder.debug_check_bounds::<Self>(offset);
2326 fidl::decode!(
2328 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<TreeNameIteratorMarker>>,
2329 fidl::encoding::DefaultFuchsiaResourceDialect,
2330 &mut self.tree_iterator,
2331 decoder,
2332 offset + 0,
2333 _depth
2334 )?;
2335 Ok(())
2336 }
2337 }
2338
2339 impl fidl::encoding::ResourceTypeMarker for TreeOpenChildRequest {
2340 type Borrowed<'a> = &'a mut Self;
2341 fn take_or_borrow<'a>(
2342 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2343 ) -> Self::Borrowed<'a> {
2344 value
2345 }
2346 }
2347
2348 unsafe impl fidl::encoding::TypeMarker for TreeOpenChildRequest {
2349 type Owned = Self;
2350
2351 #[inline(always)]
2352 fn inline_align(_context: fidl::encoding::Context) -> usize {
2353 8
2354 }
2355
2356 #[inline(always)]
2357 fn inline_size(_context: fidl::encoding::Context) -> usize {
2358 24
2359 }
2360 }
2361
2362 unsafe impl
2363 fidl::encoding::Encode<TreeOpenChildRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
2364 for &mut TreeOpenChildRequest
2365 {
2366 #[inline]
2367 unsafe fn encode(
2368 self,
2369 encoder: &mut fidl::encoding::Encoder<
2370 '_,
2371 fidl::encoding::DefaultFuchsiaResourceDialect,
2372 >,
2373 offset: usize,
2374 _depth: fidl::encoding::Depth,
2375 ) -> fidl::Result<()> {
2376 encoder.debug_check_bounds::<TreeOpenChildRequest>(offset);
2377 fidl::encoding::Encode::<TreeOpenChildRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2379 (
2380 <fidl::encoding::BoundedString<2040> as fidl::encoding::ValueTypeMarker>::borrow(&self.child_name),
2381 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<TreeMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.tree),
2382 ),
2383 encoder, offset, _depth
2384 )
2385 }
2386 }
2387 unsafe impl<
2388 T0: fidl::encoding::Encode<
2389 fidl::encoding::BoundedString<2040>,
2390 fidl::encoding::DefaultFuchsiaResourceDialect,
2391 >,
2392 T1: fidl::encoding::Encode<
2393 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<TreeMarker>>,
2394 fidl::encoding::DefaultFuchsiaResourceDialect,
2395 >,
2396 >
2397 fidl::encoding::Encode<TreeOpenChildRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
2398 for (T0, T1)
2399 {
2400 #[inline]
2401 unsafe fn encode(
2402 self,
2403 encoder: &mut fidl::encoding::Encoder<
2404 '_,
2405 fidl::encoding::DefaultFuchsiaResourceDialect,
2406 >,
2407 offset: usize,
2408 depth: fidl::encoding::Depth,
2409 ) -> fidl::Result<()> {
2410 encoder.debug_check_bounds::<TreeOpenChildRequest>(offset);
2411 unsafe {
2414 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
2415 (ptr as *mut u64).write_unaligned(0);
2416 }
2417 self.0.encode(encoder, offset + 0, depth)?;
2419 self.1.encode(encoder, offset + 16, depth)?;
2420 Ok(())
2421 }
2422 }
2423
2424 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2425 for TreeOpenChildRequest
2426 {
2427 #[inline(always)]
2428 fn new_empty() -> Self {
2429 Self {
2430 child_name: fidl::new_empty!(
2431 fidl::encoding::BoundedString<2040>,
2432 fidl::encoding::DefaultFuchsiaResourceDialect
2433 ),
2434 tree: fidl::new_empty!(
2435 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<TreeMarker>>,
2436 fidl::encoding::DefaultFuchsiaResourceDialect
2437 ),
2438 }
2439 }
2440
2441 #[inline]
2442 unsafe fn decode(
2443 &mut self,
2444 decoder: &mut fidl::encoding::Decoder<
2445 '_,
2446 fidl::encoding::DefaultFuchsiaResourceDialect,
2447 >,
2448 offset: usize,
2449 _depth: fidl::encoding::Depth,
2450 ) -> fidl::Result<()> {
2451 decoder.debug_check_bounds::<Self>(offset);
2452 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
2454 let padval = unsafe { (ptr as *const u64).read_unaligned() };
2455 let mask = 0xffffffff00000000u64;
2456 let maskedval = padval & mask;
2457 if maskedval != 0 {
2458 return Err(fidl::Error::NonZeroPadding {
2459 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
2460 });
2461 }
2462 fidl::decode!(
2463 fidl::encoding::BoundedString<2040>,
2464 fidl::encoding::DefaultFuchsiaResourceDialect,
2465 &mut self.child_name,
2466 decoder,
2467 offset + 0,
2468 _depth
2469 )?;
2470 fidl::decode!(
2471 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<TreeMarker>>,
2472 fidl::encoding::DefaultFuchsiaResourceDialect,
2473 &mut self.tree,
2474 decoder,
2475 offset + 16,
2476 _depth
2477 )?;
2478 Ok(())
2479 }
2480 }
2481
2482 impl InspectSinkEscrowRequest {
2483 #[inline(always)]
2484 fn max_ordinal_present(&self) -> u64 {
2485 if let Some(_) = self.tree {
2486 return 4;
2487 }
2488 if let Some(_) = self.name {
2489 return 3;
2490 }
2491 if let Some(_) = self.token {
2492 return 2;
2493 }
2494 if let Some(_) = self.vmo {
2495 return 1;
2496 }
2497 0
2498 }
2499 }
2500
2501 impl fidl::encoding::ResourceTypeMarker for InspectSinkEscrowRequest {
2502 type Borrowed<'a> = &'a mut Self;
2503 fn take_or_borrow<'a>(
2504 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2505 ) -> Self::Borrowed<'a> {
2506 value
2507 }
2508 }
2509
2510 unsafe impl fidl::encoding::TypeMarker for InspectSinkEscrowRequest {
2511 type Owned = Self;
2512
2513 #[inline(always)]
2514 fn inline_align(_context: fidl::encoding::Context) -> usize {
2515 8
2516 }
2517
2518 #[inline(always)]
2519 fn inline_size(_context: fidl::encoding::Context) -> usize {
2520 16
2521 }
2522 }
2523
2524 unsafe impl
2525 fidl::encoding::Encode<
2526 InspectSinkEscrowRequest,
2527 fidl::encoding::DefaultFuchsiaResourceDialect,
2528 > for &mut InspectSinkEscrowRequest
2529 {
2530 unsafe fn encode(
2531 self,
2532 encoder: &mut fidl::encoding::Encoder<
2533 '_,
2534 fidl::encoding::DefaultFuchsiaResourceDialect,
2535 >,
2536 offset: usize,
2537 mut depth: fidl::encoding::Depth,
2538 ) -> fidl::Result<()> {
2539 encoder.debug_check_bounds::<InspectSinkEscrowRequest>(offset);
2540 let max_ordinal: u64 = self.max_ordinal_present();
2542 encoder.write_num(max_ordinal, offset);
2543 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2544 if max_ordinal == 0 {
2546 return Ok(());
2547 }
2548 depth.increment()?;
2549 let envelope_size = 8;
2550 let bytes_len = max_ordinal as usize * envelope_size;
2551 #[allow(unused_variables)]
2552 let offset = encoder.out_of_line_offset(bytes_len);
2553 let mut _prev_end_offset: usize = 0;
2554 if 1 > max_ordinal {
2555 return Ok(());
2556 }
2557
2558 let cur_offset: usize = (1 - 1) * envelope_size;
2561
2562 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2564
2565 fidl::encoding::encode_in_envelope_optional::<
2570 fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 133>,
2571 fidl::encoding::DefaultFuchsiaResourceDialect,
2572 >(
2573 self.vmo.as_mut().map(
2574 <fidl::encoding::HandleType<
2575 fidl::Vmo,
2576 { fidl::ObjectType::VMO.into_raw() },
2577 133,
2578 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
2579 ),
2580 encoder,
2581 offset + cur_offset,
2582 depth,
2583 )?;
2584
2585 _prev_end_offset = cur_offset + envelope_size;
2586 if 2 > max_ordinal {
2587 return Ok(());
2588 }
2589
2590 let cur_offset: usize = (2 - 1) * envelope_size;
2593
2594 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2596
2597 fidl::encoding::encode_in_envelope_optional::<
2602 EscrowToken,
2603 fidl::encoding::DefaultFuchsiaResourceDialect,
2604 >(
2605 self.token
2606 .as_mut()
2607 .map(<EscrowToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
2608 encoder,
2609 offset + cur_offset,
2610 depth,
2611 )?;
2612
2613 _prev_end_offset = cur_offset + envelope_size;
2614 if 3 > max_ordinal {
2615 return Ok(());
2616 }
2617
2618 let cur_offset: usize = (3 - 1) * envelope_size;
2621
2622 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2624
2625 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<4096>, fidl::encoding::DefaultFuchsiaResourceDialect>(
2630 self.name.as_ref().map(<fidl::encoding::BoundedString<4096> as fidl::encoding::ValueTypeMarker>::borrow),
2631 encoder, offset + cur_offset, depth
2632 )?;
2633
2634 _prev_end_offset = cur_offset + envelope_size;
2635 if 4 > max_ordinal {
2636 return Ok(());
2637 }
2638
2639 let cur_offset: usize = (4 - 1) * envelope_size;
2642
2643 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2645
2646 fidl::encoding::encode_in_envelope_optional::<
2651 u64,
2652 fidl::encoding::DefaultFuchsiaResourceDialect,
2653 >(
2654 self.tree.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
2655 encoder,
2656 offset + cur_offset,
2657 depth,
2658 )?;
2659
2660 _prev_end_offset = cur_offset + envelope_size;
2661
2662 Ok(())
2663 }
2664 }
2665
2666 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2667 for InspectSinkEscrowRequest
2668 {
2669 #[inline(always)]
2670 fn new_empty() -> Self {
2671 Self::default()
2672 }
2673
2674 unsafe fn decode(
2675 &mut self,
2676 decoder: &mut fidl::encoding::Decoder<
2677 '_,
2678 fidl::encoding::DefaultFuchsiaResourceDialect,
2679 >,
2680 offset: usize,
2681 mut depth: fidl::encoding::Depth,
2682 ) -> fidl::Result<()> {
2683 decoder.debug_check_bounds::<Self>(offset);
2684 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2685 None => return Err(fidl::Error::NotNullable),
2686 Some(len) => len,
2687 };
2688 if len == 0 {
2690 return Ok(());
2691 };
2692 depth.increment()?;
2693 let envelope_size = 8;
2694 let bytes_len = len * envelope_size;
2695 let offset = decoder.out_of_line_offset(bytes_len)?;
2696 let mut _next_ordinal_to_read = 0;
2698 let mut next_offset = offset;
2699 let end_offset = offset + bytes_len;
2700 _next_ordinal_to_read += 1;
2701 if next_offset >= end_offset {
2702 return Ok(());
2703 }
2704
2705 while _next_ordinal_to_read < 1 {
2707 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2708 _next_ordinal_to_read += 1;
2709 next_offset += envelope_size;
2710 }
2711
2712 let next_out_of_line = decoder.next_out_of_line();
2713 let handles_before = decoder.remaining_handles();
2714 if let Some((inlined, num_bytes, num_handles)) =
2715 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2716 {
2717 let member_inline_size = <fidl::encoding::HandleType<
2718 fidl::Vmo,
2719 { fidl::ObjectType::VMO.into_raw() },
2720 133,
2721 > as fidl::encoding::TypeMarker>::inline_size(
2722 decoder.context
2723 );
2724 if inlined != (member_inline_size <= 4) {
2725 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2726 }
2727 let inner_offset;
2728 let mut inner_depth = depth.clone();
2729 if inlined {
2730 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2731 inner_offset = next_offset;
2732 } else {
2733 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2734 inner_depth.increment()?;
2735 }
2736 let val_ref =
2737 self.vmo.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 133>, fidl::encoding::DefaultFuchsiaResourceDialect));
2738 fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 133>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
2739 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2740 {
2741 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2742 }
2743 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2744 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2745 }
2746 }
2747
2748 next_offset += envelope_size;
2749 _next_ordinal_to_read += 1;
2750 if next_offset >= end_offset {
2751 return Ok(());
2752 }
2753
2754 while _next_ordinal_to_read < 2 {
2756 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2757 _next_ordinal_to_read += 1;
2758 next_offset += envelope_size;
2759 }
2760
2761 let next_out_of_line = decoder.next_out_of_line();
2762 let handles_before = decoder.remaining_handles();
2763 if let Some((inlined, num_bytes, num_handles)) =
2764 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2765 {
2766 let member_inline_size =
2767 <EscrowToken as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2768 if inlined != (member_inline_size <= 4) {
2769 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2770 }
2771 let inner_offset;
2772 let mut inner_depth = depth.clone();
2773 if inlined {
2774 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2775 inner_offset = next_offset;
2776 } else {
2777 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2778 inner_depth.increment()?;
2779 }
2780 let val_ref = self.token.get_or_insert_with(|| {
2781 fidl::new_empty!(EscrowToken, fidl::encoding::DefaultFuchsiaResourceDialect)
2782 });
2783 fidl::decode!(
2784 EscrowToken,
2785 fidl::encoding::DefaultFuchsiaResourceDialect,
2786 val_ref,
2787 decoder,
2788 inner_offset,
2789 inner_depth
2790 )?;
2791 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2792 {
2793 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2794 }
2795 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2796 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2797 }
2798 }
2799
2800 next_offset += envelope_size;
2801 _next_ordinal_to_read += 1;
2802 if next_offset >= end_offset {
2803 return Ok(());
2804 }
2805
2806 while _next_ordinal_to_read < 3 {
2808 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2809 _next_ordinal_to_read += 1;
2810 next_offset += envelope_size;
2811 }
2812
2813 let next_out_of_line = decoder.next_out_of_line();
2814 let handles_before = decoder.remaining_handles();
2815 if let Some((inlined, num_bytes, num_handles)) =
2816 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2817 {
2818 let member_inline_size = <fidl::encoding::BoundedString<4096> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2819 if inlined != (member_inline_size <= 4) {
2820 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2821 }
2822 let inner_offset;
2823 let mut inner_depth = depth.clone();
2824 if inlined {
2825 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2826 inner_offset = next_offset;
2827 } else {
2828 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2829 inner_depth.increment()?;
2830 }
2831 let val_ref = self.name.get_or_insert_with(|| {
2832 fidl::new_empty!(
2833 fidl::encoding::BoundedString<4096>,
2834 fidl::encoding::DefaultFuchsiaResourceDialect
2835 )
2836 });
2837 fidl::decode!(
2838 fidl::encoding::BoundedString<4096>,
2839 fidl::encoding::DefaultFuchsiaResourceDialect,
2840 val_ref,
2841 decoder,
2842 inner_offset,
2843 inner_depth
2844 )?;
2845 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2846 {
2847 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2848 }
2849 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2850 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2851 }
2852 }
2853
2854 next_offset += envelope_size;
2855 _next_ordinal_to_read += 1;
2856 if next_offset >= end_offset {
2857 return Ok(());
2858 }
2859
2860 while _next_ordinal_to_read < 4 {
2862 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2863 _next_ordinal_to_read += 1;
2864 next_offset += envelope_size;
2865 }
2866
2867 let next_out_of_line = decoder.next_out_of_line();
2868 let handles_before = decoder.remaining_handles();
2869 if let Some((inlined, num_bytes, num_handles)) =
2870 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2871 {
2872 let member_inline_size =
2873 <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2874 if inlined != (member_inline_size <= 4) {
2875 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2876 }
2877 let inner_offset;
2878 let mut inner_depth = depth.clone();
2879 if inlined {
2880 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2881 inner_offset = next_offset;
2882 } else {
2883 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2884 inner_depth.increment()?;
2885 }
2886 let val_ref = self.tree.get_or_insert_with(|| {
2887 fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
2888 });
2889 fidl::decode!(
2890 u64,
2891 fidl::encoding::DefaultFuchsiaResourceDialect,
2892 val_ref,
2893 decoder,
2894 inner_offset,
2895 inner_depth
2896 )?;
2897 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2898 {
2899 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2900 }
2901 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2902 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2903 }
2904 }
2905
2906 next_offset += envelope_size;
2907
2908 while next_offset < end_offset {
2910 _next_ordinal_to_read += 1;
2911 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2912 next_offset += envelope_size;
2913 }
2914
2915 Ok(())
2916 }
2917 }
2918
2919 impl InspectSinkFetchEscrowRequest {
2920 #[inline(always)]
2921 fn max_ordinal_present(&self) -> u64 {
2922 if let Some(_) = self.tree {
2923 return 2;
2924 }
2925 if let Some(_) = self.token {
2926 return 1;
2927 }
2928 0
2929 }
2930 }
2931
2932 impl fidl::encoding::ResourceTypeMarker for InspectSinkFetchEscrowRequest {
2933 type Borrowed<'a> = &'a mut Self;
2934 fn take_or_borrow<'a>(
2935 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2936 ) -> Self::Borrowed<'a> {
2937 value
2938 }
2939 }
2940
2941 unsafe impl fidl::encoding::TypeMarker for InspectSinkFetchEscrowRequest {
2942 type Owned = Self;
2943
2944 #[inline(always)]
2945 fn inline_align(_context: fidl::encoding::Context) -> usize {
2946 8
2947 }
2948
2949 #[inline(always)]
2950 fn inline_size(_context: fidl::encoding::Context) -> usize {
2951 16
2952 }
2953 }
2954
2955 unsafe impl
2956 fidl::encoding::Encode<
2957 InspectSinkFetchEscrowRequest,
2958 fidl::encoding::DefaultFuchsiaResourceDialect,
2959 > for &mut InspectSinkFetchEscrowRequest
2960 {
2961 unsafe fn encode(
2962 self,
2963 encoder: &mut fidl::encoding::Encoder<
2964 '_,
2965 fidl::encoding::DefaultFuchsiaResourceDialect,
2966 >,
2967 offset: usize,
2968 mut depth: fidl::encoding::Depth,
2969 ) -> fidl::Result<()> {
2970 encoder.debug_check_bounds::<InspectSinkFetchEscrowRequest>(offset);
2971 let max_ordinal: u64 = self.max_ordinal_present();
2973 encoder.write_num(max_ordinal, offset);
2974 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2975 if max_ordinal == 0 {
2977 return Ok(());
2978 }
2979 depth.increment()?;
2980 let envelope_size = 8;
2981 let bytes_len = max_ordinal as usize * envelope_size;
2982 #[allow(unused_variables)]
2983 let offset = encoder.out_of_line_offset(bytes_len);
2984 let mut _prev_end_offset: usize = 0;
2985 if 1 > max_ordinal {
2986 return Ok(());
2987 }
2988
2989 let cur_offset: usize = (1 - 1) * envelope_size;
2992
2993 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2995
2996 fidl::encoding::encode_in_envelope_optional::<
3001 EscrowToken,
3002 fidl::encoding::DefaultFuchsiaResourceDialect,
3003 >(
3004 self.token
3005 .as_mut()
3006 .map(<EscrowToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
3007 encoder,
3008 offset + cur_offset,
3009 depth,
3010 )?;
3011
3012 _prev_end_offset = cur_offset + envelope_size;
3013 if 2 > max_ordinal {
3014 return Ok(());
3015 }
3016
3017 let cur_offset: usize = (2 - 1) * envelope_size;
3020
3021 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3023
3024 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<TreeMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
3029 self.tree.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<TreeMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
3030 encoder, offset + cur_offset, depth
3031 )?;
3032
3033 _prev_end_offset = cur_offset + envelope_size;
3034
3035 Ok(())
3036 }
3037 }
3038
3039 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3040 for InspectSinkFetchEscrowRequest
3041 {
3042 #[inline(always)]
3043 fn new_empty() -> Self {
3044 Self::default()
3045 }
3046
3047 unsafe fn decode(
3048 &mut self,
3049 decoder: &mut fidl::encoding::Decoder<
3050 '_,
3051 fidl::encoding::DefaultFuchsiaResourceDialect,
3052 >,
3053 offset: usize,
3054 mut depth: fidl::encoding::Depth,
3055 ) -> fidl::Result<()> {
3056 decoder.debug_check_bounds::<Self>(offset);
3057 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3058 None => return Err(fidl::Error::NotNullable),
3059 Some(len) => len,
3060 };
3061 if len == 0 {
3063 return Ok(());
3064 };
3065 depth.increment()?;
3066 let envelope_size = 8;
3067 let bytes_len = len * envelope_size;
3068 let offset = decoder.out_of_line_offset(bytes_len)?;
3069 let mut _next_ordinal_to_read = 0;
3071 let mut next_offset = offset;
3072 let end_offset = offset + bytes_len;
3073 _next_ordinal_to_read += 1;
3074 if next_offset >= end_offset {
3075 return Ok(());
3076 }
3077
3078 while _next_ordinal_to_read < 1 {
3080 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3081 _next_ordinal_to_read += 1;
3082 next_offset += envelope_size;
3083 }
3084
3085 let next_out_of_line = decoder.next_out_of_line();
3086 let handles_before = decoder.remaining_handles();
3087 if let Some((inlined, num_bytes, num_handles)) =
3088 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3089 {
3090 let member_inline_size =
3091 <EscrowToken as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3092 if inlined != (member_inline_size <= 4) {
3093 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3094 }
3095 let inner_offset;
3096 let mut inner_depth = depth.clone();
3097 if inlined {
3098 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3099 inner_offset = next_offset;
3100 } else {
3101 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3102 inner_depth.increment()?;
3103 }
3104 let val_ref = self.token.get_or_insert_with(|| {
3105 fidl::new_empty!(EscrowToken, fidl::encoding::DefaultFuchsiaResourceDialect)
3106 });
3107 fidl::decode!(
3108 EscrowToken,
3109 fidl::encoding::DefaultFuchsiaResourceDialect,
3110 val_ref,
3111 decoder,
3112 inner_offset,
3113 inner_depth
3114 )?;
3115 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3116 {
3117 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3118 }
3119 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3120 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3121 }
3122 }
3123
3124 next_offset += envelope_size;
3125 _next_ordinal_to_read += 1;
3126 if next_offset >= end_offset {
3127 return Ok(());
3128 }
3129
3130 while _next_ordinal_to_read < 2 {
3132 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3133 _next_ordinal_to_read += 1;
3134 next_offset += envelope_size;
3135 }
3136
3137 let next_out_of_line = decoder.next_out_of_line();
3138 let handles_before = decoder.remaining_handles();
3139 if let Some((inlined, num_bytes, num_handles)) =
3140 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3141 {
3142 let member_inline_size = <fidl::encoding::Endpoint<
3143 fidl::endpoints::ClientEnd<TreeMarker>,
3144 > as fidl::encoding::TypeMarker>::inline_size(
3145 decoder.context
3146 );
3147 if inlined != (member_inline_size <= 4) {
3148 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3149 }
3150 let inner_offset;
3151 let mut inner_depth = depth.clone();
3152 if inlined {
3153 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3154 inner_offset = next_offset;
3155 } else {
3156 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3157 inner_depth.increment()?;
3158 }
3159 let val_ref = self.tree.get_or_insert_with(|| {
3160 fidl::new_empty!(
3161 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<TreeMarker>>,
3162 fidl::encoding::DefaultFuchsiaResourceDialect
3163 )
3164 });
3165 fidl::decode!(
3166 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<TreeMarker>>,
3167 fidl::encoding::DefaultFuchsiaResourceDialect,
3168 val_ref,
3169 decoder,
3170 inner_offset,
3171 inner_depth
3172 )?;
3173 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3174 {
3175 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3176 }
3177 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3178 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3179 }
3180 }
3181
3182 next_offset += envelope_size;
3183
3184 while next_offset < end_offset {
3186 _next_ordinal_to_read += 1;
3187 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3188 next_offset += envelope_size;
3189 }
3190
3191 Ok(())
3192 }
3193 }
3194
3195 impl InspectSinkPublishRequest {
3196 #[inline(always)]
3197 fn max_ordinal_present(&self) -> u64 {
3198 if let Some(_) = self.name {
3199 return 2;
3200 }
3201 if let Some(_) = self.tree {
3202 return 1;
3203 }
3204 0
3205 }
3206 }
3207
3208 impl fidl::encoding::ResourceTypeMarker for InspectSinkPublishRequest {
3209 type Borrowed<'a> = &'a mut Self;
3210 fn take_or_borrow<'a>(
3211 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3212 ) -> Self::Borrowed<'a> {
3213 value
3214 }
3215 }
3216
3217 unsafe impl fidl::encoding::TypeMarker for InspectSinkPublishRequest {
3218 type Owned = Self;
3219
3220 #[inline(always)]
3221 fn inline_align(_context: fidl::encoding::Context) -> usize {
3222 8
3223 }
3224
3225 #[inline(always)]
3226 fn inline_size(_context: fidl::encoding::Context) -> usize {
3227 16
3228 }
3229 }
3230
3231 unsafe impl
3232 fidl::encoding::Encode<
3233 InspectSinkPublishRequest,
3234 fidl::encoding::DefaultFuchsiaResourceDialect,
3235 > for &mut InspectSinkPublishRequest
3236 {
3237 unsafe fn encode(
3238 self,
3239 encoder: &mut fidl::encoding::Encoder<
3240 '_,
3241 fidl::encoding::DefaultFuchsiaResourceDialect,
3242 >,
3243 offset: usize,
3244 mut depth: fidl::encoding::Depth,
3245 ) -> fidl::Result<()> {
3246 encoder.debug_check_bounds::<InspectSinkPublishRequest>(offset);
3247 let max_ordinal: u64 = self.max_ordinal_present();
3249 encoder.write_num(max_ordinal, offset);
3250 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3251 if max_ordinal == 0 {
3253 return Ok(());
3254 }
3255 depth.increment()?;
3256 let envelope_size = 8;
3257 let bytes_len = max_ordinal as usize * envelope_size;
3258 #[allow(unused_variables)]
3259 let offset = encoder.out_of_line_offset(bytes_len);
3260 let mut _prev_end_offset: usize = 0;
3261 if 1 > max_ordinal {
3262 return Ok(());
3263 }
3264
3265 let cur_offset: usize = (1 - 1) * envelope_size;
3268
3269 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3271
3272 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<TreeMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
3277 self.tree.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<TreeMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
3278 encoder, offset + cur_offset, depth
3279 )?;
3280
3281 _prev_end_offset = cur_offset + envelope_size;
3282 if 2 > max_ordinal {
3283 return Ok(());
3284 }
3285
3286 let cur_offset: usize = (2 - 1) * envelope_size;
3289
3290 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3292
3293 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<4096>, fidl::encoding::DefaultFuchsiaResourceDialect>(
3298 self.name.as_ref().map(<fidl::encoding::BoundedString<4096> as fidl::encoding::ValueTypeMarker>::borrow),
3299 encoder, offset + cur_offset, depth
3300 )?;
3301
3302 _prev_end_offset = cur_offset + envelope_size;
3303
3304 Ok(())
3305 }
3306 }
3307
3308 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3309 for InspectSinkPublishRequest
3310 {
3311 #[inline(always)]
3312 fn new_empty() -> Self {
3313 Self::default()
3314 }
3315
3316 unsafe fn decode(
3317 &mut self,
3318 decoder: &mut fidl::encoding::Decoder<
3319 '_,
3320 fidl::encoding::DefaultFuchsiaResourceDialect,
3321 >,
3322 offset: usize,
3323 mut depth: fidl::encoding::Depth,
3324 ) -> fidl::Result<()> {
3325 decoder.debug_check_bounds::<Self>(offset);
3326 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3327 None => return Err(fidl::Error::NotNullable),
3328 Some(len) => len,
3329 };
3330 if len == 0 {
3332 return Ok(());
3333 };
3334 depth.increment()?;
3335 let envelope_size = 8;
3336 let bytes_len = len * envelope_size;
3337 let offset = decoder.out_of_line_offset(bytes_len)?;
3338 let mut _next_ordinal_to_read = 0;
3340 let mut next_offset = offset;
3341 let end_offset = offset + bytes_len;
3342 _next_ordinal_to_read += 1;
3343 if next_offset >= end_offset {
3344 return Ok(());
3345 }
3346
3347 while _next_ordinal_to_read < 1 {
3349 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3350 _next_ordinal_to_read += 1;
3351 next_offset += envelope_size;
3352 }
3353
3354 let next_out_of_line = decoder.next_out_of_line();
3355 let handles_before = decoder.remaining_handles();
3356 if let Some((inlined, num_bytes, num_handles)) =
3357 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3358 {
3359 let member_inline_size = <fidl::encoding::Endpoint<
3360 fidl::endpoints::ClientEnd<TreeMarker>,
3361 > as fidl::encoding::TypeMarker>::inline_size(
3362 decoder.context
3363 );
3364 if inlined != (member_inline_size <= 4) {
3365 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3366 }
3367 let inner_offset;
3368 let mut inner_depth = depth.clone();
3369 if inlined {
3370 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3371 inner_offset = next_offset;
3372 } else {
3373 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3374 inner_depth.increment()?;
3375 }
3376 let val_ref = self.tree.get_or_insert_with(|| {
3377 fidl::new_empty!(
3378 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<TreeMarker>>,
3379 fidl::encoding::DefaultFuchsiaResourceDialect
3380 )
3381 });
3382 fidl::decode!(
3383 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<TreeMarker>>,
3384 fidl::encoding::DefaultFuchsiaResourceDialect,
3385 val_ref,
3386 decoder,
3387 inner_offset,
3388 inner_depth
3389 )?;
3390 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3391 {
3392 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3393 }
3394 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3395 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3396 }
3397 }
3398
3399 next_offset += envelope_size;
3400 _next_ordinal_to_read += 1;
3401 if next_offset >= end_offset {
3402 return Ok(());
3403 }
3404
3405 while _next_ordinal_to_read < 2 {
3407 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3408 _next_ordinal_to_read += 1;
3409 next_offset += envelope_size;
3410 }
3411
3412 let next_out_of_line = decoder.next_out_of_line();
3413 let handles_before = decoder.remaining_handles();
3414 if let Some((inlined, num_bytes, num_handles)) =
3415 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3416 {
3417 let member_inline_size = <fidl::encoding::BoundedString<4096> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3418 if inlined != (member_inline_size <= 4) {
3419 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3420 }
3421 let inner_offset;
3422 let mut inner_depth = depth.clone();
3423 if inlined {
3424 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3425 inner_offset = next_offset;
3426 } else {
3427 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3428 inner_depth.increment()?;
3429 }
3430 let val_ref = self.name.get_or_insert_with(|| {
3431 fidl::new_empty!(
3432 fidl::encoding::BoundedString<4096>,
3433 fidl::encoding::DefaultFuchsiaResourceDialect
3434 )
3435 });
3436 fidl::decode!(
3437 fidl::encoding::BoundedString<4096>,
3438 fidl::encoding::DefaultFuchsiaResourceDialect,
3439 val_ref,
3440 decoder,
3441 inner_offset,
3442 inner_depth
3443 )?;
3444 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3445 {
3446 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3447 }
3448 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3449 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3450 }
3451 }
3452
3453 next_offset += envelope_size;
3454
3455 while next_offset < end_offset {
3457 _next_ordinal_to_read += 1;
3458 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3459 next_offset += envelope_size;
3460 }
3461
3462 Ok(())
3463 }
3464 }
3465
3466 impl InspectSinkFetchEscrowResponse {
3467 #[inline(always)]
3468 fn max_ordinal_present(&self) -> u64 {
3469 if let Some(_) = self.vmo {
3470 return 1;
3471 }
3472 0
3473 }
3474 }
3475
3476 impl fidl::encoding::ResourceTypeMarker for InspectSinkFetchEscrowResponse {
3477 type Borrowed<'a> = &'a mut Self;
3478 fn take_or_borrow<'a>(
3479 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3480 ) -> Self::Borrowed<'a> {
3481 value
3482 }
3483 }
3484
3485 unsafe impl fidl::encoding::TypeMarker for InspectSinkFetchEscrowResponse {
3486 type Owned = Self;
3487
3488 #[inline(always)]
3489 fn inline_align(_context: fidl::encoding::Context) -> usize {
3490 8
3491 }
3492
3493 #[inline(always)]
3494 fn inline_size(_context: fidl::encoding::Context) -> usize {
3495 16
3496 }
3497 }
3498
3499 unsafe impl
3500 fidl::encoding::Encode<
3501 InspectSinkFetchEscrowResponse,
3502 fidl::encoding::DefaultFuchsiaResourceDialect,
3503 > for &mut InspectSinkFetchEscrowResponse
3504 {
3505 unsafe fn encode(
3506 self,
3507 encoder: &mut fidl::encoding::Encoder<
3508 '_,
3509 fidl::encoding::DefaultFuchsiaResourceDialect,
3510 >,
3511 offset: usize,
3512 mut depth: fidl::encoding::Depth,
3513 ) -> fidl::Result<()> {
3514 encoder.debug_check_bounds::<InspectSinkFetchEscrowResponse>(offset);
3515 let max_ordinal: u64 = self.max_ordinal_present();
3517 encoder.write_num(max_ordinal, offset);
3518 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3519 if max_ordinal == 0 {
3521 return Ok(());
3522 }
3523 depth.increment()?;
3524 let envelope_size = 8;
3525 let bytes_len = max_ordinal as usize * envelope_size;
3526 #[allow(unused_variables)]
3527 let offset = encoder.out_of_line_offset(bytes_len);
3528 let mut _prev_end_offset: usize = 0;
3529 if 1 > max_ordinal {
3530 return Ok(());
3531 }
3532
3533 let cur_offset: usize = (1 - 1) * envelope_size;
3536
3537 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3539
3540 fidl::encoding::encode_in_envelope_optional::<
3545 fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 133>,
3546 fidl::encoding::DefaultFuchsiaResourceDialect,
3547 >(
3548 self.vmo.as_mut().map(
3549 <fidl::encoding::HandleType<
3550 fidl::Vmo,
3551 { fidl::ObjectType::VMO.into_raw() },
3552 133,
3553 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
3554 ),
3555 encoder,
3556 offset + cur_offset,
3557 depth,
3558 )?;
3559
3560 _prev_end_offset = cur_offset + envelope_size;
3561
3562 Ok(())
3563 }
3564 }
3565
3566 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3567 for InspectSinkFetchEscrowResponse
3568 {
3569 #[inline(always)]
3570 fn new_empty() -> Self {
3571 Self::default()
3572 }
3573
3574 unsafe fn decode(
3575 &mut self,
3576 decoder: &mut fidl::encoding::Decoder<
3577 '_,
3578 fidl::encoding::DefaultFuchsiaResourceDialect,
3579 >,
3580 offset: usize,
3581 mut depth: fidl::encoding::Depth,
3582 ) -> fidl::Result<()> {
3583 decoder.debug_check_bounds::<Self>(offset);
3584 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3585 None => return Err(fidl::Error::NotNullable),
3586 Some(len) => len,
3587 };
3588 if len == 0 {
3590 return Ok(());
3591 };
3592 depth.increment()?;
3593 let envelope_size = 8;
3594 let bytes_len = len * envelope_size;
3595 let offset = decoder.out_of_line_offset(bytes_len)?;
3596 let mut _next_ordinal_to_read = 0;
3598 let mut next_offset = offset;
3599 let end_offset = offset + bytes_len;
3600 _next_ordinal_to_read += 1;
3601 if next_offset >= end_offset {
3602 return Ok(());
3603 }
3604
3605 while _next_ordinal_to_read < 1 {
3607 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3608 _next_ordinal_to_read += 1;
3609 next_offset += envelope_size;
3610 }
3611
3612 let next_out_of_line = decoder.next_out_of_line();
3613 let handles_before = decoder.remaining_handles();
3614 if let Some((inlined, num_bytes, num_handles)) =
3615 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3616 {
3617 let member_inline_size = <fidl::encoding::HandleType<
3618 fidl::Vmo,
3619 { fidl::ObjectType::VMO.into_raw() },
3620 133,
3621 > as fidl::encoding::TypeMarker>::inline_size(
3622 decoder.context
3623 );
3624 if inlined != (member_inline_size <= 4) {
3625 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3626 }
3627 let inner_offset;
3628 let mut inner_depth = depth.clone();
3629 if inlined {
3630 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3631 inner_offset = next_offset;
3632 } else {
3633 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3634 inner_depth.increment()?;
3635 }
3636 let val_ref =
3637 self.vmo.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 133>, fidl::encoding::DefaultFuchsiaResourceDialect));
3638 fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 133>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
3639 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3640 {
3641 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3642 }
3643 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3644 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3645 }
3646 }
3647
3648 next_offset += envelope_size;
3649
3650 while next_offset < end_offset {
3652 _next_ordinal_to_read += 1;
3653 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3654 next_offset += envelope_size;
3655 }
3656
3657 Ok(())
3658 }
3659 }
3660
3661 impl TreeContent {
3662 #[inline(always)]
3663 fn max_ordinal_present(&self) -> u64 {
3664 if let Some(_) = self.buffer {
3665 return 1;
3666 }
3667 0
3668 }
3669 }
3670
3671 impl fidl::encoding::ResourceTypeMarker for TreeContent {
3672 type Borrowed<'a> = &'a mut Self;
3673 fn take_or_borrow<'a>(
3674 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3675 ) -> Self::Borrowed<'a> {
3676 value
3677 }
3678 }
3679
3680 unsafe impl fidl::encoding::TypeMarker for TreeContent {
3681 type Owned = Self;
3682
3683 #[inline(always)]
3684 fn inline_align(_context: fidl::encoding::Context) -> usize {
3685 8
3686 }
3687
3688 #[inline(always)]
3689 fn inline_size(_context: fidl::encoding::Context) -> usize {
3690 16
3691 }
3692 }
3693
3694 unsafe impl fidl::encoding::Encode<TreeContent, fidl::encoding::DefaultFuchsiaResourceDialect>
3695 for &mut TreeContent
3696 {
3697 unsafe fn encode(
3698 self,
3699 encoder: &mut fidl::encoding::Encoder<
3700 '_,
3701 fidl::encoding::DefaultFuchsiaResourceDialect,
3702 >,
3703 offset: usize,
3704 mut depth: fidl::encoding::Depth,
3705 ) -> fidl::Result<()> {
3706 encoder.debug_check_bounds::<TreeContent>(offset);
3707 let max_ordinal: u64 = self.max_ordinal_present();
3709 encoder.write_num(max_ordinal, offset);
3710 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3711 if max_ordinal == 0 {
3713 return Ok(());
3714 }
3715 depth.increment()?;
3716 let envelope_size = 8;
3717 let bytes_len = max_ordinal as usize * envelope_size;
3718 #[allow(unused_variables)]
3719 let offset = encoder.out_of_line_offset(bytes_len);
3720 let mut _prev_end_offset: usize = 0;
3721 if 1 > max_ordinal {
3722 return Ok(());
3723 }
3724
3725 let cur_offset: usize = (1 - 1) * envelope_size;
3728
3729 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3731
3732 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_mem::Buffer, fidl::encoding::DefaultFuchsiaResourceDialect>(
3737 self.buffer.as_mut().map(<fidl_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
3738 encoder, offset + cur_offset, depth
3739 )?;
3740
3741 _prev_end_offset = cur_offset + envelope_size;
3742
3743 Ok(())
3744 }
3745 }
3746
3747 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for TreeContent {
3748 #[inline(always)]
3749 fn new_empty() -> Self {
3750 Self::default()
3751 }
3752
3753 unsafe fn decode(
3754 &mut self,
3755 decoder: &mut fidl::encoding::Decoder<
3756 '_,
3757 fidl::encoding::DefaultFuchsiaResourceDialect,
3758 >,
3759 offset: usize,
3760 mut depth: fidl::encoding::Depth,
3761 ) -> fidl::Result<()> {
3762 decoder.debug_check_bounds::<Self>(offset);
3763 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3764 None => return Err(fidl::Error::NotNullable),
3765 Some(len) => len,
3766 };
3767 if len == 0 {
3769 return Ok(());
3770 };
3771 depth.increment()?;
3772 let envelope_size = 8;
3773 let bytes_len = len * envelope_size;
3774 let offset = decoder.out_of_line_offset(bytes_len)?;
3775 let mut _next_ordinal_to_read = 0;
3777 let mut next_offset = offset;
3778 let end_offset = offset + bytes_len;
3779 _next_ordinal_to_read += 1;
3780 if next_offset >= end_offset {
3781 return Ok(());
3782 }
3783
3784 while _next_ordinal_to_read < 1 {
3786 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3787 _next_ordinal_to_read += 1;
3788 next_offset += envelope_size;
3789 }
3790
3791 let next_out_of_line = decoder.next_out_of_line();
3792 let handles_before = decoder.remaining_handles();
3793 if let Some((inlined, num_bytes, num_handles)) =
3794 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3795 {
3796 let member_inline_size =
3797 <fidl_fuchsia_mem::Buffer as fidl::encoding::TypeMarker>::inline_size(
3798 decoder.context,
3799 );
3800 if inlined != (member_inline_size <= 4) {
3801 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3802 }
3803 let inner_offset;
3804 let mut inner_depth = depth.clone();
3805 if inlined {
3806 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3807 inner_offset = next_offset;
3808 } else {
3809 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3810 inner_depth.increment()?;
3811 }
3812 let val_ref = self.buffer.get_or_insert_with(|| {
3813 fidl::new_empty!(
3814 fidl_fuchsia_mem::Buffer,
3815 fidl::encoding::DefaultFuchsiaResourceDialect
3816 )
3817 });
3818 fidl::decode!(
3819 fidl_fuchsia_mem::Buffer,
3820 fidl::encoding::DefaultFuchsiaResourceDialect,
3821 val_ref,
3822 decoder,
3823 inner_offset,
3824 inner_depth
3825 )?;
3826 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3827 {
3828 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3829 }
3830 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3831 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3832 }
3833 }
3834
3835 next_offset += envelope_size;
3836
3837 while next_offset < end_offset {
3839 _next_ordinal_to_read += 1;
3840 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3841 next_offset += envelope_size;
3842 }
3843
3844 Ok(())
3845 }
3846 }
3847}