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_memory_attribution_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Default, PartialEq)]
16pub struct NewPrincipal {
17 pub identifier: Option<u64>,
19 pub description: Option<Description>,
25 pub principal_type: Option<PrincipalType>,
27 pub detailed_attribution: Option<fidl::endpoints::ClientEnd<ProviderMarker>>,
30 #[doc(hidden)]
31 pub __source_breaking: fidl::marker::SourceBreaking,
32}
33
34impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for NewPrincipal {}
35
36#[derive(Debug, Default, PartialEq)]
37pub struct ProviderGetResponse {
38 pub attributions: Option<Vec<AttributionUpdate>>,
39 #[doc(hidden)]
40 pub __source_breaking: fidl::marker::SourceBreaking,
41}
42
43impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ProviderGetResponse {}
44
45#[derive(Debug, Default, PartialEq)]
51pub struct UpdatedPrincipal {
52 pub identifier: Option<u64>,
54 pub resources: Option<Resources>,
59 #[doc(hidden)]
60 pub __source_breaking: fidl::marker::SourceBreaking,
61}
62
63impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for UpdatedPrincipal {}
64
65#[derive(Debug)]
67pub enum AttributionUpdate {
68 Add(NewPrincipal),
74 Update(UpdatedPrincipal),
80 Remove(u64),
87 #[doc(hidden)]
88 __SourceBreaking { unknown_ordinal: u64 },
89}
90
91#[macro_export]
93macro_rules! AttributionUpdateUnknown {
94 () => {
95 _
96 };
97}
98
99impl PartialEq for AttributionUpdate {
101 fn eq(&self, other: &Self) -> bool {
102 match (self, other) {
103 (Self::Add(x), Self::Add(y)) => *x == *y,
104 (Self::Update(x), Self::Update(y)) => *x == *y,
105 (Self::Remove(x), Self::Remove(y)) => *x == *y,
106 _ => false,
107 }
108 }
109}
110
111impl AttributionUpdate {
112 #[inline]
113 pub fn ordinal(&self) -> u64 {
114 match *self {
115 Self::Add(_) => 1,
116 Self::Update(_) => 2,
117 Self::Remove(_) => 3,
118 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
119 }
120 }
121
122 #[inline]
123 pub fn unknown_variant_for_testing() -> Self {
124 Self::__SourceBreaking { unknown_ordinal: 0 }
125 }
126
127 #[inline]
128 pub fn is_unknown(&self) -> bool {
129 match self {
130 Self::__SourceBreaking { .. } => true,
131 _ => false,
132 }
133 }
134}
135
136impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for AttributionUpdate {}
137
138#[derive(Debug)]
139pub enum Description {
140 Component(fidl::Event),
145 Part(String),
152 #[doc(hidden)]
153 __SourceBreaking { unknown_ordinal: u64 },
154}
155
156#[macro_export]
158macro_rules! DescriptionUnknown {
159 () => {
160 _
161 };
162}
163
164impl PartialEq for Description {
166 fn eq(&self, other: &Self) -> bool {
167 match (self, other) {
168 (Self::Component(x), Self::Component(y)) => *x == *y,
169 (Self::Part(x), Self::Part(y)) => *x == *y,
170 _ => false,
171 }
172 }
173}
174
175impl Description {
176 #[inline]
177 pub fn ordinal(&self) -> u64 {
178 match *self {
179 Self::Component(_) => 1,
180 Self::Part(_) => 2,
181 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
182 }
183 }
184
185 #[inline]
186 pub fn unknown_variant_for_testing() -> Self {
187 Self::__SourceBreaking { unknown_ordinal: 0 }
188 }
189
190 #[inline]
191 pub fn is_unknown(&self) -> bool {
192 match self {
193 Self::__SourceBreaking { .. } => true,
194 _ => false,
195 }
196 }
197}
198
199impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for Description {}
200
201#[derive(Debug)]
202pub enum Resources {
203 Data(Data),
204 Buffer(fidl::Vmo),
206 #[doc(hidden)]
207 __SourceBreaking {
208 unknown_ordinal: u64,
209 },
210}
211
212#[macro_export]
214macro_rules! ResourcesUnknown {
215 () => {
216 _
217 };
218}
219
220impl PartialEq for Resources {
222 fn eq(&self, other: &Self) -> bool {
223 match (self, other) {
224 (Self::Data(x), Self::Data(y)) => *x == *y,
225 (Self::Buffer(x), Self::Buffer(y)) => *x == *y,
226 _ => false,
227 }
228 }
229}
230
231impl Resources {
232 #[inline]
233 pub fn ordinal(&self) -> u64 {
234 match *self {
235 Self::Data(_) => 1,
236 Self::Buffer(_) => 2,
237 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
238 }
239 }
240
241 #[inline]
242 pub fn unknown_variant_for_testing() -> Self {
243 Self::__SourceBreaking { unknown_ordinal: 0 }
244 }
245
246 #[inline]
247 pub fn is_unknown(&self) -> bool {
248 match self {
249 Self::__SourceBreaking { .. } => true,
250 _ => false,
251 }
252 }
253}
254
255impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for Resources {}
256
257#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
258pub struct ProviderMarker;
259
260impl fidl::endpoints::ProtocolMarker for ProviderMarker {
261 type Proxy = ProviderProxy;
262 type RequestStream = ProviderRequestStream;
263 #[cfg(target_os = "fuchsia")]
264 type SynchronousProxy = ProviderSynchronousProxy;
265
266 const DEBUG_NAME: &'static str = "fuchsia.memory.attribution.Provider";
267}
268impl fidl::endpoints::DiscoverableProtocolMarker for ProviderMarker {}
269pub type ProviderGetResult = Result<ProviderGetResponse, Error>;
270
271pub trait ProviderProxyInterface: Send + Sync {
272 type GetResponseFut: std::future::Future<Output = Result<ProviderGetResult, fidl::Error>> + Send;
273 fn r#get(&self) -> Self::GetResponseFut;
274}
275#[derive(Debug)]
276#[cfg(target_os = "fuchsia")]
277pub struct ProviderSynchronousProxy {
278 client: fidl::client::sync::Client,
279}
280
281#[cfg(target_os = "fuchsia")]
282impl fidl::endpoints::SynchronousProxy for ProviderSynchronousProxy {
283 type Proxy = ProviderProxy;
284 type Protocol = ProviderMarker;
285
286 fn from_channel(inner: fidl::Channel) -> Self {
287 Self::new(inner)
288 }
289
290 fn into_channel(self) -> fidl::Channel {
291 self.client.into_channel()
292 }
293
294 fn as_channel(&self) -> &fidl::Channel {
295 self.client.as_channel()
296 }
297}
298
299#[cfg(target_os = "fuchsia")]
300impl ProviderSynchronousProxy {
301 pub fn new(channel: fidl::Channel) -> Self {
302 let protocol_name = <ProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
303 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
304 }
305
306 pub fn into_channel(self) -> fidl::Channel {
307 self.client.into_channel()
308 }
309
310 pub fn wait_for_event(
313 &self,
314 deadline: zx::MonotonicInstant,
315 ) -> Result<ProviderEvent, fidl::Error> {
316 ProviderEvent::decode(self.client.wait_for_event(deadline)?)
317 }
318
319 pub fn r#get(
333 &self,
334 ___deadline: zx::MonotonicInstant,
335 ) -> Result<ProviderGetResult, fidl::Error> {
336 let _response = self.client.send_query::<
337 fidl::encoding::EmptyPayload,
338 fidl::encoding::FlexibleResultType<ProviderGetResponse, Error>,
339 >(
340 (),
341 0x7a2f2d2cdcfcc945,
342 fidl::encoding::DynamicFlags::FLEXIBLE,
343 ___deadline,
344 )?
345 .into_result::<ProviderMarker>("get")?;
346 Ok(_response.map(|x| x))
347 }
348}
349
350#[cfg(target_os = "fuchsia")]
351impl From<ProviderSynchronousProxy> for zx::Handle {
352 fn from(value: ProviderSynchronousProxy) -> Self {
353 value.into_channel().into()
354 }
355}
356
357#[cfg(target_os = "fuchsia")]
358impl From<fidl::Channel> for ProviderSynchronousProxy {
359 fn from(value: fidl::Channel) -> Self {
360 Self::new(value)
361 }
362}
363
364#[derive(Debug, Clone)]
365pub struct ProviderProxy {
366 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
367}
368
369impl fidl::endpoints::Proxy for ProviderProxy {
370 type Protocol = ProviderMarker;
371
372 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
373 Self::new(inner)
374 }
375
376 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
377 self.client.into_channel().map_err(|client| Self { client })
378 }
379
380 fn as_channel(&self) -> &::fidl::AsyncChannel {
381 self.client.as_channel()
382 }
383}
384
385impl ProviderProxy {
386 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
388 let protocol_name = <ProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
389 Self { client: fidl::client::Client::new(channel, protocol_name) }
390 }
391
392 pub fn take_event_stream(&self) -> ProviderEventStream {
398 ProviderEventStream { event_receiver: self.client.take_event_receiver() }
399 }
400
401 pub fn r#get(
415 &self,
416 ) -> fidl::client::QueryResponseFut<
417 ProviderGetResult,
418 fidl::encoding::DefaultFuchsiaResourceDialect,
419 > {
420 ProviderProxyInterface::r#get(self)
421 }
422}
423
424impl ProviderProxyInterface for ProviderProxy {
425 type GetResponseFut = fidl::client::QueryResponseFut<
426 ProviderGetResult,
427 fidl::encoding::DefaultFuchsiaResourceDialect,
428 >;
429 fn r#get(&self) -> Self::GetResponseFut {
430 fn _decode(
431 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
432 ) -> Result<ProviderGetResult, fidl::Error> {
433 let _response = fidl::client::decode_transaction_body::<
434 fidl::encoding::FlexibleResultType<ProviderGetResponse, Error>,
435 fidl::encoding::DefaultFuchsiaResourceDialect,
436 0x7a2f2d2cdcfcc945,
437 >(_buf?)?
438 .into_result::<ProviderMarker>("get")?;
439 Ok(_response.map(|x| x))
440 }
441 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ProviderGetResult>(
442 (),
443 0x7a2f2d2cdcfcc945,
444 fidl::encoding::DynamicFlags::FLEXIBLE,
445 _decode,
446 )
447 }
448}
449
450pub struct ProviderEventStream {
451 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
452}
453
454impl std::marker::Unpin for ProviderEventStream {}
455
456impl futures::stream::FusedStream for ProviderEventStream {
457 fn is_terminated(&self) -> bool {
458 self.event_receiver.is_terminated()
459 }
460}
461
462impl futures::Stream for ProviderEventStream {
463 type Item = Result<ProviderEvent, fidl::Error>;
464
465 fn poll_next(
466 mut self: std::pin::Pin<&mut Self>,
467 cx: &mut std::task::Context<'_>,
468 ) -> std::task::Poll<Option<Self::Item>> {
469 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
470 &mut self.event_receiver,
471 cx
472 )?) {
473 Some(buf) => std::task::Poll::Ready(Some(ProviderEvent::decode(buf))),
474 None => std::task::Poll::Ready(None),
475 }
476 }
477}
478
479#[derive(Debug)]
480pub enum ProviderEvent {
481 #[non_exhaustive]
482 _UnknownEvent {
483 ordinal: u64,
485 },
486}
487
488impl ProviderEvent {
489 fn decode(
491 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
492 ) -> Result<ProviderEvent, fidl::Error> {
493 let (bytes, _handles) = buf.split_mut();
494 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
495 debug_assert_eq!(tx_header.tx_id, 0);
496 match tx_header.ordinal {
497 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
498 Ok(ProviderEvent::_UnknownEvent { ordinal: tx_header.ordinal })
499 }
500 _ => Err(fidl::Error::UnknownOrdinal {
501 ordinal: tx_header.ordinal,
502 protocol_name: <ProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
503 }),
504 }
505 }
506}
507
508pub struct ProviderRequestStream {
510 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
511 is_terminated: bool,
512}
513
514impl std::marker::Unpin for ProviderRequestStream {}
515
516impl futures::stream::FusedStream for ProviderRequestStream {
517 fn is_terminated(&self) -> bool {
518 self.is_terminated
519 }
520}
521
522impl fidl::endpoints::RequestStream for ProviderRequestStream {
523 type Protocol = ProviderMarker;
524 type ControlHandle = ProviderControlHandle;
525
526 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
527 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
528 }
529
530 fn control_handle(&self) -> Self::ControlHandle {
531 ProviderControlHandle { inner: self.inner.clone() }
532 }
533
534 fn into_inner(
535 self,
536 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
537 {
538 (self.inner, self.is_terminated)
539 }
540
541 fn from_inner(
542 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
543 is_terminated: bool,
544 ) -> Self {
545 Self { inner, is_terminated }
546 }
547}
548
549impl futures::Stream for ProviderRequestStream {
550 type Item = Result<ProviderRequest, fidl::Error>;
551
552 fn poll_next(
553 mut self: std::pin::Pin<&mut Self>,
554 cx: &mut std::task::Context<'_>,
555 ) -> std::task::Poll<Option<Self::Item>> {
556 let this = &mut *self;
557 if this.inner.check_shutdown(cx) {
558 this.is_terminated = true;
559 return std::task::Poll::Ready(None);
560 }
561 if this.is_terminated {
562 panic!("polled ProviderRequestStream after completion");
563 }
564 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
565 |bytes, handles| {
566 match this.inner.channel().read_etc(cx, bytes, handles) {
567 std::task::Poll::Ready(Ok(())) => {}
568 std::task::Poll::Pending => return std::task::Poll::Pending,
569 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
570 this.is_terminated = true;
571 return std::task::Poll::Ready(None);
572 }
573 std::task::Poll::Ready(Err(e)) => {
574 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
575 e.into(),
576 ))))
577 }
578 }
579
580 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
582
583 std::task::Poll::Ready(Some(match header.ordinal {
584 0x7a2f2d2cdcfcc945 => {
585 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
586 let mut req = fidl::new_empty!(
587 fidl::encoding::EmptyPayload,
588 fidl::encoding::DefaultFuchsiaResourceDialect
589 );
590 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
591 let control_handle = ProviderControlHandle { inner: this.inner.clone() };
592 Ok(ProviderRequest::Get {
593 responder: ProviderGetResponder {
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(ProviderRequest::_UnknownMethod {
605 ordinal: header.ordinal,
606 control_handle: ProviderControlHandle { 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(ProviderRequest::_UnknownMethod {
622 ordinal: header.ordinal,
623 control_handle: ProviderControlHandle { 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 <ProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
631 }),
632 }))
633 },
634 )
635 }
636}
637
638#[derive(Debug)]
654pub enum ProviderRequest {
655 Get { responder: ProviderGetResponder },
669 #[non_exhaustive]
671 _UnknownMethod {
672 ordinal: u64,
674 control_handle: ProviderControlHandle,
675 method_type: fidl::MethodType,
676 },
677}
678
679impl ProviderRequest {
680 #[allow(irrefutable_let_patterns)]
681 pub fn into_get(self) -> Option<(ProviderGetResponder)> {
682 if let ProviderRequest::Get { responder } = self {
683 Some((responder))
684 } else {
685 None
686 }
687 }
688
689 pub fn method_name(&self) -> &'static str {
691 match *self {
692 ProviderRequest::Get { .. } => "get",
693 ProviderRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
694 "unknown one-way method"
695 }
696 ProviderRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
697 "unknown two-way method"
698 }
699 }
700 }
701}
702
703#[derive(Debug, Clone)]
704pub struct ProviderControlHandle {
705 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
706}
707
708impl fidl::endpoints::ControlHandle for ProviderControlHandle {
709 fn shutdown(&self) {
710 self.inner.shutdown()
711 }
712 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
713 self.inner.shutdown_with_epitaph(status)
714 }
715
716 fn is_closed(&self) -> bool {
717 self.inner.channel().is_closed()
718 }
719 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
720 self.inner.channel().on_closed()
721 }
722
723 #[cfg(target_os = "fuchsia")]
724 fn signal_peer(
725 &self,
726 clear_mask: zx::Signals,
727 set_mask: zx::Signals,
728 ) -> Result<(), zx_status::Status> {
729 use fidl::Peered;
730 self.inner.channel().signal_peer(clear_mask, set_mask)
731 }
732}
733
734impl ProviderControlHandle {}
735
736#[must_use = "FIDL methods require a response to be sent"]
737#[derive(Debug)]
738pub struct ProviderGetResponder {
739 control_handle: std::mem::ManuallyDrop<ProviderControlHandle>,
740 tx_id: u32,
741}
742
743impl std::ops::Drop for ProviderGetResponder {
747 fn drop(&mut self) {
748 self.control_handle.shutdown();
749 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
751 }
752}
753
754impl fidl::endpoints::Responder for ProviderGetResponder {
755 type ControlHandle = ProviderControlHandle;
756
757 fn control_handle(&self) -> &ProviderControlHandle {
758 &self.control_handle
759 }
760
761 fn drop_without_shutdown(mut self) {
762 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
764 std::mem::forget(self);
766 }
767}
768
769impl ProviderGetResponder {
770 pub fn send(self, mut result: Result<ProviderGetResponse, Error>) -> Result<(), fidl::Error> {
774 let _result = self.send_raw(result);
775 if _result.is_err() {
776 self.control_handle.shutdown();
777 }
778 self.drop_without_shutdown();
779 _result
780 }
781
782 pub fn send_no_shutdown_on_err(
784 self,
785 mut result: Result<ProviderGetResponse, Error>,
786 ) -> Result<(), fidl::Error> {
787 let _result = self.send_raw(result);
788 self.drop_without_shutdown();
789 _result
790 }
791
792 fn send_raw(&self, mut result: Result<ProviderGetResponse, Error>) -> Result<(), fidl::Error> {
793 self.control_handle
794 .inner
795 .send::<fidl::encoding::FlexibleResultType<ProviderGetResponse, Error>>(
796 fidl::encoding::FlexibleResult::new(result.as_mut().map_err(|e| *e)),
797 self.tx_id,
798 0x7a2f2d2cdcfcc945,
799 fidl::encoding::DynamicFlags::FLEXIBLE,
800 )
801 }
802}
803
804mod internal {
805 use super::*;
806
807 impl NewPrincipal {
808 #[inline(always)]
809 fn max_ordinal_present(&self) -> u64 {
810 if let Some(_) = self.detailed_attribution {
811 return 4;
812 }
813 if let Some(_) = self.principal_type {
814 return 3;
815 }
816 if let Some(_) = self.description {
817 return 2;
818 }
819 if let Some(_) = self.identifier {
820 return 1;
821 }
822 0
823 }
824 }
825
826 impl fidl::encoding::ResourceTypeMarker for NewPrincipal {
827 type Borrowed<'a> = &'a mut Self;
828 fn take_or_borrow<'a>(
829 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
830 ) -> Self::Borrowed<'a> {
831 value
832 }
833 }
834
835 unsafe impl fidl::encoding::TypeMarker for NewPrincipal {
836 type Owned = Self;
837
838 #[inline(always)]
839 fn inline_align(_context: fidl::encoding::Context) -> usize {
840 8
841 }
842
843 #[inline(always)]
844 fn inline_size(_context: fidl::encoding::Context) -> usize {
845 16
846 }
847 }
848
849 unsafe impl fidl::encoding::Encode<NewPrincipal, fidl::encoding::DefaultFuchsiaResourceDialect>
850 for &mut NewPrincipal
851 {
852 unsafe fn encode(
853 self,
854 encoder: &mut fidl::encoding::Encoder<
855 '_,
856 fidl::encoding::DefaultFuchsiaResourceDialect,
857 >,
858 offset: usize,
859 mut depth: fidl::encoding::Depth,
860 ) -> fidl::Result<()> {
861 encoder.debug_check_bounds::<NewPrincipal>(offset);
862 let max_ordinal: u64 = self.max_ordinal_present();
864 encoder.write_num(max_ordinal, offset);
865 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
866 if max_ordinal == 0 {
868 return Ok(());
869 }
870 depth.increment()?;
871 let envelope_size = 8;
872 let bytes_len = max_ordinal as usize * envelope_size;
873 #[allow(unused_variables)]
874 let offset = encoder.out_of_line_offset(bytes_len);
875 let mut _prev_end_offset: usize = 0;
876 if 1 > max_ordinal {
877 return Ok(());
878 }
879
880 let cur_offset: usize = (1 - 1) * envelope_size;
883
884 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
886
887 fidl::encoding::encode_in_envelope_optional::<
892 u64,
893 fidl::encoding::DefaultFuchsiaResourceDialect,
894 >(
895 self.identifier.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
896 encoder,
897 offset + cur_offset,
898 depth,
899 )?;
900
901 _prev_end_offset = cur_offset + envelope_size;
902 if 2 > max_ordinal {
903 return Ok(());
904 }
905
906 let cur_offset: usize = (2 - 1) * envelope_size;
909
910 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
912
913 fidl::encoding::encode_in_envelope_optional::<
918 Description,
919 fidl::encoding::DefaultFuchsiaResourceDialect,
920 >(
921 self.description
922 .as_mut()
923 .map(<Description as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
924 encoder,
925 offset + cur_offset,
926 depth,
927 )?;
928
929 _prev_end_offset = cur_offset + envelope_size;
930 if 3 > max_ordinal {
931 return Ok(());
932 }
933
934 let cur_offset: usize = (3 - 1) * envelope_size;
937
938 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
940
941 fidl::encoding::encode_in_envelope_optional::<
946 PrincipalType,
947 fidl::encoding::DefaultFuchsiaResourceDialect,
948 >(
949 self.principal_type
950 .as_ref()
951 .map(<PrincipalType as fidl::encoding::ValueTypeMarker>::borrow),
952 encoder,
953 offset + cur_offset,
954 depth,
955 )?;
956
957 _prev_end_offset = cur_offset + envelope_size;
958 if 4 > max_ordinal {
959 return Ok(());
960 }
961
962 let cur_offset: usize = (4 - 1) * envelope_size;
965
966 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
968
969 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ProviderMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
974 self.detailed_attribution.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ProviderMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
975 encoder, offset + cur_offset, depth
976 )?;
977
978 _prev_end_offset = cur_offset + envelope_size;
979
980 Ok(())
981 }
982 }
983
984 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for NewPrincipal {
985 #[inline(always)]
986 fn new_empty() -> Self {
987 Self::default()
988 }
989
990 unsafe fn decode(
991 &mut self,
992 decoder: &mut fidl::encoding::Decoder<
993 '_,
994 fidl::encoding::DefaultFuchsiaResourceDialect,
995 >,
996 offset: usize,
997 mut depth: fidl::encoding::Depth,
998 ) -> fidl::Result<()> {
999 decoder.debug_check_bounds::<Self>(offset);
1000 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1001 None => return Err(fidl::Error::NotNullable),
1002 Some(len) => len,
1003 };
1004 if len == 0 {
1006 return Ok(());
1007 };
1008 depth.increment()?;
1009 let envelope_size = 8;
1010 let bytes_len = len * envelope_size;
1011 let offset = decoder.out_of_line_offset(bytes_len)?;
1012 let mut _next_ordinal_to_read = 0;
1014 let mut next_offset = offset;
1015 let end_offset = offset + bytes_len;
1016 _next_ordinal_to_read += 1;
1017 if next_offset >= end_offset {
1018 return Ok(());
1019 }
1020
1021 while _next_ordinal_to_read < 1 {
1023 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1024 _next_ordinal_to_read += 1;
1025 next_offset += envelope_size;
1026 }
1027
1028 let next_out_of_line = decoder.next_out_of_line();
1029 let handles_before = decoder.remaining_handles();
1030 if let Some((inlined, num_bytes, num_handles)) =
1031 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1032 {
1033 let member_inline_size =
1034 <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1035 if inlined != (member_inline_size <= 4) {
1036 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1037 }
1038 let inner_offset;
1039 let mut inner_depth = depth.clone();
1040 if inlined {
1041 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1042 inner_offset = next_offset;
1043 } else {
1044 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1045 inner_depth.increment()?;
1046 }
1047 let val_ref = self.identifier.get_or_insert_with(|| {
1048 fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
1049 });
1050 fidl::decode!(
1051 u64,
1052 fidl::encoding::DefaultFuchsiaResourceDialect,
1053 val_ref,
1054 decoder,
1055 inner_offset,
1056 inner_depth
1057 )?;
1058 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1059 {
1060 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1061 }
1062 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1063 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1064 }
1065 }
1066
1067 next_offset += envelope_size;
1068 _next_ordinal_to_read += 1;
1069 if next_offset >= end_offset {
1070 return Ok(());
1071 }
1072
1073 while _next_ordinal_to_read < 2 {
1075 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1076 _next_ordinal_to_read += 1;
1077 next_offset += envelope_size;
1078 }
1079
1080 let next_out_of_line = decoder.next_out_of_line();
1081 let handles_before = decoder.remaining_handles();
1082 if let Some((inlined, num_bytes, num_handles)) =
1083 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1084 {
1085 let member_inline_size =
1086 <Description as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1087 if inlined != (member_inline_size <= 4) {
1088 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1089 }
1090 let inner_offset;
1091 let mut inner_depth = depth.clone();
1092 if inlined {
1093 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1094 inner_offset = next_offset;
1095 } else {
1096 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1097 inner_depth.increment()?;
1098 }
1099 let val_ref = self.description.get_or_insert_with(|| {
1100 fidl::new_empty!(Description, fidl::encoding::DefaultFuchsiaResourceDialect)
1101 });
1102 fidl::decode!(
1103 Description,
1104 fidl::encoding::DefaultFuchsiaResourceDialect,
1105 val_ref,
1106 decoder,
1107 inner_offset,
1108 inner_depth
1109 )?;
1110 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1111 {
1112 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1113 }
1114 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1115 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1116 }
1117 }
1118
1119 next_offset += envelope_size;
1120 _next_ordinal_to_read += 1;
1121 if next_offset >= end_offset {
1122 return Ok(());
1123 }
1124
1125 while _next_ordinal_to_read < 3 {
1127 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1128 _next_ordinal_to_read += 1;
1129 next_offset += envelope_size;
1130 }
1131
1132 let next_out_of_line = decoder.next_out_of_line();
1133 let handles_before = decoder.remaining_handles();
1134 if let Some((inlined, num_bytes, num_handles)) =
1135 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1136 {
1137 let member_inline_size =
1138 <PrincipalType as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1139 if inlined != (member_inline_size <= 4) {
1140 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1141 }
1142 let inner_offset;
1143 let mut inner_depth = depth.clone();
1144 if inlined {
1145 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1146 inner_offset = next_offset;
1147 } else {
1148 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1149 inner_depth.increment()?;
1150 }
1151 let val_ref = self.principal_type.get_or_insert_with(|| {
1152 fidl::new_empty!(PrincipalType, fidl::encoding::DefaultFuchsiaResourceDialect)
1153 });
1154 fidl::decode!(
1155 PrincipalType,
1156 fidl::encoding::DefaultFuchsiaResourceDialect,
1157 val_ref,
1158 decoder,
1159 inner_offset,
1160 inner_depth
1161 )?;
1162 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1163 {
1164 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1165 }
1166 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1167 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1168 }
1169 }
1170
1171 next_offset += envelope_size;
1172 _next_ordinal_to_read += 1;
1173 if next_offset >= end_offset {
1174 return Ok(());
1175 }
1176
1177 while _next_ordinal_to_read < 4 {
1179 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1180 _next_ordinal_to_read += 1;
1181 next_offset += envelope_size;
1182 }
1183
1184 let next_out_of_line = decoder.next_out_of_line();
1185 let handles_before = decoder.remaining_handles();
1186 if let Some((inlined, num_bytes, num_handles)) =
1187 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1188 {
1189 let member_inline_size = <fidl::encoding::Endpoint<
1190 fidl::endpoints::ClientEnd<ProviderMarker>,
1191 > as fidl::encoding::TypeMarker>::inline_size(
1192 decoder.context
1193 );
1194 if inlined != (member_inline_size <= 4) {
1195 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1196 }
1197 let inner_offset;
1198 let mut inner_depth = depth.clone();
1199 if inlined {
1200 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1201 inner_offset = next_offset;
1202 } else {
1203 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1204 inner_depth.increment()?;
1205 }
1206 let val_ref = self.detailed_attribution.get_or_insert_with(|| {
1207 fidl::new_empty!(
1208 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ProviderMarker>>,
1209 fidl::encoding::DefaultFuchsiaResourceDialect
1210 )
1211 });
1212 fidl::decode!(
1213 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ProviderMarker>>,
1214 fidl::encoding::DefaultFuchsiaResourceDialect,
1215 val_ref,
1216 decoder,
1217 inner_offset,
1218 inner_depth
1219 )?;
1220 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1221 {
1222 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1223 }
1224 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1225 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1226 }
1227 }
1228
1229 next_offset += envelope_size;
1230
1231 while next_offset < end_offset {
1233 _next_ordinal_to_read += 1;
1234 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1235 next_offset += envelope_size;
1236 }
1237
1238 Ok(())
1239 }
1240 }
1241
1242 impl ProviderGetResponse {
1243 #[inline(always)]
1244 fn max_ordinal_present(&self) -> u64 {
1245 if let Some(_) = self.attributions {
1246 return 1;
1247 }
1248 0
1249 }
1250 }
1251
1252 impl fidl::encoding::ResourceTypeMarker for ProviderGetResponse {
1253 type Borrowed<'a> = &'a mut Self;
1254 fn take_or_borrow<'a>(
1255 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1256 ) -> Self::Borrowed<'a> {
1257 value
1258 }
1259 }
1260
1261 unsafe impl fidl::encoding::TypeMarker for ProviderGetResponse {
1262 type Owned = Self;
1263
1264 #[inline(always)]
1265 fn inline_align(_context: fidl::encoding::Context) -> usize {
1266 8
1267 }
1268
1269 #[inline(always)]
1270 fn inline_size(_context: fidl::encoding::Context) -> usize {
1271 16
1272 }
1273 }
1274
1275 unsafe impl
1276 fidl::encoding::Encode<ProviderGetResponse, fidl::encoding::DefaultFuchsiaResourceDialect>
1277 for &mut ProviderGetResponse
1278 {
1279 unsafe fn encode(
1280 self,
1281 encoder: &mut fidl::encoding::Encoder<
1282 '_,
1283 fidl::encoding::DefaultFuchsiaResourceDialect,
1284 >,
1285 offset: usize,
1286 mut depth: fidl::encoding::Depth,
1287 ) -> fidl::Result<()> {
1288 encoder.debug_check_bounds::<ProviderGetResponse>(offset);
1289 let max_ordinal: u64 = self.max_ordinal_present();
1291 encoder.write_num(max_ordinal, offset);
1292 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1293 if max_ordinal == 0 {
1295 return Ok(());
1296 }
1297 depth.increment()?;
1298 let envelope_size = 8;
1299 let bytes_len = max_ordinal as usize * envelope_size;
1300 #[allow(unused_variables)]
1301 let offset = encoder.out_of_line_offset(bytes_len);
1302 let mut _prev_end_offset: usize = 0;
1303 if 1 > max_ordinal {
1304 return Ok(());
1305 }
1306
1307 let cur_offset: usize = (1 - 1) * envelope_size;
1310
1311 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1313
1314 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<AttributionUpdate>, fidl::encoding::DefaultFuchsiaResourceDialect>(
1319 self.attributions.as_mut().map(<fidl::encoding::UnboundedVector<AttributionUpdate> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
1320 encoder, offset + cur_offset, depth
1321 )?;
1322
1323 _prev_end_offset = cur_offset + envelope_size;
1324
1325 Ok(())
1326 }
1327 }
1328
1329 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1330 for ProviderGetResponse
1331 {
1332 #[inline(always)]
1333 fn new_empty() -> Self {
1334 Self::default()
1335 }
1336
1337 unsafe fn decode(
1338 &mut self,
1339 decoder: &mut fidl::encoding::Decoder<
1340 '_,
1341 fidl::encoding::DefaultFuchsiaResourceDialect,
1342 >,
1343 offset: usize,
1344 mut depth: fidl::encoding::Depth,
1345 ) -> fidl::Result<()> {
1346 decoder.debug_check_bounds::<Self>(offset);
1347 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1348 None => return Err(fidl::Error::NotNullable),
1349 Some(len) => len,
1350 };
1351 if len == 0 {
1353 return Ok(());
1354 };
1355 depth.increment()?;
1356 let envelope_size = 8;
1357 let bytes_len = len * envelope_size;
1358 let offset = decoder.out_of_line_offset(bytes_len)?;
1359 let mut _next_ordinal_to_read = 0;
1361 let mut next_offset = offset;
1362 let end_offset = offset + bytes_len;
1363 _next_ordinal_to_read += 1;
1364 if next_offset >= end_offset {
1365 return Ok(());
1366 }
1367
1368 while _next_ordinal_to_read < 1 {
1370 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1371 _next_ordinal_to_read += 1;
1372 next_offset += envelope_size;
1373 }
1374
1375 let next_out_of_line = decoder.next_out_of_line();
1376 let handles_before = decoder.remaining_handles();
1377 if let Some((inlined, num_bytes, num_handles)) =
1378 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1379 {
1380 let member_inline_size = <fidl::encoding::UnboundedVector<AttributionUpdate> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1381 if inlined != (member_inline_size <= 4) {
1382 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1383 }
1384 let inner_offset;
1385 let mut inner_depth = depth.clone();
1386 if inlined {
1387 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1388 inner_offset = next_offset;
1389 } else {
1390 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1391 inner_depth.increment()?;
1392 }
1393 let val_ref = self.attributions.get_or_insert_with(|| {
1394 fidl::new_empty!(
1395 fidl::encoding::UnboundedVector<AttributionUpdate>,
1396 fidl::encoding::DefaultFuchsiaResourceDialect
1397 )
1398 });
1399 fidl::decode!(
1400 fidl::encoding::UnboundedVector<AttributionUpdate>,
1401 fidl::encoding::DefaultFuchsiaResourceDialect,
1402 val_ref,
1403 decoder,
1404 inner_offset,
1405 inner_depth
1406 )?;
1407 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1408 {
1409 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1410 }
1411 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1412 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1413 }
1414 }
1415
1416 next_offset += envelope_size;
1417
1418 while next_offset < end_offset {
1420 _next_ordinal_to_read += 1;
1421 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1422 next_offset += envelope_size;
1423 }
1424
1425 Ok(())
1426 }
1427 }
1428
1429 impl UpdatedPrincipal {
1430 #[inline(always)]
1431 fn max_ordinal_present(&self) -> u64 {
1432 if let Some(_) = self.resources {
1433 return 2;
1434 }
1435 if let Some(_) = self.identifier {
1436 return 1;
1437 }
1438 0
1439 }
1440 }
1441
1442 impl fidl::encoding::ResourceTypeMarker for UpdatedPrincipal {
1443 type Borrowed<'a> = &'a mut Self;
1444 fn take_or_borrow<'a>(
1445 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1446 ) -> Self::Borrowed<'a> {
1447 value
1448 }
1449 }
1450
1451 unsafe impl fidl::encoding::TypeMarker for UpdatedPrincipal {
1452 type Owned = Self;
1453
1454 #[inline(always)]
1455 fn inline_align(_context: fidl::encoding::Context) -> usize {
1456 8
1457 }
1458
1459 #[inline(always)]
1460 fn inline_size(_context: fidl::encoding::Context) -> usize {
1461 16
1462 }
1463 }
1464
1465 unsafe impl
1466 fidl::encoding::Encode<UpdatedPrincipal, fidl::encoding::DefaultFuchsiaResourceDialect>
1467 for &mut UpdatedPrincipal
1468 {
1469 unsafe fn encode(
1470 self,
1471 encoder: &mut fidl::encoding::Encoder<
1472 '_,
1473 fidl::encoding::DefaultFuchsiaResourceDialect,
1474 >,
1475 offset: usize,
1476 mut depth: fidl::encoding::Depth,
1477 ) -> fidl::Result<()> {
1478 encoder.debug_check_bounds::<UpdatedPrincipal>(offset);
1479 let max_ordinal: u64 = self.max_ordinal_present();
1481 encoder.write_num(max_ordinal, offset);
1482 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1483 if max_ordinal == 0 {
1485 return Ok(());
1486 }
1487 depth.increment()?;
1488 let envelope_size = 8;
1489 let bytes_len = max_ordinal as usize * envelope_size;
1490 #[allow(unused_variables)]
1491 let offset = encoder.out_of_line_offset(bytes_len);
1492 let mut _prev_end_offset: usize = 0;
1493 if 1 > max_ordinal {
1494 return Ok(());
1495 }
1496
1497 let cur_offset: usize = (1 - 1) * envelope_size;
1500
1501 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1503
1504 fidl::encoding::encode_in_envelope_optional::<
1509 u64,
1510 fidl::encoding::DefaultFuchsiaResourceDialect,
1511 >(
1512 self.identifier.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
1513 encoder,
1514 offset + cur_offset,
1515 depth,
1516 )?;
1517
1518 _prev_end_offset = cur_offset + envelope_size;
1519 if 2 > max_ordinal {
1520 return Ok(());
1521 }
1522
1523 let cur_offset: usize = (2 - 1) * envelope_size;
1526
1527 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1529
1530 fidl::encoding::encode_in_envelope_optional::<
1535 Resources,
1536 fidl::encoding::DefaultFuchsiaResourceDialect,
1537 >(
1538 self.resources
1539 .as_mut()
1540 .map(<Resources as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
1541 encoder,
1542 offset + cur_offset,
1543 depth,
1544 )?;
1545
1546 _prev_end_offset = cur_offset + envelope_size;
1547
1548 Ok(())
1549 }
1550 }
1551
1552 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1553 for UpdatedPrincipal
1554 {
1555 #[inline(always)]
1556 fn new_empty() -> Self {
1557 Self::default()
1558 }
1559
1560 unsafe fn decode(
1561 &mut self,
1562 decoder: &mut fidl::encoding::Decoder<
1563 '_,
1564 fidl::encoding::DefaultFuchsiaResourceDialect,
1565 >,
1566 offset: usize,
1567 mut depth: fidl::encoding::Depth,
1568 ) -> fidl::Result<()> {
1569 decoder.debug_check_bounds::<Self>(offset);
1570 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1571 None => return Err(fidl::Error::NotNullable),
1572 Some(len) => len,
1573 };
1574 if len == 0 {
1576 return Ok(());
1577 };
1578 depth.increment()?;
1579 let envelope_size = 8;
1580 let bytes_len = len * envelope_size;
1581 let offset = decoder.out_of_line_offset(bytes_len)?;
1582 let mut _next_ordinal_to_read = 0;
1584 let mut next_offset = offset;
1585 let end_offset = offset + bytes_len;
1586 _next_ordinal_to_read += 1;
1587 if next_offset >= end_offset {
1588 return Ok(());
1589 }
1590
1591 while _next_ordinal_to_read < 1 {
1593 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1594 _next_ordinal_to_read += 1;
1595 next_offset += envelope_size;
1596 }
1597
1598 let next_out_of_line = decoder.next_out_of_line();
1599 let handles_before = decoder.remaining_handles();
1600 if let Some((inlined, num_bytes, num_handles)) =
1601 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1602 {
1603 let member_inline_size =
1604 <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1605 if inlined != (member_inline_size <= 4) {
1606 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1607 }
1608 let inner_offset;
1609 let mut inner_depth = depth.clone();
1610 if inlined {
1611 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1612 inner_offset = next_offset;
1613 } else {
1614 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1615 inner_depth.increment()?;
1616 }
1617 let val_ref = self.identifier.get_or_insert_with(|| {
1618 fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
1619 });
1620 fidl::decode!(
1621 u64,
1622 fidl::encoding::DefaultFuchsiaResourceDialect,
1623 val_ref,
1624 decoder,
1625 inner_offset,
1626 inner_depth
1627 )?;
1628 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1629 {
1630 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1631 }
1632 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1633 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1634 }
1635 }
1636
1637 next_offset += envelope_size;
1638 _next_ordinal_to_read += 1;
1639 if next_offset >= end_offset {
1640 return Ok(());
1641 }
1642
1643 while _next_ordinal_to_read < 2 {
1645 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1646 _next_ordinal_to_read += 1;
1647 next_offset += envelope_size;
1648 }
1649
1650 let next_out_of_line = decoder.next_out_of_line();
1651 let handles_before = decoder.remaining_handles();
1652 if let Some((inlined, num_bytes, num_handles)) =
1653 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1654 {
1655 let member_inline_size =
1656 <Resources as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1657 if inlined != (member_inline_size <= 4) {
1658 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1659 }
1660 let inner_offset;
1661 let mut inner_depth = depth.clone();
1662 if inlined {
1663 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1664 inner_offset = next_offset;
1665 } else {
1666 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1667 inner_depth.increment()?;
1668 }
1669 let val_ref = self.resources.get_or_insert_with(|| {
1670 fidl::new_empty!(Resources, fidl::encoding::DefaultFuchsiaResourceDialect)
1671 });
1672 fidl::decode!(
1673 Resources,
1674 fidl::encoding::DefaultFuchsiaResourceDialect,
1675 val_ref,
1676 decoder,
1677 inner_offset,
1678 inner_depth
1679 )?;
1680 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1681 {
1682 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1683 }
1684 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1685 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1686 }
1687 }
1688
1689 next_offset += envelope_size;
1690
1691 while next_offset < end_offset {
1693 _next_ordinal_to_read += 1;
1694 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1695 next_offset += envelope_size;
1696 }
1697
1698 Ok(())
1699 }
1700 }
1701
1702 impl fidl::encoding::ResourceTypeMarker for AttributionUpdate {
1703 type Borrowed<'a> = &'a mut Self;
1704 fn take_or_borrow<'a>(
1705 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1706 ) -> Self::Borrowed<'a> {
1707 value
1708 }
1709 }
1710
1711 unsafe impl fidl::encoding::TypeMarker for AttributionUpdate {
1712 type Owned = Self;
1713
1714 #[inline(always)]
1715 fn inline_align(_context: fidl::encoding::Context) -> usize {
1716 8
1717 }
1718
1719 #[inline(always)]
1720 fn inline_size(_context: fidl::encoding::Context) -> usize {
1721 16
1722 }
1723 }
1724
1725 unsafe impl
1726 fidl::encoding::Encode<AttributionUpdate, fidl::encoding::DefaultFuchsiaResourceDialect>
1727 for &mut AttributionUpdate
1728 {
1729 #[inline]
1730 unsafe fn encode(
1731 self,
1732 encoder: &mut fidl::encoding::Encoder<
1733 '_,
1734 fidl::encoding::DefaultFuchsiaResourceDialect,
1735 >,
1736 offset: usize,
1737 _depth: fidl::encoding::Depth,
1738 ) -> fidl::Result<()> {
1739 encoder.debug_check_bounds::<AttributionUpdate>(offset);
1740 encoder.write_num::<u64>(self.ordinal(), offset);
1741 match self {
1742 AttributionUpdate::Add(ref mut val) => fidl::encoding::encode_in_envelope::<
1743 NewPrincipal,
1744 fidl::encoding::DefaultFuchsiaResourceDialect,
1745 >(
1746 <NewPrincipal as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
1747 encoder,
1748 offset + 8,
1749 _depth,
1750 ),
1751 AttributionUpdate::Update(ref mut val) => fidl::encoding::encode_in_envelope::<
1752 UpdatedPrincipal,
1753 fidl::encoding::DefaultFuchsiaResourceDialect,
1754 >(
1755 <UpdatedPrincipal as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
1756 encoder,
1757 offset + 8,
1758 _depth,
1759 ),
1760 AttributionUpdate::Remove(ref val) => fidl::encoding::encode_in_envelope::<
1761 u64,
1762 fidl::encoding::DefaultFuchsiaResourceDialect,
1763 >(
1764 <u64 as fidl::encoding::ValueTypeMarker>::borrow(val),
1765 encoder,
1766 offset + 8,
1767 _depth,
1768 ),
1769 AttributionUpdate::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
1770 }
1771 }
1772 }
1773
1774 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1775 for AttributionUpdate
1776 {
1777 #[inline(always)]
1778 fn new_empty() -> Self {
1779 Self::__SourceBreaking { unknown_ordinal: 0 }
1780 }
1781
1782 #[inline]
1783 unsafe fn decode(
1784 &mut self,
1785 decoder: &mut fidl::encoding::Decoder<
1786 '_,
1787 fidl::encoding::DefaultFuchsiaResourceDialect,
1788 >,
1789 offset: usize,
1790 mut depth: fidl::encoding::Depth,
1791 ) -> fidl::Result<()> {
1792 decoder.debug_check_bounds::<Self>(offset);
1793 #[allow(unused_variables)]
1794 let next_out_of_line = decoder.next_out_of_line();
1795 let handles_before = decoder.remaining_handles();
1796 let (ordinal, inlined, num_bytes, num_handles) =
1797 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
1798
1799 let member_inline_size = match ordinal {
1800 1 => <NewPrincipal as fidl::encoding::TypeMarker>::inline_size(decoder.context),
1801 2 => <UpdatedPrincipal as fidl::encoding::TypeMarker>::inline_size(decoder.context),
1802 3 => <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
1803 0 => return Err(fidl::Error::UnknownUnionTag),
1804 _ => num_bytes as usize,
1805 };
1806
1807 if inlined != (member_inline_size <= 4) {
1808 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1809 }
1810 let _inner_offset;
1811 if inlined {
1812 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
1813 _inner_offset = offset + 8;
1814 } else {
1815 depth.increment()?;
1816 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1817 }
1818 match ordinal {
1819 1 => {
1820 #[allow(irrefutable_let_patterns)]
1821 if let AttributionUpdate::Add(_) = self {
1822 } else {
1824 *self = AttributionUpdate::Add(fidl::new_empty!(
1826 NewPrincipal,
1827 fidl::encoding::DefaultFuchsiaResourceDialect
1828 ));
1829 }
1830 #[allow(irrefutable_let_patterns)]
1831 if let AttributionUpdate::Add(ref mut val) = self {
1832 fidl::decode!(
1833 NewPrincipal,
1834 fidl::encoding::DefaultFuchsiaResourceDialect,
1835 val,
1836 decoder,
1837 _inner_offset,
1838 depth
1839 )?;
1840 } else {
1841 unreachable!()
1842 }
1843 }
1844 2 => {
1845 #[allow(irrefutable_let_patterns)]
1846 if let AttributionUpdate::Update(_) = self {
1847 } else {
1849 *self = AttributionUpdate::Update(fidl::new_empty!(
1851 UpdatedPrincipal,
1852 fidl::encoding::DefaultFuchsiaResourceDialect
1853 ));
1854 }
1855 #[allow(irrefutable_let_patterns)]
1856 if let AttributionUpdate::Update(ref mut val) = self {
1857 fidl::decode!(
1858 UpdatedPrincipal,
1859 fidl::encoding::DefaultFuchsiaResourceDialect,
1860 val,
1861 decoder,
1862 _inner_offset,
1863 depth
1864 )?;
1865 } else {
1866 unreachable!()
1867 }
1868 }
1869 3 => {
1870 #[allow(irrefutable_let_patterns)]
1871 if let AttributionUpdate::Remove(_) = self {
1872 } else {
1874 *self = AttributionUpdate::Remove(fidl::new_empty!(
1876 u64,
1877 fidl::encoding::DefaultFuchsiaResourceDialect
1878 ));
1879 }
1880 #[allow(irrefutable_let_patterns)]
1881 if let AttributionUpdate::Remove(ref mut val) = self {
1882 fidl::decode!(
1883 u64,
1884 fidl::encoding::DefaultFuchsiaResourceDialect,
1885 val,
1886 decoder,
1887 _inner_offset,
1888 depth
1889 )?;
1890 } else {
1891 unreachable!()
1892 }
1893 }
1894 #[allow(deprecated)]
1895 ordinal => {
1896 for _ in 0..num_handles {
1897 decoder.drop_next_handle()?;
1898 }
1899 *self = AttributionUpdate::__SourceBreaking { unknown_ordinal: ordinal };
1900 }
1901 }
1902 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
1903 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1904 }
1905 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1906 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1907 }
1908 Ok(())
1909 }
1910 }
1911
1912 impl fidl::encoding::ResourceTypeMarker for Description {
1913 type Borrowed<'a> = &'a mut Self;
1914 fn take_or_borrow<'a>(
1915 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1916 ) -> Self::Borrowed<'a> {
1917 value
1918 }
1919 }
1920
1921 unsafe impl fidl::encoding::TypeMarker for Description {
1922 type Owned = Self;
1923
1924 #[inline(always)]
1925 fn inline_align(_context: fidl::encoding::Context) -> usize {
1926 8
1927 }
1928
1929 #[inline(always)]
1930 fn inline_size(_context: fidl::encoding::Context) -> usize {
1931 16
1932 }
1933 }
1934
1935 unsafe impl fidl::encoding::Encode<Description, fidl::encoding::DefaultFuchsiaResourceDialect>
1936 for &mut Description
1937 {
1938 #[inline]
1939 unsafe fn encode(
1940 self,
1941 encoder: &mut fidl::encoding::Encoder<
1942 '_,
1943 fidl::encoding::DefaultFuchsiaResourceDialect,
1944 >,
1945 offset: usize,
1946 _depth: fidl::encoding::Depth,
1947 ) -> fidl::Result<()> {
1948 encoder.debug_check_bounds::<Description>(offset);
1949 encoder.write_num::<u64>(self.ordinal(), offset);
1950 match self {
1951 Description::Component(ref mut val) => fidl::encoding::encode_in_envelope::<
1952 fidl::encoding::HandleType<
1953 fidl::Event,
1954 { fidl::ObjectType::EVENT.into_raw() },
1955 2147483648,
1956 >,
1957 fidl::encoding::DefaultFuchsiaResourceDialect,
1958 >(
1959 <fidl::encoding::HandleType<
1960 fidl::Event,
1961 { fidl::ObjectType::EVENT.into_raw() },
1962 2147483648,
1963 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1964 val
1965 ),
1966 encoder,
1967 offset + 8,
1968 _depth,
1969 ),
1970 Description::Part(ref val) => fidl::encoding::encode_in_envelope::<
1971 fidl::encoding::UnboundedString,
1972 fidl::encoding::DefaultFuchsiaResourceDialect,
1973 >(
1974 <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
1975 val,
1976 ),
1977 encoder,
1978 offset + 8,
1979 _depth,
1980 ),
1981 Description::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
1982 }
1983 }
1984 }
1985
1986 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for Description {
1987 #[inline(always)]
1988 fn new_empty() -> Self {
1989 Self::__SourceBreaking { unknown_ordinal: 0 }
1990 }
1991
1992 #[inline]
1993 unsafe fn decode(
1994 &mut self,
1995 decoder: &mut fidl::encoding::Decoder<
1996 '_,
1997 fidl::encoding::DefaultFuchsiaResourceDialect,
1998 >,
1999 offset: usize,
2000 mut depth: fidl::encoding::Depth,
2001 ) -> fidl::Result<()> {
2002 decoder.debug_check_bounds::<Self>(offset);
2003 #[allow(unused_variables)]
2004 let next_out_of_line = decoder.next_out_of_line();
2005 let handles_before = decoder.remaining_handles();
2006 let (ordinal, inlined, num_bytes, num_handles) =
2007 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
2008
2009 let member_inline_size = match ordinal {
2010 1 => <fidl::encoding::HandleType<
2011 fidl::Event,
2012 { fidl::ObjectType::EVENT.into_raw() },
2013 2147483648,
2014 > as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2015 2 => <fidl::encoding::UnboundedString as fidl::encoding::TypeMarker>::inline_size(
2016 decoder.context,
2017 ),
2018 0 => return Err(fidl::Error::UnknownUnionTag),
2019 _ => num_bytes as usize,
2020 };
2021
2022 if inlined != (member_inline_size <= 4) {
2023 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2024 }
2025 let _inner_offset;
2026 if inlined {
2027 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
2028 _inner_offset = offset + 8;
2029 } else {
2030 depth.increment()?;
2031 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2032 }
2033 match ordinal {
2034 1 => {
2035 #[allow(irrefutable_let_patterns)]
2036 if let Description::Component(_) = self {
2037 } else {
2039 *self = Description::Component(
2041 fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
2042 );
2043 }
2044 #[allow(irrefutable_let_patterns)]
2045 if let Description::Component(ref mut val) = self {
2046 fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val, decoder, _inner_offset, depth)?;
2047 } else {
2048 unreachable!()
2049 }
2050 }
2051 2 => {
2052 #[allow(irrefutable_let_patterns)]
2053 if let Description::Part(_) = self {
2054 } else {
2056 *self = Description::Part(fidl::new_empty!(
2058 fidl::encoding::UnboundedString,
2059 fidl::encoding::DefaultFuchsiaResourceDialect
2060 ));
2061 }
2062 #[allow(irrefutable_let_patterns)]
2063 if let Description::Part(ref mut val) = self {
2064 fidl::decode!(
2065 fidl::encoding::UnboundedString,
2066 fidl::encoding::DefaultFuchsiaResourceDialect,
2067 val,
2068 decoder,
2069 _inner_offset,
2070 depth
2071 )?;
2072 } else {
2073 unreachable!()
2074 }
2075 }
2076 #[allow(deprecated)]
2077 ordinal => {
2078 for _ in 0..num_handles {
2079 decoder.drop_next_handle()?;
2080 }
2081 *self = Description::__SourceBreaking { unknown_ordinal: ordinal };
2082 }
2083 }
2084 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
2085 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2086 }
2087 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2088 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2089 }
2090 Ok(())
2091 }
2092 }
2093
2094 impl fidl::encoding::ResourceTypeMarker for Resources {
2095 type Borrowed<'a> = &'a mut Self;
2096 fn take_or_borrow<'a>(
2097 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2098 ) -> Self::Borrowed<'a> {
2099 value
2100 }
2101 }
2102
2103 unsafe impl fidl::encoding::TypeMarker for Resources {
2104 type Owned = Self;
2105
2106 #[inline(always)]
2107 fn inline_align(_context: fidl::encoding::Context) -> usize {
2108 8
2109 }
2110
2111 #[inline(always)]
2112 fn inline_size(_context: fidl::encoding::Context) -> usize {
2113 16
2114 }
2115 }
2116
2117 unsafe impl fidl::encoding::Encode<Resources, fidl::encoding::DefaultFuchsiaResourceDialect>
2118 for &mut Resources
2119 {
2120 #[inline]
2121 unsafe fn encode(
2122 self,
2123 encoder: &mut fidl::encoding::Encoder<
2124 '_,
2125 fidl::encoding::DefaultFuchsiaResourceDialect,
2126 >,
2127 offset: usize,
2128 _depth: fidl::encoding::Depth,
2129 ) -> fidl::Result<()> {
2130 encoder.debug_check_bounds::<Resources>(offset);
2131 encoder.write_num::<u64>(self.ordinal(), offset);
2132 match self {
2133 Resources::Data(ref val) => fidl::encoding::encode_in_envelope::<
2134 Data,
2135 fidl::encoding::DefaultFuchsiaResourceDialect,
2136 >(
2137 <Data as fidl::encoding::ValueTypeMarker>::borrow(val),
2138 encoder,
2139 offset + 8,
2140 _depth,
2141 ),
2142 Resources::Buffer(ref mut val) => fidl::encoding::encode_in_envelope::<
2143 fidl::encoding::HandleType<
2144 fidl::Vmo,
2145 { fidl::ObjectType::VMO.into_raw() },
2146 2147483648,
2147 >,
2148 fidl::encoding::DefaultFuchsiaResourceDialect,
2149 >(
2150 <fidl::encoding::HandleType<
2151 fidl::Vmo,
2152 { fidl::ObjectType::VMO.into_raw() },
2153 2147483648,
2154 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2155 val
2156 ),
2157 encoder,
2158 offset + 8,
2159 _depth,
2160 ),
2161 Resources::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
2162 }
2163 }
2164 }
2165
2166 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for Resources {
2167 #[inline(always)]
2168 fn new_empty() -> Self {
2169 Self::__SourceBreaking { unknown_ordinal: 0 }
2170 }
2171
2172 #[inline]
2173 unsafe fn decode(
2174 &mut self,
2175 decoder: &mut fidl::encoding::Decoder<
2176 '_,
2177 fidl::encoding::DefaultFuchsiaResourceDialect,
2178 >,
2179 offset: usize,
2180 mut depth: fidl::encoding::Depth,
2181 ) -> fidl::Result<()> {
2182 decoder.debug_check_bounds::<Self>(offset);
2183 #[allow(unused_variables)]
2184 let next_out_of_line = decoder.next_out_of_line();
2185 let handles_before = decoder.remaining_handles();
2186 let (ordinal, inlined, num_bytes, num_handles) =
2187 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
2188
2189 let member_inline_size = match ordinal {
2190 1 => <Data as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2191 2 => <fidl::encoding::HandleType<
2192 fidl::Vmo,
2193 { fidl::ObjectType::VMO.into_raw() },
2194 2147483648,
2195 > as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2196 0 => return Err(fidl::Error::UnknownUnionTag),
2197 _ => num_bytes as usize,
2198 };
2199
2200 if inlined != (member_inline_size <= 4) {
2201 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2202 }
2203 let _inner_offset;
2204 if inlined {
2205 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
2206 _inner_offset = offset + 8;
2207 } else {
2208 depth.increment()?;
2209 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2210 }
2211 match ordinal {
2212 1 => {
2213 #[allow(irrefutable_let_patterns)]
2214 if let Resources::Data(_) = self {
2215 } else {
2217 *self = Resources::Data(fidl::new_empty!(
2219 Data,
2220 fidl::encoding::DefaultFuchsiaResourceDialect
2221 ));
2222 }
2223 #[allow(irrefutable_let_patterns)]
2224 if let Resources::Data(ref mut val) = self {
2225 fidl::decode!(
2226 Data,
2227 fidl::encoding::DefaultFuchsiaResourceDialect,
2228 val,
2229 decoder,
2230 _inner_offset,
2231 depth
2232 )?;
2233 } else {
2234 unreachable!()
2235 }
2236 }
2237 2 => {
2238 #[allow(irrefutable_let_patterns)]
2239 if let Resources::Buffer(_) = self {
2240 } else {
2242 *self = Resources::Buffer(
2244 fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
2245 );
2246 }
2247 #[allow(irrefutable_let_patterns)]
2248 if let Resources::Buffer(ref mut val) = self {
2249 fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val, decoder, _inner_offset, depth)?;
2250 } else {
2251 unreachable!()
2252 }
2253 }
2254 #[allow(deprecated)]
2255 ordinal => {
2256 for _ in 0..num_handles {
2257 decoder.drop_next_handle()?;
2258 }
2259 *self = Resources::__SourceBreaking { unknown_ordinal: ordinal };
2260 }
2261 }
2262 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
2263 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2264 }
2265 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2266 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2267 }
2268 Ok(())
2269 }
2270 }
2271}