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::Handle {
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 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
674 self.inner.shutdown_with_epitaph(status)
675 }
676
677 fn is_closed(&self) -> bool {
678 self.inner.channel().is_closed()
679 }
680 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
681 self.inner.channel().on_closed()
682 }
683
684 #[cfg(target_os = "fuchsia")]
685 fn signal_peer(
686 &self,
687 clear_mask: zx::Signals,
688 set_mask: zx::Signals,
689 ) -> Result<(), zx_status::Status> {
690 use fidl::Peered;
691 self.inner.channel().signal_peer(clear_mask, set_mask)
692 }
693}
694
695impl PageRefaultSinkControlHandle {}
696
697#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
698pub struct ProviderMarker;
699
700impl fidl::endpoints::ProtocolMarker for ProviderMarker {
701 type Proxy = ProviderProxy;
702 type RequestStream = ProviderRequestStream;
703 #[cfg(target_os = "fuchsia")]
704 type SynchronousProxy = ProviderSynchronousProxy;
705
706 const DEBUG_NAME: &'static str = "fuchsia.memory.attribution.Provider";
707}
708impl fidl::endpoints::DiscoverableProtocolMarker for ProviderMarker {}
709pub type ProviderGetResult = Result<ProviderGetResponse, Error>;
710
711pub trait ProviderProxyInterface: Send + Sync {
712 type GetResponseFut: std::future::Future<Output = Result<ProviderGetResult, fidl::Error>> + Send;
713 fn r#get(&self) -> Self::GetResponseFut;
714}
715#[derive(Debug)]
716#[cfg(target_os = "fuchsia")]
717pub struct ProviderSynchronousProxy {
718 client: fidl::client::sync::Client,
719}
720
721#[cfg(target_os = "fuchsia")]
722impl fidl::endpoints::SynchronousProxy for ProviderSynchronousProxy {
723 type Proxy = ProviderProxy;
724 type Protocol = ProviderMarker;
725
726 fn from_channel(inner: fidl::Channel) -> Self {
727 Self::new(inner)
728 }
729
730 fn into_channel(self) -> fidl::Channel {
731 self.client.into_channel()
732 }
733
734 fn as_channel(&self) -> &fidl::Channel {
735 self.client.as_channel()
736 }
737}
738
739#[cfg(target_os = "fuchsia")]
740impl ProviderSynchronousProxy {
741 pub fn new(channel: fidl::Channel) -> Self {
742 let protocol_name = <ProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
743 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
744 }
745
746 pub fn into_channel(self) -> fidl::Channel {
747 self.client.into_channel()
748 }
749
750 pub fn wait_for_event(
753 &self,
754 deadline: zx::MonotonicInstant,
755 ) -> Result<ProviderEvent, fidl::Error> {
756 ProviderEvent::decode(self.client.wait_for_event(deadline)?)
757 }
758
759 pub fn r#get(
773 &self,
774 ___deadline: zx::MonotonicInstant,
775 ) -> Result<ProviderGetResult, fidl::Error> {
776 let _response = self.client.send_query::<
777 fidl::encoding::EmptyPayload,
778 fidl::encoding::FlexibleResultType<ProviderGetResponse, Error>,
779 >(
780 (),
781 0x7a2f2d2cdcfcc945,
782 fidl::encoding::DynamicFlags::FLEXIBLE,
783 ___deadline,
784 )?
785 .into_result::<ProviderMarker>("get")?;
786 Ok(_response.map(|x| x))
787 }
788}
789
790#[cfg(target_os = "fuchsia")]
791impl From<ProviderSynchronousProxy> for zx::Handle {
792 fn from(value: ProviderSynchronousProxy) -> Self {
793 value.into_channel().into()
794 }
795}
796
797#[cfg(target_os = "fuchsia")]
798impl From<fidl::Channel> for ProviderSynchronousProxy {
799 fn from(value: fidl::Channel) -> Self {
800 Self::new(value)
801 }
802}
803
804#[cfg(target_os = "fuchsia")]
805impl fidl::endpoints::FromClient for ProviderSynchronousProxy {
806 type Protocol = ProviderMarker;
807
808 fn from_client(value: fidl::endpoints::ClientEnd<ProviderMarker>) -> Self {
809 Self::new(value.into_channel())
810 }
811}
812
813#[derive(Debug, Clone)]
814pub struct ProviderProxy {
815 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
816}
817
818impl fidl::endpoints::Proxy for ProviderProxy {
819 type Protocol = ProviderMarker;
820
821 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
822 Self::new(inner)
823 }
824
825 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
826 self.client.into_channel().map_err(|client| Self { client })
827 }
828
829 fn as_channel(&self) -> &::fidl::AsyncChannel {
830 self.client.as_channel()
831 }
832}
833
834impl ProviderProxy {
835 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
837 let protocol_name = <ProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
838 Self { client: fidl::client::Client::new(channel, protocol_name) }
839 }
840
841 pub fn take_event_stream(&self) -> ProviderEventStream {
847 ProviderEventStream { event_receiver: self.client.take_event_receiver() }
848 }
849
850 pub fn r#get(
864 &self,
865 ) -> fidl::client::QueryResponseFut<
866 ProviderGetResult,
867 fidl::encoding::DefaultFuchsiaResourceDialect,
868 > {
869 ProviderProxyInterface::r#get(self)
870 }
871}
872
873impl ProviderProxyInterface for ProviderProxy {
874 type GetResponseFut = fidl::client::QueryResponseFut<
875 ProviderGetResult,
876 fidl::encoding::DefaultFuchsiaResourceDialect,
877 >;
878 fn r#get(&self) -> Self::GetResponseFut {
879 fn _decode(
880 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
881 ) -> Result<ProviderGetResult, fidl::Error> {
882 let _response = fidl::client::decode_transaction_body::<
883 fidl::encoding::FlexibleResultType<ProviderGetResponse, Error>,
884 fidl::encoding::DefaultFuchsiaResourceDialect,
885 0x7a2f2d2cdcfcc945,
886 >(_buf?)?
887 .into_result::<ProviderMarker>("get")?;
888 Ok(_response.map(|x| x))
889 }
890 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ProviderGetResult>(
891 (),
892 0x7a2f2d2cdcfcc945,
893 fidl::encoding::DynamicFlags::FLEXIBLE,
894 _decode,
895 )
896 }
897}
898
899pub struct ProviderEventStream {
900 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
901}
902
903impl std::marker::Unpin for ProviderEventStream {}
904
905impl futures::stream::FusedStream for ProviderEventStream {
906 fn is_terminated(&self) -> bool {
907 self.event_receiver.is_terminated()
908 }
909}
910
911impl futures::Stream for ProviderEventStream {
912 type Item = Result<ProviderEvent, fidl::Error>;
913
914 fn poll_next(
915 mut self: std::pin::Pin<&mut Self>,
916 cx: &mut std::task::Context<'_>,
917 ) -> std::task::Poll<Option<Self::Item>> {
918 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
919 &mut self.event_receiver,
920 cx
921 )?) {
922 Some(buf) => std::task::Poll::Ready(Some(ProviderEvent::decode(buf))),
923 None => std::task::Poll::Ready(None),
924 }
925 }
926}
927
928#[derive(Debug)]
929pub enum ProviderEvent {
930 #[non_exhaustive]
931 _UnknownEvent {
932 ordinal: u64,
934 },
935}
936
937impl ProviderEvent {
938 fn decode(
940 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
941 ) -> Result<ProviderEvent, fidl::Error> {
942 let (bytes, _handles) = buf.split_mut();
943 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
944 debug_assert_eq!(tx_header.tx_id, 0);
945 match tx_header.ordinal {
946 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
947 Ok(ProviderEvent::_UnknownEvent { ordinal: tx_header.ordinal })
948 }
949 _ => Err(fidl::Error::UnknownOrdinal {
950 ordinal: tx_header.ordinal,
951 protocol_name: <ProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
952 }),
953 }
954 }
955}
956
957pub struct ProviderRequestStream {
959 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
960 is_terminated: bool,
961}
962
963impl std::marker::Unpin for ProviderRequestStream {}
964
965impl futures::stream::FusedStream for ProviderRequestStream {
966 fn is_terminated(&self) -> bool {
967 self.is_terminated
968 }
969}
970
971impl fidl::endpoints::RequestStream for ProviderRequestStream {
972 type Protocol = ProviderMarker;
973 type ControlHandle = ProviderControlHandle;
974
975 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
976 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
977 }
978
979 fn control_handle(&self) -> Self::ControlHandle {
980 ProviderControlHandle { inner: self.inner.clone() }
981 }
982
983 fn into_inner(
984 self,
985 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
986 {
987 (self.inner, self.is_terminated)
988 }
989
990 fn from_inner(
991 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
992 is_terminated: bool,
993 ) -> Self {
994 Self { inner, is_terminated }
995 }
996}
997
998impl futures::Stream for ProviderRequestStream {
999 type Item = Result<ProviderRequest, fidl::Error>;
1000
1001 fn poll_next(
1002 mut self: std::pin::Pin<&mut Self>,
1003 cx: &mut std::task::Context<'_>,
1004 ) -> std::task::Poll<Option<Self::Item>> {
1005 let this = &mut *self;
1006 if this.inner.check_shutdown(cx) {
1007 this.is_terminated = true;
1008 return std::task::Poll::Ready(None);
1009 }
1010 if this.is_terminated {
1011 panic!("polled ProviderRequestStream after completion");
1012 }
1013 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1014 |bytes, handles| {
1015 match this.inner.channel().read_etc(cx, bytes, handles) {
1016 std::task::Poll::Ready(Ok(())) => {}
1017 std::task::Poll::Pending => return std::task::Poll::Pending,
1018 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1019 this.is_terminated = true;
1020 return std::task::Poll::Ready(None);
1021 }
1022 std::task::Poll::Ready(Err(e)) => {
1023 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1024 e.into(),
1025 ))));
1026 }
1027 }
1028
1029 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1031
1032 std::task::Poll::Ready(Some(match header.ordinal {
1033 0x7a2f2d2cdcfcc945 => {
1034 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1035 let mut req = fidl::new_empty!(
1036 fidl::encoding::EmptyPayload,
1037 fidl::encoding::DefaultFuchsiaResourceDialect
1038 );
1039 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1040 let control_handle = ProviderControlHandle { inner: this.inner.clone() };
1041 Ok(ProviderRequest::Get {
1042 responder: ProviderGetResponder {
1043 control_handle: std::mem::ManuallyDrop::new(control_handle),
1044 tx_id: header.tx_id,
1045 },
1046 })
1047 }
1048 _ if header.tx_id == 0
1049 && header
1050 .dynamic_flags()
1051 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1052 {
1053 Ok(ProviderRequest::_UnknownMethod {
1054 ordinal: header.ordinal,
1055 control_handle: ProviderControlHandle { inner: this.inner.clone() },
1056 method_type: fidl::MethodType::OneWay,
1057 })
1058 }
1059 _ if header
1060 .dynamic_flags()
1061 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1062 {
1063 this.inner.send_framework_err(
1064 fidl::encoding::FrameworkErr::UnknownMethod,
1065 header.tx_id,
1066 header.ordinal,
1067 header.dynamic_flags(),
1068 (bytes, handles),
1069 )?;
1070 Ok(ProviderRequest::_UnknownMethod {
1071 ordinal: header.ordinal,
1072 control_handle: ProviderControlHandle { inner: this.inner.clone() },
1073 method_type: fidl::MethodType::TwoWay,
1074 })
1075 }
1076 _ => Err(fidl::Error::UnknownOrdinal {
1077 ordinal: header.ordinal,
1078 protocol_name:
1079 <ProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1080 }),
1081 }))
1082 },
1083 )
1084 }
1085}
1086
1087#[derive(Debug)]
1103pub enum ProviderRequest {
1104 Get { responder: ProviderGetResponder },
1118 #[non_exhaustive]
1120 _UnknownMethod {
1121 ordinal: u64,
1123 control_handle: ProviderControlHandle,
1124 method_type: fidl::MethodType,
1125 },
1126}
1127
1128impl ProviderRequest {
1129 #[allow(irrefutable_let_patterns)]
1130 pub fn into_get(self) -> Option<(ProviderGetResponder)> {
1131 if let ProviderRequest::Get { responder } = self { Some((responder)) } else { None }
1132 }
1133
1134 pub fn method_name(&self) -> &'static str {
1136 match *self {
1137 ProviderRequest::Get { .. } => "get",
1138 ProviderRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
1139 "unknown one-way method"
1140 }
1141 ProviderRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
1142 "unknown two-way method"
1143 }
1144 }
1145 }
1146}
1147
1148#[derive(Debug, Clone)]
1149pub struct ProviderControlHandle {
1150 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1151}
1152
1153impl fidl::endpoints::ControlHandle for ProviderControlHandle {
1154 fn shutdown(&self) {
1155 self.inner.shutdown()
1156 }
1157 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1158 self.inner.shutdown_with_epitaph(status)
1159 }
1160
1161 fn is_closed(&self) -> bool {
1162 self.inner.channel().is_closed()
1163 }
1164 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1165 self.inner.channel().on_closed()
1166 }
1167
1168 #[cfg(target_os = "fuchsia")]
1169 fn signal_peer(
1170 &self,
1171 clear_mask: zx::Signals,
1172 set_mask: zx::Signals,
1173 ) -> Result<(), zx_status::Status> {
1174 use fidl::Peered;
1175 self.inner.channel().signal_peer(clear_mask, set_mask)
1176 }
1177}
1178
1179impl ProviderControlHandle {}
1180
1181#[must_use = "FIDL methods require a response to be sent"]
1182#[derive(Debug)]
1183pub struct ProviderGetResponder {
1184 control_handle: std::mem::ManuallyDrop<ProviderControlHandle>,
1185 tx_id: u32,
1186}
1187
1188impl std::ops::Drop for ProviderGetResponder {
1192 fn drop(&mut self) {
1193 self.control_handle.shutdown();
1194 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1196 }
1197}
1198
1199impl fidl::endpoints::Responder for ProviderGetResponder {
1200 type ControlHandle = ProviderControlHandle;
1201
1202 fn control_handle(&self) -> &ProviderControlHandle {
1203 &self.control_handle
1204 }
1205
1206 fn drop_without_shutdown(mut self) {
1207 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1209 std::mem::forget(self);
1211 }
1212}
1213
1214impl ProviderGetResponder {
1215 pub fn send(self, mut result: Result<ProviderGetResponse, Error>) -> Result<(), fidl::Error> {
1219 let _result = self.send_raw(result);
1220 if _result.is_err() {
1221 self.control_handle.shutdown();
1222 }
1223 self.drop_without_shutdown();
1224 _result
1225 }
1226
1227 pub fn send_no_shutdown_on_err(
1229 self,
1230 mut result: Result<ProviderGetResponse, Error>,
1231 ) -> Result<(), fidl::Error> {
1232 let _result = self.send_raw(result);
1233 self.drop_without_shutdown();
1234 _result
1235 }
1236
1237 fn send_raw(&self, mut result: Result<ProviderGetResponse, Error>) -> Result<(), fidl::Error> {
1238 self.control_handle
1239 .inner
1240 .send::<fidl::encoding::FlexibleResultType<ProviderGetResponse, Error>>(
1241 fidl::encoding::FlexibleResult::new(result.as_mut().map_err(|e| *e)),
1242 self.tx_id,
1243 0x7a2f2d2cdcfcc945,
1244 fidl::encoding::DynamicFlags::FLEXIBLE,
1245 )
1246 }
1247}
1248
1249mod internal {
1250 use super::*;
1251
1252 impl fidl::encoding::ResourceTypeMarker for PageRefaultSinkSendPageRefaultCountRequest {
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 PageRefaultSinkSendPageRefaultCountRequest {
1262 type Owned = Self;
1263
1264 #[inline(always)]
1265 fn inline_align(_context: fidl::encoding::Context) -> usize {
1266 4
1267 }
1268
1269 #[inline(always)]
1270 fn inline_size(_context: fidl::encoding::Context) -> usize {
1271 4
1272 }
1273 }
1274
1275 unsafe impl
1276 fidl::encoding::Encode<
1277 PageRefaultSinkSendPageRefaultCountRequest,
1278 fidl::encoding::DefaultFuchsiaResourceDialect,
1279 > for &mut PageRefaultSinkSendPageRefaultCountRequest
1280 {
1281 #[inline]
1282 unsafe fn encode(
1283 self,
1284 encoder: &mut fidl::encoding::Encoder<
1285 '_,
1286 fidl::encoding::DefaultFuchsiaResourceDialect,
1287 >,
1288 offset: usize,
1289 _depth: fidl::encoding::Depth,
1290 ) -> fidl::Result<()> {
1291 encoder.debug_check_bounds::<PageRefaultSinkSendPageRefaultCountRequest>(offset);
1292 fidl::encoding::Encode::<
1294 PageRefaultSinkSendPageRefaultCountRequest,
1295 fidl::encoding::DefaultFuchsiaResourceDialect,
1296 >::encode(
1297 (<fidl::encoding::HandleType<
1298 fidl::Vmo,
1299 { fidl::ObjectType::VMO.into_raw() },
1300 49255,
1301 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1302 &mut self.page_refaults_vmo,
1303 ),),
1304 encoder,
1305 offset,
1306 _depth,
1307 )
1308 }
1309 }
1310 unsafe impl<
1311 T0: fidl::encoding::Encode<
1312 fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 49255>,
1313 fidl::encoding::DefaultFuchsiaResourceDialect,
1314 >,
1315 >
1316 fidl::encoding::Encode<
1317 PageRefaultSinkSendPageRefaultCountRequest,
1318 fidl::encoding::DefaultFuchsiaResourceDialect,
1319 > for (T0,)
1320 {
1321 #[inline]
1322 unsafe fn encode(
1323 self,
1324 encoder: &mut fidl::encoding::Encoder<
1325 '_,
1326 fidl::encoding::DefaultFuchsiaResourceDialect,
1327 >,
1328 offset: usize,
1329 depth: fidl::encoding::Depth,
1330 ) -> fidl::Result<()> {
1331 encoder.debug_check_bounds::<PageRefaultSinkSendPageRefaultCountRequest>(offset);
1332 self.0.encode(encoder, offset + 0, depth)?;
1336 Ok(())
1337 }
1338 }
1339
1340 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1341 for PageRefaultSinkSendPageRefaultCountRequest
1342 {
1343 #[inline(always)]
1344 fn new_empty() -> Self {
1345 Self {
1346 page_refaults_vmo: fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 49255>, fidl::encoding::DefaultFuchsiaResourceDialect),
1347 }
1348 }
1349
1350 #[inline]
1351 unsafe fn decode(
1352 &mut self,
1353 decoder: &mut fidl::encoding::Decoder<
1354 '_,
1355 fidl::encoding::DefaultFuchsiaResourceDialect,
1356 >,
1357 offset: usize,
1358 _depth: fidl::encoding::Depth,
1359 ) -> fidl::Result<()> {
1360 decoder.debug_check_bounds::<Self>(offset);
1361 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)?;
1363 Ok(())
1364 }
1365 }
1366
1367 impl NewPrincipal {
1368 #[inline(always)]
1369 fn max_ordinal_present(&self) -> u64 {
1370 if let Some(_) = self.detailed_attribution {
1371 return 4;
1372 }
1373 if let Some(_) = self.principal_type {
1374 return 3;
1375 }
1376 if let Some(_) = self.description {
1377 return 2;
1378 }
1379 if let Some(_) = self.identifier {
1380 return 1;
1381 }
1382 0
1383 }
1384 }
1385
1386 impl fidl::encoding::ResourceTypeMarker for NewPrincipal {
1387 type Borrowed<'a> = &'a mut Self;
1388 fn take_or_borrow<'a>(
1389 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1390 ) -> Self::Borrowed<'a> {
1391 value
1392 }
1393 }
1394
1395 unsafe impl fidl::encoding::TypeMarker for NewPrincipal {
1396 type Owned = Self;
1397
1398 #[inline(always)]
1399 fn inline_align(_context: fidl::encoding::Context) -> usize {
1400 8
1401 }
1402
1403 #[inline(always)]
1404 fn inline_size(_context: fidl::encoding::Context) -> usize {
1405 16
1406 }
1407 }
1408
1409 unsafe impl fidl::encoding::Encode<NewPrincipal, fidl::encoding::DefaultFuchsiaResourceDialect>
1410 for &mut NewPrincipal
1411 {
1412 unsafe fn encode(
1413 self,
1414 encoder: &mut fidl::encoding::Encoder<
1415 '_,
1416 fidl::encoding::DefaultFuchsiaResourceDialect,
1417 >,
1418 offset: usize,
1419 mut depth: fidl::encoding::Depth,
1420 ) -> fidl::Result<()> {
1421 encoder.debug_check_bounds::<NewPrincipal>(offset);
1422 let max_ordinal: u64 = self.max_ordinal_present();
1424 encoder.write_num(max_ordinal, offset);
1425 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1426 if max_ordinal == 0 {
1428 return Ok(());
1429 }
1430 depth.increment()?;
1431 let envelope_size = 8;
1432 let bytes_len = max_ordinal as usize * envelope_size;
1433 #[allow(unused_variables)]
1434 let offset = encoder.out_of_line_offset(bytes_len);
1435 let mut _prev_end_offset: usize = 0;
1436 if 1 > max_ordinal {
1437 return Ok(());
1438 }
1439
1440 let cur_offset: usize = (1 - 1) * envelope_size;
1443
1444 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1446
1447 fidl::encoding::encode_in_envelope_optional::<
1452 u64,
1453 fidl::encoding::DefaultFuchsiaResourceDialect,
1454 >(
1455 self.identifier.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
1456 encoder,
1457 offset + cur_offset,
1458 depth,
1459 )?;
1460
1461 _prev_end_offset = cur_offset + envelope_size;
1462 if 2 > max_ordinal {
1463 return Ok(());
1464 }
1465
1466 let cur_offset: usize = (2 - 1) * envelope_size;
1469
1470 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1472
1473 fidl::encoding::encode_in_envelope_optional::<
1478 Description,
1479 fidl::encoding::DefaultFuchsiaResourceDialect,
1480 >(
1481 self.description
1482 .as_mut()
1483 .map(<Description as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
1484 encoder,
1485 offset + cur_offset,
1486 depth,
1487 )?;
1488
1489 _prev_end_offset = cur_offset + envelope_size;
1490 if 3 > max_ordinal {
1491 return Ok(());
1492 }
1493
1494 let cur_offset: usize = (3 - 1) * envelope_size;
1497
1498 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1500
1501 fidl::encoding::encode_in_envelope_optional::<
1506 PrincipalType,
1507 fidl::encoding::DefaultFuchsiaResourceDialect,
1508 >(
1509 self.principal_type
1510 .as_ref()
1511 .map(<PrincipalType as fidl::encoding::ValueTypeMarker>::borrow),
1512 encoder,
1513 offset + cur_offset,
1514 depth,
1515 )?;
1516
1517 _prev_end_offset = cur_offset + envelope_size;
1518 if 4 > max_ordinal {
1519 return Ok(());
1520 }
1521
1522 let cur_offset: usize = (4 - 1) * envelope_size;
1525
1526 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1528
1529 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ProviderMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
1534 self.detailed_attribution.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ProviderMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
1535 encoder, offset + cur_offset, depth
1536 )?;
1537
1538 _prev_end_offset = cur_offset + envelope_size;
1539
1540 Ok(())
1541 }
1542 }
1543
1544 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for NewPrincipal {
1545 #[inline(always)]
1546 fn new_empty() -> Self {
1547 Self::default()
1548 }
1549
1550 unsafe fn decode(
1551 &mut self,
1552 decoder: &mut fidl::encoding::Decoder<
1553 '_,
1554 fidl::encoding::DefaultFuchsiaResourceDialect,
1555 >,
1556 offset: usize,
1557 mut depth: fidl::encoding::Depth,
1558 ) -> fidl::Result<()> {
1559 decoder.debug_check_bounds::<Self>(offset);
1560 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1561 None => return Err(fidl::Error::NotNullable),
1562 Some(len) => len,
1563 };
1564 if len == 0 {
1566 return Ok(());
1567 };
1568 depth.increment()?;
1569 let envelope_size = 8;
1570 let bytes_len = len * envelope_size;
1571 let offset = decoder.out_of_line_offset(bytes_len)?;
1572 let mut _next_ordinal_to_read = 0;
1574 let mut next_offset = offset;
1575 let end_offset = offset + bytes_len;
1576 _next_ordinal_to_read += 1;
1577 if next_offset >= end_offset {
1578 return Ok(());
1579 }
1580
1581 while _next_ordinal_to_read < 1 {
1583 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1584 _next_ordinal_to_read += 1;
1585 next_offset += envelope_size;
1586 }
1587
1588 let next_out_of_line = decoder.next_out_of_line();
1589 let handles_before = decoder.remaining_handles();
1590 if let Some((inlined, num_bytes, num_handles)) =
1591 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1592 {
1593 let member_inline_size =
1594 <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1595 if inlined != (member_inline_size <= 4) {
1596 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1597 }
1598 let inner_offset;
1599 let mut inner_depth = depth.clone();
1600 if inlined {
1601 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1602 inner_offset = next_offset;
1603 } else {
1604 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1605 inner_depth.increment()?;
1606 }
1607 let val_ref = self.identifier.get_or_insert_with(|| {
1608 fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
1609 });
1610 fidl::decode!(
1611 u64,
1612 fidl::encoding::DefaultFuchsiaResourceDialect,
1613 val_ref,
1614 decoder,
1615 inner_offset,
1616 inner_depth
1617 )?;
1618 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1619 {
1620 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1621 }
1622 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1623 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1624 }
1625 }
1626
1627 next_offset += envelope_size;
1628 _next_ordinal_to_read += 1;
1629 if next_offset >= end_offset {
1630 return Ok(());
1631 }
1632
1633 while _next_ordinal_to_read < 2 {
1635 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1636 _next_ordinal_to_read += 1;
1637 next_offset += envelope_size;
1638 }
1639
1640 let next_out_of_line = decoder.next_out_of_line();
1641 let handles_before = decoder.remaining_handles();
1642 if let Some((inlined, num_bytes, num_handles)) =
1643 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1644 {
1645 let member_inline_size =
1646 <Description as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1647 if inlined != (member_inline_size <= 4) {
1648 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1649 }
1650 let inner_offset;
1651 let mut inner_depth = depth.clone();
1652 if inlined {
1653 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1654 inner_offset = next_offset;
1655 } else {
1656 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1657 inner_depth.increment()?;
1658 }
1659 let val_ref = self.description.get_or_insert_with(|| {
1660 fidl::new_empty!(Description, fidl::encoding::DefaultFuchsiaResourceDialect)
1661 });
1662 fidl::decode!(
1663 Description,
1664 fidl::encoding::DefaultFuchsiaResourceDialect,
1665 val_ref,
1666 decoder,
1667 inner_offset,
1668 inner_depth
1669 )?;
1670 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1671 {
1672 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1673 }
1674 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1675 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1676 }
1677 }
1678
1679 next_offset += envelope_size;
1680 _next_ordinal_to_read += 1;
1681 if next_offset >= end_offset {
1682 return Ok(());
1683 }
1684
1685 while _next_ordinal_to_read < 3 {
1687 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1688 _next_ordinal_to_read += 1;
1689 next_offset += envelope_size;
1690 }
1691
1692 let next_out_of_line = decoder.next_out_of_line();
1693 let handles_before = decoder.remaining_handles();
1694 if let Some((inlined, num_bytes, num_handles)) =
1695 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1696 {
1697 let member_inline_size =
1698 <PrincipalType as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1699 if inlined != (member_inline_size <= 4) {
1700 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1701 }
1702 let inner_offset;
1703 let mut inner_depth = depth.clone();
1704 if inlined {
1705 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1706 inner_offset = next_offset;
1707 } else {
1708 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1709 inner_depth.increment()?;
1710 }
1711 let val_ref = self.principal_type.get_or_insert_with(|| {
1712 fidl::new_empty!(PrincipalType, fidl::encoding::DefaultFuchsiaResourceDialect)
1713 });
1714 fidl::decode!(
1715 PrincipalType,
1716 fidl::encoding::DefaultFuchsiaResourceDialect,
1717 val_ref,
1718 decoder,
1719 inner_offset,
1720 inner_depth
1721 )?;
1722 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1723 {
1724 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1725 }
1726 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1727 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1728 }
1729 }
1730
1731 next_offset += envelope_size;
1732 _next_ordinal_to_read += 1;
1733 if next_offset >= end_offset {
1734 return Ok(());
1735 }
1736
1737 while _next_ordinal_to_read < 4 {
1739 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1740 _next_ordinal_to_read += 1;
1741 next_offset += envelope_size;
1742 }
1743
1744 let next_out_of_line = decoder.next_out_of_line();
1745 let handles_before = decoder.remaining_handles();
1746 if let Some((inlined, num_bytes, num_handles)) =
1747 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1748 {
1749 let member_inline_size = <fidl::encoding::Endpoint<
1750 fidl::endpoints::ClientEnd<ProviderMarker>,
1751 > as fidl::encoding::TypeMarker>::inline_size(
1752 decoder.context
1753 );
1754 if inlined != (member_inline_size <= 4) {
1755 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1756 }
1757 let inner_offset;
1758 let mut inner_depth = depth.clone();
1759 if inlined {
1760 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1761 inner_offset = next_offset;
1762 } else {
1763 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1764 inner_depth.increment()?;
1765 }
1766 let val_ref = self.detailed_attribution.get_or_insert_with(|| {
1767 fidl::new_empty!(
1768 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ProviderMarker>>,
1769 fidl::encoding::DefaultFuchsiaResourceDialect
1770 )
1771 });
1772 fidl::decode!(
1773 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ProviderMarker>>,
1774 fidl::encoding::DefaultFuchsiaResourceDialect,
1775 val_ref,
1776 decoder,
1777 inner_offset,
1778 inner_depth
1779 )?;
1780 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1781 {
1782 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1783 }
1784 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1785 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1786 }
1787 }
1788
1789 next_offset += envelope_size;
1790
1791 while next_offset < end_offset {
1793 _next_ordinal_to_read += 1;
1794 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1795 next_offset += envelope_size;
1796 }
1797
1798 Ok(())
1799 }
1800 }
1801
1802 impl ProviderGetResponse {
1803 #[inline(always)]
1804 fn max_ordinal_present(&self) -> u64 {
1805 if let Some(_) = self.attributions {
1806 return 1;
1807 }
1808 0
1809 }
1810 }
1811
1812 impl fidl::encoding::ResourceTypeMarker for ProviderGetResponse {
1813 type Borrowed<'a> = &'a mut Self;
1814 fn take_or_borrow<'a>(
1815 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1816 ) -> Self::Borrowed<'a> {
1817 value
1818 }
1819 }
1820
1821 unsafe impl fidl::encoding::TypeMarker for ProviderGetResponse {
1822 type Owned = Self;
1823
1824 #[inline(always)]
1825 fn inline_align(_context: fidl::encoding::Context) -> usize {
1826 8
1827 }
1828
1829 #[inline(always)]
1830 fn inline_size(_context: fidl::encoding::Context) -> usize {
1831 16
1832 }
1833 }
1834
1835 unsafe impl
1836 fidl::encoding::Encode<ProviderGetResponse, fidl::encoding::DefaultFuchsiaResourceDialect>
1837 for &mut ProviderGetResponse
1838 {
1839 unsafe fn encode(
1840 self,
1841 encoder: &mut fidl::encoding::Encoder<
1842 '_,
1843 fidl::encoding::DefaultFuchsiaResourceDialect,
1844 >,
1845 offset: usize,
1846 mut depth: fidl::encoding::Depth,
1847 ) -> fidl::Result<()> {
1848 encoder.debug_check_bounds::<ProviderGetResponse>(offset);
1849 let max_ordinal: u64 = self.max_ordinal_present();
1851 encoder.write_num(max_ordinal, offset);
1852 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1853 if max_ordinal == 0 {
1855 return Ok(());
1856 }
1857 depth.increment()?;
1858 let envelope_size = 8;
1859 let bytes_len = max_ordinal as usize * envelope_size;
1860 #[allow(unused_variables)]
1861 let offset = encoder.out_of_line_offset(bytes_len);
1862 let mut _prev_end_offset: usize = 0;
1863 if 1 > max_ordinal {
1864 return Ok(());
1865 }
1866
1867 let cur_offset: usize = (1 - 1) * envelope_size;
1870
1871 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1873
1874 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<AttributionUpdate>, fidl::encoding::DefaultFuchsiaResourceDialect>(
1879 self.attributions.as_mut().map(<fidl::encoding::UnboundedVector<AttributionUpdate> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
1880 encoder, offset + cur_offset, depth
1881 )?;
1882
1883 _prev_end_offset = cur_offset + envelope_size;
1884
1885 Ok(())
1886 }
1887 }
1888
1889 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1890 for ProviderGetResponse
1891 {
1892 #[inline(always)]
1893 fn new_empty() -> Self {
1894 Self::default()
1895 }
1896
1897 unsafe fn decode(
1898 &mut self,
1899 decoder: &mut fidl::encoding::Decoder<
1900 '_,
1901 fidl::encoding::DefaultFuchsiaResourceDialect,
1902 >,
1903 offset: usize,
1904 mut depth: fidl::encoding::Depth,
1905 ) -> fidl::Result<()> {
1906 decoder.debug_check_bounds::<Self>(offset);
1907 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1908 None => return Err(fidl::Error::NotNullable),
1909 Some(len) => len,
1910 };
1911 if len == 0 {
1913 return Ok(());
1914 };
1915 depth.increment()?;
1916 let envelope_size = 8;
1917 let bytes_len = len * envelope_size;
1918 let offset = decoder.out_of_line_offset(bytes_len)?;
1919 let mut _next_ordinal_to_read = 0;
1921 let mut next_offset = offset;
1922 let end_offset = offset + bytes_len;
1923 _next_ordinal_to_read += 1;
1924 if next_offset >= end_offset {
1925 return Ok(());
1926 }
1927
1928 while _next_ordinal_to_read < 1 {
1930 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1931 _next_ordinal_to_read += 1;
1932 next_offset += envelope_size;
1933 }
1934
1935 let next_out_of_line = decoder.next_out_of_line();
1936 let handles_before = decoder.remaining_handles();
1937 if let Some((inlined, num_bytes, num_handles)) =
1938 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1939 {
1940 let member_inline_size = <fidl::encoding::UnboundedVector<AttributionUpdate> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1941 if inlined != (member_inline_size <= 4) {
1942 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1943 }
1944 let inner_offset;
1945 let mut inner_depth = depth.clone();
1946 if inlined {
1947 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1948 inner_offset = next_offset;
1949 } else {
1950 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1951 inner_depth.increment()?;
1952 }
1953 let val_ref = self.attributions.get_or_insert_with(|| {
1954 fidl::new_empty!(
1955 fidl::encoding::UnboundedVector<AttributionUpdate>,
1956 fidl::encoding::DefaultFuchsiaResourceDialect
1957 )
1958 });
1959 fidl::decode!(
1960 fidl::encoding::UnboundedVector<AttributionUpdate>,
1961 fidl::encoding::DefaultFuchsiaResourceDialect,
1962 val_ref,
1963 decoder,
1964 inner_offset,
1965 inner_depth
1966 )?;
1967 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1968 {
1969 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1970 }
1971 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1972 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1973 }
1974 }
1975
1976 next_offset += envelope_size;
1977
1978 while next_offset < end_offset {
1980 _next_ordinal_to_read += 1;
1981 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1982 next_offset += envelope_size;
1983 }
1984
1985 Ok(())
1986 }
1987 }
1988
1989 impl UpdatedPrincipal {
1990 #[inline(always)]
1991 fn max_ordinal_present(&self) -> u64 {
1992 if let Some(_) = self.resources {
1993 return 2;
1994 }
1995 if let Some(_) = self.identifier {
1996 return 1;
1997 }
1998 0
1999 }
2000 }
2001
2002 impl fidl::encoding::ResourceTypeMarker for UpdatedPrincipal {
2003 type Borrowed<'a> = &'a mut Self;
2004 fn take_or_borrow<'a>(
2005 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2006 ) -> Self::Borrowed<'a> {
2007 value
2008 }
2009 }
2010
2011 unsafe impl fidl::encoding::TypeMarker for UpdatedPrincipal {
2012 type Owned = Self;
2013
2014 #[inline(always)]
2015 fn inline_align(_context: fidl::encoding::Context) -> usize {
2016 8
2017 }
2018
2019 #[inline(always)]
2020 fn inline_size(_context: fidl::encoding::Context) -> usize {
2021 16
2022 }
2023 }
2024
2025 unsafe impl
2026 fidl::encoding::Encode<UpdatedPrincipal, fidl::encoding::DefaultFuchsiaResourceDialect>
2027 for &mut UpdatedPrincipal
2028 {
2029 unsafe fn encode(
2030 self,
2031 encoder: &mut fidl::encoding::Encoder<
2032 '_,
2033 fidl::encoding::DefaultFuchsiaResourceDialect,
2034 >,
2035 offset: usize,
2036 mut depth: fidl::encoding::Depth,
2037 ) -> fidl::Result<()> {
2038 encoder.debug_check_bounds::<UpdatedPrincipal>(offset);
2039 let max_ordinal: u64 = self.max_ordinal_present();
2041 encoder.write_num(max_ordinal, offset);
2042 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2043 if max_ordinal == 0 {
2045 return Ok(());
2046 }
2047 depth.increment()?;
2048 let envelope_size = 8;
2049 let bytes_len = max_ordinal as usize * envelope_size;
2050 #[allow(unused_variables)]
2051 let offset = encoder.out_of_line_offset(bytes_len);
2052 let mut _prev_end_offset: usize = 0;
2053 if 1 > max_ordinal {
2054 return Ok(());
2055 }
2056
2057 let cur_offset: usize = (1 - 1) * envelope_size;
2060
2061 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2063
2064 fidl::encoding::encode_in_envelope_optional::<
2069 u64,
2070 fidl::encoding::DefaultFuchsiaResourceDialect,
2071 >(
2072 self.identifier.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
2073 encoder,
2074 offset + cur_offset,
2075 depth,
2076 )?;
2077
2078 _prev_end_offset = cur_offset + envelope_size;
2079 if 2 > max_ordinal {
2080 return Ok(());
2081 }
2082
2083 let cur_offset: usize = (2 - 1) * envelope_size;
2086
2087 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2089
2090 fidl::encoding::encode_in_envelope_optional::<
2095 Resources,
2096 fidl::encoding::DefaultFuchsiaResourceDialect,
2097 >(
2098 self.resources
2099 .as_mut()
2100 .map(<Resources as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
2101 encoder,
2102 offset + cur_offset,
2103 depth,
2104 )?;
2105
2106 _prev_end_offset = cur_offset + envelope_size;
2107
2108 Ok(())
2109 }
2110 }
2111
2112 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2113 for UpdatedPrincipal
2114 {
2115 #[inline(always)]
2116 fn new_empty() -> Self {
2117 Self::default()
2118 }
2119
2120 unsafe fn decode(
2121 &mut self,
2122 decoder: &mut fidl::encoding::Decoder<
2123 '_,
2124 fidl::encoding::DefaultFuchsiaResourceDialect,
2125 >,
2126 offset: usize,
2127 mut depth: fidl::encoding::Depth,
2128 ) -> fidl::Result<()> {
2129 decoder.debug_check_bounds::<Self>(offset);
2130 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2131 None => return Err(fidl::Error::NotNullable),
2132 Some(len) => len,
2133 };
2134 if len == 0 {
2136 return Ok(());
2137 };
2138 depth.increment()?;
2139 let envelope_size = 8;
2140 let bytes_len = len * envelope_size;
2141 let offset = decoder.out_of_line_offset(bytes_len)?;
2142 let mut _next_ordinal_to_read = 0;
2144 let mut next_offset = offset;
2145 let end_offset = offset + bytes_len;
2146 _next_ordinal_to_read += 1;
2147 if next_offset >= end_offset {
2148 return Ok(());
2149 }
2150
2151 while _next_ordinal_to_read < 1 {
2153 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2154 _next_ordinal_to_read += 1;
2155 next_offset += envelope_size;
2156 }
2157
2158 let next_out_of_line = decoder.next_out_of_line();
2159 let handles_before = decoder.remaining_handles();
2160 if let Some((inlined, num_bytes, num_handles)) =
2161 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2162 {
2163 let member_inline_size =
2164 <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2165 if inlined != (member_inline_size <= 4) {
2166 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2167 }
2168 let inner_offset;
2169 let mut inner_depth = depth.clone();
2170 if inlined {
2171 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2172 inner_offset = next_offset;
2173 } else {
2174 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2175 inner_depth.increment()?;
2176 }
2177 let val_ref = self.identifier.get_or_insert_with(|| {
2178 fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
2179 });
2180 fidl::decode!(
2181 u64,
2182 fidl::encoding::DefaultFuchsiaResourceDialect,
2183 val_ref,
2184 decoder,
2185 inner_offset,
2186 inner_depth
2187 )?;
2188 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2189 {
2190 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2191 }
2192 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2193 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2194 }
2195 }
2196
2197 next_offset += envelope_size;
2198 _next_ordinal_to_read += 1;
2199 if next_offset >= end_offset {
2200 return Ok(());
2201 }
2202
2203 while _next_ordinal_to_read < 2 {
2205 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2206 _next_ordinal_to_read += 1;
2207 next_offset += envelope_size;
2208 }
2209
2210 let next_out_of_line = decoder.next_out_of_line();
2211 let handles_before = decoder.remaining_handles();
2212 if let Some((inlined, num_bytes, num_handles)) =
2213 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2214 {
2215 let member_inline_size =
2216 <Resources as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2217 if inlined != (member_inline_size <= 4) {
2218 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2219 }
2220 let inner_offset;
2221 let mut inner_depth = depth.clone();
2222 if inlined {
2223 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2224 inner_offset = next_offset;
2225 } else {
2226 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2227 inner_depth.increment()?;
2228 }
2229 let val_ref = self.resources.get_or_insert_with(|| {
2230 fidl::new_empty!(Resources, fidl::encoding::DefaultFuchsiaResourceDialect)
2231 });
2232 fidl::decode!(
2233 Resources,
2234 fidl::encoding::DefaultFuchsiaResourceDialect,
2235 val_ref,
2236 decoder,
2237 inner_offset,
2238 inner_depth
2239 )?;
2240 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2241 {
2242 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2243 }
2244 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2245 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2246 }
2247 }
2248
2249 next_offset += envelope_size;
2250
2251 while next_offset < end_offset {
2253 _next_ordinal_to_read += 1;
2254 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2255 next_offset += envelope_size;
2256 }
2257
2258 Ok(())
2259 }
2260 }
2261
2262 impl fidl::encoding::ResourceTypeMarker for AttributionUpdate {
2263 type Borrowed<'a> = &'a mut Self;
2264 fn take_or_borrow<'a>(
2265 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2266 ) -> Self::Borrowed<'a> {
2267 value
2268 }
2269 }
2270
2271 unsafe impl fidl::encoding::TypeMarker for AttributionUpdate {
2272 type Owned = Self;
2273
2274 #[inline(always)]
2275 fn inline_align(_context: fidl::encoding::Context) -> usize {
2276 8
2277 }
2278
2279 #[inline(always)]
2280 fn inline_size(_context: fidl::encoding::Context) -> usize {
2281 16
2282 }
2283 }
2284
2285 unsafe impl
2286 fidl::encoding::Encode<AttributionUpdate, fidl::encoding::DefaultFuchsiaResourceDialect>
2287 for &mut AttributionUpdate
2288 {
2289 #[inline]
2290 unsafe fn encode(
2291 self,
2292 encoder: &mut fidl::encoding::Encoder<
2293 '_,
2294 fidl::encoding::DefaultFuchsiaResourceDialect,
2295 >,
2296 offset: usize,
2297 _depth: fidl::encoding::Depth,
2298 ) -> fidl::Result<()> {
2299 encoder.debug_check_bounds::<AttributionUpdate>(offset);
2300 encoder.write_num::<u64>(self.ordinal(), offset);
2301 match self {
2302 AttributionUpdate::Add(ref mut val) => fidl::encoding::encode_in_envelope::<
2303 NewPrincipal,
2304 fidl::encoding::DefaultFuchsiaResourceDialect,
2305 >(
2306 <NewPrincipal as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
2307 encoder,
2308 offset + 8,
2309 _depth,
2310 ),
2311 AttributionUpdate::Update(ref mut val) => fidl::encoding::encode_in_envelope::<
2312 UpdatedPrincipal,
2313 fidl::encoding::DefaultFuchsiaResourceDialect,
2314 >(
2315 <UpdatedPrincipal as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
2316 encoder,
2317 offset + 8,
2318 _depth,
2319 ),
2320 AttributionUpdate::Remove(ref val) => fidl::encoding::encode_in_envelope::<
2321 u64,
2322 fidl::encoding::DefaultFuchsiaResourceDialect,
2323 >(
2324 <u64 as fidl::encoding::ValueTypeMarker>::borrow(val),
2325 encoder,
2326 offset + 8,
2327 _depth,
2328 ),
2329 AttributionUpdate::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
2330 }
2331 }
2332 }
2333
2334 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2335 for AttributionUpdate
2336 {
2337 #[inline(always)]
2338 fn new_empty() -> Self {
2339 Self::__SourceBreaking { unknown_ordinal: 0 }
2340 }
2341
2342 #[inline]
2343 unsafe fn decode(
2344 &mut self,
2345 decoder: &mut fidl::encoding::Decoder<
2346 '_,
2347 fidl::encoding::DefaultFuchsiaResourceDialect,
2348 >,
2349 offset: usize,
2350 mut depth: fidl::encoding::Depth,
2351 ) -> fidl::Result<()> {
2352 decoder.debug_check_bounds::<Self>(offset);
2353 #[allow(unused_variables)]
2354 let next_out_of_line = decoder.next_out_of_line();
2355 let handles_before = decoder.remaining_handles();
2356 let (ordinal, inlined, num_bytes, num_handles) =
2357 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
2358
2359 let member_inline_size = match ordinal {
2360 1 => <NewPrincipal as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2361 2 => <UpdatedPrincipal as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2362 3 => <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2363 0 => return Err(fidl::Error::UnknownUnionTag),
2364 _ => num_bytes as usize,
2365 };
2366
2367 if inlined != (member_inline_size <= 4) {
2368 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2369 }
2370 let _inner_offset;
2371 if inlined {
2372 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
2373 _inner_offset = offset + 8;
2374 } else {
2375 depth.increment()?;
2376 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2377 }
2378 match ordinal {
2379 1 => {
2380 #[allow(irrefutable_let_patterns)]
2381 if let AttributionUpdate::Add(_) = self {
2382 } else {
2384 *self = AttributionUpdate::Add(fidl::new_empty!(
2386 NewPrincipal,
2387 fidl::encoding::DefaultFuchsiaResourceDialect
2388 ));
2389 }
2390 #[allow(irrefutable_let_patterns)]
2391 if let AttributionUpdate::Add(ref mut val) = self {
2392 fidl::decode!(
2393 NewPrincipal,
2394 fidl::encoding::DefaultFuchsiaResourceDialect,
2395 val,
2396 decoder,
2397 _inner_offset,
2398 depth
2399 )?;
2400 } else {
2401 unreachable!()
2402 }
2403 }
2404 2 => {
2405 #[allow(irrefutable_let_patterns)]
2406 if let AttributionUpdate::Update(_) = self {
2407 } else {
2409 *self = AttributionUpdate::Update(fidl::new_empty!(
2411 UpdatedPrincipal,
2412 fidl::encoding::DefaultFuchsiaResourceDialect
2413 ));
2414 }
2415 #[allow(irrefutable_let_patterns)]
2416 if let AttributionUpdate::Update(ref mut val) = self {
2417 fidl::decode!(
2418 UpdatedPrincipal,
2419 fidl::encoding::DefaultFuchsiaResourceDialect,
2420 val,
2421 decoder,
2422 _inner_offset,
2423 depth
2424 )?;
2425 } else {
2426 unreachable!()
2427 }
2428 }
2429 3 => {
2430 #[allow(irrefutable_let_patterns)]
2431 if let AttributionUpdate::Remove(_) = self {
2432 } else {
2434 *self = AttributionUpdate::Remove(fidl::new_empty!(
2436 u64,
2437 fidl::encoding::DefaultFuchsiaResourceDialect
2438 ));
2439 }
2440 #[allow(irrefutable_let_patterns)]
2441 if let AttributionUpdate::Remove(ref mut val) = self {
2442 fidl::decode!(
2443 u64,
2444 fidl::encoding::DefaultFuchsiaResourceDialect,
2445 val,
2446 decoder,
2447 _inner_offset,
2448 depth
2449 )?;
2450 } else {
2451 unreachable!()
2452 }
2453 }
2454 #[allow(deprecated)]
2455 ordinal => {
2456 for _ in 0..num_handles {
2457 decoder.drop_next_handle()?;
2458 }
2459 *self = AttributionUpdate::__SourceBreaking { unknown_ordinal: ordinal };
2460 }
2461 }
2462 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
2463 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2464 }
2465 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2466 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2467 }
2468 Ok(())
2469 }
2470 }
2471
2472 impl fidl::encoding::ResourceTypeMarker for Description {
2473 type Borrowed<'a> = &'a mut Self;
2474 fn take_or_borrow<'a>(
2475 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2476 ) -> Self::Borrowed<'a> {
2477 value
2478 }
2479 }
2480
2481 unsafe impl fidl::encoding::TypeMarker for Description {
2482 type Owned = Self;
2483
2484 #[inline(always)]
2485 fn inline_align(_context: fidl::encoding::Context) -> usize {
2486 8
2487 }
2488
2489 #[inline(always)]
2490 fn inline_size(_context: fidl::encoding::Context) -> usize {
2491 16
2492 }
2493 }
2494
2495 unsafe impl fidl::encoding::Encode<Description, fidl::encoding::DefaultFuchsiaResourceDialect>
2496 for &mut Description
2497 {
2498 #[inline]
2499 unsafe fn encode(
2500 self,
2501 encoder: &mut fidl::encoding::Encoder<
2502 '_,
2503 fidl::encoding::DefaultFuchsiaResourceDialect,
2504 >,
2505 offset: usize,
2506 _depth: fidl::encoding::Depth,
2507 ) -> fidl::Result<()> {
2508 encoder.debug_check_bounds::<Description>(offset);
2509 encoder.write_num::<u64>(self.ordinal(), offset);
2510 match self {
2511 Description::Component(ref mut val) => fidl::encoding::encode_in_envelope::<
2512 fidl::encoding::HandleType<
2513 fidl::Event,
2514 { fidl::ObjectType::EVENT.into_raw() },
2515 2147483648,
2516 >,
2517 fidl::encoding::DefaultFuchsiaResourceDialect,
2518 >(
2519 <fidl::encoding::HandleType<
2520 fidl::Event,
2521 { fidl::ObjectType::EVENT.into_raw() },
2522 2147483648,
2523 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2524 val
2525 ),
2526 encoder,
2527 offset + 8,
2528 _depth,
2529 ),
2530 Description::Part(ref val) => fidl::encoding::encode_in_envelope::<
2531 fidl::encoding::UnboundedString,
2532 fidl::encoding::DefaultFuchsiaResourceDialect,
2533 >(
2534 <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
2535 val,
2536 ),
2537 encoder,
2538 offset + 8,
2539 _depth,
2540 ),
2541 Description::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
2542 }
2543 }
2544 }
2545
2546 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for Description {
2547 #[inline(always)]
2548 fn new_empty() -> Self {
2549 Self::__SourceBreaking { unknown_ordinal: 0 }
2550 }
2551
2552 #[inline]
2553 unsafe fn decode(
2554 &mut self,
2555 decoder: &mut fidl::encoding::Decoder<
2556 '_,
2557 fidl::encoding::DefaultFuchsiaResourceDialect,
2558 >,
2559 offset: usize,
2560 mut depth: fidl::encoding::Depth,
2561 ) -> fidl::Result<()> {
2562 decoder.debug_check_bounds::<Self>(offset);
2563 #[allow(unused_variables)]
2564 let next_out_of_line = decoder.next_out_of_line();
2565 let handles_before = decoder.remaining_handles();
2566 let (ordinal, inlined, num_bytes, num_handles) =
2567 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
2568
2569 let member_inline_size = match ordinal {
2570 1 => <fidl::encoding::HandleType<
2571 fidl::Event,
2572 { fidl::ObjectType::EVENT.into_raw() },
2573 2147483648,
2574 > as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2575 2 => <fidl::encoding::UnboundedString as fidl::encoding::TypeMarker>::inline_size(
2576 decoder.context,
2577 ),
2578 0 => return Err(fidl::Error::UnknownUnionTag),
2579 _ => num_bytes as usize,
2580 };
2581
2582 if inlined != (member_inline_size <= 4) {
2583 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2584 }
2585 let _inner_offset;
2586 if inlined {
2587 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
2588 _inner_offset = offset + 8;
2589 } else {
2590 depth.increment()?;
2591 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2592 }
2593 match ordinal {
2594 1 => {
2595 #[allow(irrefutable_let_patterns)]
2596 if let Description::Component(_) = self {
2597 } else {
2599 *self = Description::Component(
2601 fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
2602 );
2603 }
2604 #[allow(irrefutable_let_patterns)]
2605 if let Description::Component(ref mut val) = self {
2606 fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val, decoder, _inner_offset, depth)?;
2607 } else {
2608 unreachable!()
2609 }
2610 }
2611 2 => {
2612 #[allow(irrefutable_let_patterns)]
2613 if let Description::Part(_) = self {
2614 } else {
2616 *self = Description::Part(fidl::new_empty!(
2618 fidl::encoding::UnboundedString,
2619 fidl::encoding::DefaultFuchsiaResourceDialect
2620 ));
2621 }
2622 #[allow(irrefutable_let_patterns)]
2623 if let Description::Part(ref mut val) = self {
2624 fidl::decode!(
2625 fidl::encoding::UnboundedString,
2626 fidl::encoding::DefaultFuchsiaResourceDialect,
2627 val,
2628 decoder,
2629 _inner_offset,
2630 depth
2631 )?;
2632 } else {
2633 unreachable!()
2634 }
2635 }
2636 #[allow(deprecated)]
2637 ordinal => {
2638 for _ in 0..num_handles {
2639 decoder.drop_next_handle()?;
2640 }
2641 *self = Description::__SourceBreaking { unknown_ordinal: ordinal };
2642 }
2643 }
2644 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
2645 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2646 }
2647 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2648 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2649 }
2650 Ok(())
2651 }
2652 }
2653
2654 impl fidl::encoding::ResourceTypeMarker for Resources {
2655 type Borrowed<'a> = &'a mut Self;
2656 fn take_or_borrow<'a>(
2657 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2658 ) -> Self::Borrowed<'a> {
2659 value
2660 }
2661 }
2662
2663 unsafe impl fidl::encoding::TypeMarker for Resources {
2664 type Owned = Self;
2665
2666 #[inline(always)]
2667 fn inline_align(_context: fidl::encoding::Context) -> usize {
2668 8
2669 }
2670
2671 #[inline(always)]
2672 fn inline_size(_context: fidl::encoding::Context) -> usize {
2673 16
2674 }
2675 }
2676
2677 unsafe impl fidl::encoding::Encode<Resources, fidl::encoding::DefaultFuchsiaResourceDialect>
2678 for &mut Resources
2679 {
2680 #[inline]
2681 unsafe fn encode(
2682 self,
2683 encoder: &mut fidl::encoding::Encoder<
2684 '_,
2685 fidl::encoding::DefaultFuchsiaResourceDialect,
2686 >,
2687 offset: usize,
2688 _depth: fidl::encoding::Depth,
2689 ) -> fidl::Result<()> {
2690 encoder.debug_check_bounds::<Resources>(offset);
2691 encoder.write_num::<u64>(self.ordinal(), offset);
2692 match self {
2693 Resources::Data(ref val) => fidl::encoding::encode_in_envelope::<
2694 Data,
2695 fidl::encoding::DefaultFuchsiaResourceDialect,
2696 >(
2697 <Data as fidl::encoding::ValueTypeMarker>::borrow(val),
2698 encoder,
2699 offset + 8,
2700 _depth,
2701 ),
2702 Resources::Buffer(ref mut val) => fidl::encoding::encode_in_envelope::<
2703 fidl::encoding::HandleType<
2704 fidl::Vmo,
2705 { fidl::ObjectType::VMO.into_raw() },
2706 2147483648,
2707 >,
2708 fidl::encoding::DefaultFuchsiaResourceDialect,
2709 >(
2710 <fidl::encoding::HandleType<
2711 fidl::Vmo,
2712 { fidl::ObjectType::VMO.into_raw() },
2713 2147483648,
2714 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2715 val
2716 ),
2717 encoder,
2718 offset + 8,
2719 _depth,
2720 ),
2721 Resources::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
2722 }
2723 }
2724 }
2725
2726 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for Resources {
2727 #[inline(always)]
2728 fn new_empty() -> Self {
2729 Self::__SourceBreaking { unknown_ordinal: 0 }
2730 }
2731
2732 #[inline]
2733 unsafe fn decode(
2734 &mut self,
2735 decoder: &mut fidl::encoding::Decoder<
2736 '_,
2737 fidl::encoding::DefaultFuchsiaResourceDialect,
2738 >,
2739 offset: usize,
2740 mut depth: fidl::encoding::Depth,
2741 ) -> fidl::Result<()> {
2742 decoder.debug_check_bounds::<Self>(offset);
2743 #[allow(unused_variables)]
2744 let next_out_of_line = decoder.next_out_of_line();
2745 let handles_before = decoder.remaining_handles();
2746 let (ordinal, inlined, num_bytes, num_handles) =
2747 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
2748
2749 let member_inline_size = match ordinal {
2750 1 => <Data as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2751 2 => <fidl::encoding::HandleType<
2752 fidl::Vmo,
2753 { fidl::ObjectType::VMO.into_raw() },
2754 2147483648,
2755 > as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2756 0 => return Err(fidl::Error::UnknownUnionTag),
2757 _ => num_bytes as usize,
2758 };
2759
2760 if inlined != (member_inline_size <= 4) {
2761 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2762 }
2763 let _inner_offset;
2764 if inlined {
2765 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
2766 _inner_offset = offset + 8;
2767 } else {
2768 depth.increment()?;
2769 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2770 }
2771 match ordinal {
2772 1 => {
2773 #[allow(irrefutable_let_patterns)]
2774 if let Resources::Data(_) = self {
2775 } else {
2777 *self = Resources::Data(fidl::new_empty!(
2779 Data,
2780 fidl::encoding::DefaultFuchsiaResourceDialect
2781 ));
2782 }
2783 #[allow(irrefutable_let_patterns)]
2784 if let Resources::Data(ref mut val) = self {
2785 fidl::decode!(
2786 Data,
2787 fidl::encoding::DefaultFuchsiaResourceDialect,
2788 val,
2789 decoder,
2790 _inner_offset,
2791 depth
2792 )?;
2793 } else {
2794 unreachable!()
2795 }
2796 }
2797 2 => {
2798 #[allow(irrefutable_let_patterns)]
2799 if let Resources::Buffer(_) = self {
2800 } else {
2802 *self = Resources::Buffer(
2804 fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
2805 );
2806 }
2807 #[allow(irrefutable_let_patterns)]
2808 if let Resources::Buffer(ref mut val) = self {
2809 fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val, decoder, _inner_offset, depth)?;
2810 } else {
2811 unreachable!()
2812 }
2813 }
2814 #[allow(deprecated)]
2815 ordinal => {
2816 for _ in 0..num_handles {
2817 decoder.drop_next_handle()?;
2818 }
2819 *self = Resources::__SourceBreaking { unknown_ordinal: ordinal };
2820 }
2821 }
2822 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
2823 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2824 }
2825 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2826 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2827 }
2828 Ok(())
2829 }
2830 }
2831}