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, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct PageRefaultSinkSendPageRefaultCountRequest {
16 pub page_refaults_vmo: fidl::Vmo,
17}
18
19impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
20 for PageRefaultSinkSendPageRefaultCountRequest
21{
22}
23
24#[derive(Debug, Default, PartialEq)]
26pub struct NewPrincipal {
27 pub identifier: Option<u64>,
29 pub description: Option<Description>,
35 pub principal_type: Option<PrincipalType>,
37 pub detailed_attribution: Option<fidl::endpoints::ClientEnd<ProviderMarker>>,
40 #[doc(hidden)]
41 pub __source_breaking: fidl::marker::SourceBreaking,
42}
43
44impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for NewPrincipal {}
45
46#[derive(Debug, Default, PartialEq)]
47pub struct ProviderGetResponse {
48 pub attributions: Option<Vec<AttributionUpdate>>,
49 #[doc(hidden)]
50 pub __source_breaking: fidl::marker::SourceBreaking,
51}
52
53impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ProviderGetResponse {}
54
55#[derive(Debug, Default, PartialEq)]
61pub struct UpdatedPrincipal {
62 pub identifier: Option<u64>,
64 pub resources: Option<Resources>,
69 #[doc(hidden)]
70 pub __source_breaking: fidl::marker::SourceBreaking,
71}
72
73impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for UpdatedPrincipal {}
74
75#[derive(Debug)]
77pub enum AttributionUpdate {
78 Add(NewPrincipal),
84 Update(UpdatedPrincipal),
90 Remove(u64),
97 #[doc(hidden)]
98 __SourceBreaking { unknown_ordinal: u64 },
99}
100
101#[macro_export]
103macro_rules! AttributionUpdateUnknown {
104 () => {
105 _
106 };
107}
108
109impl PartialEq for AttributionUpdate {
111 fn eq(&self, other: &Self) -> bool {
112 match (self, other) {
113 (Self::Add(x), Self::Add(y)) => *x == *y,
114 (Self::Update(x), Self::Update(y)) => *x == *y,
115 (Self::Remove(x), Self::Remove(y)) => *x == *y,
116 _ => false,
117 }
118 }
119}
120
121impl AttributionUpdate {
122 #[inline]
123 pub fn ordinal(&self) -> u64 {
124 match *self {
125 Self::Add(_) => 1,
126 Self::Update(_) => 2,
127 Self::Remove(_) => 3,
128 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
129 }
130 }
131
132 #[inline]
133 pub fn unknown_variant_for_testing() -> Self {
134 Self::__SourceBreaking { unknown_ordinal: 0 }
135 }
136
137 #[inline]
138 pub fn is_unknown(&self) -> bool {
139 match self {
140 Self::__SourceBreaking { .. } => true,
141 _ => false,
142 }
143 }
144}
145
146impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for AttributionUpdate {}
147
148#[derive(Debug)]
149pub enum Description {
150 Component(fidl::Event),
155 Part(String),
162 #[doc(hidden)]
163 __SourceBreaking { unknown_ordinal: u64 },
164}
165
166#[macro_export]
168macro_rules! DescriptionUnknown {
169 () => {
170 _
171 };
172}
173
174impl PartialEq for Description {
176 fn eq(&self, other: &Self) -> bool {
177 match (self, other) {
178 (Self::Component(x), Self::Component(y)) => *x == *y,
179 (Self::Part(x), Self::Part(y)) => *x == *y,
180 _ => false,
181 }
182 }
183}
184
185impl Description {
186 #[inline]
187 pub fn ordinal(&self) -> u64 {
188 match *self {
189 Self::Component(_) => 1,
190 Self::Part(_) => 2,
191 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
192 }
193 }
194
195 #[inline]
196 pub fn unknown_variant_for_testing() -> Self {
197 Self::__SourceBreaking { unknown_ordinal: 0 }
198 }
199
200 #[inline]
201 pub fn is_unknown(&self) -> bool {
202 match self {
203 Self::__SourceBreaking { .. } => true,
204 _ => false,
205 }
206 }
207}
208
209impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for Description {}
210
211#[derive(Debug)]
212pub enum Resources {
213 Data(Data),
214 Buffer(fidl::Vmo),
216 #[doc(hidden)]
217 __SourceBreaking {
218 unknown_ordinal: u64,
219 },
220}
221
222#[macro_export]
224macro_rules! ResourcesUnknown {
225 () => {
226 _
227 };
228}
229
230impl PartialEq for Resources {
232 fn eq(&self, other: &Self) -> bool {
233 match (self, other) {
234 (Self::Data(x), Self::Data(y)) => *x == *y,
235 (Self::Buffer(x), Self::Buffer(y)) => *x == *y,
236 _ => false,
237 }
238 }
239}
240
241impl Resources {
242 #[inline]
243 pub fn ordinal(&self) -> u64 {
244 match *self {
245 Self::Data(_) => 1,
246 Self::Buffer(_) => 2,
247 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
248 }
249 }
250
251 #[inline]
252 pub fn unknown_variant_for_testing() -> Self {
253 Self::__SourceBreaking { unknown_ordinal: 0 }
254 }
255
256 #[inline]
257 pub fn is_unknown(&self) -> bool {
258 match self {
259 Self::__SourceBreaking { .. } => true,
260 _ => false,
261 }
262 }
263}
264
265impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for Resources {}
266
267#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
268pub struct PageRefaultSinkMarker;
269
270impl fidl::endpoints::ProtocolMarker for PageRefaultSinkMarker {
271 type Proxy = PageRefaultSinkProxy;
272 type RequestStream = PageRefaultSinkRequestStream;
273 #[cfg(target_os = "fuchsia")]
274 type SynchronousProxy = PageRefaultSinkSynchronousProxy;
275
276 const DEBUG_NAME: &'static str = "fuchsia.memory.attribution.PageRefaultSink";
277}
278impl fidl::endpoints::DiscoverableProtocolMarker for PageRefaultSinkMarker {}
279
280pub trait PageRefaultSinkProxyInterface: Send + Sync {
281 fn r#send_page_refault_count(&self, page_refaults_vmo: fidl::Vmo) -> Result<(), fidl::Error>;
282}
283#[derive(Debug)]
284#[cfg(target_os = "fuchsia")]
285pub struct PageRefaultSinkSynchronousProxy {
286 client: fidl::client::sync::Client,
287}
288
289#[cfg(target_os = "fuchsia")]
290impl fidl::endpoints::SynchronousProxy for PageRefaultSinkSynchronousProxy {
291 type Proxy = PageRefaultSinkProxy;
292 type Protocol = PageRefaultSinkMarker;
293
294 fn from_channel(inner: fidl::Channel) -> Self {
295 Self::new(inner)
296 }
297
298 fn into_channel(self) -> fidl::Channel {
299 self.client.into_channel()
300 }
301
302 fn as_channel(&self) -> &fidl::Channel {
303 self.client.as_channel()
304 }
305}
306
307#[cfg(target_os = "fuchsia")]
308impl PageRefaultSinkSynchronousProxy {
309 pub fn new(channel: fidl::Channel) -> Self {
310 let protocol_name = <PageRefaultSinkMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
311 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
312 }
313
314 pub fn into_channel(self) -> fidl::Channel {
315 self.client.into_channel()
316 }
317
318 pub fn wait_for_event(
321 &self,
322 deadline: zx::MonotonicInstant,
323 ) -> Result<PageRefaultSinkEvent, fidl::Error> {
324 PageRefaultSinkEvent::decode(self.client.wait_for_event(deadline)?)
325 }
326
327 pub fn r#send_page_refault_count(
330 &self,
331 mut page_refaults_vmo: fidl::Vmo,
332 ) -> Result<(), fidl::Error> {
333 self.client.send::<PageRefaultSinkSendPageRefaultCountRequest>(
334 (page_refaults_vmo,),
335 0x1d4f9f7efbb957e3,
336 fidl::encoding::DynamicFlags::FLEXIBLE,
337 )
338 }
339}
340
341#[cfg(target_os = "fuchsia")]
342impl From<PageRefaultSinkSynchronousProxy> for zx::NullableHandle {
343 fn from(value: PageRefaultSinkSynchronousProxy) -> Self {
344 value.into_channel().into()
345 }
346}
347
348#[cfg(target_os = "fuchsia")]
349impl From<fidl::Channel> for PageRefaultSinkSynchronousProxy {
350 fn from(value: fidl::Channel) -> Self {
351 Self::new(value)
352 }
353}
354
355#[cfg(target_os = "fuchsia")]
356impl fidl::endpoints::FromClient for PageRefaultSinkSynchronousProxy {
357 type Protocol = PageRefaultSinkMarker;
358
359 fn from_client(value: fidl::endpoints::ClientEnd<PageRefaultSinkMarker>) -> Self {
360 Self::new(value.into_channel())
361 }
362}
363
364#[derive(Debug, Clone)]
365pub struct PageRefaultSinkProxy {
366 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
367}
368
369impl fidl::endpoints::Proxy for PageRefaultSinkProxy {
370 type Protocol = PageRefaultSinkMarker;
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 PageRefaultSinkProxy {
386 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
388 let protocol_name = <PageRefaultSinkMarker 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) -> PageRefaultSinkEventStream {
398 PageRefaultSinkEventStream { event_receiver: self.client.take_event_receiver() }
399 }
400
401 pub fn r#send_page_refault_count(
404 &self,
405 mut page_refaults_vmo: fidl::Vmo,
406 ) -> Result<(), fidl::Error> {
407 PageRefaultSinkProxyInterface::r#send_page_refault_count(self, page_refaults_vmo)
408 }
409}
410
411impl PageRefaultSinkProxyInterface for PageRefaultSinkProxy {
412 fn r#send_page_refault_count(
413 &self,
414 mut page_refaults_vmo: fidl::Vmo,
415 ) -> Result<(), fidl::Error> {
416 self.client.send::<PageRefaultSinkSendPageRefaultCountRequest>(
417 (page_refaults_vmo,),
418 0x1d4f9f7efbb957e3,
419 fidl::encoding::DynamicFlags::FLEXIBLE,
420 )
421 }
422}
423
424pub struct PageRefaultSinkEventStream {
425 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
426}
427
428impl std::marker::Unpin for PageRefaultSinkEventStream {}
429
430impl futures::stream::FusedStream for PageRefaultSinkEventStream {
431 fn is_terminated(&self) -> bool {
432 self.event_receiver.is_terminated()
433 }
434}
435
436impl futures::Stream for PageRefaultSinkEventStream {
437 type Item = Result<PageRefaultSinkEvent, fidl::Error>;
438
439 fn poll_next(
440 mut self: std::pin::Pin<&mut Self>,
441 cx: &mut std::task::Context<'_>,
442 ) -> std::task::Poll<Option<Self::Item>> {
443 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
444 &mut self.event_receiver,
445 cx
446 )?) {
447 Some(buf) => std::task::Poll::Ready(Some(PageRefaultSinkEvent::decode(buf))),
448 None => std::task::Poll::Ready(None),
449 }
450 }
451}
452
453#[derive(Debug)]
454pub enum PageRefaultSinkEvent {
455 #[non_exhaustive]
456 _UnknownEvent {
457 ordinal: u64,
459 },
460}
461
462impl PageRefaultSinkEvent {
463 fn decode(
465 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
466 ) -> Result<PageRefaultSinkEvent, fidl::Error> {
467 let (bytes, _handles) = buf.split_mut();
468 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
469 debug_assert_eq!(tx_header.tx_id, 0);
470 match tx_header.ordinal {
471 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
472 Ok(PageRefaultSinkEvent::_UnknownEvent { ordinal: tx_header.ordinal })
473 }
474 _ => Err(fidl::Error::UnknownOrdinal {
475 ordinal: tx_header.ordinal,
476 protocol_name:
477 <PageRefaultSinkMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
478 }),
479 }
480 }
481}
482
483pub struct PageRefaultSinkRequestStream {
485 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
486 is_terminated: bool,
487}
488
489impl std::marker::Unpin for PageRefaultSinkRequestStream {}
490
491impl futures::stream::FusedStream for PageRefaultSinkRequestStream {
492 fn is_terminated(&self) -> bool {
493 self.is_terminated
494 }
495}
496
497impl fidl::endpoints::RequestStream for PageRefaultSinkRequestStream {
498 type Protocol = PageRefaultSinkMarker;
499 type ControlHandle = PageRefaultSinkControlHandle;
500
501 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
502 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
503 }
504
505 fn control_handle(&self) -> Self::ControlHandle {
506 PageRefaultSinkControlHandle { inner: self.inner.clone() }
507 }
508
509 fn into_inner(
510 self,
511 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
512 {
513 (self.inner, self.is_terminated)
514 }
515
516 fn from_inner(
517 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
518 is_terminated: bool,
519 ) -> Self {
520 Self { inner, is_terminated }
521 }
522}
523
524impl futures::Stream for PageRefaultSinkRequestStream {
525 type Item = Result<PageRefaultSinkRequest, fidl::Error>;
526
527 fn poll_next(
528 mut self: std::pin::Pin<&mut Self>,
529 cx: &mut std::task::Context<'_>,
530 ) -> std::task::Poll<Option<Self::Item>> {
531 let this = &mut *self;
532 if this.inner.check_shutdown(cx) {
533 this.is_terminated = true;
534 return std::task::Poll::Ready(None);
535 }
536 if this.is_terminated {
537 panic!("polled PageRefaultSinkRequestStream after completion");
538 }
539 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
540 |bytes, handles| {
541 match this.inner.channel().read_etc(cx, bytes, handles) {
542 std::task::Poll::Ready(Ok(())) => {}
543 std::task::Poll::Pending => return std::task::Poll::Pending,
544 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
545 this.is_terminated = true;
546 return std::task::Poll::Ready(None);
547 }
548 std::task::Poll::Ready(Err(e)) => {
549 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
550 e.into(),
551 ))));
552 }
553 }
554
555 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
557
558 std::task::Poll::Ready(Some(match header.ordinal {
559 0x1d4f9f7efbb957e3 => {
560 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
561 let mut req = fidl::new_empty!(
562 PageRefaultSinkSendPageRefaultCountRequest,
563 fidl::encoding::DefaultFuchsiaResourceDialect
564 );
565 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PageRefaultSinkSendPageRefaultCountRequest>(&header, _body_bytes, handles, &mut req)?;
566 let control_handle =
567 PageRefaultSinkControlHandle { inner: this.inner.clone() };
568 Ok(PageRefaultSinkRequest::SendPageRefaultCount {
569 page_refaults_vmo: req.page_refaults_vmo,
570
571 control_handle,
572 })
573 }
574 _ if header.tx_id == 0
575 && header
576 .dynamic_flags()
577 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
578 {
579 Ok(PageRefaultSinkRequest::_UnknownMethod {
580 ordinal: header.ordinal,
581 control_handle: PageRefaultSinkControlHandle {
582 inner: this.inner.clone(),
583 },
584 method_type: fidl::MethodType::OneWay,
585 })
586 }
587 _ if header
588 .dynamic_flags()
589 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
590 {
591 this.inner.send_framework_err(
592 fidl::encoding::FrameworkErr::UnknownMethod,
593 header.tx_id,
594 header.ordinal,
595 header.dynamic_flags(),
596 (bytes, handles),
597 )?;
598 Ok(PageRefaultSinkRequest::_UnknownMethod {
599 ordinal: header.ordinal,
600 control_handle: PageRefaultSinkControlHandle {
601 inner: this.inner.clone(),
602 },
603 method_type: fidl::MethodType::TwoWay,
604 })
605 }
606 _ => Err(fidl::Error::UnknownOrdinal {
607 ordinal: header.ordinal,
608 protocol_name:
609 <PageRefaultSinkMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
610 }),
611 }))
612 },
613 )
614 }
615}
616
617#[derive(Debug)]
619pub enum PageRefaultSinkRequest {
620 SendPageRefaultCount {
623 page_refaults_vmo: fidl::Vmo,
624 control_handle: PageRefaultSinkControlHandle,
625 },
626 #[non_exhaustive]
628 _UnknownMethod {
629 ordinal: u64,
631 control_handle: PageRefaultSinkControlHandle,
632 method_type: fidl::MethodType,
633 },
634}
635
636impl PageRefaultSinkRequest {
637 #[allow(irrefutable_let_patterns)]
638 pub fn into_send_page_refault_count(self) -> Option<(fidl::Vmo, PageRefaultSinkControlHandle)> {
639 if let PageRefaultSinkRequest::SendPageRefaultCount { page_refaults_vmo, control_handle } =
640 self
641 {
642 Some((page_refaults_vmo, control_handle))
643 } else {
644 None
645 }
646 }
647
648 pub fn method_name(&self) -> &'static str {
650 match *self {
651 PageRefaultSinkRequest::SendPageRefaultCount { .. } => "send_page_refault_count",
652 PageRefaultSinkRequest::_UnknownMethod {
653 method_type: fidl::MethodType::OneWay,
654 ..
655 } => "unknown one-way method",
656 PageRefaultSinkRequest::_UnknownMethod {
657 method_type: fidl::MethodType::TwoWay,
658 ..
659 } => "unknown two-way method",
660 }
661 }
662}
663
664#[derive(Debug, Clone)]
665pub struct PageRefaultSinkControlHandle {
666 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
667}
668
669impl fidl::endpoints::ControlHandle for PageRefaultSinkControlHandle {
670 fn shutdown(&self) {
671 self.inner.shutdown()
672 }
673
674 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
675 self.inner.shutdown_with_epitaph(status)
676 }
677
678 fn is_closed(&self) -> bool {
679 self.inner.channel().is_closed()
680 }
681 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
682 self.inner.channel().on_closed()
683 }
684
685 #[cfg(target_os = "fuchsia")]
686 fn signal_peer(
687 &self,
688 clear_mask: zx::Signals,
689 set_mask: zx::Signals,
690 ) -> Result<(), zx_status::Status> {
691 use fidl::Peered;
692 self.inner.channel().signal_peer(clear_mask, set_mask)
693 }
694}
695
696impl PageRefaultSinkControlHandle {}
697
698#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
699pub struct ProviderMarker;
700
701impl fidl::endpoints::ProtocolMarker for ProviderMarker {
702 type Proxy = ProviderProxy;
703 type RequestStream = ProviderRequestStream;
704 #[cfg(target_os = "fuchsia")]
705 type SynchronousProxy = ProviderSynchronousProxy;
706
707 const DEBUG_NAME: &'static str = "fuchsia.memory.attribution.Provider";
708}
709impl fidl::endpoints::DiscoverableProtocolMarker for ProviderMarker {}
710pub type ProviderGetResult = Result<ProviderGetResponse, Error>;
711
712pub trait ProviderProxyInterface: Send + Sync {
713 type GetResponseFut: std::future::Future<Output = Result<ProviderGetResult, fidl::Error>> + Send;
714 fn r#get(&self) -> Self::GetResponseFut;
715}
716#[derive(Debug)]
717#[cfg(target_os = "fuchsia")]
718pub struct ProviderSynchronousProxy {
719 client: fidl::client::sync::Client,
720}
721
722#[cfg(target_os = "fuchsia")]
723impl fidl::endpoints::SynchronousProxy for ProviderSynchronousProxy {
724 type Proxy = ProviderProxy;
725 type Protocol = ProviderMarker;
726
727 fn from_channel(inner: fidl::Channel) -> Self {
728 Self::new(inner)
729 }
730
731 fn into_channel(self) -> fidl::Channel {
732 self.client.into_channel()
733 }
734
735 fn as_channel(&self) -> &fidl::Channel {
736 self.client.as_channel()
737 }
738}
739
740#[cfg(target_os = "fuchsia")]
741impl ProviderSynchronousProxy {
742 pub fn new(channel: fidl::Channel) -> Self {
743 let protocol_name = <ProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
744 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
745 }
746
747 pub fn into_channel(self) -> fidl::Channel {
748 self.client.into_channel()
749 }
750
751 pub fn wait_for_event(
754 &self,
755 deadline: zx::MonotonicInstant,
756 ) -> Result<ProviderEvent, fidl::Error> {
757 ProviderEvent::decode(self.client.wait_for_event(deadline)?)
758 }
759
760 pub fn r#get(
774 &self,
775 ___deadline: zx::MonotonicInstant,
776 ) -> Result<ProviderGetResult, fidl::Error> {
777 let _response = self.client.send_query::<
778 fidl::encoding::EmptyPayload,
779 fidl::encoding::FlexibleResultType<ProviderGetResponse, Error>,
780 >(
781 (),
782 0x7a2f2d2cdcfcc945,
783 fidl::encoding::DynamicFlags::FLEXIBLE,
784 ___deadline,
785 )?
786 .into_result::<ProviderMarker>("get")?;
787 Ok(_response.map(|x| x))
788 }
789}
790
791#[cfg(target_os = "fuchsia")]
792impl From<ProviderSynchronousProxy> for zx::NullableHandle {
793 fn from(value: ProviderSynchronousProxy) -> Self {
794 value.into_channel().into()
795 }
796}
797
798#[cfg(target_os = "fuchsia")]
799impl From<fidl::Channel> for ProviderSynchronousProxy {
800 fn from(value: fidl::Channel) -> Self {
801 Self::new(value)
802 }
803}
804
805#[cfg(target_os = "fuchsia")]
806impl fidl::endpoints::FromClient for ProviderSynchronousProxy {
807 type Protocol = ProviderMarker;
808
809 fn from_client(value: fidl::endpoints::ClientEnd<ProviderMarker>) -> Self {
810 Self::new(value.into_channel())
811 }
812}
813
814#[derive(Debug, Clone)]
815pub struct ProviderProxy {
816 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
817}
818
819impl fidl::endpoints::Proxy for ProviderProxy {
820 type Protocol = ProviderMarker;
821
822 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
823 Self::new(inner)
824 }
825
826 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
827 self.client.into_channel().map_err(|client| Self { client })
828 }
829
830 fn as_channel(&self) -> &::fidl::AsyncChannel {
831 self.client.as_channel()
832 }
833}
834
835impl ProviderProxy {
836 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
838 let protocol_name = <ProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
839 Self { client: fidl::client::Client::new(channel, protocol_name) }
840 }
841
842 pub fn take_event_stream(&self) -> ProviderEventStream {
848 ProviderEventStream { event_receiver: self.client.take_event_receiver() }
849 }
850
851 pub fn r#get(
865 &self,
866 ) -> fidl::client::QueryResponseFut<
867 ProviderGetResult,
868 fidl::encoding::DefaultFuchsiaResourceDialect,
869 > {
870 ProviderProxyInterface::r#get(self)
871 }
872}
873
874impl ProviderProxyInterface for ProviderProxy {
875 type GetResponseFut = fidl::client::QueryResponseFut<
876 ProviderGetResult,
877 fidl::encoding::DefaultFuchsiaResourceDialect,
878 >;
879 fn r#get(&self) -> Self::GetResponseFut {
880 fn _decode(
881 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
882 ) -> Result<ProviderGetResult, fidl::Error> {
883 let _response = fidl::client::decode_transaction_body::<
884 fidl::encoding::FlexibleResultType<ProviderGetResponse, Error>,
885 fidl::encoding::DefaultFuchsiaResourceDialect,
886 0x7a2f2d2cdcfcc945,
887 >(_buf?)?
888 .into_result::<ProviderMarker>("get")?;
889 Ok(_response.map(|x| x))
890 }
891 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ProviderGetResult>(
892 (),
893 0x7a2f2d2cdcfcc945,
894 fidl::encoding::DynamicFlags::FLEXIBLE,
895 _decode,
896 )
897 }
898}
899
900pub struct ProviderEventStream {
901 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
902}
903
904impl std::marker::Unpin for ProviderEventStream {}
905
906impl futures::stream::FusedStream for ProviderEventStream {
907 fn is_terminated(&self) -> bool {
908 self.event_receiver.is_terminated()
909 }
910}
911
912impl futures::Stream for ProviderEventStream {
913 type Item = Result<ProviderEvent, fidl::Error>;
914
915 fn poll_next(
916 mut self: std::pin::Pin<&mut Self>,
917 cx: &mut std::task::Context<'_>,
918 ) -> std::task::Poll<Option<Self::Item>> {
919 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
920 &mut self.event_receiver,
921 cx
922 )?) {
923 Some(buf) => std::task::Poll::Ready(Some(ProviderEvent::decode(buf))),
924 None => std::task::Poll::Ready(None),
925 }
926 }
927}
928
929#[derive(Debug)]
930pub enum ProviderEvent {
931 #[non_exhaustive]
932 _UnknownEvent {
933 ordinal: u64,
935 },
936}
937
938impl ProviderEvent {
939 fn decode(
941 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
942 ) -> Result<ProviderEvent, fidl::Error> {
943 let (bytes, _handles) = buf.split_mut();
944 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
945 debug_assert_eq!(tx_header.tx_id, 0);
946 match tx_header.ordinal {
947 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
948 Ok(ProviderEvent::_UnknownEvent { ordinal: tx_header.ordinal })
949 }
950 _ => Err(fidl::Error::UnknownOrdinal {
951 ordinal: tx_header.ordinal,
952 protocol_name: <ProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
953 }),
954 }
955 }
956}
957
958pub struct ProviderRequestStream {
960 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
961 is_terminated: bool,
962}
963
964impl std::marker::Unpin for ProviderRequestStream {}
965
966impl futures::stream::FusedStream for ProviderRequestStream {
967 fn is_terminated(&self) -> bool {
968 self.is_terminated
969 }
970}
971
972impl fidl::endpoints::RequestStream for ProviderRequestStream {
973 type Protocol = ProviderMarker;
974 type ControlHandle = ProviderControlHandle;
975
976 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
977 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
978 }
979
980 fn control_handle(&self) -> Self::ControlHandle {
981 ProviderControlHandle { inner: self.inner.clone() }
982 }
983
984 fn into_inner(
985 self,
986 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
987 {
988 (self.inner, self.is_terminated)
989 }
990
991 fn from_inner(
992 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
993 is_terminated: bool,
994 ) -> Self {
995 Self { inner, is_terminated }
996 }
997}
998
999impl futures::Stream for ProviderRequestStream {
1000 type Item = Result<ProviderRequest, fidl::Error>;
1001
1002 fn poll_next(
1003 mut self: std::pin::Pin<&mut Self>,
1004 cx: &mut std::task::Context<'_>,
1005 ) -> std::task::Poll<Option<Self::Item>> {
1006 let this = &mut *self;
1007 if this.inner.check_shutdown(cx) {
1008 this.is_terminated = true;
1009 return std::task::Poll::Ready(None);
1010 }
1011 if this.is_terminated {
1012 panic!("polled ProviderRequestStream after completion");
1013 }
1014 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1015 |bytes, handles| {
1016 match this.inner.channel().read_etc(cx, bytes, handles) {
1017 std::task::Poll::Ready(Ok(())) => {}
1018 std::task::Poll::Pending => return std::task::Poll::Pending,
1019 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1020 this.is_terminated = true;
1021 return std::task::Poll::Ready(None);
1022 }
1023 std::task::Poll::Ready(Err(e)) => {
1024 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1025 e.into(),
1026 ))));
1027 }
1028 }
1029
1030 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1032
1033 std::task::Poll::Ready(Some(match header.ordinal {
1034 0x7a2f2d2cdcfcc945 => {
1035 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1036 let mut req = fidl::new_empty!(
1037 fidl::encoding::EmptyPayload,
1038 fidl::encoding::DefaultFuchsiaResourceDialect
1039 );
1040 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1041 let control_handle = ProviderControlHandle { inner: this.inner.clone() };
1042 Ok(ProviderRequest::Get {
1043 responder: ProviderGetResponder {
1044 control_handle: std::mem::ManuallyDrop::new(control_handle),
1045 tx_id: header.tx_id,
1046 },
1047 })
1048 }
1049 _ if header.tx_id == 0
1050 && header
1051 .dynamic_flags()
1052 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1053 {
1054 Ok(ProviderRequest::_UnknownMethod {
1055 ordinal: header.ordinal,
1056 control_handle: ProviderControlHandle { inner: this.inner.clone() },
1057 method_type: fidl::MethodType::OneWay,
1058 })
1059 }
1060 _ if header
1061 .dynamic_flags()
1062 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1063 {
1064 this.inner.send_framework_err(
1065 fidl::encoding::FrameworkErr::UnknownMethod,
1066 header.tx_id,
1067 header.ordinal,
1068 header.dynamic_flags(),
1069 (bytes, handles),
1070 )?;
1071 Ok(ProviderRequest::_UnknownMethod {
1072 ordinal: header.ordinal,
1073 control_handle: ProviderControlHandle { inner: this.inner.clone() },
1074 method_type: fidl::MethodType::TwoWay,
1075 })
1076 }
1077 _ => Err(fidl::Error::UnknownOrdinal {
1078 ordinal: header.ordinal,
1079 protocol_name:
1080 <ProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1081 }),
1082 }))
1083 },
1084 )
1085 }
1086}
1087
1088#[derive(Debug)]
1104pub enum ProviderRequest {
1105 Get { responder: ProviderGetResponder },
1119 #[non_exhaustive]
1121 _UnknownMethod {
1122 ordinal: u64,
1124 control_handle: ProviderControlHandle,
1125 method_type: fidl::MethodType,
1126 },
1127}
1128
1129impl ProviderRequest {
1130 #[allow(irrefutable_let_patterns)]
1131 pub fn into_get(self) -> Option<(ProviderGetResponder)> {
1132 if let ProviderRequest::Get { responder } = self { Some((responder)) } else { None }
1133 }
1134
1135 pub fn method_name(&self) -> &'static str {
1137 match *self {
1138 ProviderRequest::Get { .. } => "get",
1139 ProviderRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
1140 "unknown one-way method"
1141 }
1142 ProviderRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
1143 "unknown two-way method"
1144 }
1145 }
1146 }
1147}
1148
1149#[derive(Debug, Clone)]
1150pub struct ProviderControlHandle {
1151 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1152}
1153
1154impl fidl::endpoints::ControlHandle for ProviderControlHandle {
1155 fn shutdown(&self) {
1156 self.inner.shutdown()
1157 }
1158
1159 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1160 self.inner.shutdown_with_epitaph(status)
1161 }
1162
1163 fn is_closed(&self) -> bool {
1164 self.inner.channel().is_closed()
1165 }
1166 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1167 self.inner.channel().on_closed()
1168 }
1169
1170 #[cfg(target_os = "fuchsia")]
1171 fn signal_peer(
1172 &self,
1173 clear_mask: zx::Signals,
1174 set_mask: zx::Signals,
1175 ) -> Result<(), zx_status::Status> {
1176 use fidl::Peered;
1177 self.inner.channel().signal_peer(clear_mask, set_mask)
1178 }
1179}
1180
1181impl ProviderControlHandle {}
1182
1183#[must_use = "FIDL methods require a response to be sent"]
1184#[derive(Debug)]
1185pub struct ProviderGetResponder {
1186 control_handle: std::mem::ManuallyDrop<ProviderControlHandle>,
1187 tx_id: u32,
1188}
1189
1190impl std::ops::Drop for ProviderGetResponder {
1194 fn drop(&mut self) {
1195 self.control_handle.shutdown();
1196 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1198 }
1199}
1200
1201impl fidl::endpoints::Responder for ProviderGetResponder {
1202 type ControlHandle = ProviderControlHandle;
1203
1204 fn control_handle(&self) -> &ProviderControlHandle {
1205 &self.control_handle
1206 }
1207
1208 fn drop_without_shutdown(mut self) {
1209 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1211 std::mem::forget(self);
1213 }
1214}
1215
1216impl ProviderGetResponder {
1217 pub fn send(self, mut result: Result<ProviderGetResponse, Error>) -> Result<(), fidl::Error> {
1221 let _result = self.send_raw(result);
1222 if _result.is_err() {
1223 self.control_handle.shutdown();
1224 }
1225 self.drop_without_shutdown();
1226 _result
1227 }
1228
1229 pub fn send_no_shutdown_on_err(
1231 self,
1232 mut result: Result<ProviderGetResponse, Error>,
1233 ) -> Result<(), fidl::Error> {
1234 let _result = self.send_raw(result);
1235 self.drop_without_shutdown();
1236 _result
1237 }
1238
1239 fn send_raw(&self, mut result: Result<ProviderGetResponse, Error>) -> Result<(), fidl::Error> {
1240 self.control_handle
1241 .inner
1242 .send::<fidl::encoding::FlexibleResultType<ProviderGetResponse, Error>>(
1243 fidl::encoding::FlexibleResult::new(result.as_mut().map_err(|e| *e)),
1244 self.tx_id,
1245 0x7a2f2d2cdcfcc945,
1246 fidl::encoding::DynamicFlags::FLEXIBLE,
1247 )
1248 }
1249}
1250
1251mod internal {
1252 use super::*;
1253
1254 impl fidl::encoding::ResourceTypeMarker for PageRefaultSinkSendPageRefaultCountRequest {
1255 type Borrowed<'a> = &'a mut Self;
1256 fn take_or_borrow<'a>(
1257 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1258 ) -> Self::Borrowed<'a> {
1259 value
1260 }
1261 }
1262
1263 unsafe impl fidl::encoding::TypeMarker for PageRefaultSinkSendPageRefaultCountRequest {
1264 type Owned = Self;
1265
1266 #[inline(always)]
1267 fn inline_align(_context: fidl::encoding::Context) -> usize {
1268 4
1269 }
1270
1271 #[inline(always)]
1272 fn inline_size(_context: fidl::encoding::Context) -> usize {
1273 4
1274 }
1275 }
1276
1277 unsafe impl
1278 fidl::encoding::Encode<
1279 PageRefaultSinkSendPageRefaultCountRequest,
1280 fidl::encoding::DefaultFuchsiaResourceDialect,
1281 > for &mut PageRefaultSinkSendPageRefaultCountRequest
1282 {
1283 #[inline]
1284 unsafe fn encode(
1285 self,
1286 encoder: &mut fidl::encoding::Encoder<
1287 '_,
1288 fidl::encoding::DefaultFuchsiaResourceDialect,
1289 >,
1290 offset: usize,
1291 _depth: fidl::encoding::Depth,
1292 ) -> fidl::Result<()> {
1293 encoder.debug_check_bounds::<PageRefaultSinkSendPageRefaultCountRequest>(offset);
1294 fidl::encoding::Encode::<
1296 PageRefaultSinkSendPageRefaultCountRequest,
1297 fidl::encoding::DefaultFuchsiaResourceDialect,
1298 >::encode(
1299 (<fidl::encoding::HandleType<
1300 fidl::Vmo,
1301 { fidl::ObjectType::VMO.into_raw() },
1302 49255,
1303 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1304 &mut self.page_refaults_vmo,
1305 ),),
1306 encoder,
1307 offset,
1308 _depth,
1309 )
1310 }
1311 }
1312 unsafe impl<
1313 T0: fidl::encoding::Encode<
1314 fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 49255>,
1315 fidl::encoding::DefaultFuchsiaResourceDialect,
1316 >,
1317 >
1318 fidl::encoding::Encode<
1319 PageRefaultSinkSendPageRefaultCountRequest,
1320 fidl::encoding::DefaultFuchsiaResourceDialect,
1321 > for (T0,)
1322 {
1323 #[inline]
1324 unsafe fn encode(
1325 self,
1326 encoder: &mut fidl::encoding::Encoder<
1327 '_,
1328 fidl::encoding::DefaultFuchsiaResourceDialect,
1329 >,
1330 offset: usize,
1331 depth: fidl::encoding::Depth,
1332 ) -> fidl::Result<()> {
1333 encoder.debug_check_bounds::<PageRefaultSinkSendPageRefaultCountRequest>(offset);
1334 self.0.encode(encoder, offset + 0, depth)?;
1338 Ok(())
1339 }
1340 }
1341
1342 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1343 for PageRefaultSinkSendPageRefaultCountRequest
1344 {
1345 #[inline(always)]
1346 fn new_empty() -> Self {
1347 Self {
1348 page_refaults_vmo: fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 49255>, fidl::encoding::DefaultFuchsiaResourceDialect),
1349 }
1350 }
1351
1352 #[inline]
1353 unsafe fn decode(
1354 &mut self,
1355 decoder: &mut fidl::encoding::Decoder<
1356 '_,
1357 fidl::encoding::DefaultFuchsiaResourceDialect,
1358 >,
1359 offset: usize,
1360 _depth: fidl::encoding::Depth,
1361 ) -> fidl::Result<()> {
1362 decoder.debug_check_bounds::<Self>(offset);
1363 fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 49255>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.page_refaults_vmo, decoder, offset + 0, _depth)?;
1365 Ok(())
1366 }
1367 }
1368
1369 impl NewPrincipal {
1370 #[inline(always)]
1371 fn max_ordinal_present(&self) -> u64 {
1372 if let Some(_) = self.detailed_attribution {
1373 return 4;
1374 }
1375 if let Some(_) = self.principal_type {
1376 return 3;
1377 }
1378 if let Some(_) = self.description {
1379 return 2;
1380 }
1381 if let Some(_) = self.identifier {
1382 return 1;
1383 }
1384 0
1385 }
1386 }
1387
1388 impl fidl::encoding::ResourceTypeMarker for NewPrincipal {
1389 type Borrowed<'a> = &'a mut Self;
1390 fn take_or_borrow<'a>(
1391 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1392 ) -> Self::Borrowed<'a> {
1393 value
1394 }
1395 }
1396
1397 unsafe impl fidl::encoding::TypeMarker for NewPrincipal {
1398 type Owned = Self;
1399
1400 #[inline(always)]
1401 fn inline_align(_context: fidl::encoding::Context) -> usize {
1402 8
1403 }
1404
1405 #[inline(always)]
1406 fn inline_size(_context: fidl::encoding::Context) -> usize {
1407 16
1408 }
1409 }
1410
1411 unsafe impl fidl::encoding::Encode<NewPrincipal, fidl::encoding::DefaultFuchsiaResourceDialect>
1412 for &mut NewPrincipal
1413 {
1414 unsafe fn encode(
1415 self,
1416 encoder: &mut fidl::encoding::Encoder<
1417 '_,
1418 fidl::encoding::DefaultFuchsiaResourceDialect,
1419 >,
1420 offset: usize,
1421 mut depth: fidl::encoding::Depth,
1422 ) -> fidl::Result<()> {
1423 encoder.debug_check_bounds::<NewPrincipal>(offset);
1424 let max_ordinal: u64 = self.max_ordinal_present();
1426 encoder.write_num(max_ordinal, offset);
1427 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1428 if max_ordinal == 0 {
1430 return Ok(());
1431 }
1432 depth.increment()?;
1433 let envelope_size = 8;
1434 let bytes_len = max_ordinal as usize * envelope_size;
1435 #[allow(unused_variables)]
1436 let offset = encoder.out_of_line_offset(bytes_len);
1437 let mut _prev_end_offset: usize = 0;
1438 if 1 > max_ordinal {
1439 return Ok(());
1440 }
1441
1442 let cur_offset: usize = (1 - 1) * envelope_size;
1445
1446 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1448
1449 fidl::encoding::encode_in_envelope_optional::<
1454 u64,
1455 fidl::encoding::DefaultFuchsiaResourceDialect,
1456 >(
1457 self.identifier.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
1458 encoder,
1459 offset + cur_offset,
1460 depth,
1461 )?;
1462
1463 _prev_end_offset = cur_offset + envelope_size;
1464 if 2 > max_ordinal {
1465 return Ok(());
1466 }
1467
1468 let cur_offset: usize = (2 - 1) * envelope_size;
1471
1472 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1474
1475 fidl::encoding::encode_in_envelope_optional::<
1480 Description,
1481 fidl::encoding::DefaultFuchsiaResourceDialect,
1482 >(
1483 self.description
1484 .as_mut()
1485 .map(<Description as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
1486 encoder,
1487 offset + cur_offset,
1488 depth,
1489 )?;
1490
1491 _prev_end_offset = cur_offset + envelope_size;
1492 if 3 > max_ordinal {
1493 return Ok(());
1494 }
1495
1496 let cur_offset: usize = (3 - 1) * envelope_size;
1499
1500 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1502
1503 fidl::encoding::encode_in_envelope_optional::<
1508 PrincipalType,
1509 fidl::encoding::DefaultFuchsiaResourceDialect,
1510 >(
1511 self.principal_type
1512 .as_ref()
1513 .map(<PrincipalType as fidl::encoding::ValueTypeMarker>::borrow),
1514 encoder,
1515 offset + cur_offset,
1516 depth,
1517 )?;
1518
1519 _prev_end_offset = cur_offset + envelope_size;
1520 if 4 > max_ordinal {
1521 return Ok(());
1522 }
1523
1524 let cur_offset: usize = (4 - 1) * envelope_size;
1527
1528 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1530
1531 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ProviderMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
1536 self.detailed_attribution.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ProviderMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
1537 encoder, offset + cur_offset, depth
1538 )?;
1539
1540 _prev_end_offset = cur_offset + envelope_size;
1541
1542 Ok(())
1543 }
1544 }
1545
1546 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for NewPrincipal {
1547 #[inline(always)]
1548 fn new_empty() -> Self {
1549 Self::default()
1550 }
1551
1552 unsafe fn decode(
1553 &mut self,
1554 decoder: &mut fidl::encoding::Decoder<
1555 '_,
1556 fidl::encoding::DefaultFuchsiaResourceDialect,
1557 >,
1558 offset: usize,
1559 mut depth: fidl::encoding::Depth,
1560 ) -> fidl::Result<()> {
1561 decoder.debug_check_bounds::<Self>(offset);
1562 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1563 None => return Err(fidl::Error::NotNullable),
1564 Some(len) => len,
1565 };
1566 if len == 0 {
1568 return Ok(());
1569 };
1570 depth.increment()?;
1571 let envelope_size = 8;
1572 let bytes_len = len * envelope_size;
1573 let offset = decoder.out_of_line_offset(bytes_len)?;
1574 let mut _next_ordinal_to_read = 0;
1576 let mut next_offset = offset;
1577 let end_offset = offset + bytes_len;
1578 _next_ordinal_to_read += 1;
1579 if next_offset >= end_offset {
1580 return Ok(());
1581 }
1582
1583 while _next_ordinal_to_read < 1 {
1585 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1586 _next_ordinal_to_read += 1;
1587 next_offset += envelope_size;
1588 }
1589
1590 let next_out_of_line = decoder.next_out_of_line();
1591 let handles_before = decoder.remaining_handles();
1592 if let Some((inlined, num_bytes, num_handles)) =
1593 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1594 {
1595 let member_inline_size =
1596 <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1597 if inlined != (member_inline_size <= 4) {
1598 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1599 }
1600 let inner_offset;
1601 let mut inner_depth = depth.clone();
1602 if inlined {
1603 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1604 inner_offset = next_offset;
1605 } else {
1606 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1607 inner_depth.increment()?;
1608 }
1609 let val_ref = self.identifier.get_or_insert_with(|| {
1610 fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
1611 });
1612 fidl::decode!(
1613 u64,
1614 fidl::encoding::DefaultFuchsiaResourceDialect,
1615 val_ref,
1616 decoder,
1617 inner_offset,
1618 inner_depth
1619 )?;
1620 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1621 {
1622 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1623 }
1624 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1625 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1626 }
1627 }
1628
1629 next_offset += envelope_size;
1630 _next_ordinal_to_read += 1;
1631 if next_offset >= end_offset {
1632 return Ok(());
1633 }
1634
1635 while _next_ordinal_to_read < 2 {
1637 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1638 _next_ordinal_to_read += 1;
1639 next_offset += envelope_size;
1640 }
1641
1642 let next_out_of_line = decoder.next_out_of_line();
1643 let handles_before = decoder.remaining_handles();
1644 if let Some((inlined, num_bytes, num_handles)) =
1645 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1646 {
1647 let member_inline_size =
1648 <Description as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1649 if inlined != (member_inline_size <= 4) {
1650 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1651 }
1652 let inner_offset;
1653 let mut inner_depth = depth.clone();
1654 if inlined {
1655 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1656 inner_offset = next_offset;
1657 } else {
1658 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1659 inner_depth.increment()?;
1660 }
1661 let val_ref = self.description.get_or_insert_with(|| {
1662 fidl::new_empty!(Description, fidl::encoding::DefaultFuchsiaResourceDialect)
1663 });
1664 fidl::decode!(
1665 Description,
1666 fidl::encoding::DefaultFuchsiaResourceDialect,
1667 val_ref,
1668 decoder,
1669 inner_offset,
1670 inner_depth
1671 )?;
1672 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1673 {
1674 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1675 }
1676 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1677 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1678 }
1679 }
1680
1681 next_offset += envelope_size;
1682 _next_ordinal_to_read += 1;
1683 if next_offset >= end_offset {
1684 return Ok(());
1685 }
1686
1687 while _next_ordinal_to_read < 3 {
1689 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1690 _next_ordinal_to_read += 1;
1691 next_offset += envelope_size;
1692 }
1693
1694 let next_out_of_line = decoder.next_out_of_line();
1695 let handles_before = decoder.remaining_handles();
1696 if let Some((inlined, num_bytes, num_handles)) =
1697 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1698 {
1699 let member_inline_size =
1700 <PrincipalType as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1701 if inlined != (member_inline_size <= 4) {
1702 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1703 }
1704 let inner_offset;
1705 let mut inner_depth = depth.clone();
1706 if inlined {
1707 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1708 inner_offset = next_offset;
1709 } else {
1710 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1711 inner_depth.increment()?;
1712 }
1713 let val_ref = self.principal_type.get_or_insert_with(|| {
1714 fidl::new_empty!(PrincipalType, fidl::encoding::DefaultFuchsiaResourceDialect)
1715 });
1716 fidl::decode!(
1717 PrincipalType,
1718 fidl::encoding::DefaultFuchsiaResourceDialect,
1719 val_ref,
1720 decoder,
1721 inner_offset,
1722 inner_depth
1723 )?;
1724 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1725 {
1726 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1727 }
1728 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1729 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1730 }
1731 }
1732
1733 next_offset += envelope_size;
1734 _next_ordinal_to_read += 1;
1735 if next_offset >= end_offset {
1736 return Ok(());
1737 }
1738
1739 while _next_ordinal_to_read < 4 {
1741 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1742 _next_ordinal_to_read += 1;
1743 next_offset += envelope_size;
1744 }
1745
1746 let next_out_of_line = decoder.next_out_of_line();
1747 let handles_before = decoder.remaining_handles();
1748 if let Some((inlined, num_bytes, num_handles)) =
1749 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1750 {
1751 let member_inline_size = <fidl::encoding::Endpoint<
1752 fidl::endpoints::ClientEnd<ProviderMarker>,
1753 > as fidl::encoding::TypeMarker>::inline_size(
1754 decoder.context
1755 );
1756 if inlined != (member_inline_size <= 4) {
1757 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1758 }
1759 let inner_offset;
1760 let mut inner_depth = depth.clone();
1761 if inlined {
1762 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1763 inner_offset = next_offset;
1764 } else {
1765 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1766 inner_depth.increment()?;
1767 }
1768 let val_ref = self.detailed_attribution.get_or_insert_with(|| {
1769 fidl::new_empty!(
1770 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ProviderMarker>>,
1771 fidl::encoding::DefaultFuchsiaResourceDialect
1772 )
1773 });
1774 fidl::decode!(
1775 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ProviderMarker>>,
1776 fidl::encoding::DefaultFuchsiaResourceDialect,
1777 val_ref,
1778 decoder,
1779 inner_offset,
1780 inner_depth
1781 )?;
1782 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1783 {
1784 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1785 }
1786 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1787 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1788 }
1789 }
1790
1791 next_offset += envelope_size;
1792
1793 while next_offset < end_offset {
1795 _next_ordinal_to_read += 1;
1796 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1797 next_offset += envelope_size;
1798 }
1799
1800 Ok(())
1801 }
1802 }
1803
1804 impl ProviderGetResponse {
1805 #[inline(always)]
1806 fn max_ordinal_present(&self) -> u64 {
1807 if let Some(_) = self.attributions {
1808 return 1;
1809 }
1810 0
1811 }
1812 }
1813
1814 impl fidl::encoding::ResourceTypeMarker for ProviderGetResponse {
1815 type Borrowed<'a> = &'a mut Self;
1816 fn take_or_borrow<'a>(
1817 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1818 ) -> Self::Borrowed<'a> {
1819 value
1820 }
1821 }
1822
1823 unsafe impl fidl::encoding::TypeMarker for ProviderGetResponse {
1824 type Owned = Self;
1825
1826 #[inline(always)]
1827 fn inline_align(_context: fidl::encoding::Context) -> usize {
1828 8
1829 }
1830
1831 #[inline(always)]
1832 fn inline_size(_context: fidl::encoding::Context) -> usize {
1833 16
1834 }
1835 }
1836
1837 unsafe impl
1838 fidl::encoding::Encode<ProviderGetResponse, fidl::encoding::DefaultFuchsiaResourceDialect>
1839 for &mut ProviderGetResponse
1840 {
1841 unsafe fn encode(
1842 self,
1843 encoder: &mut fidl::encoding::Encoder<
1844 '_,
1845 fidl::encoding::DefaultFuchsiaResourceDialect,
1846 >,
1847 offset: usize,
1848 mut depth: fidl::encoding::Depth,
1849 ) -> fidl::Result<()> {
1850 encoder.debug_check_bounds::<ProviderGetResponse>(offset);
1851 let max_ordinal: u64 = self.max_ordinal_present();
1853 encoder.write_num(max_ordinal, offset);
1854 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1855 if max_ordinal == 0 {
1857 return Ok(());
1858 }
1859 depth.increment()?;
1860 let envelope_size = 8;
1861 let bytes_len = max_ordinal as usize * envelope_size;
1862 #[allow(unused_variables)]
1863 let offset = encoder.out_of_line_offset(bytes_len);
1864 let mut _prev_end_offset: usize = 0;
1865 if 1 > max_ordinal {
1866 return Ok(());
1867 }
1868
1869 let cur_offset: usize = (1 - 1) * envelope_size;
1872
1873 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1875
1876 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<AttributionUpdate>, fidl::encoding::DefaultFuchsiaResourceDialect>(
1881 self.attributions.as_mut().map(<fidl::encoding::UnboundedVector<AttributionUpdate> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
1882 encoder, offset + cur_offset, depth
1883 )?;
1884
1885 _prev_end_offset = cur_offset + envelope_size;
1886
1887 Ok(())
1888 }
1889 }
1890
1891 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1892 for ProviderGetResponse
1893 {
1894 #[inline(always)]
1895 fn new_empty() -> Self {
1896 Self::default()
1897 }
1898
1899 unsafe fn decode(
1900 &mut self,
1901 decoder: &mut fidl::encoding::Decoder<
1902 '_,
1903 fidl::encoding::DefaultFuchsiaResourceDialect,
1904 >,
1905 offset: usize,
1906 mut depth: fidl::encoding::Depth,
1907 ) -> fidl::Result<()> {
1908 decoder.debug_check_bounds::<Self>(offset);
1909 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1910 None => return Err(fidl::Error::NotNullable),
1911 Some(len) => len,
1912 };
1913 if len == 0 {
1915 return Ok(());
1916 };
1917 depth.increment()?;
1918 let envelope_size = 8;
1919 let bytes_len = len * envelope_size;
1920 let offset = decoder.out_of_line_offset(bytes_len)?;
1921 let mut _next_ordinal_to_read = 0;
1923 let mut next_offset = offset;
1924 let end_offset = offset + bytes_len;
1925 _next_ordinal_to_read += 1;
1926 if next_offset >= end_offset {
1927 return Ok(());
1928 }
1929
1930 while _next_ordinal_to_read < 1 {
1932 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1933 _next_ordinal_to_read += 1;
1934 next_offset += envelope_size;
1935 }
1936
1937 let next_out_of_line = decoder.next_out_of_line();
1938 let handles_before = decoder.remaining_handles();
1939 if let Some((inlined, num_bytes, num_handles)) =
1940 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1941 {
1942 let member_inline_size = <fidl::encoding::UnboundedVector<AttributionUpdate> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1943 if inlined != (member_inline_size <= 4) {
1944 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1945 }
1946 let inner_offset;
1947 let mut inner_depth = depth.clone();
1948 if inlined {
1949 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1950 inner_offset = next_offset;
1951 } else {
1952 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1953 inner_depth.increment()?;
1954 }
1955 let val_ref = self.attributions.get_or_insert_with(|| {
1956 fidl::new_empty!(
1957 fidl::encoding::UnboundedVector<AttributionUpdate>,
1958 fidl::encoding::DefaultFuchsiaResourceDialect
1959 )
1960 });
1961 fidl::decode!(
1962 fidl::encoding::UnboundedVector<AttributionUpdate>,
1963 fidl::encoding::DefaultFuchsiaResourceDialect,
1964 val_ref,
1965 decoder,
1966 inner_offset,
1967 inner_depth
1968 )?;
1969 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1970 {
1971 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1972 }
1973 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1974 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1975 }
1976 }
1977
1978 next_offset += envelope_size;
1979
1980 while next_offset < end_offset {
1982 _next_ordinal_to_read += 1;
1983 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1984 next_offset += envelope_size;
1985 }
1986
1987 Ok(())
1988 }
1989 }
1990
1991 impl UpdatedPrincipal {
1992 #[inline(always)]
1993 fn max_ordinal_present(&self) -> u64 {
1994 if let Some(_) = self.resources {
1995 return 2;
1996 }
1997 if let Some(_) = self.identifier {
1998 return 1;
1999 }
2000 0
2001 }
2002 }
2003
2004 impl fidl::encoding::ResourceTypeMarker for UpdatedPrincipal {
2005 type Borrowed<'a> = &'a mut Self;
2006 fn take_or_borrow<'a>(
2007 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2008 ) -> Self::Borrowed<'a> {
2009 value
2010 }
2011 }
2012
2013 unsafe impl fidl::encoding::TypeMarker for UpdatedPrincipal {
2014 type Owned = Self;
2015
2016 #[inline(always)]
2017 fn inline_align(_context: fidl::encoding::Context) -> usize {
2018 8
2019 }
2020
2021 #[inline(always)]
2022 fn inline_size(_context: fidl::encoding::Context) -> usize {
2023 16
2024 }
2025 }
2026
2027 unsafe impl
2028 fidl::encoding::Encode<UpdatedPrincipal, fidl::encoding::DefaultFuchsiaResourceDialect>
2029 for &mut UpdatedPrincipal
2030 {
2031 unsafe fn encode(
2032 self,
2033 encoder: &mut fidl::encoding::Encoder<
2034 '_,
2035 fidl::encoding::DefaultFuchsiaResourceDialect,
2036 >,
2037 offset: usize,
2038 mut depth: fidl::encoding::Depth,
2039 ) -> fidl::Result<()> {
2040 encoder.debug_check_bounds::<UpdatedPrincipal>(offset);
2041 let max_ordinal: u64 = self.max_ordinal_present();
2043 encoder.write_num(max_ordinal, offset);
2044 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2045 if max_ordinal == 0 {
2047 return Ok(());
2048 }
2049 depth.increment()?;
2050 let envelope_size = 8;
2051 let bytes_len = max_ordinal as usize * envelope_size;
2052 #[allow(unused_variables)]
2053 let offset = encoder.out_of_line_offset(bytes_len);
2054 let mut _prev_end_offset: usize = 0;
2055 if 1 > max_ordinal {
2056 return Ok(());
2057 }
2058
2059 let cur_offset: usize = (1 - 1) * envelope_size;
2062
2063 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2065
2066 fidl::encoding::encode_in_envelope_optional::<
2071 u64,
2072 fidl::encoding::DefaultFuchsiaResourceDialect,
2073 >(
2074 self.identifier.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
2075 encoder,
2076 offset + cur_offset,
2077 depth,
2078 )?;
2079
2080 _prev_end_offset = cur_offset + envelope_size;
2081 if 2 > max_ordinal {
2082 return Ok(());
2083 }
2084
2085 let cur_offset: usize = (2 - 1) * envelope_size;
2088
2089 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2091
2092 fidl::encoding::encode_in_envelope_optional::<
2097 Resources,
2098 fidl::encoding::DefaultFuchsiaResourceDialect,
2099 >(
2100 self.resources
2101 .as_mut()
2102 .map(<Resources as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
2103 encoder,
2104 offset + cur_offset,
2105 depth,
2106 )?;
2107
2108 _prev_end_offset = cur_offset + envelope_size;
2109
2110 Ok(())
2111 }
2112 }
2113
2114 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2115 for UpdatedPrincipal
2116 {
2117 #[inline(always)]
2118 fn new_empty() -> Self {
2119 Self::default()
2120 }
2121
2122 unsafe fn decode(
2123 &mut self,
2124 decoder: &mut fidl::encoding::Decoder<
2125 '_,
2126 fidl::encoding::DefaultFuchsiaResourceDialect,
2127 >,
2128 offset: usize,
2129 mut depth: fidl::encoding::Depth,
2130 ) -> fidl::Result<()> {
2131 decoder.debug_check_bounds::<Self>(offset);
2132 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2133 None => return Err(fidl::Error::NotNullable),
2134 Some(len) => len,
2135 };
2136 if len == 0 {
2138 return Ok(());
2139 };
2140 depth.increment()?;
2141 let envelope_size = 8;
2142 let bytes_len = len * envelope_size;
2143 let offset = decoder.out_of_line_offset(bytes_len)?;
2144 let mut _next_ordinal_to_read = 0;
2146 let mut next_offset = offset;
2147 let end_offset = offset + bytes_len;
2148 _next_ordinal_to_read += 1;
2149 if next_offset >= end_offset {
2150 return Ok(());
2151 }
2152
2153 while _next_ordinal_to_read < 1 {
2155 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2156 _next_ordinal_to_read += 1;
2157 next_offset += envelope_size;
2158 }
2159
2160 let next_out_of_line = decoder.next_out_of_line();
2161 let handles_before = decoder.remaining_handles();
2162 if let Some((inlined, num_bytes, num_handles)) =
2163 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2164 {
2165 let member_inline_size =
2166 <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2167 if inlined != (member_inline_size <= 4) {
2168 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2169 }
2170 let inner_offset;
2171 let mut inner_depth = depth.clone();
2172 if inlined {
2173 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2174 inner_offset = next_offset;
2175 } else {
2176 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2177 inner_depth.increment()?;
2178 }
2179 let val_ref = self.identifier.get_or_insert_with(|| {
2180 fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
2181 });
2182 fidl::decode!(
2183 u64,
2184 fidl::encoding::DefaultFuchsiaResourceDialect,
2185 val_ref,
2186 decoder,
2187 inner_offset,
2188 inner_depth
2189 )?;
2190 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2191 {
2192 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2193 }
2194 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2195 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2196 }
2197 }
2198
2199 next_offset += envelope_size;
2200 _next_ordinal_to_read += 1;
2201 if next_offset >= end_offset {
2202 return Ok(());
2203 }
2204
2205 while _next_ordinal_to_read < 2 {
2207 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2208 _next_ordinal_to_read += 1;
2209 next_offset += envelope_size;
2210 }
2211
2212 let next_out_of_line = decoder.next_out_of_line();
2213 let handles_before = decoder.remaining_handles();
2214 if let Some((inlined, num_bytes, num_handles)) =
2215 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2216 {
2217 let member_inline_size =
2218 <Resources as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2219 if inlined != (member_inline_size <= 4) {
2220 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2221 }
2222 let inner_offset;
2223 let mut inner_depth = depth.clone();
2224 if inlined {
2225 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2226 inner_offset = next_offset;
2227 } else {
2228 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2229 inner_depth.increment()?;
2230 }
2231 let val_ref = self.resources.get_or_insert_with(|| {
2232 fidl::new_empty!(Resources, fidl::encoding::DefaultFuchsiaResourceDialect)
2233 });
2234 fidl::decode!(
2235 Resources,
2236 fidl::encoding::DefaultFuchsiaResourceDialect,
2237 val_ref,
2238 decoder,
2239 inner_offset,
2240 inner_depth
2241 )?;
2242 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2243 {
2244 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2245 }
2246 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2247 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2248 }
2249 }
2250
2251 next_offset += envelope_size;
2252
2253 while next_offset < end_offset {
2255 _next_ordinal_to_read += 1;
2256 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2257 next_offset += envelope_size;
2258 }
2259
2260 Ok(())
2261 }
2262 }
2263
2264 impl fidl::encoding::ResourceTypeMarker for AttributionUpdate {
2265 type Borrowed<'a> = &'a mut Self;
2266 fn take_or_borrow<'a>(
2267 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2268 ) -> Self::Borrowed<'a> {
2269 value
2270 }
2271 }
2272
2273 unsafe impl fidl::encoding::TypeMarker for AttributionUpdate {
2274 type Owned = Self;
2275
2276 #[inline(always)]
2277 fn inline_align(_context: fidl::encoding::Context) -> usize {
2278 8
2279 }
2280
2281 #[inline(always)]
2282 fn inline_size(_context: fidl::encoding::Context) -> usize {
2283 16
2284 }
2285 }
2286
2287 unsafe impl
2288 fidl::encoding::Encode<AttributionUpdate, fidl::encoding::DefaultFuchsiaResourceDialect>
2289 for &mut AttributionUpdate
2290 {
2291 #[inline]
2292 unsafe fn encode(
2293 self,
2294 encoder: &mut fidl::encoding::Encoder<
2295 '_,
2296 fidl::encoding::DefaultFuchsiaResourceDialect,
2297 >,
2298 offset: usize,
2299 _depth: fidl::encoding::Depth,
2300 ) -> fidl::Result<()> {
2301 encoder.debug_check_bounds::<AttributionUpdate>(offset);
2302 encoder.write_num::<u64>(self.ordinal(), offset);
2303 match self {
2304 AttributionUpdate::Add(ref mut val) => fidl::encoding::encode_in_envelope::<
2305 NewPrincipal,
2306 fidl::encoding::DefaultFuchsiaResourceDialect,
2307 >(
2308 <NewPrincipal as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
2309 encoder,
2310 offset + 8,
2311 _depth,
2312 ),
2313 AttributionUpdate::Update(ref mut val) => fidl::encoding::encode_in_envelope::<
2314 UpdatedPrincipal,
2315 fidl::encoding::DefaultFuchsiaResourceDialect,
2316 >(
2317 <UpdatedPrincipal as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
2318 encoder,
2319 offset + 8,
2320 _depth,
2321 ),
2322 AttributionUpdate::Remove(ref val) => fidl::encoding::encode_in_envelope::<
2323 u64,
2324 fidl::encoding::DefaultFuchsiaResourceDialect,
2325 >(
2326 <u64 as fidl::encoding::ValueTypeMarker>::borrow(val),
2327 encoder,
2328 offset + 8,
2329 _depth,
2330 ),
2331 AttributionUpdate::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
2332 }
2333 }
2334 }
2335
2336 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2337 for AttributionUpdate
2338 {
2339 #[inline(always)]
2340 fn new_empty() -> Self {
2341 Self::__SourceBreaking { unknown_ordinal: 0 }
2342 }
2343
2344 #[inline]
2345 unsafe fn decode(
2346 &mut self,
2347 decoder: &mut fidl::encoding::Decoder<
2348 '_,
2349 fidl::encoding::DefaultFuchsiaResourceDialect,
2350 >,
2351 offset: usize,
2352 mut depth: fidl::encoding::Depth,
2353 ) -> fidl::Result<()> {
2354 decoder.debug_check_bounds::<Self>(offset);
2355 #[allow(unused_variables)]
2356 let next_out_of_line = decoder.next_out_of_line();
2357 let handles_before = decoder.remaining_handles();
2358 let (ordinal, inlined, num_bytes, num_handles) =
2359 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
2360
2361 let member_inline_size = match ordinal {
2362 1 => <NewPrincipal as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2363 2 => <UpdatedPrincipal as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2364 3 => <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2365 0 => return Err(fidl::Error::UnknownUnionTag),
2366 _ => num_bytes as usize,
2367 };
2368
2369 if inlined != (member_inline_size <= 4) {
2370 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2371 }
2372 let _inner_offset;
2373 if inlined {
2374 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
2375 _inner_offset = offset + 8;
2376 } else {
2377 depth.increment()?;
2378 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2379 }
2380 match ordinal {
2381 1 => {
2382 #[allow(irrefutable_let_patterns)]
2383 if let AttributionUpdate::Add(_) = self {
2384 } else {
2386 *self = AttributionUpdate::Add(fidl::new_empty!(
2388 NewPrincipal,
2389 fidl::encoding::DefaultFuchsiaResourceDialect
2390 ));
2391 }
2392 #[allow(irrefutable_let_patterns)]
2393 if let AttributionUpdate::Add(ref mut val) = self {
2394 fidl::decode!(
2395 NewPrincipal,
2396 fidl::encoding::DefaultFuchsiaResourceDialect,
2397 val,
2398 decoder,
2399 _inner_offset,
2400 depth
2401 )?;
2402 } else {
2403 unreachable!()
2404 }
2405 }
2406 2 => {
2407 #[allow(irrefutable_let_patterns)]
2408 if let AttributionUpdate::Update(_) = self {
2409 } else {
2411 *self = AttributionUpdate::Update(fidl::new_empty!(
2413 UpdatedPrincipal,
2414 fidl::encoding::DefaultFuchsiaResourceDialect
2415 ));
2416 }
2417 #[allow(irrefutable_let_patterns)]
2418 if let AttributionUpdate::Update(ref mut val) = self {
2419 fidl::decode!(
2420 UpdatedPrincipal,
2421 fidl::encoding::DefaultFuchsiaResourceDialect,
2422 val,
2423 decoder,
2424 _inner_offset,
2425 depth
2426 )?;
2427 } else {
2428 unreachable!()
2429 }
2430 }
2431 3 => {
2432 #[allow(irrefutable_let_patterns)]
2433 if let AttributionUpdate::Remove(_) = self {
2434 } else {
2436 *self = AttributionUpdate::Remove(fidl::new_empty!(
2438 u64,
2439 fidl::encoding::DefaultFuchsiaResourceDialect
2440 ));
2441 }
2442 #[allow(irrefutable_let_patterns)]
2443 if let AttributionUpdate::Remove(ref mut val) = self {
2444 fidl::decode!(
2445 u64,
2446 fidl::encoding::DefaultFuchsiaResourceDialect,
2447 val,
2448 decoder,
2449 _inner_offset,
2450 depth
2451 )?;
2452 } else {
2453 unreachable!()
2454 }
2455 }
2456 #[allow(deprecated)]
2457 ordinal => {
2458 for _ in 0..num_handles {
2459 decoder.drop_next_handle()?;
2460 }
2461 *self = AttributionUpdate::__SourceBreaking { unknown_ordinal: ordinal };
2462 }
2463 }
2464 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
2465 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2466 }
2467 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2468 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2469 }
2470 Ok(())
2471 }
2472 }
2473
2474 impl fidl::encoding::ResourceTypeMarker for Description {
2475 type Borrowed<'a> = &'a mut Self;
2476 fn take_or_borrow<'a>(
2477 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2478 ) -> Self::Borrowed<'a> {
2479 value
2480 }
2481 }
2482
2483 unsafe impl fidl::encoding::TypeMarker for Description {
2484 type Owned = Self;
2485
2486 #[inline(always)]
2487 fn inline_align(_context: fidl::encoding::Context) -> usize {
2488 8
2489 }
2490
2491 #[inline(always)]
2492 fn inline_size(_context: fidl::encoding::Context) -> usize {
2493 16
2494 }
2495 }
2496
2497 unsafe impl fidl::encoding::Encode<Description, fidl::encoding::DefaultFuchsiaResourceDialect>
2498 for &mut Description
2499 {
2500 #[inline]
2501 unsafe fn encode(
2502 self,
2503 encoder: &mut fidl::encoding::Encoder<
2504 '_,
2505 fidl::encoding::DefaultFuchsiaResourceDialect,
2506 >,
2507 offset: usize,
2508 _depth: fidl::encoding::Depth,
2509 ) -> fidl::Result<()> {
2510 encoder.debug_check_bounds::<Description>(offset);
2511 encoder.write_num::<u64>(self.ordinal(), offset);
2512 match self {
2513 Description::Component(ref mut val) => fidl::encoding::encode_in_envelope::<
2514 fidl::encoding::HandleType<
2515 fidl::Event,
2516 { fidl::ObjectType::EVENT.into_raw() },
2517 2147483648,
2518 >,
2519 fidl::encoding::DefaultFuchsiaResourceDialect,
2520 >(
2521 <fidl::encoding::HandleType<
2522 fidl::Event,
2523 { fidl::ObjectType::EVENT.into_raw() },
2524 2147483648,
2525 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2526 val
2527 ),
2528 encoder,
2529 offset + 8,
2530 _depth,
2531 ),
2532 Description::Part(ref val) => fidl::encoding::encode_in_envelope::<
2533 fidl::encoding::UnboundedString,
2534 fidl::encoding::DefaultFuchsiaResourceDialect,
2535 >(
2536 <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
2537 val,
2538 ),
2539 encoder,
2540 offset + 8,
2541 _depth,
2542 ),
2543 Description::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
2544 }
2545 }
2546 }
2547
2548 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for Description {
2549 #[inline(always)]
2550 fn new_empty() -> Self {
2551 Self::__SourceBreaking { unknown_ordinal: 0 }
2552 }
2553
2554 #[inline]
2555 unsafe fn decode(
2556 &mut self,
2557 decoder: &mut fidl::encoding::Decoder<
2558 '_,
2559 fidl::encoding::DefaultFuchsiaResourceDialect,
2560 >,
2561 offset: usize,
2562 mut depth: fidl::encoding::Depth,
2563 ) -> fidl::Result<()> {
2564 decoder.debug_check_bounds::<Self>(offset);
2565 #[allow(unused_variables)]
2566 let next_out_of_line = decoder.next_out_of_line();
2567 let handles_before = decoder.remaining_handles();
2568 let (ordinal, inlined, num_bytes, num_handles) =
2569 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
2570
2571 let member_inline_size = match ordinal {
2572 1 => <fidl::encoding::HandleType<
2573 fidl::Event,
2574 { fidl::ObjectType::EVENT.into_raw() },
2575 2147483648,
2576 > as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2577 2 => <fidl::encoding::UnboundedString as fidl::encoding::TypeMarker>::inline_size(
2578 decoder.context,
2579 ),
2580 0 => return Err(fidl::Error::UnknownUnionTag),
2581 _ => num_bytes as usize,
2582 };
2583
2584 if inlined != (member_inline_size <= 4) {
2585 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2586 }
2587 let _inner_offset;
2588 if inlined {
2589 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
2590 _inner_offset = offset + 8;
2591 } else {
2592 depth.increment()?;
2593 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2594 }
2595 match ordinal {
2596 1 => {
2597 #[allow(irrefutable_let_patterns)]
2598 if let Description::Component(_) = self {
2599 } else {
2601 *self = Description::Component(
2603 fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
2604 );
2605 }
2606 #[allow(irrefutable_let_patterns)]
2607 if let Description::Component(ref mut val) = self {
2608 fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val, decoder, _inner_offset, depth)?;
2609 } else {
2610 unreachable!()
2611 }
2612 }
2613 2 => {
2614 #[allow(irrefutable_let_patterns)]
2615 if let Description::Part(_) = self {
2616 } else {
2618 *self = Description::Part(fidl::new_empty!(
2620 fidl::encoding::UnboundedString,
2621 fidl::encoding::DefaultFuchsiaResourceDialect
2622 ));
2623 }
2624 #[allow(irrefutable_let_patterns)]
2625 if let Description::Part(ref mut val) = self {
2626 fidl::decode!(
2627 fidl::encoding::UnboundedString,
2628 fidl::encoding::DefaultFuchsiaResourceDialect,
2629 val,
2630 decoder,
2631 _inner_offset,
2632 depth
2633 )?;
2634 } else {
2635 unreachable!()
2636 }
2637 }
2638 #[allow(deprecated)]
2639 ordinal => {
2640 for _ in 0..num_handles {
2641 decoder.drop_next_handle()?;
2642 }
2643 *self = Description::__SourceBreaking { unknown_ordinal: ordinal };
2644 }
2645 }
2646 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
2647 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2648 }
2649 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2650 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2651 }
2652 Ok(())
2653 }
2654 }
2655
2656 impl fidl::encoding::ResourceTypeMarker for Resources {
2657 type Borrowed<'a> = &'a mut Self;
2658 fn take_or_borrow<'a>(
2659 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2660 ) -> Self::Borrowed<'a> {
2661 value
2662 }
2663 }
2664
2665 unsafe impl fidl::encoding::TypeMarker for Resources {
2666 type Owned = Self;
2667
2668 #[inline(always)]
2669 fn inline_align(_context: fidl::encoding::Context) -> usize {
2670 8
2671 }
2672
2673 #[inline(always)]
2674 fn inline_size(_context: fidl::encoding::Context) -> usize {
2675 16
2676 }
2677 }
2678
2679 unsafe impl fidl::encoding::Encode<Resources, fidl::encoding::DefaultFuchsiaResourceDialect>
2680 for &mut Resources
2681 {
2682 #[inline]
2683 unsafe fn encode(
2684 self,
2685 encoder: &mut fidl::encoding::Encoder<
2686 '_,
2687 fidl::encoding::DefaultFuchsiaResourceDialect,
2688 >,
2689 offset: usize,
2690 _depth: fidl::encoding::Depth,
2691 ) -> fidl::Result<()> {
2692 encoder.debug_check_bounds::<Resources>(offset);
2693 encoder.write_num::<u64>(self.ordinal(), offset);
2694 match self {
2695 Resources::Data(ref val) => fidl::encoding::encode_in_envelope::<
2696 Data,
2697 fidl::encoding::DefaultFuchsiaResourceDialect,
2698 >(
2699 <Data as fidl::encoding::ValueTypeMarker>::borrow(val),
2700 encoder,
2701 offset + 8,
2702 _depth,
2703 ),
2704 Resources::Buffer(ref mut val) => fidl::encoding::encode_in_envelope::<
2705 fidl::encoding::HandleType<
2706 fidl::Vmo,
2707 { fidl::ObjectType::VMO.into_raw() },
2708 2147483648,
2709 >,
2710 fidl::encoding::DefaultFuchsiaResourceDialect,
2711 >(
2712 <fidl::encoding::HandleType<
2713 fidl::Vmo,
2714 { fidl::ObjectType::VMO.into_raw() },
2715 2147483648,
2716 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2717 val
2718 ),
2719 encoder,
2720 offset + 8,
2721 _depth,
2722 ),
2723 Resources::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
2724 }
2725 }
2726 }
2727
2728 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for Resources {
2729 #[inline(always)]
2730 fn new_empty() -> Self {
2731 Self::__SourceBreaking { unknown_ordinal: 0 }
2732 }
2733
2734 #[inline]
2735 unsafe fn decode(
2736 &mut self,
2737 decoder: &mut fidl::encoding::Decoder<
2738 '_,
2739 fidl::encoding::DefaultFuchsiaResourceDialect,
2740 >,
2741 offset: usize,
2742 mut depth: fidl::encoding::Depth,
2743 ) -> fidl::Result<()> {
2744 decoder.debug_check_bounds::<Self>(offset);
2745 #[allow(unused_variables)]
2746 let next_out_of_line = decoder.next_out_of_line();
2747 let handles_before = decoder.remaining_handles();
2748 let (ordinal, inlined, num_bytes, num_handles) =
2749 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
2750
2751 let member_inline_size = match ordinal {
2752 1 => <Data as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2753 2 => <fidl::encoding::HandleType<
2754 fidl::Vmo,
2755 { fidl::ObjectType::VMO.into_raw() },
2756 2147483648,
2757 > as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2758 0 => return Err(fidl::Error::UnknownUnionTag),
2759 _ => num_bytes as usize,
2760 };
2761
2762 if inlined != (member_inline_size <= 4) {
2763 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2764 }
2765 let _inner_offset;
2766 if inlined {
2767 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
2768 _inner_offset = offset + 8;
2769 } else {
2770 depth.increment()?;
2771 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2772 }
2773 match ordinal {
2774 1 => {
2775 #[allow(irrefutable_let_patterns)]
2776 if let Resources::Data(_) = self {
2777 } else {
2779 *self = Resources::Data(fidl::new_empty!(
2781 Data,
2782 fidl::encoding::DefaultFuchsiaResourceDialect
2783 ));
2784 }
2785 #[allow(irrefutable_let_patterns)]
2786 if let Resources::Data(ref mut val) = self {
2787 fidl::decode!(
2788 Data,
2789 fidl::encoding::DefaultFuchsiaResourceDialect,
2790 val,
2791 decoder,
2792 _inner_offset,
2793 depth
2794 )?;
2795 } else {
2796 unreachable!()
2797 }
2798 }
2799 2 => {
2800 #[allow(irrefutable_let_patterns)]
2801 if let Resources::Buffer(_) = self {
2802 } else {
2804 *self = Resources::Buffer(
2806 fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
2807 );
2808 }
2809 #[allow(irrefutable_let_patterns)]
2810 if let Resources::Buffer(ref mut val) = self {
2811 fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val, decoder, _inner_offset, depth)?;
2812 } else {
2813 unreachable!()
2814 }
2815 }
2816 #[allow(deprecated)]
2817 ordinal => {
2818 for _ in 0..num_handles {
2819 decoder.drop_next_handle()?;
2820 }
2821 *self = Resources::__SourceBreaking { unknown_ordinal: ordinal };
2822 }
2823 }
2824 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
2825 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2826 }
2827 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2828 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2829 }
2830 Ok(())
2831 }
2832 }
2833}