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_scheduler_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Default, PartialEq)]
15pub struct RoleManagerGetProfileForRoleRequest {
16 pub target: Option<RoleType>,
17 pub role: Option<RoleName>,
18 pub input_parameters: Option<Vec<Parameter>>,
19 #[doc(hidden)]
20 pub __source_breaking: fidl::marker::SourceBreaking,
21}
22
23impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
24 for RoleManagerGetProfileForRoleRequest
25{
26}
27
28#[derive(Debug, Default, PartialEq)]
29pub struct RoleManagerSetRoleRequest {
30 pub target: Option<RoleTarget>,
31 pub role: Option<RoleName>,
32 pub input_parameters: Option<Vec<Parameter>>,
33 #[doc(hidden)]
34 pub __source_breaking: fidl::marker::SourceBreaking,
35}
36
37impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for RoleManagerSetRoleRequest {}
38
39#[derive(Debug, Default, PartialEq)]
40pub struct RoleManagerGetProfileForRoleResponse {
41 pub profile: Option<fidl::Profile>,
42 pub output_parameters: Option<Vec<Parameter>>,
43 #[doc(hidden)]
44 pub __source_breaking: fidl::marker::SourceBreaking,
45}
46
47impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
48 for RoleManagerGetProfileForRoleResponse
49{
50}
51
52#[derive(Debug, Default, PartialEq)]
53pub struct RoleManagerSetRoleResponse {
54 pub output_parameters: Option<Vec<Parameter>>,
55 #[doc(hidden)]
56 pub __source_breaking: fidl::marker::SourceBreaking,
57}
58
59impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
60 for RoleManagerSetRoleResponse
61{
62}
63
64#[derive(Debug)]
67pub enum RoleTarget {
68 Thread(fidl::Thread),
69 Vmar(fidl::Vmar),
70 #[doc(hidden)]
71 __SourceBreaking {
72 unknown_ordinal: u64,
73 },
74}
75
76#[macro_export]
78macro_rules! RoleTargetUnknown {
79 () => {
80 _
81 };
82}
83
84impl PartialEq for RoleTarget {
86 fn eq(&self, other: &Self) -> bool {
87 match (self, other) {
88 (Self::Thread(x), Self::Thread(y)) => *x == *y,
89 (Self::Vmar(x), Self::Vmar(y)) => *x == *y,
90 _ => false,
91 }
92 }
93}
94
95impl RoleTarget {
96 #[inline]
97 pub fn ordinal(&self) -> u64 {
98 match *self {
99 Self::Thread(_) => 1,
100 Self::Vmar(_) => 2,
101 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
102 }
103 }
104
105 #[inline]
106 pub fn unknown_variant_for_testing() -> Self {
107 Self::__SourceBreaking { unknown_ordinal: 0 }
108 }
109
110 #[inline]
111 pub fn is_unknown(&self) -> bool {
112 match self {
113 Self::__SourceBreaking { .. } => true,
114 _ => false,
115 }
116 }
117}
118
119impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for RoleTarget {}
120
121#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
122pub struct RoleManagerMarker;
123
124impl fidl::endpoints::ProtocolMarker for RoleManagerMarker {
125 type Proxy = RoleManagerProxy;
126 type RequestStream = RoleManagerRequestStream;
127 #[cfg(target_os = "fuchsia")]
128 type SynchronousProxy = RoleManagerSynchronousProxy;
129
130 const DEBUG_NAME: &'static str = "fuchsia.scheduler.RoleManager";
131}
132impl fidl::endpoints::DiscoverableProtocolMarker for RoleManagerMarker {}
133pub type RoleManagerSetRoleResult = Result<RoleManagerSetRoleResponse, i32>;
134pub type RoleManagerGetProfileForRoleResult = Result<RoleManagerGetProfileForRoleResponse, i32>;
135
136pub trait RoleManagerProxyInterface: Send + Sync {
137 type SetRoleResponseFut: std::future::Future<Output = Result<RoleManagerSetRoleResult, fidl::Error>>
138 + Send;
139 fn r#set_role(&self, payload: RoleManagerSetRoleRequest) -> Self::SetRoleResponseFut;
140 type GetProfileForRoleResponseFut: std::future::Future<Output = Result<RoleManagerGetProfileForRoleResult, fidl::Error>>
141 + Send;
142 fn r#get_profile_for_role(
143 &self,
144 payload: RoleManagerGetProfileForRoleRequest,
145 ) -> Self::GetProfileForRoleResponseFut;
146}
147#[derive(Debug)]
148#[cfg(target_os = "fuchsia")]
149pub struct RoleManagerSynchronousProxy {
150 client: fidl::client::sync::Client,
151}
152
153#[cfg(target_os = "fuchsia")]
154impl fidl::endpoints::SynchronousProxy for RoleManagerSynchronousProxy {
155 type Proxy = RoleManagerProxy;
156 type Protocol = RoleManagerMarker;
157
158 fn from_channel(inner: fidl::Channel) -> Self {
159 Self::new(inner)
160 }
161
162 fn into_channel(self) -> fidl::Channel {
163 self.client.into_channel()
164 }
165
166 fn as_channel(&self) -> &fidl::Channel {
167 self.client.as_channel()
168 }
169}
170
171#[cfg(target_os = "fuchsia")]
172impl RoleManagerSynchronousProxy {
173 pub fn new(channel: fidl::Channel) -> Self {
174 Self { client: fidl::client::sync::Client::new(channel) }
175 }
176
177 pub fn into_channel(self) -> fidl::Channel {
178 self.client.into_channel()
179 }
180
181 pub fn wait_for_event(
184 &self,
185 deadline: zx::MonotonicInstant,
186 ) -> Result<RoleManagerEvent, fidl::Error> {
187 RoleManagerEvent::decode(self.client.wait_for_event::<RoleManagerMarker>(deadline)?)
188 }
189
190 pub fn r#set_role(
203 &self,
204 mut payload: RoleManagerSetRoleRequest,
205 ___deadline: zx::MonotonicInstant,
206 ) -> Result<RoleManagerSetRoleResult, fidl::Error> {
207 let _response = self.client.send_query::<
208 RoleManagerSetRoleRequest,
209 fidl::encoding::FlexibleResultType<RoleManagerSetRoleResponse, i32>,
210 RoleManagerMarker,
211 >(
212 &mut payload,
213 0x617dd765af923edc,
214 fidl::encoding::DynamicFlags::FLEXIBLE,
215 ___deadline,
216 )?
217 .into_result::<RoleManagerMarker>("set_role")?;
218 Ok(_response.map(|x| x))
219 }
220
221 pub fn r#get_profile_for_role(
232 &self,
233 mut payload: RoleManagerGetProfileForRoleRequest,
234 ___deadline: zx::MonotonicInstant,
235 ) -> Result<RoleManagerGetProfileForRoleResult, fidl::Error> {
236 let _response = self.client.send_query::<
237 RoleManagerGetProfileForRoleRequest,
238 fidl::encoding::FlexibleResultType<RoleManagerGetProfileForRoleResponse, i32>,
239 RoleManagerMarker,
240 >(
241 &mut payload,
242 0x3969032370723810,
243 fidl::encoding::DynamicFlags::FLEXIBLE,
244 ___deadline,
245 )?
246 .into_result::<RoleManagerMarker>("get_profile_for_role")?;
247 Ok(_response.map(|x| x))
248 }
249}
250
251#[cfg(target_os = "fuchsia")]
252impl From<RoleManagerSynchronousProxy> for zx::NullableHandle {
253 fn from(value: RoleManagerSynchronousProxy) -> Self {
254 value.into_channel().into()
255 }
256}
257
258#[cfg(target_os = "fuchsia")]
259impl From<fidl::Channel> for RoleManagerSynchronousProxy {
260 fn from(value: fidl::Channel) -> Self {
261 Self::new(value)
262 }
263}
264
265#[cfg(target_os = "fuchsia")]
266impl fidl::endpoints::FromClient for RoleManagerSynchronousProxy {
267 type Protocol = RoleManagerMarker;
268
269 fn from_client(value: fidl::endpoints::ClientEnd<RoleManagerMarker>) -> Self {
270 Self::new(value.into_channel())
271 }
272}
273
274#[derive(Debug, Clone)]
275pub struct RoleManagerProxy {
276 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
277}
278
279impl fidl::endpoints::Proxy for RoleManagerProxy {
280 type Protocol = RoleManagerMarker;
281
282 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
283 Self::new(inner)
284 }
285
286 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
287 self.client.into_channel().map_err(|client| Self { client })
288 }
289
290 fn as_channel(&self) -> &::fidl::AsyncChannel {
291 self.client.as_channel()
292 }
293}
294
295impl RoleManagerProxy {
296 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
298 let protocol_name = <RoleManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
299 Self { client: fidl::client::Client::new(channel, protocol_name) }
300 }
301
302 pub fn take_event_stream(&self) -> RoleManagerEventStream {
308 RoleManagerEventStream { event_receiver: self.client.take_event_receiver() }
309 }
310
311 pub fn r#set_role(
324 &self,
325 mut payload: RoleManagerSetRoleRequest,
326 ) -> fidl::client::QueryResponseFut<
327 RoleManagerSetRoleResult,
328 fidl::encoding::DefaultFuchsiaResourceDialect,
329 > {
330 RoleManagerProxyInterface::r#set_role(self, payload)
331 }
332
333 pub fn r#get_profile_for_role(
344 &self,
345 mut payload: RoleManagerGetProfileForRoleRequest,
346 ) -> fidl::client::QueryResponseFut<
347 RoleManagerGetProfileForRoleResult,
348 fidl::encoding::DefaultFuchsiaResourceDialect,
349 > {
350 RoleManagerProxyInterface::r#get_profile_for_role(self, payload)
351 }
352}
353
354impl RoleManagerProxyInterface for RoleManagerProxy {
355 type SetRoleResponseFut = fidl::client::QueryResponseFut<
356 RoleManagerSetRoleResult,
357 fidl::encoding::DefaultFuchsiaResourceDialect,
358 >;
359 fn r#set_role(&self, mut payload: RoleManagerSetRoleRequest) -> Self::SetRoleResponseFut {
360 fn _decode(
361 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
362 ) -> Result<RoleManagerSetRoleResult, fidl::Error> {
363 let _response = fidl::client::decode_transaction_body::<
364 fidl::encoding::FlexibleResultType<RoleManagerSetRoleResponse, i32>,
365 fidl::encoding::DefaultFuchsiaResourceDialect,
366 0x617dd765af923edc,
367 >(_buf?)?
368 .into_result::<RoleManagerMarker>("set_role")?;
369 Ok(_response.map(|x| x))
370 }
371 self.client.send_query_and_decode::<RoleManagerSetRoleRequest, RoleManagerSetRoleResult>(
372 &mut payload,
373 0x617dd765af923edc,
374 fidl::encoding::DynamicFlags::FLEXIBLE,
375 _decode,
376 )
377 }
378
379 type GetProfileForRoleResponseFut = fidl::client::QueryResponseFut<
380 RoleManagerGetProfileForRoleResult,
381 fidl::encoding::DefaultFuchsiaResourceDialect,
382 >;
383 fn r#get_profile_for_role(
384 &self,
385 mut payload: RoleManagerGetProfileForRoleRequest,
386 ) -> Self::GetProfileForRoleResponseFut {
387 fn _decode(
388 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
389 ) -> Result<RoleManagerGetProfileForRoleResult, fidl::Error> {
390 let _response = fidl::client::decode_transaction_body::<
391 fidl::encoding::FlexibleResultType<RoleManagerGetProfileForRoleResponse, i32>,
392 fidl::encoding::DefaultFuchsiaResourceDialect,
393 0x3969032370723810,
394 >(_buf?)?
395 .into_result::<RoleManagerMarker>("get_profile_for_role")?;
396 Ok(_response.map(|x| x))
397 }
398 self.client.send_query_and_decode::<
399 RoleManagerGetProfileForRoleRequest,
400 RoleManagerGetProfileForRoleResult,
401 >(
402 &mut payload,
403 0x3969032370723810,
404 fidl::encoding::DynamicFlags::FLEXIBLE,
405 _decode,
406 )
407 }
408}
409
410pub struct RoleManagerEventStream {
411 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
412}
413
414impl std::marker::Unpin for RoleManagerEventStream {}
415
416impl futures::stream::FusedStream for RoleManagerEventStream {
417 fn is_terminated(&self) -> bool {
418 self.event_receiver.is_terminated()
419 }
420}
421
422impl futures::Stream for RoleManagerEventStream {
423 type Item = Result<RoleManagerEvent, fidl::Error>;
424
425 fn poll_next(
426 mut self: std::pin::Pin<&mut Self>,
427 cx: &mut std::task::Context<'_>,
428 ) -> std::task::Poll<Option<Self::Item>> {
429 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
430 &mut self.event_receiver,
431 cx
432 )?) {
433 Some(buf) => std::task::Poll::Ready(Some(RoleManagerEvent::decode(buf))),
434 None => std::task::Poll::Ready(None),
435 }
436 }
437}
438
439#[derive(Debug)]
440pub enum RoleManagerEvent {
441 #[non_exhaustive]
442 _UnknownEvent {
443 ordinal: u64,
445 },
446}
447
448impl RoleManagerEvent {
449 fn decode(
451 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
452 ) -> Result<RoleManagerEvent, fidl::Error> {
453 let (bytes, _handles) = buf.split_mut();
454 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
455 debug_assert_eq!(tx_header.tx_id, 0);
456 match tx_header.ordinal {
457 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
458 Ok(RoleManagerEvent::_UnknownEvent { ordinal: tx_header.ordinal })
459 }
460 _ => Err(fidl::Error::UnknownOrdinal {
461 ordinal: tx_header.ordinal,
462 protocol_name: <RoleManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
463 }),
464 }
465 }
466}
467
468pub struct RoleManagerRequestStream {
470 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
471 is_terminated: bool,
472}
473
474impl std::marker::Unpin for RoleManagerRequestStream {}
475
476impl futures::stream::FusedStream for RoleManagerRequestStream {
477 fn is_terminated(&self) -> bool {
478 self.is_terminated
479 }
480}
481
482impl fidl::endpoints::RequestStream for RoleManagerRequestStream {
483 type Protocol = RoleManagerMarker;
484 type ControlHandle = RoleManagerControlHandle;
485
486 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
487 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
488 }
489
490 fn control_handle(&self) -> Self::ControlHandle {
491 RoleManagerControlHandle { inner: self.inner.clone() }
492 }
493
494 fn into_inner(
495 self,
496 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
497 {
498 (self.inner, self.is_terminated)
499 }
500
501 fn from_inner(
502 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
503 is_terminated: bool,
504 ) -> Self {
505 Self { inner, is_terminated }
506 }
507}
508
509impl futures::Stream for RoleManagerRequestStream {
510 type Item = Result<RoleManagerRequest, fidl::Error>;
511
512 fn poll_next(
513 mut self: std::pin::Pin<&mut Self>,
514 cx: &mut std::task::Context<'_>,
515 ) -> std::task::Poll<Option<Self::Item>> {
516 let this = &mut *self;
517 if this.inner.check_shutdown(cx) {
518 this.is_terminated = true;
519 return std::task::Poll::Ready(None);
520 }
521 if this.is_terminated {
522 panic!("polled RoleManagerRequestStream after completion");
523 }
524 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
525 |bytes, handles| {
526 match this.inner.channel().read_etc(cx, bytes, handles) {
527 std::task::Poll::Ready(Ok(())) => {}
528 std::task::Poll::Pending => return std::task::Poll::Pending,
529 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
530 this.is_terminated = true;
531 return std::task::Poll::Ready(None);
532 }
533 std::task::Poll::Ready(Err(e)) => {
534 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
535 e.into(),
536 ))));
537 }
538 }
539
540 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
542
543 std::task::Poll::Ready(Some(match header.ordinal {
544 0x617dd765af923edc => {
545 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
546 let mut req = fidl::new_empty!(
547 RoleManagerSetRoleRequest,
548 fidl::encoding::DefaultFuchsiaResourceDialect
549 );
550 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RoleManagerSetRoleRequest>(&header, _body_bytes, handles, &mut req)?;
551 let control_handle = RoleManagerControlHandle { inner: this.inner.clone() };
552 Ok(RoleManagerRequest::SetRole {
553 payload: req,
554 responder: RoleManagerSetRoleResponder {
555 control_handle: std::mem::ManuallyDrop::new(control_handle),
556 tx_id: header.tx_id,
557 },
558 })
559 }
560 0x3969032370723810 => {
561 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
562 let mut req = fidl::new_empty!(
563 RoleManagerGetProfileForRoleRequest,
564 fidl::encoding::DefaultFuchsiaResourceDialect
565 );
566 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RoleManagerGetProfileForRoleRequest>(&header, _body_bytes, handles, &mut req)?;
567 let control_handle = RoleManagerControlHandle { inner: this.inner.clone() };
568 Ok(RoleManagerRequest::GetProfileForRole {
569 payload: req,
570 responder: RoleManagerGetProfileForRoleResponder {
571 control_handle: std::mem::ManuallyDrop::new(control_handle),
572 tx_id: header.tx_id,
573 },
574 })
575 }
576 _ if header.tx_id == 0
577 && header
578 .dynamic_flags()
579 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
580 {
581 Ok(RoleManagerRequest::_UnknownMethod {
582 ordinal: header.ordinal,
583 control_handle: RoleManagerControlHandle { inner: this.inner.clone() },
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(RoleManagerRequest::_UnknownMethod {
599 ordinal: header.ordinal,
600 control_handle: RoleManagerControlHandle { inner: this.inner.clone() },
601 method_type: fidl::MethodType::TwoWay,
602 })
603 }
604 _ => Err(fidl::Error::UnknownOrdinal {
605 ordinal: header.ordinal,
606 protocol_name:
607 <RoleManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
608 }),
609 }))
610 },
611 )
612 }
613}
614
615#[derive(Debug)]
617pub enum RoleManagerRequest {
618 SetRole { payload: RoleManagerSetRoleRequest, responder: RoleManagerSetRoleResponder },
631 GetProfileForRole {
642 payload: RoleManagerGetProfileForRoleRequest,
643 responder: RoleManagerGetProfileForRoleResponder,
644 },
645 #[non_exhaustive]
647 _UnknownMethod {
648 ordinal: u64,
650 control_handle: RoleManagerControlHandle,
651 method_type: fidl::MethodType,
652 },
653}
654
655impl RoleManagerRequest {
656 #[allow(irrefutable_let_patterns)]
657 pub fn into_set_role(self) -> Option<(RoleManagerSetRoleRequest, RoleManagerSetRoleResponder)> {
658 if let RoleManagerRequest::SetRole { payload, responder } = self {
659 Some((payload, responder))
660 } else {
661 None
662 }
663 }
664
665 #[allow(irrefutable_let_patterns)]
666 pub fn into_get_profile_for_role(
667 self,
668 ) -> Option<(RoleManagerGetProfileForRoleRequest, RoleManagerGetProfileForRoleResponder)> {
669 if let RoleManagerRequest::GetProfileForRole { payload, responder } = self {
670 Some((payload, responder))
671 } else {
672 None
673 }
674 }
675
676 pub fn method_name(&self) -> &'static str {
678 match *self {
679 RoleManagerRequest::SetRole { .. } => "set_role",
680 RoleManagerRequest::GetProfileForRole { .. } => "get_profile_for_role",
681 RoleManagerRequest::_UnknownMethod {
682 method_type: fidl::MethodType::OneWay, ..
683 } => "unknown one-way method",
684 RoleManagerRequest::_UnknownMethod {
685 method_type: fidl::MethodType::TwoWay, ..
686 } => "unknown two-way method",
687 }
688 }
689}
690
691#[derive(Debug, Clone)]
692pub struct RoleManagerControlHandle {
693 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
694}
695
696impl RoleManagerControlHandle {
697 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
698 self.inner.shutdown_with_epitaph(status.into())
699 }
700}
701
702impl fidl::endpoints::ControlHandle for RoleManagerControlHandle {
703 fn shutdown(&self) {
704 self.inner.shutdown()
705 }
706
707 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
708 self.inner.shutdown_with_epitaph(status)
709 }
710
711 fn is_closed(&self) -> bool {
712 self.inner.channel().is_closed()
713 }
714 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
715 self.inner.channel().on_closed()
716 }
717
718 #[cfg(target_os = "fuchsia")]
719 fn signal_peer(
720 &self,
721 clear_mask: zx::Signals,
722 set_mask: zx::Signals,
723 ) -> Result<(), zx_status::Status> {
724 use fidl::Peered;
725 self.inner.channel().signal_peer(clear_mask, set_mask)
726 }
727}
728
729impl RoleManagerControlHandle {}
730
731#[must_use = "FIDL methods require a response to be sent"]
732#[derive(Debug)]
733pub struct RoleManagerSetRoleResponder {
734 control_handle: std::mem::ManuallyDrop<RoleManagerControlHandle>,
735 tx_id: u32,
736}
737
738impl std::ops::Drop for RoleManagerSetRoleResponder {
742 fn drop(&mut self) {
743 self.control_handle.shutdown();
744 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
746 }
747}
748
749impl fidl::endpoints::Responder for RoleManagerSetRoleResponder {
750 type ControlHandle = RoleManagerControlHandle;
751
752 fn control_handle(&self) -> &RoleManagerControlHandle {
753 &self.control_handle
754 }
755
756 fn drop_without_shutdown(mut self) {
757 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
759 std::mem::forget(self);
761 }
762}
763
764impl RoleManagerSetRoleResponder {
765 pub fn send(
769 self,
770 mut result: Result<RoleManagerSetRoleResponse, i32>,
771 ) -> Result<(), fidl::Error> {
772 let _result = self.send_raw(result);
773 if _result.is_err() {
774 self.control_handle.shutdown();
775 }
776 self.drop_without_shutdown();
777 _result
778 }
779
780 pub fn send_no_shutdown_on_err(
782 self,
783 mut result: Result<RoleManagerSetRoleResponse, i32>,
784 ) -> Result<(), fidl::Error> {
785 let _result = self.send_raw(result);
786 self.drop_without_shutdown();
787 _result
788 }
789
790 fn send_raw(
791 &self,
792 mut result: Result<RoleManagerSetRoleResponse, i32>,
793 ) -> Result<(), fidl::Error> {
794 self.control_handle
795 .inner
796 .send::<fidl::encoding::FlexibleResultType<RoleManagerSetRoleResponse, i32>>(
797 fidl::encoding::FlexibleResult::new(result.as_mut().map_err(|e| *e)),
798 self.tx_id,
799 0x617dd765af923edc,
800 fidl::encoding::DynamicFlags::FLEXIBLE,
801 )
802 }
803}
804
805#[must_use = "FIDL methods require a response to be sent"]
806#[derive(Debug)]
807pub struct RoleManagerGetProfileForRoleResponder {
808 control_handle: std::mem::ManuallyDrop<RoleManagerControlHandle>,
809 tx_id: u32,
810}
811
812impl std::ops::Drop for RoleManagerGetProfileForRoleResponder {
816 fn drop(&mut self) {
817 self.control_handle.shutdown();
818 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
820 }
821}
822
823impl fidl::endpoints::Responder for RoleManagerGetProfileForRoleResponder {
824 type ControlHandle = RoleManagerControlHandle;
825
826 fn control_handle(&self) -> &RoleManagerControlHandle {
827 &self.control_handle
828 }
829
830 fn drop_without_shutdown(mut self) {
831 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
833 std::mem::forget(self);
835 }
836}
837
838impl RoleManagerGetProfileForRoleResponder {
839 pub fn send(
843 self,
844 mut result: Result<RoleManagerGetProfileForRoleResponse, i32>,
845 ) -> Result<(), fidl::Error> {
846 let _result = self.send_raw(result);
847 if _result.is_err() {
848 self.control_handle.shutdown();
849 }
850 self.drop_without_shutdown();
851 _result
852 }
853
854 pub fn send_no_shutdown_on_err(
856 self,
857 mut result: Result<RoleManagerGetProfileForRoleResponse, i32>,
858 ) -> Result<(), fidl::Error> {
859 let _result = self.send_raw(result);
860 self.drop_without_shutdown();
861 _result
862 }
863
864 fn send_raw(
865 &self,
866 mut result: Result<RoleManagerGetProfileForRoleResponse, i32>,
867 ) -> Result<(), fidl::Error> {
868 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
869 RoleManagerGetProfileForRoleResponse,
870 i32,
871 >>(
872 fidl::encoding::FlexibleResult::new(result.as_mut().map_err(|e| *e)),
873 self.tx_id,
874 0x3969032370723810,
875 fidl::encoding::DynamicFlags::FLEXIBLE,
876 )
877 }
878}
879
880mod internal {
881 use super::*;
882
883 impl RoleManagerGetProfileForRoleRequest {
884 #[inline(always)]
885 fn max_ordinal_present(&self) -> u64 {
886 if let Some(_) = self.input_parameters {
887 return 3;
888 }
889 if let Some(_) = self.role {
890 return 2;
891 }
892 if let Some(_) = self.target {
893 return 1;
894 }
895 0
896 }
897 }
898
899 impl fidl::encoding::ResourceTypeMarker for RoleManagerGetProfileForRoleRequest {
900 type Borrowed<'a> = &'a mut Self;
901 fn take_or_borrow<'a>(
902 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
903 ) -> Self::Borrowed<'a> {
904 value
905 }
906 }
907
908 unsafe impl fidl::encoding::TypeMarker for RoleManagerGetProfileForRoleRequest {
909 type Owned = Self;
910
911 #[inline(always)]
912 fn inline_align(_context: fidl::encoding::Context) -> usize {
913 8
914 }
915
916 #[inline(always)]
917 fn inline_size(_context: fidl::encoding::Context) -> usize {
918 16
919 }
920 }
921
922 unsafe impl
923 fidl::encoding::Encode<
924 RoleManagerGetProfileForRoleRequest,
925 fidl::encoding::DefaultFuchsiaResourceDialect,
926 > for &mut RoleManagerGetProfileForRoleRequest
927 {
928 unsafe fn encode(
929 self,
930 encoder: &mut fidl::encoding::Encoder<
931 '_,
932 fidl::encoding::DefaultFuchsiaResourceDialect,
933 >,
934 offset: usize,
935 mut depth: fidl::encoding::Depth,
936 ) -> fidl::Result<()> {
937 encoder.debug_check_bounds::<RoleManagerGetProfileForRoleRequest>(offset);
938 let max_ordinal: u64 = self.max_ordinal_present();
940 encoder.write_num(max_ordinal, offset);
941 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
942 if max_ordinal == 0 {
944 return Ok(());
945 }
946 depth.increment()?;
947 let envelope_size = 8;
948 let bytes_len = max_ordinal as usize * envelope_size;
949 #[allow(unused_variables)]
950 let offset = encoder.out_of_line_offset(bytes_len);
951 let mut _prev_end_offset: usize = 0;
952 if 1 > max_ordinal {
953 return Ok(());
954 }
955
956 let cur_offset: usize = (1 - 1) * envelope_size;
959
960 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
962
963 fidl::encoding::encode_in_envelope_optional::<
968 RoleType,
969 fidl::encoding::DefaultFuchsiaResourceDialect,
970 >(
971 self.target.as_ref().map(<RoleType as fidl::encoding::ValueTypeMarker>::borrow),
972 encoder,
973 offset + cur_offset,
974 depth,
975 )?;
976
977 _prev_end_offset = cur_offset + envelope_size;
978 if 2 > max_ordinal {
979 return Ok(());
980 }
981
982 let cur_offset: usize = (2 - 1) * envelope_size;
985
986 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
988
989 fidl::encoding::encode_in_envelope_optional::<
994 RoleName,
995 fidl::encoding::DefaultFuchsiaResourceDialect,
996 >(
997 self.role.as_ref().map(<RoleName as fidl::encoding::ValueTypeMarker>::borrow),
998 encoder,
999 offset + cur_offset,
1000 depth,
1001 )?;
1002
1003 _prev_end_offset = cur_offset + envelope_size;
1004 if 3 > max_ordinal {
1005 return Ok(());
1006 }
1007
1008 let cur_offset: usize = (3 - 1) * envelope_size;
1011
1012 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1014
1015 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<Parameter, 512>, fidl::encoding::DefaultFuchsiaResourceDialect>(
1020 self.input_parameters.as_ref().map(<fidl::encoding::Vector<Parameter, 512> as fidl::encoding::ValueTypeMarker>::borrow),
1021 encoder, offset + cur_offset, depth
1022 )?;
1023
1024 _prev_end_offset = cur_offset + envelope_size;
1025
1026 Ok(())
1027 }
1028 }
1029
1030 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1031 for RoleManagerGetProfileForRoleRequest
1032 {
1033 #[inline(always)]
1034 fn new_empty() -> Self {
1035 Self::default()
1036 }
1037
1038 unsafe fn decode(
1039 &mut self,
1040 decoder: &mut fidl::encoding::Decoder<
1041 '_,
1042 fidl::encoding::DefaultFuchsiaResourceDialect,
1043 >,
1044 offset: usize,
1045 mut depth: fidl::encoding::Depth,
1046 ) -> fidl::Result<()> {
1047 decoder.debug_check_bounds::<Self>(offset);
1048 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1049 None => return Err(fidl::Error::NotNullable),
1050 Some(len) => len,
1051 };
1052 if len == 0 {
1054 return Ok(());
1055 };
1056 depth.increment()?;
1057 let envelope_size = 8;
1058 let bytes_len = len * envelope_size;
1059 let offset = decoder.out_of_line_offset(bytes_len)?;
1060 let mut _next_ordinal_to_read = 0;
1062 let mut next_offset = offset;
1063 let end_offset = offset + bytes_len;
1064 _next_ordinal_to_read += 1;
1065 if next_offset >= end_offset {
1066 return Ok(());
1067 }
1068
1069 while _next_ordinal_to_read < 1 {
1071 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1072 _next_ordinal_to_read += 1;
1073 next_offset += envelope_size;
1074 }
1075
1076 let next_out_of_line = decoder.next_out_of_line();
1077 let handles_before = decoder.remaining_handles();
1078 if let Some((inlined, num_bytes, num_handles)) =
1079 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1080 {
1081 let member_inline_size =
1082 <RoleType as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1083 if inlined != (member_inline_size <= 4) {
1084 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1085 }
1086 let inner_offset;
1087 let mut inner_depth = depth.clone();
1088 if inlined {
1089 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1090 inner_offset = next_offset;
1091 } else {
1092 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1093 inner_depth.increment()?;
1094 }
1095 let val_ref = self.target.get_or_insert_with(|| {
1096 fidl::new_empty!(RoleType, fidl::encoding::DefaultFuchsiaResourceDialect)
1097 });
1098 fidl::decode!(
1099 RoleType,
1100 fidl::encoding::DefaultFuchsiaResourceDialect,
1101 val_ref,
1102 decoder,
1103 inner_offset,
1104 inner_depth
1105 )?;
1106 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1107 {
1108 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1109 }
1110 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1111 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1112 }
1113 }
1114
1115 next_offset += envelope_size;
1116 _next_ordinal_to_read += 1;
1117 if next_offset >= end_offset {
1118 return Ok(());
1119 }
1120
1121 while _next_ordinal_to_read < 2 {
1123 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1124 _next_ordinal_to_read += 1;
1125 next_offset += envelope_size;
1126 }
1127
1128 let next_out_of_line = decoder.next_out_of_line();
1129 let handles_before = decoder.remaining_handles();
1130 if let Some((inlined, num_bytes, num_handles)) =
1131 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1132 {
1133 let member_inline_size =
1134 <RoleName as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1135 if inlined != (member_inline_size <= 4) {
1136 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1137 }
1138 let inner_offset;
1139 let mut inner_depth = depth.clone();
1140 if inlined {
1141 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1142 inner_offset = next_offset;
1143 } else {
1144 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1145 inner_depth.increment()?;
1146 }
1147 let val_ref = self.role.get_or_insert_with(|| {
1148 fidl::new_empty!(RoleName, fidl::encoding::DefaultFuchsiaResourceDialect)
1149 });
1150 fidl::decode!(
1151 RoleName,
1152 fidl::encoding::DefaultFuchsiaResourceDialect,
1153 val_ref,
1154 decoder,
1155 inner_offset,
1156 inner_depth
1157 )?;
1158 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1159 {
1160 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1161 }
1162 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1163 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1164 }
1165 }
1166
1167 next_offset += envelope_size;
1168 _next_ordinal_to_read += 1;
1169 if next_offset >= end_offset {
1170 return Ok(());
1171 }
1172
1173 while _next_ordinal_to_read < 3 {
1175 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1176 _next_ordinal_to_read += 1;
1177 next_offset += envelope_size;
1178 }
1179
1180 let next_out_of_line = decoder.next_out_of_line();
1181 let handles_before = decoder.remaining_handles();
1182 if let Some((inlined, num_bytes, num_handles)) =
1183 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1184 {
1185 let member_inline_size = <fidl::encoding::Vector<Parameter, 512> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1186 if inlined != (member_inline_size <= 4) {
1187 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1188 }
1189 let inner_offset;
1190 let mut inner_depth = depth.clone();
1191 if inlined {
1192 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1193 inner_offset = next_offset;
1194 } else {
1195 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1196 inner_depth.increment()?;
1197 }
1198 let val_ref =
1199 self.input_parameters.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<Parameter, 512>, fidl::encoding::DefaultFuchsiaResourceDialect));
1200 fidl::decode!(fidl::encoding::Vector<Parameter, 512>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
1201 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1202 {
1203 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1204 }
1205 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1206 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1207 }
1208 }
1209
1210 next_offset += envelope_size;
1211
1212 while next_offset < end_offset {
1214 _next_ordinal_to_read += 1;
1215 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1216 next_offset += envelope_size;
1217 }
1218
1219 Ok(())
1220 }
1221 }
1222
1223 impl RoleManagerSetRoleRequest {
1224 #[inline(always)]
1225 fn max_ordinal_present(&self) -> u64 {
1226 if let Some(_) = self.input_parameters {
1227 return 3;
1228 }
1229 if let Some(_) = self.role {
1230 return 2;
1231 }
1232 if let Some(_) = self.target {
1233 return 1;
1234 }
1235 0
1236 }
1237 }
1238
1239 impl fidl::encoding::ResourceTypeMarker for RoleManagerSetRoleRequest {
1240 type Borrowed<'a> = &'a mut Self;
1241 fn take_or_borrow<'a>(
1242 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1243 ) -> Self::Borrowed<'a> {
1244 value
1245 }
1246 }
1247
1248 unsafe impl fidl::encoding::TypeMarker for RoleManagerSetRoleRequest {
1249 type Owned = Self;
1250
1251 #[inline(always)]
1252 fn inline_align(_context: fidl::encoding::Context) -> usize {
1253 8
1254 }
1255
1256 #[inline(always)]
1257 fn inline_size(_context: fidl::encoding::Context) -> usize {
1258 16
1259 }
1260 }
1261
1262 unsafe impl
1263 fidl::encoding::Encode<
1264 RoleManagerSetRoleRequest,
1265 fidl::encoding::DefaultFuchsiaResourceDialect,
1266 > for &mut RoleManagerSetRoleRequest
1267 {
1268 unsafe fn encode(
1269 self,
1270 encoder: &mut fidl::encoding::Encoder<
1271 '_,
1272 fidl::encoding::DefaultFuchsiaResourceDialect,
1273 >,
1274 offset: usize,
1275 mut depth: fidl::encoding::Depth,
1276 ) -> fidl::Result<()> {
1277 encoder.debug_check_bounds::<RoleManagerSetRoleRequest>(offset);
1278 let max_ordinal: u64 = self.max_ordinal_present();
1280 encoder.write_num(max_ordinal, offset);
1281 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1282 if max_ordinal == 0 {
1284 return Ok(());
1285 }
1286 depth.increment()?;
1287 let envelope_size = 8;
1288 let bytes_len = max_ordinal as usize * envelope_size;
1289 #[allow(unused_variables)]
1290 let offset = encoder.out_of_line_offset(bytes_len);
1291 let mut _prev_end_offset: usize = 0;
1292 if 1 > max_ordinal {
1293 return Ok(());
1294 }
1295
1296 let cur_offset: usize = (1 - 1) * envelope_size;
1299
1300 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1302
1303 fidl::encoding::encode_in_envelope_optional::<
1308 RoleTarget,
1309 fidl::encoding::DefaultFuchsiaResourceDialect,
1310 >(
1311 self.target
1312 .as_mut()
1313 .map(<RoleTarget as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
1314 encoder,
1315 offset + cur_offset,
1316 depth,
1317 )?;
1318
1319 _prev_end_offset = cur_offset + envelope_size;
1320 if 2 > max_ordinal {
1321 return Ok(());
1322 }
1323
1324 let cur_offset: usize = (2 - 1) * envelope_size;
1327
1328 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1330
1331 fidl::encoding::encode_in_envelope_optional::<
1336 RoleName,
1337 fidl::encoding::DefaultFuchsiaResourceDialect,
1338 >(
1339 self.role.as_ref().map(<RoleName as fidl::encoding::ValueTypeMarker>::borrow),
1340 encoder,
1341 offset + cur_offset,
1342 depth,
1343 )?;
1344
1345 _prev_end_offset = cur_offset + envelope_size;
1346 if 3 > max_ordinal {
1347 return Ok(());
1348 }
1349
1350 let cur_offset: usize = (3 - 1) * envelope_size;
1353
1354 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1356
1357 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<Parameter, 512>, fidl::encoding::DefaultFuchsiaResourceDialect>(
1362 self.input_parameters.as_ref().map(<fidl::encoding::Vector<Parameter, 512> as fidl::encoding::ValueTypeMarker>::borrow),
1363 encoder, offset + cur_offset, depth
1364 )?;
1365
1366 _prev_end_offset = cur_offset + envelope_size;
1367
1368 Ok(())
1369 }
1370 }
1371
1372 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1373 for RoleManagerSetRoleRequest
1374 {
1375 #[inline(always)]
1376 fn new_empty() -> Self {
1377 Self::default()
1378 }
1379
1380 unsafe fn decode(
1381 &mut self,
1382 decoder: &mut fidl::encoding::Decoder<
1383 '_,
1384 fidl::encoding::DefaultFuchsiaResourceDialect,
1385 >,
1386 offset: usize,
1387 mut depth: fidl::encoding::Depth,
1388 ) -> fidl::Result<()> {
1389 decoder.debug_check_bounds::<Self>(offset);
1390 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1391 None => return Err(fidl::Error::NotNullable),
1392 Some(len) => len,
1393 };
1394 if len == 0 {
1396 return Ok(());
1397 };
1398 depth.increment()?;
1399 let envelope_size = 8;
1400 let bytes_len = len * envelope_size;
1401 let offset = decoder.out_of_line_offset(bytes_len)?;
1402 let mut _next_ordinal_to_read = 0;
1404 let mut next_offset = offset;
1405 let end_offset = offset + bytes_len;
1406 _next_ordinal_to_read += 1;
1407 if next_offset >= end_offset {
1408 return Ok(());
1409 }
1410
1411 while _next_ordinal_to_read < 1 {
1413 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1414 _next_ordinal_to_read += 1;
1415 next_offset += envelope_size;
1416 }
1417
1418 let next_out_of_line = decoder.next_out_of_line();
1419 let handles_before = decoder.remaining_handles();
1420 if let Some((inlined, num_bytes, num_handles)) =
1421 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1422 {
1423 let member_inline_size =
1424 <RoleTarget as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1425 if inlined != (member_inline_size <= 4) {
1426 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1427 }
1428 let inner_offset;
1429 let mut inner_depth = depth.clone();
1430 if inlined {
1431 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1432 inner_offset = next_offset;
1433 } else {
1434 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1435 inner_depth.increment()?;
1436 }
1437 let val_ref = self.target.get_or_insert_with(|| {
1438 fidl::new_empty!(RoleTarget, fidl::encoding::DefaultFuchsiaResourceDialect)
1439 });
1440 fidl::decode!(
1441 RoleTarget,
1442 fidl::encoding::DefaultFuchsiaResourceDialect,
1443 val_ref,
1444 decoder,
1445 inner_offset,
1446 inner_depth
1447 )?;
1448 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1449 {
1450 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1451 }
1452 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1453 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1454 }
1455 }
1456
1457 next_offset += envelope_size;
1458 _next_ordinal_to_read += 1;
1459 if next_offset >= end_offset {
1460 return Ok(());
1461 }
1462
1463 while _next_ordinal_to_read < 2 {
1465 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1466 _next_ordinal_to_read += 1;
1467 next_offset += envelope_size;
1468 }
1469
1470 let next_out_of_line = decoder.next_out_of_line();
1471 let handles_before = decoder.remaining_handles();
1472 if let Some((inlined, num_bytes, num_handles)) =
1473 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1474 {
1475 let member_inline_size =
1476 <RoleName as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1477 if inlined != (member_inline_size <= 4) {
1478 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1479 }
1480 let inner_offset;
1481 let mut inner_depth = depth.clone();
1482 if inlined {
1483 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1484 inner_offset = next_offset;
1485 } else {
1486 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1487 inner_depth.increment()?;
1488 }
1489 let val_ref = self.role.get_or_insert_with(|| {
1490 fidl::new_empty!(RoleName, fidl::encoding::DefaultFuchsiaResourceDialect)
1491 });
1492 fidl::decode!(
1493 RoleName,
1494 fidl::encoding::DefaultFuchsiaResourceDialect,
1495 val_ref,
1496 decoder,
1497 inner_offset,
1498 inner_depth
1499 )?;
1500 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1501 {
1502 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1503 }
1504 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1505 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1506 }
1507 }
1508
1509 next_offset += envelope_size;
1510 _next_ordinal_to_read += 1;
1511 if next_offset >= end_offset {
1512 return Ok(());
1513 }
1514
1515 while _next_ordinal_to_read < 3 {
1517 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1518 _next_ordinal_to_read += 1;
1519 next_offset += envelope_size;
1520 }
1521
1522 let next_out_of_line = decoder.next_out_of_line();
1523 let handles_before = decoder.remaining_handles();
1524 if let Some((inlined, num_bytes, num_handles)) =
1525 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1526 {
1527 let member_inline_size = <fidl::encoding::Vector<Parameter, 512> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1528 if inlined != (member_inline_size <= 4) {
1529 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1530 }
1531 let inner_offset;
1532 let mut inner_depth = depth.clone();
1533 if inlined {
1534 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1535 inner_offset = next_offset;
1536 } else {
1537 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1538 inner_depth.increment()?;
1539 }
1540 let val_ref =
1541 self.input_parameters.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<Parameter, 512>, fidl::encoding::DefaultFuchsiaResourceDialect));
1542 fidl::decode!(fidl::encoding::Vector<Parameter, 512>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
1543 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1544 {
1545 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1546 }
1547 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1548 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1549 }
1550 }
1551
1552 next_offset += envelope_size;
1553
1554 while next_offset < end_offset {
1556 _next_ordinal_to_read += 1;
1557 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1558 next_offset += envelope_size;
1559 }
1560
1561 Ok(())
1562 }
1563 }
1564
1565 impl RoleManagerGetProfileForRoleResponse {
1566 #[inline(always)]
1567 fn max_ordinal_present(&self) -> u64 {
1568 if let Some(_) = self.output_parameters {
1569 return 2;
1570 }
1571 if let Some(_) = self.profile {
1572 return 1;
1573 }
1574 0
1575 }
1576 }
1577
1578 impl fidl::encoding::ResourceTypeMarker for RoleManagerGetProfileForRoleResponse {
1579 type Borrowed<'a> = &'a mut Self;
1580 fn take_or_borrow<'a>(
1581 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1582 ) -> Self::Borrowed<'a> {
1583 value
1584 }
1585 }
1586
1587 unsafe impl fidl::encoding::TypeMarker for RoleManagerGetProfileForRoleResponse {
1588 type Owned = Self;
1589
1590 #[inline(always)]
1591 fn inline_align(_context: fidl::encoding::Context) -> usize {
1592 8
1593 }
1594
1595 #[inline(always)]
1596 fn inline_size(_context: fidl::encoding::Context) -> usize {
1597 16
1598 }
1599 }
1600
1601 unsafe impl
1602 fidl::encoding::Encode<
1603 RoleManagerGetProfileForRoleResponse,
1604 fidl::encoding::DefaultFuchsiaResourceDialect,
1605 > for &mut RoleManagerGetProfileForRoleResponse
1606 {
1607 unsafe fn encode(
1608 self,
1609 encoder: &mut fidl::encoding::Encoder<
1610 '_,
1611 fidl::encoding::DefaultFuchsiaResourceDialect,
1612 >,
1613 offset: usize,
1614 mut depth: fidl::encoding::Depth,
1615 ) -> fidl::Result<()> {
1616 encoder.debug_check_bounds::<RoleManagerGetProfileForRoleResponse>(offset);
1617 let max_ordinal: u64 = self.max_ordinal_present();
1619 encoder.write_num(max_ordinal, offset);
1620 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1621 if max_ordinal == 0 {
1623 return Ok(());
1624 }
1625 depth.increment()?;
1626 let envelope_size = 8;
1627 let bytes_len = max_ordinal as usize * envelope_size;
1628 #[allow(unused_variables)]
1629 let offset = encoder.out_of_line_offset(bytes_len);
1630 let mut _prev_end_offset: usize = 0;
1631 if 1 > max_ordinal {
1632 return Ok(());
1633 }
1634
1635 let cur_offset: usize = (1 - 1) * envelope_size;
1638
1639 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1641
1642 fidl::encoding::encode_in_envelope_optional::<
1647 fidl::encoding::HandleType<
1648 fidl::Profile,
1649 { fidl::ObjectType::PROFILE.into_raw() },
1650 2147483648,
1651 >,
1652 fidl::encoding::DefaultFuchsiaResourceDialect,
1653 >(
1654 self.profile.as_mut().map(
1655 <fidl::encoding::HandleType<
1656 fidl::Profile,
1657 { fidl::ObjectType::PROFILE.into_raw() },
1658 2147483648,
1659 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
1660 ),
1661 encoder,
1662 offset + cur_offset,
1663 depth,
1664 )?;
1665
1666 _prev_end_offset = cur_offset + envelope_size;
1667 if 2 > max_ordinal {
1668 return Ok(());
1669 }
1670
1671 let cur_offset: usize = (2 - 1) * envelope_size;
1674
1675 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1677
1678 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<Parameter, 512>, fidl::encoding::DefaultFuchsiaResourceDialect>(
1683 self.output_parameters.as_ref().map(<fidl::encoding::Vector<Parameter, 512> as fidl::encoding::ValueTypeMarker>::borrow),
1684 encoder, offset + cur_offset, depth
1685 )?;
1686
1687 _prev_end_offset = cur_offset + envelope_size;
1688
1689 Ok(())
1690 }
1691 }
1692
1693 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1694 for RoleManagerGetProfileForRoleResponse
1695 {
1696 #[inline(always)]
1697 fn new_empty() -> Self {
1698 Self::default()
1699 }
1700
1701 unsafe fn decode(
1702 &mut self,
1703 decoder: &mut fidl::encoding::Decoder<
1704 '_,
1705 fidl::encoding::DefaultFuchsiaResourceDialect,
1706 >,
1707 offset: usize,
1708 mut depth: fidl::encoding::Depth,
1709 ) -> fidl::Result<()> {
1710 decoder.debug_check_bounds::<Self>(offset);
1711 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1712 None => return Err(fidl::Error::NotNullable),
1713 Some(len) => len,
1714 };
1715 if len == 0 {
1717 return Ok(());
1718 };
1719 depth.increment()?;
1720 let envelope_size = 8;
1721 let bytes_len = len * envelope_size;
1722 let offset = decoder.out_of_line_offset(bytes_len)?;
1723 let mut _next_ordinal_to_read = 0;
1725 let mut next_offset = offset;
1726 let end_offset = offset + bytes_len;
1727 _next_ordinal_to_read += 1;
1728 if next_offset >= end_offset {
1729 return Ok(());
1730 }
1731
1732 while _next_ordinal_to_read < 1 {
1734 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1735 _next_ordinal_to_read += 1;
1736 next_offset += envelope_size;
1737 }
1738
1739 let next_out_of_line = decoder.next_out_of_line();
1740 let handles_before = decoder.remaining_handles();
1741 if let Some((inlined, num_bytes, num_handles)) =
1742 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1743 {
1744 let member_inline_size = <fidl::encoding::HandleType<
1745 fidl::Profile,
1746 { fidl::ObjectType::PROFILE.into_raw() },
1747 2147483648,
1748 > as fidl::encoding::TypeMarker>::inline_size(
1749 decoder.context
1750 );
1751 if inlined != (member_inline_size <= 4) {
1752 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1753 }
1754 let inner_offset;
1755 let mut inner_depth = depth.clone();
1756 if inlined {
1757 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1758 inner_offset = next_offset;
1759 } else {
1760 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1761 inner_depth.increment()?;
1762 }
1763 let val_ref =
1764 self.profile.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Profile, { fidl::ObjectType::PROFILE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
1765 fidl::decode!(fidl::encoding::HandleType<fidl::Profile, { fidl::ObjectType::PROFILE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
1766 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1767 {
1768 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1769 }
1770 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1771 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1772 }
1773 }
1774
1775 next_offset += envelope_size;
1776 _next_ordinal_to_read += 1;
1777 if next_offset >= end_offset {
1778 return Ok(());
1779 }
1780
1781 while _next_ordinal_to_read < 2 {
1783 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1784 _next_ordinal_to_read += 1;
1785 next_offset += envelope_size;
1786 }
1787
1788 let next_out_of_line = decoder.next_out_of_line();
1789 let handles_before = decoder.remaining_handles();
1790 if let Some((inlined, num_bytes, num_handles)) =
1791 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1792 {
1793 let member_inline_size = <fidl::encoding::Vector<Parameter, 512> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1794 if inlined != (member_inline_size <= 4) {
1795 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1796 }
1797 let inner_offset;
1798 let mut inner_depth = depth.clone();
1799 if inlined {
1800 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1801 inner_offset = next_offset;
1802 } else {
1803 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1804 inner_depth.increment()?;
1805 }
1806 let val_ref =
1807 self.output_parameters.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<Parameter, 512>, fidl::encoding::DefaultFuchsiaResourceDialect));
1808 fidl::decode!(fidl::encoding::Vector<Parameter, 512>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
1809 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1810 {
1811 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1812 }
1813 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1814 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1815 }
1816 }
1817
1818 next_offset += envelope_size;
1819
1820 while next_offset < end_offset {
1822 _next_ordinal_to_read += 1;
1823 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1824 next_offset += envelope_size;
1825 }
1826
1827 Ok(())
1828 }
1829 }
1830
1831 impl RoleManagerSetRoleResponse {
1832 #[inline(always)]
1833 fn max_ordinal_present(&self) -> u64 {
1834 if let Some(_) = self.output_parameters {
1835 return 1;
1836 }
1837 0
1838 }
1839 }
1840
1841 impl fidl::encoding::ResourceTypeMarker for RoleManagerSetRoleResponse {
1842 type Borrowed<'a> = &'a mut Self;
1843 fn take_or_borrow<'a>(
1844 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1845 ) -> Self::Borrowed<'a> {
1846 value
1847 }
1848 }
1849
1850 unsafe impl fidl::encoding::TypeMarker for RoleManagerSetRoleResponse {
1851 type Owned = Self;
1852
1853 #[inline(always)]
1854 fn inline_align(_context: fidl::encoding::Context) -> usize {
1855 8
1856 }
1857
1858 #[inline(always)]
1859 fn inline_size(_context: fidl::encoding::Context) -> usize {
1860 16
1861 }
1862 }
1863
1864 unsafe impl
1865 fidl::encoding::Encode<
1866 RoleManagerSetRoleResponse,
1867 fidl::encoding::DefaultFuchsiaResourceDialect,
1868 > for &mut RoleManagerSetRoleResponse
1869 {
1870 unsafe fn encode(
1871 self,
1872 encoder: &mut fidl::encoding::Encoder<
1873 '_,
1874 fidl::encoding::DefaultFuchsiaResourceDialect,
1875 >,
1876 offset: usize,
1877 mut depth: fidl::encoding::Depth,
1878 ) -> fidl::Result<()> {
1879 encoder.debug_check_bounds::<RoleManagerSetRoleResponse>(offset);
1880 let max_ordinal: u64 = self.max_ordinal_present();
1882 encoder.write_num(max_ordinal, offset);
1883 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1884 if max_ordinal == 0 {
1886 return Ok(());
1887 }
1888 depth.increment()?;
1889 let envelope_size = 8;
1890 let bytes_len = max_ordinal as usize * envelope_size;
1891 #[allow(unused_variables)]
1892 let offset = encoder.out_of_line_offset(bytes_len);
1893 let mut _prev_end_offset: usize = 0;
1894 if 1 > max_ordinal {
1895 return Ok(());
1896 }
1897
1898 let cur_offset: usize = (1 - 1) * envelope_size;
1901
1902 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1904
1905 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<Parameter, 512>, fidl::encoding::DefaultFuchsiaResourceDialect>(
1910 self.output_parameters.as_ref().map(<fidl::encoding::Vector<Parameter, 512> as fidl::encoding::ValueTypeMarker>::borrow),
1911 encoder, offset + cur_offset, depth
1912 )?;
1913
1914 _prev_end_offset = cur_offset + envelope_size;
1915
1916 Ok(())
1917 }
1918 }
1919
1920 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1921 for RoleManagerSetRoleResponse
1922 {
1923 #[inline(always)]
1924 fn new_empty() -> Self {
1925 Self::default()
1926 }
1927
1928 unsafe fn decode(
1929 &mut self,
1930 decoder: &mut fidl::encoding::Decoder<
1931 '_,
1932 fidl::encoding::DefaultFuchsiaResourceDialect,
1933 >,
1934 offset: usize,
1935 mut depth: fidl::encoding::Depth,
1936 ) -> fidl::Result<()> {
1937 decoder.debug_check_bounds::<Self>(offset);
1938 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1939 None => return Err(fidl::Error::NotNullable),
1940 Some(len) => len,
1941 };
1942 if len == 0 {
1944 return Ok(());
1945 };
1946 depth.increment()?;
1947 let envelope_size = 8;
1948 let bytes_len = len * envelope_size;
1949 let offset = decoder.out_of_line_offset(bytes_len)?;
1950 let mut _next_ordinal_to_read = 0;
1952 let mut next_offset = offset;
1953 let end_offset = offset + bytes_len;
1954 _next_ordinal_to_read += 1;
1955 if next_offset >= end_offset {
1956 return Ok(());
1957 }
1958
1959 while _next_ordinal_to_read < 1 {
1961 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1962 _next_ordinal_to_read += 1;
1963 next_offset += envelope_size;
1964 }
1965
1966 let next_out_of_line = decoder.next_out_of_line();
1967 let handles_before = decoder.remaining_handles();
1968 if let Some((inlined, num_bytes, num_handles)) =
1969 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1970 {
1971 let member_inline_size = <fidl::encoding::Vector<Parameter, 512> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1972 if inlined != (member_inline_size <= 4) {
1973 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1974 }
1975 let inner_offset;
1976 let mut inner_depth = depth.clone();
1977 if inlined {
1978 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1979 inner_offset = next_offset;
1980 } else {
1981 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1982 inner_depth.increment()?;
1983 }
1984 let val_ref =
1985 self.output_parameters.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<Parameter, 512>, fidl::encoding::DefaultFuchsiaResourceDialect));
1986 fidl::decode!(fidl::encoding::Vector<Parameter, 512>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
1987 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1988 {
1989 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1990 }
1991 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1992 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1993 }
1994 }
1995
1996 next_offset += envelope_size;
1997
1998 while next_offset < end_offset {
2000 _next_ordinal_to_read += 1;
2001 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2002 next_offset += envelope_size;
2003 }
2004
2005 Ok(())
2006 }
2007 }
2008
2009 impl fidl::encoding::ResourceTypeMarker for RoleTarget {
2010 type Borrowed<'a> = &'a mut Self;
2011 fn take_or_borrow<'a>(
2012 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2013 ) -> Self::Borrowed<'a> {
2014 value
2015 }
2016 }
2017
2018 unsafe impl fidl::encoding::TypeMarker for RoleTarget {
2019 type Owned = Self;
2020
2021 #[inline(always)]
2022 fn inline_align(_context: fidl::encoding::Context) -> usize {
2023 8
2024 }
2025
2026 #[inline(always)]
2027 fn inline_size(_context: fidl::encoding::Context) -> usize {
2028 16
2029 }
2030 }
2031
2032 unsafe impl fidl::encoding::Encode<RoleTarget, fidl::encoding::DefaultFuchsiaResourceDialect>
2033 for &mut RoleTarget
2034 {
2035 #[inline]
2036 unsafe fn encode(
2037 self,
2038 encoder: &mut fidl::encoding::Encoder<
2039 '_,
2040 fidl::encoding::DefaultFuchsiaResourceDialect,
2041 >,
2042 offset: usize,
2043 _depth: fidl::encoding::Depth,
2044 ) -> fidl::Result<()> {
2045 encoder.debug_check_bounds::<RoleTarget>(offset);
2046 encoder.write_num::<u64>(self.ordinal(), offset);
2047 match self {
2048 RoleTarget::Thread(ref mut val) => fidl::encoding::encode_in_envelope::<
2049 fidl::encoding::HandleType<
2050 fidl::Thread,
2051 { fidl::ObjectType::THREAD.into_raw() },
2052 2147483648,
2053 >,
2054 fidl::encoding::DefaultFuchsiaResourceDialect,
2055 >(
2056 <fidl::encoding::HandleType<
2057 fidl::Thread,
2058 { fidl::ObjectType::THREAD.into_raw() },
2059 2147483648,
2060 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2061 val
2062 ),
2063 encoder,
2064 offset + 8,
2065 _depth,
2066 ),
2067 RoleTarget::Vmar(ref mut val) => fidl::encoding::encode_in_envelope::<
2068 fidl::encoding::HandleType<
2069 fidl::Vmar,
2070 { fidl::ObjectType::VMAR.into_raw() },
2071 2147483648,
2072 >,
2073 fidl::encoding::DefaultFuchsiaResourceDialect,
2074 >(
2075 <fidl::encoding::HandleType<
2076 fidl::Vmar,
2077 { fidl::ObjectType::VMAR.into_raw() },
2078 2147483648,
2079 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2080 val
2081 ),
2082 encoder,
2083 offset + 8,
2084 _depth,
2085 ),
2086 RoleTarget::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
2087 }
2088 }
2089 }
2090
2091 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for RoleTarget {
2092 #[inline(always)]
2093 fn new_empty() -> Self {
2094 Self::__SourceBreaking { unknown_ordinal: 0 }
2095 }
2096
2097 #[inline]
2098 unsafe fn decode(
2099 &mut self,
2100 decoder: &mut fidl::encoding::Decoder<
2101 '_,
2102 fidl::encoding::DefaultFuchsiaResourceDialect,
2103 >,
2104 offset: usize,
2105 mut depth: fidl::encoding::Depth,
2106 ) -> fidl::Result<()> {
2107 decoder.debug_check_bounds::<Self>(offset);
2108 #[allow(unused_variables)]
2109 let next_out_of_line = decoder.next_out_of_line();
2110 let handles_before = decoder.remaining_handles();
2111 let (ordinal, inlined, num_bytes, num_handles) =
2112 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
2113
2114 let member_inline_size = match ordinal {
2115 1 => <fidl::encoding::HandleType<
2116 fidl::Thread,
2117 { fidl::ObjectType::THREAD.into_raw() },
2118 2147483648,
2119 > as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2120 2 => <fidl::encoding::HandleType<
2121 fidl::Vmar,
2122 { fidl::ObjectType::VMAR.into_raw() },
2123 2147483648,
2124 > as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2125 0 => return Err(fidl::Error::UnknownUnionTag),
2126 _ => num_bytes as usize,
2127 };
2128
2129 if inlined != (member_inline_size <= 4) {
2130 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2131 }
2132 let _inner_offset;
2133 if inlined {
2134 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
2135 _inner_offset = offset + 8;
2136 } else {
2137 depth.increment()?;
2138 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2139 }
2140 match ordinal {
2141 1 => {
2142 #[allow(irrefutable_let_patterns)]
2143 if let RoleTarget::Thread(_) = self {
2144 } else {
2146 *self = RoleTarget::Thread(
2148 fidl::new_empty!(fidl::encoding::HandleType<fidl::Thread, { fidl::ObjectType::THREAD.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
2149 );
2150 }
2151 #[allow(irrefutable_let_patterns)]
2152 if let RoleTarget::Thread(ref mut val) = self {
2153 fidl::decode!(fidl::encoding::HandleType<fidl::Thread, { fidl::ObjectType::THREAD.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val, decoder, _inner_offset, depth)?;
2154 } else {
2155 unreachable!()
2156 }
2157 }
2158 2 => {
2159 #[allow(irrefutable_let_patterns)]
2160 if let RoleTarget::Vmar(_) = self {
2161 } else {
2163 *self = RoleTarget::Vmar(
2165 fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmar, { fidl::ObjectType::VMAR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
2166 );
2167 }
2168 #[allow(irrefutable_let_patterns)]
2169 if let RoleTarget::Vmar(ref mut val) = self {
2170 fidl::decode!(fidl::encoding::HandleType<fidl::Vmar, { fidl::ObjectType::VMAR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val, decoder, _inner_offset, depth)?;
2171 } else {
2172 unreachable!()
2173 }
2174 }
2175 #[allow(deprecated)]
2176 ordinal => {
2177 for _ in 0..num_handles {
2178 decoder.drop_next_handle()?;
2179 }
2180 *self = RoleTarget::__SourceBreaking { unknown_ordinal: ordinal };
2181 }
2182 }
2183 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
2184 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2185 }
2186 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2187 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2188 }
2189 Ok(())
2190 }
2191 }
2192}