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_netemul_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct ManagedRealmAddDeviceRequest {
16 pub path: String,
17 pub device: fidl::endpoints::ClientEnd<fidl_fuchsia_netemul_network::DeviceProxy_Marker>,
18}
19
20impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
21 for ManagedRealmAddDeviceRequest
22{
23}
24
25#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
26pub struct ManagedRealmConnectToProtocolRequest {
27 pub protocol_name: String,
28 pub child_name: Option<String>,
29 pub req: fidl::Channel,
30}
31
32impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
33 for ManagedRealmConnectToProtocolRequest
34{
35}
36
37#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
38pub struct ManagedRealmGetDevfsRequest {
39 pub devfs: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
40}
41
42impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
43 for ManagedRealmGetDevfsRequest
44{
45}
46
47#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
48pub struct ManagedRealmOpenDiagnosticsDirectoryRequest {
49 pub child_name: String,
50 pub directory: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
51}
52
53impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
54 for ManagedRealmOpenDiagnosticsDirectoryRequest
55{
56}
57
58#[derive(Debug, PartialEq)]
59pub struct SandboxCreateRealmRequest {
60 pub realm: fidl::endpoints::ServerEnd<ManagedRealmMarker>,
61 pub options: RealmOptions,
62}
63
64impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for SandboxCreateRealmRequest {}
65
66#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
67pub struct SandboxGetNetworkContextRequest {
68 pub network_context:
69 fidl::endpoints::ServerEnd<fidl_fuchsia_netemul_network::NetworkContextMarker>,
70}
71
72impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
73 for SandboxGetNetworkContextRequest
74{
75}
76
77#[derive(Debug, Default, PartialEq)]
78pub struct ChildDef {
79 pub source: Option<ChildSource>,
83 pub name: Option<String>,
87 pub exposes: Option<Vec<String>>,
91 pub uses: Option<ChildUses>,
95 pub program_args: Option<Vec<String>>,
102 pub eager: Option<bool>,
107 pub config_values: Option<Vec<ChildConfigValue>>,
112 #[doc(hidden)]
113 pub __source_breaking: fidl::marker::SourceBreaking,
114}
115
116impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ChildDef {}
117
118#[derive(Debug, Default, PartialEq)]
119pub struct InterfaceOptions {
120 pub name: Option<String>,
124 pub device: Option<fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_network::PortMarker>>,
128 pub without_autogenerated_addresses: Option<bool>,
133 pub static_ips: Option<Vec<fidl_fuchsia_net::Subnet>>,
139 pub gateway: Option<fidl_fuchsia_net::IpAddress>,
143 pub enable_ipv4_forwarding: Option<bool>,
147 pub enable_ipv6_forwarding: Option<bool>,
151 pub ipv4_multicast_neighbor_solicitations: Option<u16>,
155 pub ipv6_multicast_neighbor_solicitations: Option<u16>,
159 #[doc(hidden)]
160 pub __source_breaking: fidl::marker::SourceBreaking,
161}
162
163impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for InterfaceOptions {}
164
165#[derive(Debug, Default, PartialEq)]
166pub struct RealmOptions {
167 pub name: Option<String>,
175 pub children: Option<Vec<ChildDef>>,
179 #[doc(hidden)]
180 pub __source_breaking: fidl::marker::SourceBreaking,
181}
182
183impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for RealmOptions {}
184
185#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
186pub enum ChildSource {
187 Component(String),
189 Mock(fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>),
192}
193
194impl ChildSource {
195 #[inline]
196 pub fn ordinal(&self) -> u64 {
197 match *self {
198 Self::Component(_) => 1,
199 Self::Mock(_) => 2,
200 }
201 }
202
203 #[deprecated = "Strict unions should not use `is_unknown`"]
204 #[inline]
205 pub fn is_unknown(&self) -> bool {
206 false
207 }
208}
209
210impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ChildSource {}
211
212#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
213pub struct ConfigurableNetstackMarker;
214
215impl fidl::endpoints::ProtocolMarker for ConfigurableNetstackMarker {
216 type Proxy = ConfigurableNetstackProxy;
217 type RequestStream = ConfigurableNetstackRequestStream;
218 #[cfg(target_os = "fuchsia")]
219 type SynchronousProxy = ConfigurableNetstackSynchronousProxy;
220
221 const DEBUG_NAME: &'static str = "fuchsia.netemul.ConfigurableNetstack";
222}
223impl fidl::endpoints::DiscoverableProtocolMarker for ConfigurableNetstackMarker {}
224pub type ConfigurableNetstackConfigureInterfaceResult = Result<(), ConfigurationError>;
225
226pub trait ConfigurableNetstackProxyInterface: Send + Sync {
227 type ConfigureInterfaceResponseFut: std::future::Future<
228 Output = Result<ConfigurableNetstackConfigureInterfaceResult, fidl::Error>,
229 > + Send;
230 fn r#configure_interface(
231 &self,
232 payload: InterfaceOptions,
233 ) -> Self::ConfigureInterfaceResponseFut;
234}
235#[derive(Debug)]
236#[cfg(target_os = "fuchsia")]
237pub struct ConfigurableNetstackSynchronousProxy {
238 client: fidl::client::sync::Client,
239}
240
241#[cfg(target_os = "fuchsia")]
242impl fidl::endpoints::SynchronousProxy for ConfigurableNetstackSynchronousProxy {
243 type Proxy = ConfigurableNetstackProxy;
244 type Protocol = ConfigurableNetstackMarker;
245
246 fn from_channel(inner: fidl::Channel) -> Self {
247 Self::new(inner)
248 }
249
250 fn into_channel(self) -> fidl::Channel {
251 self.client.into_channel()
252 }
253
254 fn as_channel(&self) -> &fidl::Channel {
255 self.client.as_channel()
256 }
257}
258
259#[cfg(target_os = "fuchsia")]
260impl ConfigurableNetstackSynchronousProxy {
261 pub fn new(channel: fidl::Channel) -> Self {
262 let protocol_name =
263 <ConfigurableNetstackMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
264 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
265 }
266
267 pub fn into_channel(self) -> fidl::Channel {
268 self.client.into_channel()
269 }
270
271 pub fn wait_for_event(
274 &self,
275 deadline: zx::MonotonicInstant,
276 ) -> Result<ConfigurableNetstackEvent, fidl::Error> {
277 ConfigurableNetstackEvent::decode(self.client.wait_for_event(deadline)?)
278 }
279
280 pub fn r#configure_interface(
291 &self,
292 mut payload: InterfaceOptions,
293 ___deadline: zx::MonotonicInstant,
294 ) -> Result<ConfigurableNetstackConfigureInterfaceResult, fidl::Error> {
295 let _response = self.client.send_query::<InterfaceOptions, fidl::encoding::ResultType<
296 fidl::encoding::EmptyStruct,
297 ConfigurationError,
298 >>(
299 &mut payload,
300 0x64db8deb981ee49,
301 fidl::encoding::DynamicFlags::empty(),
302 ___deadline,
303 )?;
304 Ok(_response.map(|x| x))
305 }
306}
307
308#[cfg(target_os = "fuchsia")]
309impl From<ConfigurableNetstackSynchronousProxy> for zx::Handle {
310 fn from(value: ConfigurableNetstackSynchronousProxy) -> Self {
311 value.into_channel().into()
312 }
313}
314
315#[cfg(target_os = "fuchsia")]
316impl From<fidl::Channel> for ConfigurableNetstackSynchronousProxy {
317 fn from(value: fidl::Channel) -> Self {
318 Self::new(value)
319 }
320}
321
322#[derive(Debug, Clone)]
323pub struct ConfigurableNetstackProxy {
324 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
325}
326
327impl fidl::endpoints::Proxy for ConfigurableNetstackProxy {
328 type Protocol = ConfigurableNetstackMarker;
329
330 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
331 Self::new(inner)
332 }
333
334 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
335 self.client.into_channel().map_err(|client| Self { client })
336 }
337
338 fn as_channel(&self) -> &::fidl::AsyncChannel {
339 self.client.as_channel()
340 }
341}
342
343impl ConfigurableNetstackProxy {
344 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
346 let protocol_name =
347 <ConfigurableNetstackMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
348 Self { client: fidl::client::Client::new(channel, protocol_name) }
349 }
350
351 pub fn take_event_stream(&self) -> ConfigurableNetstackEventStream {
357 ConfigurableNetstackEventStream { event_receiver: self.client.take_event_receiver() }
358 }
359
360 pub fn r#configure_interface(
371 &self,
372 mut payload: InterfaceOptions,
373 ) -> fidl::client::QueryResponseFut<
374 ConfigurableNetstackConfigureInterfaceResult,
375 fidl::encoding::DefaultFuchsiaResourceDialect,
376 > {
377 ConfigurableNetstackProxyInterface::r#configure_interface(self, payload)
378 }
379}
380
381impl ConfigurableNetstackProxyInterface for ConfigurableNetstackProxy {
382 type ConfigureInterfaceResponseFut = fidl::client::QueryResponseFut<
383 ConfigurableNetstackConfigureInterfaceResult,
384 fidl::encoding::DefaultFuchsiaResourceDialect,
385 >;
386 fn r#configure_interface(
387 &self,
388 mut payload: InterfaceOptions,
389 ) -> Self::ConfigureInterfaceResponseFut {
390 fn _decode(
391 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
392 ) -> Result<ConfigurableNetstackConfigureInterfaceResult, fidl::Error> {
393 let _response = fidl::client::decode_transaction_body::<
394 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, ConfigurationError>,
395 fidl::encoding::DefaultFuchsiaResourceDialect,
396 0x64db8deb981ee49,
397 >(_buf?)?;
398 Ok(_response.map(|x| x))
399 }
400 self.client.send_query_and_decode::<
401 InterfaceOptions,
402 ConfigurableNetstackConfigureInterfaceResult,
403 >(
404 &mut payload,
405 0x64db8deb981ee49,
406 fidl::encoding::DynamicFlags::empty(),
407 _decode,
408 )
409 }
410}
411
412pub struct ConfigurableNetstackEventStream {
413 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
414}
415
416impl std::marker::Unpin for ConfigurableNetstackEventStream {}
417
418impl futures::stream::FusedStream for ConfigurableNetstackEventStream {
419 fn is_terminated(&self) -> bool {
420 self.event_receiver.is_terminated()
421 }
422}
423
424impl futures::Stream for ConfigurableNetstackEventStream {
425 type Item = Result<ConfigurableNetstackEvent, fidl::Error>;
426
427 fn poll_next(
428 mut self: std::pin::Pin<&mut Self>,
429 cx: &mut std::task::Context<'_>,
430 ) -> std::task::Poll<Option<Self::Item>> {
431 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
432 &mut self.event_receiver,
433 cx
434 )?) {
435 Some(buf) => std::task::Poll::Ready(Some(ConfigurableNetstackEvent::decode(buf))),
436 None => std::task::Poll::Ready(None),
437 }
438 }
439}
440
441#[derive(Debug)]
442pub enum ConfigurableNetstackEvent {}
443
444impl ConfigurableNetstackEvent {
445 fn decode(
447 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
448 ) -> Result<ConfigurableNetstackEvent, fidl::Error> {
449 let (bytes, _handles) = buf.split_mut();
450 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
451 debug_assert_eq!(tx_header.tx_id, 0);
452 match tx_header.ordinal {
453 _ => Err(fidl::Error::UnknownOrdinal {
454 ordinal: tx_header.ordinal,
455 protocol_name:
456 <ConfigurableNetstackMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
457 }),
458 }
459 }
460}
461
462pub struct ConfigurableNetstackRequestStream {
464 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
465 is_terminated: bool,
466}
467
468impl std::marker::Unpin for ConfigurableNetstackRequestStream {}
469
470impl futures::stream::FusedStream for ConfigurableNetstackRequestStream {
471 fn is_terminated(&self) -> bool {
472 self.is_terminated
473 }
474}
475
476impl fidl::endpoints::RequestStream for ConfigurableNetstackRequestStream {
477 type Protocol = ConfigurableNetstackMarker;
478 type ControlHandle = ConfigurableNetstackControlHandle;
479
480 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
481 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
482 }
483
484 fn control_handle(&self) -> Self::ControlHandle {
485 ConfigurableNetstackControlHandle { inner: self.inner.clone() }
486 }
487
488 fn into_inner(
489 self,
490 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
491 {
492 (self.inner, self.is_terminated)
493 }
494
495 fn from_inner(
496 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
497 is_terminated: bool,
498 ) -> Self {
499 Self { inner, is_terminated }
500 }
501}
502
503impl futures::Stream for ConfigurableNetstackRequestStream {
504 type Item = Result<ConfigurableNetstackRequest, fidl::Error>;
505
506 fn poll_next(
507 mut self: std::pin::Pin<&mut Self>,
508 cx: &mut std::task::Context<'_>,
509 ) -> std::task::Poll<Option<Self::Item>> {
510 let this = &mut *self;
511 if this.inner.check_shutdown(cx) {
512 this.is_terminated = true;
513 return std::task::Poll::Ready(None);
514 }
515 if this.is_terminated {
516 panic!("polled ConfigurableNetstackRequestStream after completion");
517 }
518 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
519 |bytes, handles| {
520 match this.inner.channel().read_etc(cx, bytes, handles) {
521 std::task::Poll::Ready(Ok(())) => {}
522 std::task::Poll::Pending => return std::task::Poll::Pending,
523 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
524 this.is_terminated = true;
525 return std::task::Poll::Ready(None);
526 }
527 std::task::Poll::Ready(Err(e)) => {
528 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
529 e.into(),
530 ))))
531 }
532 }
533
534 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
536
537 std::task::Poll::Ready(Some(match header.ordinal {
538 0x64db8deb981ee49 => {
539 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
540 let mut req = fidl::new_empty!(InterfaceOptions, fidl::encoding::DefaultFuchsiaResourceDialect);
541 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InterfaceOptions>(&header, _body_bytes, handles, &mut req)?;
542 let control_handle = ConfigurableNetstackControlHandle {
543 inner: this.inner.clone(),
544 };
545 Ok(ConfigurableNetstackRequest::ConfigureInterface {payload: req,
546 responder: ConfigurableNetstackConfigureInterfaceResponder {
547 control_handle: std::mem::ManuallyDrop::new(control_handle),
548 tx_id: header.tx_id,
549 },
550 })
551 }
552 _ => Err(fidl::Error::UnknownOrdinal {
553 ordinal: header.ordinal,
554 protocol_name: <ConfigurableNetstackMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
555 }),
556 }))
557 },
558 )
559 }
560}
561
562#[derive(Debug)]
567pub enum ConfigurableNetstackRequest {
568 ConfigureInterface {
579 payload: InterfaceOptions,
580 responder: ConfigurableNetstackConfigureInterfaceResponder,
581 },
582}
583
584impl ConfigurableNetstackRequest {
585 #[allow(irrefutable_let_patterns)]
586 pub fn into_configure_interface(
587 self,
588 ) -> Option<(InterfaceOptions, ConfigurableNetstackConfigureInterfaceResponder)> {
589 if let ConfigurableNetstackRequest::ConfigureInterface { payload, responder } = self {
590 Some((payload, responder))
591 } else {
592 None
593 }
594 }
595
596 pub fn method_name(&self) -> &'static str {
598 match *self {
599 ConfigurableNetstackRequest::ConfigureInterface { .. } => "configure_interface",
600 }
601 }
602}
603
604#[derive(Debug, Clone)]
605pub struct ConfigurableNetstackControlHandle {
606 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
607}
608
609impl fidl::endpoints::ControlHandle for ConfigurableNetstackControlHandle {
610 fn shutdown(&self) {
611 self.inner.shutdown()
612 }
613 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
614 self.inner.shutdown_with_epitaph(status)
615 }
616
617 fn is_closed(&self) -> bool {
618 self.inner.channel().is_closed()
619 }
620 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
621 self.inner.channel().on_closed()
622 }
623
624 #[cfg(target_os = "fuchsia")]
625 fn signal_peer(
626 &self,
627 clear_mask: zx::Signals,
628 set_mask: zx::Signals,
629 ) -> Result<(), zx_status::Status> {
630 use fidl::Peered;
631 self.inner.channel().signal_peer(clear_mask, set_mask)
632 }
633}
634
635impl ConfigurableNetstackControlHandle {}
636
637#[must_use = "FIDL methods require a response to be sent"]
638#[derive(Debug)]
639pub struct ConfigurableNetstackConfigureInterfaceResponder {
640 control_handle: std::mem::ManuallyDrop<ConfigurableNetstackControlHandle>,
641 tx_id: u32,
642}
643
644impl std::ops::Drop for ConfigurableNetstackConfigureInterfaceResponder {
648 fn drop(&mut self) {
649 self.control_handle.shutdown();
650 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
652 }
653}
654
655impl fidl::endpoints::Responder for ConfigurableNetstackConfigureInterfaceResponder {
656 type ControlHandle = ConfigurableNetstackControlHandle;
657
658 fn control_handle(&self) -> &ConfigurableNetstackControlHandle {
659 &self.control_handle
660 }
661
662 fn drop_without_shutdown(mut self) {
663 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
665 std::mem::forget(self);
667 }
668}
669
670impl ConfigurableNetstackConfigureInterfaceResponder {
671 pub fn send(self, mut result: Result<(), ConfigurationError>) -> Result<(), fidl::Error> {
675 let _result = self.send_raw(result);
676 if _result.is_err() {
677 self.control_handle.shutdown();
678 }
679 self.drop_without_shutdown();
680 _result
681 }
682
683 pub fn send_no_shutdown_on_err(
685 self,
686 mut result: Result<(), ConfigurationError>,
687 ) -> Result<(), fidl::Error> {
688 let _result = self.send_raw(result);
689 self.drop_without_shutdown();
690 _result
691 }
692
693 fn send_raw(&self, mut result: Result<(), ConfigurationError>) -> Result<(), fidl::Error> {
694 self.control_handle.inner.send::<fidl::encoding::ResultType<
695 fidl::encoding::EmptyStruct,
696 ConfigurationError,
697 >>(
698 result,
699 self.tx_id,
700 0x64db8deb981ee49,
701 fidl::encoding::DynamicFlags::empty(),
702 )
703 }
704}
705
706#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
707pub struct ManagedRealmMarker;
708
709impl fidl::endpoints::ProtocolMarker for ManagedRealmMarker {
710 type Proxy = ManagedRealmProxy;
711 type RequestStream = ManagedRealmRequestStream;
712 #[cfg(target_os = "fuchsia")]
713 type SynchronousProxy = ManagedRealmSynchronousProxy;
714
715 const DEBUG_NAME: &'static str = "(anonymous) ManagedRealm";
716}
717pub type ManagedRealmAddDeviceResult = Result<(), i32>;
718pub type ManagedRealmRemoveDeviceResult = Result<(), i32>;
719pub type ManagedRealmStartChildComponentResult = Result<(), i32>;
720pub type ManagedRealmStopChildComponentResult = Result<(), i32>;
721
722pub trait ManagedRealmProxyInterface: Send + Sync {
723 type GetMonikerResponseFut: std::future::Future<Output = Result<String, fidl::Error>> + Send;
724 fn r#get_moniker(&self) -> Self::GetMonikerResponseFut;
725 fn r#connect_to_protocol(
726 &self,
727 protocol_name: &str,
728 child_name: Option<&str>,
729 req: fidl::Channel,
730 ) -> Result<(), fidl::Error>;
731 type AddDeviceResponseFut: std::future::Future<Output = Result<ManagedRealmAddDeviceResult, fidl::Error>>
732 + Send;
733 fn r#add_device(
734 &self,
735 path: &str,
736 device: fidl::endpoints::ClientEnd<fidl_fuchsia_netemul_network::DeviceProxy_Marker>,
737 ) -> Self::AddDeviceResponseFut;
738 type RemoveDeviceResponseFut: std::future::Future<Output = Result<ManagedRealmRemoveDeviceResult, fidl::Error>>
739 + Send;
740 fn r#remove_device(&self, path: &str) -> Self::RemoveDeviceResponseFut;
741 fn r#get_devfs(
742 &self,
743 devfs: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
744 ) -> Result<(), fidl::Error>;
745 type StartChildComponentResponseFut: std::future::Future<Output = Result<ManagedRealmStartChildComponentResult, fidl::Error>>
746 + Send;
747 fn r#start_child_component(&self, child_name: &str) -> Self::StartChildComponentResponseFut;
748 type StopChildComponentResponseFut: std::future::Future<Output = Result<ManagedRealmStopChildComponentResult, fidl::Error>>
749 + Send;
750 fn r#stop_child_component(&self, child_name: &str) -> Self::StopChildComponentResponseFut;
751 fn r#shutdown(&self) -> Result<(), fidl::Error>;
752 fn r#open_diagnostics_directory(
753 &self,
754 child_name: &str,
755 directory: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
756 ) -> Result<(), fidl::Error>;
757}
758#[derive(Debug)]
759#[cfg(target_os = "fuchsia")]
760pub struct ManagedRealmSynchronousProxy {
761 client: fidl::client::sync::Client,
762}
763
764#[cfg(target_os = "fuchsia")]
765impl fidl::endpoints::SynchronousProxy for ManagedRealmSynchronousProxy {
766 type Proxy = ManagedRealmProxy;
767 type Protocol = ManagedRealmMarker;
768
769 fn from_channel(inner: fidl::Channel) -> Self {
770 Self::new(inner)
771 }
772
773 fn into_channel(self) -> fidl::Channel {
774 self.client.into_channel()
775 }
776
777 fn as_channel(&self) -> &fidl::Channel {
778 self.client.as_channel()
779 }
780}
781
782#[cfg(target_os = "fuchsia")]
783impl ManagedRealmSynchronousProxy {
784 pub fn new(channel: fidl::Channel) -> Self {
785 let protocol_name = <ManagedRealmMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
786 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
787 }
788
789 pub fn into_channel(self) -> fidl::Channel {
790 self.client.into_channel()
791 }
792
793 pub fn wait_for_event(
796 &self,
797 deadline: zx::MonotonicInstant,
798 ) -> Result<ManagedRealmEvent, fidl::Error> {
799 ManagedRealmEvent::decode(self.client.wait_for_event(deadline)?)
800 }
801
802 pub fn r#get_moniker(&self, ___deadline: zx::MonotonicInstant) -> Result<String, fidl::Error> {
807 let _response = self
808 .client
809 .send_query::<fidl::encoding::EmptyPayload, ManagedRealmGetMonikerResponse>(
810 (),
811 0xec8f2bf894ddc5f,
812 fidl::encoding::DynamicFlags::empty(),
813 ___deadline,
814 )?;
815 Ok(_response.moniker)
816 }
817
818 pub fn r#connect_to_protocol(
830 &self,
831 mut protocol_name: &str,
832 mut child_name: Option<&str>,
833 mut req: fidl::Channel,
834 ) -> Result<(), fidl::Error> {
835 self.client.send::<ManagedRealmConnectToProtocolRequest>(
836 (protocol_name, child_name, req),
837 0x20865b728239813d,
838 fidl::encoding::DynamicFlags::empty(),
839 )
840 }
841
842 pub fn r#add_device(
855 &self,
856 mut path: &str,
857 mut device: fidl::endpoints::ClientEnd<fidl_fuchsia_netemul_network::DeviceProxy_Marker>,
858 ___deadline: zx::MonotonicInstant,
859 ) -> Result<ManagedRealmAddDeviceResult, fidl::Error> {
860 let _response = self.client.send_query::<
861 ManagedRealmAddDeviceRequest,
862 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
863 >(
864 (path, device,),
865 0x789925e6f5d47c07,
866 fidl::encoding::DynamicFlags::empty(),
867 ___deadline,
868 )?;
869 Ok(_response.map(|x| x))
870 }
871
872 pub fn r#remove_device(
880 &self,
881 mut path: &str,
882 ___deadline: zx::MonotonicInstant,
883 ) -> Result<ManagedRealmRemoveDeviceResult, fidl::Error> {
884 let _response = self.client.send_query::<
885 ManagedRealmRemoveDeviceRequest,
886 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
887 >(
888 (path,),
889 0x6cffbba70ac757cc,
890 fidl::encoding::DynamicFlags::empty(),
891 ___deadline,
892 )?;
893 Ok(_response.map(|x| x))
894 }
895
896 pub fn r#get_devfs(
900 &self,
901 mut devfs: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
902 ) -> Result<(), fidl::Error> {
903 self.client.send::<ManagedRealmGetDevfsRequest>(
904 (devfs,),
905 0x707e2b17f65fcadc,
906 fidl::encoding::DynamicFlags::empty(),
907 )
908 }
909
910 pub fn r#start_child_component(
920 &self,
921 mut child_name: &str,
922 ___deadline: zx::MonotonicInstant,
923 ) -> Result<ManagedRealmStartChildComponentResult, fidl::Error> {
924 let _response = self.client.send_query::<
925 ManagedRealmStartChildComponentRequest,
926 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
927 >(
928 (child_name,),
929 0x20dfa243752906a1,
930 fidl::encoding::DynamicFlags::empty(),
931 ___deadline,
932 )?;
933 Ok(_response.map(|x| x))
934 }
935
936 pub fn r#stop_child_component(
946 &self,
947 mut child_name: &str,
948 ___deadline: zx::MonotonicInstant,
949 ) -> Result<ManagedRealmStopChildComponentResult, fidl::Error> {
950 let _response = self.client.send_query::<
951 ManagedRealmStopChildComponentRequest,
952 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
953 >(
954 (child_name,),
955 0x5ecfe48430aeeca7,
956 fidl::encoding::DynamicFlags::empty(),
957 ___deadline,
958 )?;
959 Ok(_response.map(|x| x))
960 }
961
962 pub fn r#shutdown(&self) -> Result<(), fidl::Error> {
967 self.client.send::<fidl::encoding::EmptyPayload>(
968 (),
969 0x4750920f723fba9d,
970 fidl::encoding::DynamicFlags::empty(),
971 )
972 }
973
974 pub fn r#open_diagnostics_directory(
976 &self,
977 mut child_name: &str,
978 mut directory: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
979 ) -> Result<(), fidl::Error> {
980 self.client.send::<ManagedRealmOpenDiagnosticsDirectoryRequest>(
981 (child_name, directory),
982 0x7c5312484aa41c99,
983 fidl::encoding::DynamicFlags::empty(),
984 )
985 }
986}
987
988#[cfg(target_os = "fuchsia")]
989impl From<ManagedRealmSynchronousProxy> for zx::Handle {
990 fn from(value: ManagedRealmSynchronousProxy) -> Self {
991 value.into_channel().into()
992 }
993}
994
995#[cfg(target_os = "fuchsia")]
996impl From<fidl::Channel> for ManagedRealmSynchronousProxy {
997 fn from(value: fidl::Channel) -> Self {
998 Self::new(value)
999 }
1000}
1001
1002#[derive(Debug, Clone)]
1003pub struct ManagedRealmProxy {
1004 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1005}
1006
1007impl fidl::endpoints::Proxy for ManagedRealmProxy {
1008 type Protocol = ManagedRealmMarker;
1009
1010 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1011 Self::new(inner)
1012 }
1013
1014 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1015 self.client.into_channel().map_err(|client| Self { client })
1016 }
1017
1018 fn as_channel(&self) -> &::fidl::AsyncChannel {
1019 self.client.as_channel()
1020 }
1021}
1022
1023impl ManagedRealmProxy {
1024 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1026 let protocol_name = <ManagedRealmMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1027 Self { client: fidl::client::Client::new(channel, protocol_name) }
1028 }
1029
1030 pub fn take_event_stream(&self) -> ManagedRealmEventStream {
1036 ManagedRealmEventStream { event_receiver: self.client.take_event_receiver() }
1037 }
1038
1039 pub fn r#get_moniker(
1044 &self,
1045 ) -> fidl::client::QueryResponseFut<String, fidl::encoding::DefaultFuchsiaResourceDialect> {
1046 ManagedRealmProxyInterface::r#get_moniker(self)
1047 }
1048
1049 pub fn r#connect_to_protocol(
1061 &self,
1062 mut protocol_name: &str,
1063 mut child_name: Option<&str>,
1064 mut req: fidl::Channel,
1065 ) -> Result<(), fidl::Error> {
1066 ManagedRealmProxyInterface::r#connect_to_protocol(self, protocol_name, child_name, req)
1067 }
1068
1069 pub fn r#add_device(
1082 &self,
1083 mut path: &str,
1084 mut device: fidl::endpoints::ClientEnd<fidl_fuchsia_netemul_network::DeviceProxy_Marker>,
1085 ) -> fidl::client::QueryResponseFut<
1086 ManagedRealmAddDeviceResult,
1087 fidl::encoding::DefaultFuchsiaResourceDialect,
1088 > {
1089 ManagedRealmProxyInterface::r#add_device(self, path, device)
1090 }
1091
1092 pub fn r#remove_device(
1100 &self,
1101 mut path: &str,
1102 ) -> fidl::client::QueryResponseFut<
1103 ManagedRealmRemoveDeviceResult,
1104 fidl::encoding::DefaultFuchsiaResourceDialect,
1105 > {
1106 ManagedRealmProxyInterface::r#remove_device(self, path)
1107 }
1108
1109 pub fn r#get_devfs(
1113 &self,
1114 mut devfs: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
1115 ) -> Result<(), fidl::Error> {
1116 ManagedRealmProxyInterface::r#get_devfs(self, devfs)
1117 }
1118
1119 pub fn r#start_child_component(
1129 &self,
1130 mut child_name: &str,
1131 ) -> fidl::client::QueryResponseFut<
1132 ManagedRealmStartChildComponentResult,
1133 fidl::encoding::DefaultFuchsiaResourceDialect,
1134 > {
1135 ManagedRealmProxyInterface::r#start_child_component(self, child_name)
1136 }
1137
1138 pub fn r#stop_child_component(
1148 &self,
1149 mut child_name: &str,
1150 ) -> fidl::client::QueryResponseFut<
1151 ManagedRealmStopChildComponentResult,
1152 fidl::encoding::DefaultFuchsiaResourceDialect,
1153 > {
1154 ManagedRealmProxyInterface::r#stop_child_component(self, child_name)
1155 }
1156
1157 pub fn r#shutdown(&self) -> Result<(), fidl::Error> {
1162 ManagedRealmProxyInterface::r#shutdown(self)
1163 }
1164
1165 pub fn r#open_diagnostics_directory(
1167 &self,
1168 mut child_name: &str,
1169 mut directory: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
1170 ) -> Result<(), fidl::Error> {
1171 ManagedRealmProxyInterface::r#open_diagnostics_directory(self, child_name, directory)
1172 }
1173}
1174
1175impl ManagedRealmProxyInterface for ManagedRealmProxy {
1176 type GetMonikerResponseFut =
1177 fidl::client::QueryResponseFut<String, fidl::encoding::DefaultFuchsiaResourceDialect>;
1178 fn r#get_moniker(&self) -> Self::GetMonikerResponseFut {
1179 fn _decode(
1180 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1181 ) -> Result<String, fidl::Error> {
1182 let _response = fidl::client::decode_transaction_body::<
1183 ManagedRealmGetMonikerResponse,
1184 fidl::encoding::DefaultFuchsiaResourceDialect,
1185 0xec8f2bf894ddc5f,
1186 >(_buf?)?;
1187 Ok(_response.moniker)
1188 }
1189 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, String>(
1190 (),
1191 0xec8f2bf894ddc5f,
1192 fidl::encoding::DynamicFlags::empty(),
1193 _decode,
1194 )
1195 }
1196
1197 fn r#connect_to_protocol(
1198 &self,
1199 mut protocol_name: &str,
1200 mut child_name: Option<&str>,
1201 mut req: fidl::Channel,
1202 ) -> Result<(), fidl::Error> {
1203 self.client.send::<ManagedRealmConnectToProtocolRequest>(
1204 (protocol_name, child_name, req),
1205 0x20865b728239813d,
1206 fidl::encoding::DynamicFlags::empty(),
1207 )
1208 }
1209
1210 type AddDeviceResponseFut = fidl::client::QueryResponseFut<
1211 ManagedRealmAddDeviceResult,
1212 fidl::encoding::DefaultFuchsiaResourceDialect,
1213 >;
1214 fn r#add_device(
1215 &self,
1216 mut path: &str,
1217 mut device: fidl::endpoints::ClientEnd<fidl_fuchsia_netemul_network::DeviceProxy_Marker>,
1218 ) -> Self::AddDeviceResponseFut {
1219 fn _decode(
1220 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1221 ) -> Result<ManagedRealmAddDeviceResult, fidl::Error> {
1222 let _response = fidl::client::decode_transaction_body::<
1223 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1224 fidl::encoding::DefaultFuchsiaResourceDialect,
1225 0x789925e6f5d47c07,
1226 >(_buf?)?;
1227 Ok(_response.map(|x| x))
1228 }
1229 self.client
1230 .send_query_and_decode::<ManagedRealmAddDeviceRequest, ManagedRealmAddDeviceResult>(
1231 (path, device),
1232 0x789925e6f5d47c07,
1233 fidl::encoding::DynamicFlags::empty(),
1234 _decode,
1235 )
1236 }
1237
1238 type RemoveDeviceResponseFut = fidl::client::QueryResponseFut<
1239 ManagedRealmRemoveDeviceResult,
1240 fidl::encoding::DefaultFuchsiaResourceDialect,
1241 >;
1242 fn r#remove_device(&self, mut path: &str) -> Self::RemoveDeviceResponseFut {
1243 fn _decode(
1244 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1245 ) -> Result<ManagedRealmRemoveDeviceResult, fidl::Error> {
1246 let _response = fidl::client::decode_transaction_body::<
1247 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1248 fidl::encoding::DefaultFuchsiaResourceDialect,
1249 0x6cffbba70ac757cc,
1250 >(_buf?)?;
1251 Ok(_response.map(|x| x))
1252 }
1253 self.client.send_query_and_decode::<
1254 ManagedRealmRemoveDeviceRequest,
1255 ManagedRealmRemoveDeviceResult,
1256 >(
1257 (path,),
1258 0x6cffbba70ac757cc,
1259 fidl::encoding::DynamicFlags::empty(),
1260 _decode,
1261 )
1262 }
1263
1264 fn r#get_devfs(
1265 &self,
1266 mut devfs: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
1267 ) -> Result<(), fidl::Error> {
1268 self.client.send::<ManagedRealmGetDevfsRequest>(
1269 (devfs,),
1270 0x707e2b17f65fcadc,
1271 fidl::encoding::DynamicFlags::empty(),
1272 )
1273 }
1274
1275 type StartChildComponentResponseFut = fidl::client::QueryResponseFut<
1276 ManagedRealmStartChildComponentResult,
1277 fidl::encoding::DefaultFuchsiaResourceDialect,
1278 >;
1279 fn r#start_child_component(
1280 &self,
1281 mut child_name: &str,
1282 ) -> Self::StartChildComponentResponseFut {
1283 fn _decode(
1284 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1285 ) -> Result<ManagedRealmStartChildComponentResult, fidl::Error> {
1286 let _response = fidl::client::decode_transaction_body::<
1287 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1288 fidl::encoding::DefaultFuchsiaResourceDialect,
1289 0x20dfa243752906a1,
1290 >(_buf?)?;
1291 Ok(_response.map(|x| x))
1292 }
1293 self.client.send_query_and_decode::<
1294 ManagedRealmStartChildComponentRequest,
1295 ManagedRealmStartChildComponentResult,
1296 >(
1297 (child_name,),
1298 0x20dfa243752906a1,
1299 fidl::encoding::DynamicFlags::empty(),
1300 _decode,
1301 )
1302 }
1303
1304 type StopChildComponentResponseFut = fidl::client::QueryResponseFut<
1305 ManagedRealmStopChildComponentResult,
1306 fidl::encoding::DefaultFuchsiaResourceDialect,
1307 >;
1308 fn r#stop_child_component(&self, mut child_name: &str) -> Self::StopChildComponentResponseFut {
1309 fn _decode(
1310 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1311 ) -> Result<ManagedRealmStopChildComponentResult, fidl::Error> {
1312 let _response = fidl::client::decode_transaction_body::<
1313 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1314 fidl::encoding::DefaultFuchsiaResourceDialect,
1315 0x5ecfe48430aeeca7,
1316 >(_buf?)?;
1317 Ok(_response.map(|x| x))
1318 }
1319 self.client.send_query_and_decode::<
1320 ManagedRealmStopChildComponentRequest,
1321 ManagedRealmStopChildComponentResult,
1322 >(
1323 (child_name,),
1324 0x5ecfe48430aeeca7,
1325 fidl::encoding::DynamicFlags::empty(),
1326 _decode,
1327 )
1328 }
1329
1330 fn r#shutdown(&self) -> Result<(), fidl::Error> {
1331 self.client.send::<fidl::encoding::EmptyPayload>(
1332 (),
1333 0x4750920f723fba9d,
1334 fidl::encoding::DynamicFlags::empty(),
1335 )
1336 }
1337
1338 fn r#open_diagnostics_directory(
1339 &self,
1340 mut child_name: &str,
1341 mut directory: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
1342 ) -> Result<(), fidl::Error> {
1343 self.client.send::<ManagedRealmOpenDiagnosticsDirectoryRequest>(
1344 (child_name, directory),
1345 0x7c5312484aa41c99,
1346 fidl::encoding::DynamicFlags::empty(),
1347 )
1348 }
1349}
1350
1351pub struct ManagedRealmEventStream {
1352 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1353}
1354
1355impl std::marker::Unpin for ManagedRealmEventStream {}
1356
1357impl futures::stream::FusedStream for ManagedRealmEventStream {
1358 fn is_terminated(&self) -> bool {
1359 self.event_receiver.is_terminated()
1360 }
1361}
1362
1363impl futures::Stream for ManagedRealmEventStream {
1364 type Item = Result<ManagedRealmEvent, fidl::Error>;
1365
1366 fn poll_next(
1367 mut self: std::pin::Pin<&mut Self>,
1368 cx: &mut std::task::Context<'_>,
1369 ) -> std::task::Poll<Option<Self::Item>> {
1370 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1371 &mut self.event_receiver,
1372 cx
1373 )?) {
1374 Some(buf) => std::task::Poll::Ready(Some(ManagedRealmEvent::decode(buf))),
1375 None => std::task::Poll::Ready(None),
1376 }
1377 }
1378}
1379
1380#[derive(Debug)]
1381pub enum ManagedRealmEvent {
1382 OnShutdown {},
1383}
1384
1385impl ManagedRealmEvent {
1386 #[allow(irrefutable_let_patterns)]
1387 pub fn into_on_shutdown(self) -> Option<()> {
1388 if let ManagedRealmEvent::OnShutdown {} = self {
1389 Some(())
1390 } else {
1391 None
1392 }
1393 }
1394
1395 fn decode(
1397 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1398 ) -> Result<ManagedRealmEvent, fidl::Error> {
1399 let (bytes, _handles) = buf.split_mut();
1400 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1401 debug_assert_eq!(tx_header.tx_id, 0);
1402 match tx_header.ordinal {
1403 0x1dff0b58a5b546be => {
1404 let mut out = fidl::new_empty!(
1405 fidl::encoding::EmptyPayload,
1406 fidl::encoding::DefaultFuchsiaResourceDialect
1407 );
1408 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&tx_header, _body_bytes, _handles, &mut out)?;
1409 Ok((ManagedRealmEvent::OnShutdown {}))
1410 }
1411 _ => Err(fidl::Error::UnknownOrdinal {
1412 ordinal: tx_header.ordinal,
1413 protocol_name: <ManagedRealmMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1414 }),
1415 }
1416 }
1417}
1418
1419pub struct ManagedRealmRequestStream {
1421 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1422 is_terminated: bool,
1423}
1424
1425impl std::marker::Unpin for ManagedRealmRequestStream {}
1426
1427impl futures::stream::FusedStream for ManagedRealmRequestStream {
1428 fn is_terminated(&self) -> bool {
1429 self.is_terminated
1430 }
1431}
1432
1433impl fidl::endpoints::RequestStream for ManagedRealmRequestStream {
1434 type Protocol = ManagedRealmMarker;
1435 type ControlHandle = ManagedRealmControlHandle;
1436
1437 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1438 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1439 }
1440
1441 fn control_handle(&self) -> Self::ControlHandle {
1442 ManagedRealmControlHandle { inner: self.inner.clone() }
1443 }
1444
1445 fn into_inner(
1446 self,
1447 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1448 {
1449 (self.inner, self.is_terminated)
1450 }
1451
1452 fn from_inner(
1453 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1454 is_terminated: bool,
1455 ) -> Self {
1456 Self { inner, is_terminated }
1457 }
1458}
1459
1460impl futures::Stream for ManagedRealmRequestStream {
1461 type Item = Result<ManagedRealmRequest, fidl::Error>;
1462
1463 fn poll_next(
1464 mut self: std::pin::Pin<&mut Self>,
1465 cx: &mut std::task::Context<'_>,
1466 ) -> std::task::Poll<Option<Self::Item>> {
1467 let this = &mut *self;
1468 if this.inner.check_shutdown(cx) {
1469 this.is_terminated = true;
1470 return std::task::Poll::Ready(None);
1471 }
1472 if this.is_terminated {
1473 panic!("polled ManagedRealmRequestStream after completion");
1474 }
1475 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1476 |bytes, handles| {
1477 match this.inner.channel().read_etc(cx, bytes, handles) {
1478 std::task::Poll::Ready(Ok(())) => {}
1479 std::task::Poll::Pending => return std::task::Poll::Pending,
1480 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1481 this.is_terminated = true;
1482 return std::task::Poll::Ready(None);
1483 }
1484 std::task::Poll::Ready(Err(e)) => {
1485 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1486 e.into(),
1487 ))))
1488 }
1489 }
1490
1491 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1493
1494 std::task::Poll::Ready(Some(match header.ordinal {
1495 0xec8f2bf894ddc5f => {
1496 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1497 let mut req = fidl::new_empty!(
1498 fidl::encoding::EmptyPayload,
1499 fidl::encoding::DefaultFuchsiaResourceDialect
1500 );
1501 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1502 let control_handle =
1503 ManagedRealmControlHandle { inner: this.inner.clone() };
1504 Ok(ManagedRealmRequest::GetMoniker {
1505 responder: ManagedRealmGetMonikerResponder {
1506 control_handle: std::mem::ManuallyDrop::new(control_handle),
1507 tx_id: header.tx_id,
1508 },
1509 })
1510 }
1511 0x20865b728239813d => {
1512 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1513 let mut req = fidl::new_empty!(
1514 ManagedRealmConnectToProtocolRequest,
1515 fidl::encoding::DefaultFuchsiaResourceDialect
1516 );
1517 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ManagedRealmConnectToProtocolRequest>(&header, _body_bytes, handles, &mut req)?;
1518 let control_handle =
1519 ManagedRealmControlHandle { inner: this.inner.clone() };
1520 Ok(ManagedRealmRequest::ConnectToProtocol {
1521 protocol_name: req.protocol_name,
1522 child_name: req.child_name,
1523 req: req.req,
1524
1525 control_handle,
1526 })
1527 }
1528 0x789925e6f5d47c07 => {
1529 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1530 let mut req = fidl::new_empty!(
1531 ManagedRealmAddDeviceRequest,
1532 fidl::encoding::DefaultFuchsiaResourceDialect
1533 );
1534 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ManagedRealmAddDeviceRequest>(&header, _body_bytes, handles, &mut req)?;
1535 let control_handle =
1536 ManagedRealmControlHandle { inner: this.inner.clone() };
1537 Ok(ManagedRealmRequest::AddDevice {
1538 path: req.path,
1539 device: req.device,
1540
1541 responder: ManagedRealmAddDeviceResponder {
1542 control_handle: std::mem::ManuallyDrop::new(control_handle),
1543 tx_id: header.tx_id,
1544 },
1545 })
1546 }
1547 0x6cffbba70ac757cc => {
1548 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1549 let mut req = fidl::new_empty!(
1550 ManagedRealmRemoveDeviceRequest,
1551 fidl::encoding::DefaultFuchsiaResourceDialect
1552 );
1553 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ManagedRealmRemoveDeviceRequest>(&header, _body_bytes, handles, &mut req)?;
1554 let control_handle =
1555 ManagedRealmControlHandle { inner: this.inner.clone() };
1556 Ok(ManagedRealmRequest::RemoveDevice {
1557 path: req.path,
1558
1559 responder: ManagedRealmRemoveDeviceResponder {
1560 control_handle: std::mem::ManuallyDrop::new(control_handle),
1561 tx_id: header.tx_id,
1562 },
1563 })
1564 }
1565 0x707e2b17f65fcadc => {
1566 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1567 let mut req = fidl::new_empty!(
1568 ManagedRealmGetDevfsRequest,
1569 fidl::encoding::DefaultFuchsiaResourceDialect
1570 );
1571 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ManagedRealmGetDevfsRequest>(&header, _body_bytes, handles, &mut req)?;
1572 let control_handle =
1573 ManagedRealmControlHandle { inner: this.inner.clone() };
1574 Ok(ManagedRealmRequest::GetDevfs { devfs: req.devfs, control_handle })
1575 }
1576 0x20dfa243752906a1 => {
1577 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1578 let mut req = fidl::new_empty!(
1579 ManagedRealmStartChildComponentRequest,
1580 fidl::encoding::DefaultFuchsiaResourceDialect
1581 );
1582 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ManagedRealmStartChildComponentRequest>(&header, _body_bytes, handles, &mut req)?;
1583 let control_handle =
1584 ManagedRealmControlHandle { inner: this.inner.clone() };
1585 Ok(ManagedRealmRequest::StartChildComponent {
1586 child_name: req.child_name,
1587
1588 responder: ManagedRealmStartChildComponentResponder {
1589 control_handle: std::mem::ManuallyDrop::new(control_handle),
1590 tx_id: header.tx_id,
1591 },
1592 })
1593 }
1594 0x5ecfe48430aeeca7 => {
1595 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1596 let mut req = fidl::new_empty!(
1597 ManagedRealmStopChildComponentRequest,
1598 fidl::encoding::DefaultFuchsiaResourceDialect
1599 );
1600 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ManagedRealmStopChildComponentRequest>(&header, _body_bytes, handles, &mut req)?;
1601 let control_handle =
1602 ManagedRealmControlHandle { inner: this.inner.clone() };
1603 Ok(ManagedRealmRequest::StopChildComponent {
1604 child_name: req.child_name,
1605
1606 responder: ManagedRealmStopChildComponentResponder {
1607 control_handle: std::mem::ManuallyDrop::new(control_handle),
1608 tx_id: header.tx_id,
1609 },
1610 })
1611 }
1612 0x4750920f723fba9d => {
1613 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1614 let mut req = fidl::new_empty!(
1615 fidl::encoding::EmptyPayload,
1616 fidl::encoding::DefaultFuchsiaResourceDialect
1617 );
1618 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1619 let control_handle =
1620 ManagedRealmControlHandle { inner: this.inner.clone() };
1621 Ok(ManagedRealmRequest::Shutdown { control_handle })
1622 }
1623 0x7c5312484aa41c99 => {
1624 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1625 let mut req = fidl::new_empty!(
1626 ManagedRealmOpenDiagnosticsDirectoryRequest,
1627 fidl::encoding::DefaultFuchsiaResourceDialect
1628 );
1629 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ManagedRealmOpenDiagnosticsDirectoryRequest>(&header, _body_bytes, handles, &mut req)?;
1630 let control_handle =
1631 ManagedRealmControlHandle { inner: this.inner.clone() };
1632 Ok(ManagedRealmRequest::OpenDiagnosticsDirectory {
1633 child_name: req.child_name,
1634 directory: req.directory,
1635
1636 control_handle,
1637 })
1638 }
1639 _ => Err(fidl::Error::UnknownOrdinal {
1640 ordinal: header.ordinal,
1641 protocol_name:
1642 <ManagedRealmMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1643 }),
1644 }))
1645 },
1646 )
1647 }
1648}
1649
1650#[derive(Debug)]
1663pub enum ManagedRealmRequest {
1664 GetMoniker { responder: ManagedRealmGetMonikerResponder },
1669 ConnectToProtocol {
1681 protocol_name: String,
1682 child_name: Option<String>,
1683 req: fidl::Channel,
1684 control_handle: ManagedRealmControlHandle,
1685 },
1686 AddDevice {
1699 path: String,
1700 device: fidl::endpoints::ClientEnd<fidl_fuchsia_netemul_network::DeviceProxy_Marker>,
1701 responder: ManagedRealmAddDeviceResponder,
1702 },
1703 RemoveDevice { path: String, responder: ManagedRealmRemoveDeviceResponder },
1711 GetDevfs {
1715 devfs: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
1716 control_handle: ManagedRealmControlHandle,
1717 },
1718 StartChildComponent { child_name: String, responder: ManagedRealmStartChildComponentResponder },
1728 StopChildComponent { child_name: String, responder: ManagedRealmStopChildComponentResponder },
1738 Shutdown { control_handle: ManagedRealmControlHandle },
1743 OpenDiagnosticsDirectory {
1745 child_name: String,
1746 directory: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
1747 control_handle: ManagedRealmControlHandle,
1748 },
1749}
1750
1751impl ManagedRealmRequest {
1752 #[allow(irrefutable_let_patterns)]
1753 pub fn into_get_moniker(self) -> Option<(ManagedRealmGetMonikerResponder)> {
1754 if let ManagedRealmRequest::GetMoniker { responder } = self {
1755 Some((responder))
1756 } else {
1757 None
1758 }
1759 }
1760
1761 #[allow(irrefutable_let_patterns)]
1762 pub fn into_connect_to_protocol(
1763 self,
1764 ) -> Option<(String, Option<String>, fidl::Channel, ManagedRealmControlHandle)> {
1765 if let ManagedRealmRequest::ConnectToProtocol {
1766 protocol_name,
1767 child_name,
1768 req,
1769 control_handle,
1770 } = self
1771 {
1772 Some((protocol_name, child_name, req, control_handle))
1773 } else {
1774 None
1775 }
1776 }
1777
1778 #[allow(irrefutable_let_patterns)]
1779 pub fn into_add_device(
1780 self,
1781 ) -> Option<(
1782 String,
1783 fidl::endpoints::ClientEnd<fidl_fuchsia_netemul_network::DeviceProxy_Marker>,
1784 ManagedRealmAddDeviceResponder,
1785 )> {
1786 if let ManagedRealmRequest::AddDevice { path, device, responder } = self {
1787 Some((path, device, responder))
1788 } else {
1789 None
1790 }
1791 }
1792
1793 #[allow(irrefutable_let_patterns)]
1794 pub fn into_remove_device(self) -> Option<(String, ManagedRealmRemoveDeviceResponder)> {
1795 if let ManagedRealmRequest::RemoveDevice { path, responder } = self {
1796 Some((path, responder))
1797 } else {
1798 None
1799 }
1800 }
1801
1802 #[allow(irrefutable_let_patterns)]
1803 pub fn into_get_devfs(
1804 self,
1805 ) -> Option<(
1806 fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
1807 ManagedRealmControlHandle,
1808 )> {
1809 if let ManagedRealmRequest::GetDevfs { devfs, control_handle } = self {
1810 Some((devfs, control_handle))
1811 } else {
1812 None
1813 }
1814 }
1815
1816 #[allow(irrefutable_let_patterns)]
1817 pub fn into_start_child_component(
1818 self,
1819 ) -> Option<(String, ManagedRealmStartChildComponentResponder)> {
1820 if let ManagedRealmRequest::StartChildComponent { child_name, responder } = self {
1821 Some((child_name, responder))
1822 } else {
1823 None
1824 }
1825 }
1826
1827 #[allow(irrefutable_let_patterns)]
1828 pub fn into_stop_child_component(
1829 self,
1830 ) -> Option<(String, ManagedRealmStopChildComponentResponder)> {
1831 if let ManagedRealmRequest::StopChildComponent { child_name, responder } = self {
1832 Some((child_name, responder))
1833 } else {
1834 None
1835 }
1836 }
1837
1838 #[allow(irrefutable_let_patterns)]
1839 pub fn into_shutdown(self) -> Option<(ManagedRealmControlHandle)> {
1840 if let ManagedRealmRequest::Shutdown { control_handle } = self {
1841 Some((control_handle))
1842 } else {
1843 None
1844 }
1845 }
1846
1847 #[allow(irrefutable_let_patterns)]
1848 pub fn into_open_diagnostics_directory(
1849 self,
1850 ) -> Option<(
1851 String,
1852 fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
1853 ManagedRealmControlHandle,
1854 )> {
1855 if let ManagedRealmRequest::OpenDiagnosticsDirectory {
1856 child_name,
1857 directory,
1858 control_handle,
1859 } = self
1860 {
1861 Some((child_name, directory, control_handle))
1862 } else {
1863 None
1864 }
1865 }
1866
1867 pub fn method_name(&self) -> &'static str {
1869 match *self {
1870 ManagedRealmRequest::GetMoniker { .. } => "get_moniker",
1871 ManagedRealmRequest::ConnectToProtocol { .. } => "connect_to_protocol",
1872 ManagedRealmRequest::AddDevice { .. } => "add_device",
1873 ManagedRealmRequest::RemoveDevice { .. } => "remove_device",
1874 ManagedRealmRequest::GetDevfs { .. } => "get_devfs",
1875 ManagedRealmRequest::StartChildComponent { .. } => "start_child_component",
1876 ManagedRealmRequest::StopChildComponent { .. } => "stop_child_component",
1877 ManagedRealmRequest::Shutdown { .. } => "shutdown",
1878 ManagedRealmRequest::OpenDiagnosticsDirectory { .. } => "open_diagnostics_directory",
1879 }
1880 }
1881}
1882
1883#[derive(Debug, Clone)]
1884pub struct ManagedRealmControlHandle {
1885 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1886}
1887
1888impl fidl::endpoints::ControlHandle for ManagedRealmControlHandle {
1889 fn shutdown(&self) {
1890 self.inner.shutdown()
1891 }
1892 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1893 self.inner.shutdown_with_epitaph(status)
1894 }
1895
1896 fn is_closed(&self) -> bool {
1897 self.inner.channel().is_closed()
1898 }
1899 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1900 self.inner.channel().on_closed()
1901 }
1902
1903 #[cfg(target_os = "fuchsia")]
1904 fn signal_peer(
1905 &self,
1906 clear_mask: zx::Signals,
1907 set_mask: zx::Signals,
1908 ) -> Result<(), zx_status::Status> {
1909 use fidl::Peered;
1910 self.inner.channel().signal_peer(clear_mask, set_mask)
1911 }
1912}
1913
1914impl ManagedRealmControlHandle {
1915 pub fn send_on_shutdown(&self) -> Result<(), fidl::Error> {
1916 self.inner.send::<fidl::encoding::EmptyPayload>(
1917 (),
1918 0,
1919 0x1dff0b58a5b546be,
1920 fidl::encoding::DynamicFlags::empty(),
1921 )
1922 }
1923}
1924
1925#[must_use = "FIDL methods require a response to be sent"]
1926#[derive(Debug)]
1927pub struct ManagedRealmGetMonikerResponder {
1928 control_handle: std::mem::ManuallyDrop<ManagedRealmControlHandle>,
1929 tx_id: u32,
1930}
1931
1932impl std::ops::Drop for ManagedRealmGetMonikerResponder {
1936 fn drop(&mut self) {
1937 self.control_handle.shutdown();
1938 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1940 }
1941}
1942
1943impl fidl::endpoints::Responder for ManagedRealmGetMonikerResponder {
1944 type ControlHandle = ManagedRealmControlHandle;
1945
1946 fn control_handle(&self) -> &ManagedRealmControlHandle {
1947 &self.control_handle
1948 }
1949
1950 fn drop_without_shutdown(mut self) {
1951 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1953 std::mem::forget(self);
1955 }
1956}
1957
1958impl ManagedRealmGetMonikerResponder {
1959 pub fn send(self, mut moniker: &str) -> Result<(), fidl::Error> {
1963 let _result = self.send_raw(moniker);
1964 if _result.is_err() {
1965 self.control_handle.shutdown();
1966 }
1967 self.drop_without_shutdown();
1968 _result
1969 }
1970
1971 pub fn send_no_shutdown_on_err(self, mut moniker: &str) -> Result<(), fidl::Error> {
1973 let _result = self.send_raw(moniker);
1974 self.drop_without_shutdown();
1975 _result
1976 }
1977
1978 fn send_raw(&self, mut moniker: &str) -> Result<(), fidl::Error> {
1979 self.control_handle.inner.send::<ManagedRealmGetMonikerResponse>(
1980 (moniker,),
1981 self.tx_id,
1982 0xec8f2bf894ddc5f,
1983 fidl::encoding::DynamicFlags::empty(),
1984 )
1985 }
1986}
1987
1988#[must_use = "FIDL methods require a response to be sent"]
1989#[derive(Debug)]
1990pub struct ManagedRealmAddDeviceResponder {
1991 control_handle: std::mem::ManuallyDrop<ManagedRealmControlHandle>,
1992 tx_id: u32,
1993}
1994
1995impl std::ops::Drop for ManagedRealmAddDeviceResponder {
1999 fn drop(&mut self) {
2000 self.control_handle.shutdown();
2001 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2003 }
2004}
2005
2006impl fidl::endpoints::Responder for ManagedRealmAddDeviceResponder {
2007 type ControlHandle = ManagedRealmControlHandle;
2008
2009 fn control_handle(&self) -> &ManagedRealmControlHandle {
2010 &self.control_handle
2011 }
2012
2013 fn drop_without_shutdown(mut self) {
2014 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2016 std::mem::forget(self);
2018 }
2019}
2020
2021impl ManagedRealmAddDeviceResponder {
2022 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2026 let _result = self.send_raw(result);
2027 if _result.is_err() {
2028 self.control_handle.shutdown();
2029 }
2030 self.drop_without_shutdown();
2031 _result
2032 }
2033
2034 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2036 let _result = self.send_raw(result);
2037 self.drop_without_shutdown();
2038 _result
2039 }
2040
2041 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2042 self.control_handle
2043 .inner
2044 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
2045 result,
2046 self.tx_id,
2047 0x789925e6f5d47c07,
2048 fidl::encoding::DynamicFlags::empty(),
2049 )
2050 }
2051}
2052
2053#[must_use = "FIDL methods require a response to be sent"]
2054#[derive(Debug)]
2055pub struct ManagedRealmRemoveDeviceResponder {
2056 control_handle: std::mem::ManuallyDrop<ManagedRealmControlHandle>,
2057 tx_id: u32,
2058}
2059
2060impl std::ops::Drop for ManagedRealmRemoveDeviceResponder {
2064 fn drop(&mut self) {
2065 self.control_handle.shutdown();
2066 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2068 }
2069}
2070
2071impl fidl::endpoints::Responder for ManagedRealmRemoveDeviceResponder {
2072 type ControlHandle = ManagedRealmControlHandle;
2073
2074 fn control_handle(&self) -> &ManagedRealmControlHandle {
2075 &self.control_handle
2076 }
2077
2078 fn drop_without_shutdown(mut self) {
2079 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2081 std::mem::forget(self);
2083 }
2084}
2085
2086impl ManagedRealmRemoveDeviceResponder {
2087 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2091 let _result = self.send_raw(result);
2092 if _result.is_err() {
2093 self.control_handle.shutdown();
2094 }
2095 self.drop_without_shutdown();
2096 _result
2097 }
2098
2099 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2101 let _result = self.send_raw(result);
2102 self.drop_without_shutdown();
2103 _result
2104 }
2105
2106 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2107 self.control_handle
2108 .inner
2109 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
2110 result,
2111 self.tx_id,
2112 0x6cffbba70ac757cc,
2113 fidl::encoding::DynamicFlags::empty(),
2114 )
2115 }
2116}
2117
2118#[must_use = "FIDL methods require a response to be sent"]
2119#[derive(Debug)]
2120pub struct ManagedRealmStartChildComponentResponder {
2121 control_handle: std::mem::ManuallyDrop<ManagedRealmControlHandle>,
2122 tx_id: u32,
2123}
2124
2125impl std::ops::Drop for ManagedRealmStartChildComponentResponder {
2129 fn drop(&mut self) {
2130 self.control_handle.shutdown();
2131 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2133 }
2134}
2135
2136impl fidl::endpoints::Responder for ManagedRealmStartChildComponentResponder {
2137 type ControlHandle = ManagedRealmControlHandle;
2138
2139 fn control_handle(&self) -> &ManagedRealmControlHandle {
2140 &self.control_handle
2141 }
2142
2143 fn drop_without_shutdown(mut self) {
2144 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2146 std::mem::forget(self);
2148 }
2149}
2150
2151impl ManagedRealmStartChildComponentResponder {
2152 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2156 let _result = self.send_raw(result);
2157 if _result.is_err() {
2158 self.control_handle.shutdown();
2159 }
2160 self.drop_without_shutdown();
2161 _result
2162 }
2163
2164 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2166 let _result = self.send_raw(result);
2167 self.drop_without_shutdown();
2168 _result
2169 }
2170
2171 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2172 self.control_handle
2173 .inner
2174 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
2175 result,
2176 self.tx_id,
2177 0x20dfa243752906a1,
2178 fidl::encoding::DynamicFlags::empty(),
2179 )
2180 }
2181}
2182
2183#[must_use = "FIDL methods require a response to be sent"]
2184#[derive(Debug)]
2185pub struct ManagedRealmStopChildComponentResponder {
2186 control_handle: std::mem::ManuallyDrop<ManagedRealmControlHandle>,
2187 tx_id: u32,
2188}
2189
2190impl std::ops::Drop for ManagedRealmStopChildComponentResponder {
2194 fn drop(&mut self) {
2195 self.control_handle.shutdown();
2196 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2198 }
2199}
2200
2201impl fidl::endpoints::Responder for ManagedRealmStopChildComponentResponder {
2202 type ControlHandle = ManagedRealmControlHandle;
2203
2204 fn control_handle(&self) -> &ManagedRealmControlHandle {
2205 &self.control_handle
2206 }
2207
2208 fn drop_without_shutdown(mut self) {
2209 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2211 std::mem::forget(self);
2213 }
2214}
2215
2216impl ManagedRealmStopChildComponentResponder {
2217 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2221 let _result = self.send_raw(result);
2222 if _result.is_err() {
2223 self.control_handle.shutdown();
2224 }
2225 self.drop_without_shutdown();
2226 _result
2227 }
2228
2229 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2231 let _result = self.send_raw(result);
2232 self.drop_without_shutdown();
2233 _result
2234 }
2235
2236 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2237 self.control_handle
2238 .inner
2239 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
2240 result,
2241 self.tx_id,
2242 0x5ecfe48430aeeca7,
2243 fidl::encoding::DynamicFlags::empty(),
2244 )
2245 }
2246}
2247
2248#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2249pub struct SandboxMarker;
2250
2251impl fidl::endpoints::ProtocolMarker for SandboxMarker {
2252 type Proxy = SandboxProxy;
2253 type RequestStream = SandboxRequestStream;
2254 #[cfg(target_os = "fuchsia")]
2255 type SynchronousProxy = SandboxSynchronousProxy;
2256
2257 const DEBUG_NAME: &'static str = "fuchsia.netemul.Sandbox";
2258}
2259impl fidl::endpoints::DiscoverableProtocolMarker for SandboxMarker {}
2260
2261pub trait SandboxProxyInterface: Send + Sync {
2262 fn r#create_realm(
2263 &self,
2264 realm: fidl::endpoints::ServerEnd<ManagedRealmMarker>,
2265 options: RealmOptions,
2266 ) -> Result<(), fidl::Error>;
2267 fn r#get_network_context(
2268 &self,
2269 network_context: fidl::endpoints::ServerEnd<
2270 fidl_fuchsia_netemul_network::NetworkContextMarker,
2271 >,
2272 ) -> Result<(), fidl::Error>;
2273}
2274#[derive(Debug)]
2275#[cfg(target_os = "fuchsia")]
2276pub struct SandboxSynchronousProxy {
2277 client: fidl::client::sync::Client,
2278}
2279
2280#[cfg(target_os = "fuchsia")]
2281impl fidl::endpoints::SynchronousProxy for SandboxSynchronousProxy {
2282 type Proxy = SandboxProxy;
2283 type Protocol = SandboxMarker;
2284
2285 fn from_channel(inner: fidl::Channel) -> Self {
2286 Self::new(inner)
2287 }
2288
2289 fn into_channel(self) -> fidl::Channel {
2290 self.client.into_channel()
2291 }
2292
2293 fn as_channel(&self) -> &fidl::Channel {
2294 self.client.as_channel()
2295 }
2296}
2297
2298#[cfg(target_os = "fuchsia")]
2299impl SandboxSynchronousProxy {
2300 pub fn new(channel: fidl::Channel) -> Self {
2301 let protocol_name = <SandboxMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2302 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2303 }
2304
2305 pub fn into_channel(self) -> fidl::Channel {
2306 self.client.into_channel()
2307 }
2308
2309 pub fn wait_for_event(
2312 &self,
2313 deadline: zx::MonotonicInstant,
2314 ) -> Result<SandboxEvent, fidl::Error> {
2315 SandboxEvent::decode(self.client.wait_for_event(deadline)?)
2316 }
2317
2318 pub fn r#create_realm(
2329 &self,
2330 mut realm: fidl::endpoints::ServerEnd<ManagedRealmMarker>,
2331 mut options: RealmOptions,
2332 ) -> Result<(), fidl::Error> {
2333 self.client.send::<SandboxCreateRealmRequest>(
2334 (realm, &mut options),
2335 0x25d0bc5f1006a0c9,
2336 fidl::encoding::DynamicFlags::empty(),
2337 )
2338 }
2339
2340 pub fn r#get_network_context(
2344 &self,
2345 mut network_context: fidl::endpoints::ServerEnd<
2346 fidl_fuchsia_netemul_network::NetworkContextMarker,
2347 >,
2348 ) -> Result<(), fidl::Error> {
2349 self.client.send::<SandboxGetNetworkContextRequest>(
2350 (network_context,),
2351 0x140cb104c2605970,
2352 fidl::encoding::DynamicFlags::empty(),
2353 )
2354 }
2355}
2356
2357#[cfg(target_os = "fuchsia")]
2358impl From<SandboxSynchronousProxy> for zx::Handle {
2359 fn from(value: SandboxSynchronousProxy) -> Self {
2360 value.into_channel().into()
2361 }
2362}
2363
2364#[cfg(target_os = "fuchsia")]
2365impl From<fidl::Channel> for SandboxSynchronousProxy {
2366 fn from(value: fidl::Channel) -> Self {
2367 Self::new(value)
2368 }
2369}
2370
2371#[derive(Debug, Clone)]
2372pub struct SandboxProxy {
2373 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2374}
2375
2376impl fidl::endpoints::Proxy for SandboxProxy {
2377 type Protocol = SandboxMarker;
2378
2379 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2380 Self::new(inner)
2381 }
2382
2383 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2384 self.client.into_channel().map_err(|client| Self { client })
2385 }
2386
2387 fn as_channel(&self) -> &::fidl::AsyncChannel {
2388 self.client.as_channel()
2389 }
2390}
2391
2392impl SandboxProxy {
2393 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2395 let protocol_name = <SandboxMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2396 Self { client: fidl::client::Client::new(channel, protocol_name) }
2397 }
2398
2399 pub fn take_event_stream(&self) -> SandboxEventStream {
2405 SandboxEventStream { event_receiver: self.client.take_event_receiver() }
2406 }
2407
2408 pub fn r#create_realm(
2419 &self,
2420 mut realm: fidl::endpoints::ServerEnd<ManagedRealmMarker>,
2421 mut options: RealmOptions,
2422 ) -> Result<(), fidl::Error> {
2423 SandboxProxyInterface::r#create_realm(self, realm, options)
2424 }
2425
2426 pub fn r#get_network_context(
2430 &self,
2431 mut network_context: fidl::endpoints::ServerEnd<
2432 fidl_fuchsia_netemul_network::NetworkContextMarker,
2433 >,
2434 ) -> Result<(), fidl::Error> {
2435 SandboxProxyInterface::r#get_network_context(self, network_context)
2436 }
2437}
2438
2439impl SandboxProxyInterface for SandboxProxy {
2440 fn r#create_realm(
2441 &self,
2442 mut realm: fidl::endpoints::ServerEnd<ManagedRealmMarker>,
2443 mut options: RealmOptions,
2444 ) -> Result<(), fidl::Error> {
2445 self.client.send::<SandboxCreateRealmRequest>(
2446 (realm, &mut options),
2447 0x25d0bc5f1006a0c9,
2448 fidl::encoding::DynamicFlags::empty(),
2449 )
2450 }
2451
2452 fn r#get_network_context(
2453 &self,
2454 mut network_context: fidl::endpoints::ServerEnd<
2455 fidl_fuchsia_netemul_network::NetworkContextMarker,
2456 >,
2457 ) -> Result<(), fidl::Error> {
2458 self.client.send::<SandboxGetNetworkContextRequest>(
2459 (network_context,),
2460 0x140cb104c2605970,
2461 fidl::encoding::DynamicFlags::empty(),
2462 )
2463 }
2464}
2465
2466pub struct SandboxEventStream {
2467 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2468}
2469
2470impl std::marker::Unpin for SandboxEventStream {}
2471
2472impl futures::stream::FusedStream for SandboxEventStream {
2473 fn is_terminated(&self) -> bool {
2474 self.event_receiver.is_terminated()
2475 }
2476}
2477
2478impl futures::Stream for SandboxEventStream {
2479 type Item = Result<SandboxEvent, fidl::Error>;
2480
2481 fn poll_next(
2482 mut self: std::pin::Pin<&mut Self>,
2483 cx: &mut std::task::Context<'_>,
2484 ) -> std::task::Poll<Option<Self::Item>> {
2485 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2486 &mut self.event_receiver,
2487 cx
2488 )?) {
2489 Some(buf) => std::task::Poll::Ready(Some(SandboxEvent::decode(buf))),
2490 None => std::task::Poll::Ready(None),
2491 }
2492 }
2493}
2494
2495#[derive(Debug)]
2496pub enum SandboxEvent {}
2497
2498impl SandboxEvent {
2499 fn decode(
2501 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2502 ) -> Result<SandboxEvent, fidl::Error> {
2503 let (bytes, _handles) = buf.split_mut();
2504 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2505 debug_assert_eq!(tx_header.tx_id, 0);
2506 match tx_header.ordinal {
2507 _ => Err(fidl::Error::UnknownOrdinal {
2508 ordinal: tx_header.ordinal,
2509 protocol_name: <SandboxMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2510 }),
2511 }
2512 }
2513}
2514
2515pub struct SandboxRequestStream {
2517 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2518 is_terminated: bool,
2519}
2520
2521impl std::marker::Unpin for SandboxRequestStream {}
2522
2523impl futures::stream::FusedStream for SandboxRequestStream {
2524 fn is_terminated(&self) -> bool {
2525 self.is_terminated
2526 }
2527}
2528
2529impl fidl::endpoints::RequestStream for SandboxRequestStream {
2530 type Protocol = SandboxMarker;
2531 type ControlHandle = SandboxControlHandle;
2532
2533 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2534 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2535 }
2536
2537 fn control_handle(&self) -> Self::ControlHandle {
2538 SandboxControlHandle { inner: self.inner.clone() }
2539 }
2540
2541 fn into_inner(
2542 self,
2543 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2544 {
2545 (self.inner, self.is_terminated)
2546 }
2547
2548 fn from_inner(
2549 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2550 is_terminated: bool,
2551 ) -> Self {
2552 Self { inner, is_terminated }
2553 }
2554}
2555
2556impl futures::Stream for SandboxRequestStream {
2557 type Item = Result<SandboxRequest, fidl::Error>;
2558
2559 fn poll_next(
2560 mut self: std::pin::Pin<&mut Self>,
2561 cx: &mut std::task::Context<'_>,
2562 ) -> std::task::Poll<Option<Self::Item>> {
2563 let this = &mut *self;
2564 if this.inner.check_shutdown(cx) {
2565 this.is_terminated = true;
2566 return std::task::Poll::Ready(None);
2567 }
2568 if this.is_terminated {
2569 panic!("polled SandboxRequestStream after completion");
2570 }
2571 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2572 |bytes, handles| {
2573 match this.inner.channel().read_etc(cx, bytes, handles) {
2574 std::task::Poll::Ready(Ok(())) => {}
2575 std::task::Poll::Pending => return std::task::Poll::Pending,
2576 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2577 this.is_terminated = true;
2578 return std::task::Poll::Ready(None);
2579 }
2580 std::task::Poll::Ready(Err(e)) => {
2581 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2582 e.into(),
2583 ))))
2584 }
2585 }
2586
2587 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2589
2590 std::task::Poll::Ready(Some(match header.ordinal {
2591 0x25d0bc5f1006a0c9 => {
2592 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2593 let mut req = fidl::new_empty!(
2594 SandboxCreateRealmRequest,
2595 fidl::encoding::DefaultFuchsiaResourceDialect
2596 );
2597 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SandboxCreateRealmRequest>(&header, _body_bytes, handles, &mut req)?;
2598 let control_handle = SandboxControlHandle { inner: this.inner.clone() };
2599 Ok(SandboxRequest::CreateRealm {
2600 realm: req.realm,
2601 options: req.options,
2602
2603 control_handle,
2604 })
2605 }
2606 0x140cb104c2605970 => {
2607 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2608 let mut req = fidl::new_empty!(
2609 SandboxGetNetworkContextRequest,
2610 fidl::encoding::DefaultFuchsiaResourceDialect
2611 );
2612 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SandboxGetNetworkContextRequest>(&header, _body_bytes, handles, &mut req)?;
2613 let control_handle = SandboxControlHandle { inner: this.inner.clone() };
2614 Ok(SandboxRequest::GetNetworkContext {
2615 network_context: req.network_context,
2616
2617 control_handle,
2618 })
2619 }
2620 _ => Err(fidl::Error::UnknownOrdinal {
2621 ordinal: header.ordinal,
2622 protocol_name:
2623 <SandboxMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2624 }),
2625 }))
2626 },
2627 )
2628 }
2629}
2630
2631#[derive(Debug)]
2642pub enum SandboxRequest {
2643 CreateRealm {
2654 realm: fidl::endpoints::ServerEnd<ManagedRealmMarker>,
2655 options: RealmOptions,
2656 control_handle: SandboxControlHandle,
2657 },
2658 GetNetworkContext {
2662 network_context:
2663 fidl::endpoints::ServerEnd<fidl_fuchsia_netemul_network::NetworkContextMarker>,
2664 control_handle: SandboxControlHandle,
2665 },
2666}
2667
2668impl SandboxRequest {
2669 #[allow(irrefutable_let_patterns)]
2670 pub fn into_create_realm(
2671 self,
2672 ) -> Option<(fidl::endpoints::ServerEnd<ManagedRealmMarker>, RealmOptions, SandboxControlHandle)>
2673 {
2674 if let SandboxRequest::CreateRealm { realm, options, control_handle } = self {
2675 Some((realm, options, control_handle))
2676 } else {
2677 None
2678 }
2679 }
2680
2681 #[allow(irrefutable_let_patterns)]
2682 pub fn into_get_network_context(
2683 self,
2684 ) -> Option<(
2685 fidl::endpoints::ServerEnd<fidl_fuchsia_netemul_network::NetworkContextMarker>,
2686 SandboxControlHandle,
2687 )> {
2688 if let SandboxRequest::GetNetworkContext { network_context, control_handle } = self {
2689 Some((network_context, control_handle))
2690 } else {
2691 None
2692 }
2693 }
2694
2695 pub fn method_name(&self) -> &'static str {
2697 match *self {
2698 SandboxRequest::CreateRealm { .. } => "create_realm",
2699 SandboxRequest::GetNetworkContext { .. } => "get_network_context",
2700 }
2701 }
2702}
2703
2704#[derive(Debug, Clone)]
2705pub struct SandboxControlHandle {
2706 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2707}
2708
2709impl fidl::endpoints::ControlHandle for SandboxControlHandle {
2710 fn shutdown(&self) {
2711 self.inner.shutdown()
2712 }
2713 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2714 self.inner.shutdown_with_epitaph(status)
2715 }
2716
2717 fn is_closed(&self) -> bool {
2718 self.inner.channel().is_closed()
2719 }
2720 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2721 self.inner.channel().on_closed()
2722 }
2723
2724 #[cfg(target_os = "fuchsia")]
2725 fn signal_peer(
2726 &self,
2727 clear_mask: zx::Signals,
2728 set_mask: zx::Signals,
2729 ) -> Result<(), zx_status::Status> {
2730 use fidl::Peered;
2731 self.inner.channel().signal_peer(clear_mask, set_mask)
2732 }
2733}
2734
2735impl SandboxControlHandle {}
2736
2737mod internal {
2738 use super::*;
2739
2740 impl fidl::encoding::ResourceTypeMarker for ManagedRealmAddDeviceRequest {
2741 type Borrowed<'a> = &'a mut Self;
2742 fn take_or_borrow<'a>(
2743 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2744 ) -> Self::Borrowed<'a> {
2745 value
2746 }
2747 }
2748
2749 unsafe impl fidl::encoding::TypeMarker for ManagedRealmAddDeviceRequest {
2750 type Owned = Self;
2751
2752 #[inline(always)]
2753 fn inline_align(_context: fidl::encoding::Context) -> usize {
2754 8
2755 }
2756
2757 #[inline(always)]
2758 fn inline_size(_context: fidl::encoding::Context) -> usize {
2759 24
2760 }
2761 }
2762
2763 unsafe impl
2764 fidl::encoding::Encode<
2765 ManagedRealmAddDeviceRequest,
2766 fidl::encoding::DefaultFuchsiaResourceDialect,
2767 > for &mut ManagedRealmAddDeviceRequest
2768 {
2769 #[inline]
2770 unsafe fn encode(
2771 self,
2772 encoder: &mut fidl::encoding::Encoder<
2773 '_,
2774 fidl::encoding::DefaultFuchsiaResourceDialect,
2775 >,
2776 offset: usize,
2777 _depth: fidl::encoding::Depth,
2778 ) -> fidl::Result<()> {
2779 encoder.debug_check_bounds::<ManagedRealmAddDeviceRequest>(offset);
2780 fidl::encoding::Encode::<
2782 ManagedRealmAddDeviceRequest,
2783 fidl::encoding::DefaultFuchsiaResourceDialect,
2784 >::encode(
2785 (
2786 <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
2787 &self.path,
2788 ),
2789 <fidl::encoding::Endpoint<
2790 fidl::endpoints::ClientEnd<
2791 fidl_fuchsia_netemul_network::DeviceProxy_Marker,
2792 >,
2793 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2794 &mut self.device
2795 ),
2796 ),
2797 encoder,
2798 offset,
2799 _depth,
2800 )
2801 }
2802 }
2803 unsafe impl<
2804 T0: fidl::encoding::Encode<
2805 fidl::encoding::UnboundedString,
2806 fidl::encoding::DefaultFuchsiaResourceDialect,
2807 >,
2808 T1: fidl::encoding::Encode<
2809 fidl::encoding::Endpoint<
2810 fidl::endpoints::ClientEnd<fidl_fuchsia_netemul_network::DeviceProxy_Marker>,
2811 >,
2812 fidl::encoding::DefaultFuchsiaResourceDialect,
2813 >,
2814 >
2815 fidl::encoding::Encode<
2816 ManagedRealmAddDeviceRequest,
2817 fidl::encoding::DefaultFuchsiaResourceDialect,
2818 > for (T0, T1)
2819 {
2820 #[inline]
2821 unsafe fn encode(
2822 self,
2823 encoder: &mut fidl::encoding::Encoder<
2824 '_,
2825 fidl::encoding::DefaultFuchsiaResourceDialect,
2826 >,
2827 offset: usize,
2828 depth: fidl::encoding::Depth,
2829 ) -> fidl::Result<()> {
2830 encoder.debug_check_bounds::<ManagedRealmAddDeviceRequest>(offset);
2831 unsafe {
2834 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
2835 (ptr as *mut u64).write_unaligned(0);
2836 }
2837 self.0.encode(encoder, offset + 0, depth)?;
2839 self.1.encode(encoder, offset + 16, depth)?;
2840 Ok(())
2841 }
2842 }
2843
2844 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2845 for ManagedRealmAddDeviceRequest
2846 {
2847 #[inline(always)]
2848 fn new_empty() -> Self {
2849 Self {
2850 path: fidl::new_empty!(
2851 fidl::encoding::UnboundedString,
2852 fidl::encoding::DefaultFuchsiaResourceDialect
2853 ),
2854 device: fidl::new_empty!(
2855 fidl::encoding::Endpoint<
2856 fidl::endpoints::ClientEnd<
2857 fidl_fuchsia_netemul_network::DeviceProxy_Marker,
2858 >,
2859 >,
2860 fidl::encoding::DefaultFuchsiaResourceDialect
2861 ),
2862 }
2863 }
2864
2865 #[inline]
2866 unsafe fn decode(
2867 &mut self,
2868 decoder: &mut fidl::encoding::Decoder<
2869 '_,
2870 fidl::encoding::DefaultFuchsiaResourceDialect,
2871 >,
2872 offset: usize,
2873 _depth: fidl::encoding::Depth,
2874 ) -> fidl::Result<()> {
2875 decoder.debug_check_bounds::<Self>(offset);
2876 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
2878 let padval = unsafe { (ptr as *const u64).read_unaligned() };
2879 let mask = 0xffffffff00000000u64;
2880 let maskedval = padval & mask;
2881 if maskedval != 0 {
2882 return Err(fidl::Error::NonZeroPadding {
2883 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
2884 });
2885 }
2886 fidl::decode!(
2887 fidl::encoding::UnboundedString,
2888 fidl::encoding::DefaultFuchsiaResourceDialect,
2889 &mut self.path,
2890 decoder,
2891 offset + 0,
2892 _depth
2893 )?;
2894 fidl::decode!(
2895 fidl::encoding::Endpoint<
2896 fidl::endpoints::ClientEnd<fidl_fuchsia_netemul_network::DeviceProxy_Marker>,
2897 >,
2898 fidl::encoding::DefaultFuchsiaResourceDialect,
2899 &mut self.device,
2900 decoder,
2901 offset + 16,
2902 _depth
2903 )?;
2904 Ok(())
2905 }
2906 }
2907
2908 impl fidl::encoding::ResourceTypeMarker for ManagedRealmConnectToProtocolRequest {
2909 type Borrowed<'a> = &'a mut Self;
2910 fn take_or_borrow<'a>(
2911 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2912 ) -> Self::Borrowed<'a> {
2913 value
2914 }
2915 }
2916
2917 unsafe impl fidl::encoding::TypeMarker for ManagedRealmConnectToProtocolRequest {
2918 type Owned = Self;
2919
2920 #[inline(always)]
2921 fn inline_align(_context: fidl::encoding::Context) -> usize {
2922 8
2923 }
2924
2925 #[inline(always)]
2926 fn inline_size(_context: fidl::encoding::Context) -> usize {
2927 40
2928 }
2929 }
2930
2931 unsafe impl
2932 fidl::encoding::Encode<
2933 ManagedRealmConnectToProtocolRequest,
2934 fidl::encoding::DefaultFuchsiaResourceDialect,
2935 > for &mut ManagedRealmConnectToProtocolRequest
2936 {
2937 #[inline]
2938 unsafe fn encode(
2939 self,
2940 encoder: &mut fidl::encoding::Encoder<
2941 '_,
2942 fidl::encoding::DefaultFuchsiaResourceDialect,
2943 >,
2944 offset: usize,
2945 _depth: fidl::encoding::Depth,
2946 ) -> fidl::Result<()> {
2947 encoder.debug_check_bounds::<ManagedRealmConnectToProtocolRequest>(offset);
2948 fidl::encoding::Encode::<ManagedRealmConnectToProtocolRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2950 (
2951 <fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(&self.protocol_name),
2952 <fidl::encoding::Optional<fidl::encoding::BoundedString<255>> as fidl::encoding::ValueTypeMarker>::borrow(&self.child_name),
2953 <fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.req),
2954 ),
2955 encoder, offset, _depth
2956 )
2957 }
2958 }
2959 unsafe impl<
2960 T0: fidl::encoding::Encode<
2961 fidl::encoding::BoundedString<255>,
2962 fidl::encoding::DefaultFuchsiaResourceDialect,
2963 >,
2964 T1: fidl::encoding::Encode<
2965 fidl::encoding::Optional<fidl::encoding::BoundedString<255>>,
2966 fidl::encoding::DefaultFuchsiaResourceDialect,
2967 >,
2968 T2: fidl::encoding::Encode<
2969 fidl::encoding::HandleType<
2970 fidl::Channel,
2971 { fidl::ObjectType::CHANNEL.into_raw() },
2972 2147483648,
2973 >,
2974 fidl::encoding::DefaultFuchsiaResourceDialect,
2975 >,
2976 >
2977 fidl::encoding::Encode<
2978 ManagedRealmConnectToProtocolRequest,
2979 fidl::encoding::DefaultFuchsiaResourceDialect,
2980 > for (T0, T1, T2)
2981 {
2982 #[inline]
2983 unsafe fn encode(
2984 self,
2985 encoder: &mut fidl::encoding::Encoder<
2986 '_,
2987 fidl::encoding::DefaultFuchsiaResourceDialect,
2988 >,
2989 offset: usize,
2990 depth: fidl::encoding::Depth,
2991 ) -> fidl::Result<()> {
2992 encoder.debug_check_bounds::<ManagedRealmConnectToProtocolRequest>(offset);
2993 unsafe {
2996 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
2997 (ptr as *mut u64).write_unaligned(0);
2998 }
2999 self.0.encode(encoder, offset + 0, depth)?;
3001 self.1.encode(encoder, offset + 16, depth)?;
3002 self.2.encode(encoder, offset + 32, depth)?;
3003 Ok(())
3004 }
3005 }
3006
3007 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3008 for ManagedRealmConnectToProtocolRequest
3009 {
3010 #[inline(always)]
3011 fn new_empty() -> Self {
3012 Self {
3013 protocol_name: fidl::new_empty!(
3014 fidl::encoding::BoundedString<255>,
3015 fidl::encoding::DefaultFuchsiaResourceDialect
3016 ),
3017 child_name: fidl::new_empty!(
3018 fidl::encoding::Optional<fidl::encoding::BoundedString<255>>,
3019 fidl::encoding::DefaultFuchsiaResourceDialect
3020 ),
3021 req: fidl::new_empty!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
3022 }
3023 }
3024
3025 #[inline]
3026 unsafe fn decode(
3027 &mut self,
3028 decoder: &mut fidl::encoding::Decoder<
3029 '_,
3030 fidl::encoding::DefaultFuchsiaResourceDialect,
3031 >,
3032 offset: usize,
3033 _depth: fidl::encoding::Depth,
3034 ) -> fidl::Result<()> {
3035 decoder.debug_check_bounds::<Self>(offset);
3036 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
3038 let padval = unsafe { (ptr as *const u64).read_unaligned() };
3039 let mask = 0xffffffff00000000u64;
3040 let maskedval = padval & mask;
3041 if maskedval != 0 {
3042 return Err(fidl::Error::NonZeroPadding {
3043 padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
3044 });
3045 }
3046 fidl::decode!(
3047 fidl::encoding::BoundedString<255>,
3048 fidl::encoding::DefaultFuchsiaResourceDialect,
3049 &mut self.protocol_name,
3050 decoder,
3051 offset + 0,
3052 _depth
3053 )?;
3054 fidl::decode!(
3055 fidl::encoding::Optional<fidl::encoding::BoundedString<255>>,
3056 fidl::encoding::DefaultFuchsiaResourceDialect,
3057 &mut self.child_name,
3058 decoder,
3059 offset + 16,
3060 _depth
3061 )?;
3062 fidl::decode!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.req, decoder, offset + 32, _depth)?;
3063 Ok(())
3064 }
3065 }
3066
3067 impl fidl::encoding::ResourceTypeMarker for ManagedRealmGetDevfsRequest {
3068 type Borrowed<'a> = &'a mut Self;
3069 fn take_or_borrow<'a>(
3070 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3071 ) -> Self::Borrowed<'a> {
3072 value
3073 }
3074 }
3075
3076 unsafe impl fidl::encoding::TypeMarker for ManagedRealmGetDevfsRequest {
3077 type Owned = Self;
3078
3079 #[inline(always)]
3080 fn inline_align(_context: fidl::encoding::Context) -> usize {
3081 4
3082 }
3083
3084 #[inline(always)]
3085 fn inline_size(_context: fidl::encoding::Context) -> usize {
3086 4
3087 }
3088 }
3089
3090 unsafe impl
3091 fidl::encoding::Encode<
3092 ManagedRealmGetDevfsRequest,
3093 fidl::encoding::DefaultFuchsiaResourceDialect,
3094 > for &mut ManagedRealmGetDevfsRequest
3095 {
3096 #[inline]
3097 unsafe fn encode(
3098 self,
3099 encoder: &mut fidl::encoding::Encoder<
3100 '_,
3101 fidl::encoding::DefaultFuchsiaResourceDialect,
3102 >,
3103 offset: usize,
3104 _depth: fidl::encoding::Depth,
3105 ) -> fidl::Result<()> {
3106 encoder.debug_check_bounds::<ManagedRealmGetDevfsRequest>(offset);
3107 fidl::encoding::Encode::<
3109 ManagedRealmGetDevfsRequest,
3110 fidl::encoding::DefaultFuchsiaResourceDialect,
3111 >::encode(
3112 (<fidl::encoding::Endpoint<
3113 fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
3114 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
3115 &mut self.devfs
3116 ),),
3117 encoder,
3118 offset,
3119 _depth,
3120 )
3121 }
3122 }
3123 unsafe impl<
3124 T0: fidl::encoding::Encode<
3125 fidl::encoding::Endpoint<
3126 fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
3127 >,
3128 fidl::encoding::DefaultFuchsiaResourceDialect,
3129 >,
3130 >
3131 fidl::encoding::Encode<
3132 ManagedRealmGetDevfsRequest,
3133 fidl::encoding::DefaultFuchsiaResourceDialect,
3134 > for (T0,)
3135 {
3136 #[inline]
3137 unsafe fn encode(
3138 self,
3139 encoder: &mut fidl::encoding::Encoder<
3140 '_,
3141 fidl::encoding::DefaultFuchsiaResourceDialect,
3142 >,
3143 offset: usize,
3144 depth: fidl::encoding::Depth,
3145 ) -> fidl::Result<()> {
3146 encoder.debug_check_bounds::<ManagedRealmGetDevfsRequest>(offset);
3147 self.0.encode(encoder, offset + 0, depth)?;
3151 Ok(())
3152 }
3153 }
3154
3155 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3156 for ManagedRealmGetDevfsRequest
3157 {
3158 #[inline(always)]
3159 fn new_empty() -> Self {
3160 Self {
3161 devfs: fidl::new_empty!(
3162 fidl::encoding::Endpoint<
3163 fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
3164 >,
3165 fidl::encoding::DefaultFuchsiaResourceDialect
3166 ),
3167 }
3168 }
3169
3170 #[inline]
3171 unsafe fn decode(
3172 &mut self,
3173 decoder: &mut fidl::encoding::Decoder<
3174 '_,
3175 fidl::encoding::DefaultFuchsiaResourceDialect,
3176 >,
3177 offset: usize,
3178 _depth: fidl::encoding::Depth,
3179 ) -> fidl::Result<()> {
3180 decoder.debug_check_bounds::<Self>(offset);
3181 fidl::decode!(
3183 fidl::encoding::Endpoint<
3184 fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
3185 >,
3186 fidl::encoding::DefaultFuchsiaResourceDialect,
3187 &mut self.devfs,
3188 decoder,
3189 offset + 0,
3190 _depth
3191 )?;
3192 Ok(())
3193 }
3194 }
3195
3196 impl fidl::encoding::ResourceTypeMarker for ManagedRealmOpenDiagnosticsDirectoryRequest {
3197 type Borrowed<'a> = &'a mut Self;
3198 fn take_or_borrow<'a>(
3199 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3200 ) -> Self::Borrowed<'a> {
3201 value
3202 }
3203 }
3204
3205 unsafe impl fidl::encoding::TypeMarker for ManagedRealmOpenDiagnosticsDirectoryRequest {
3206 type Owned = Self;
3207
3208 #[inline(always)]
3209 fn inline_align(_context: fidl::encoding::Context) -> usize {
3210 8
3211 }
3212
3213 #[inline(always)]
3214 fn inline_size(_context: fidl::encoding::Context) -> usize {
3215 24
3216 }
3217 }
3218
3219 unsafe impl
3220 fidl::encoding::Encode<
3221 ManagedRealmOpenDiagnosticsDirectoryRequest,
3222 fidl::encoding::DefaultFuchsiaResourceDialect,
3223 > for &mut ManagedRealmOpenDiagnosticsDirectoryRequest
3224 {
3225 #[inline]
3226 unsafe fn encode(
3227 self,
3228 encoder: &mut fidl::encoding::Encoder<
3229 '_,
3230 fidl::encoding::DefaultFuchsiaResourceDialect,
3231 >,
3232 offset: usize,
3233 _depth: fidl::encoding::Depth,
3234 ) -> fidl::Result<()> {
3235 encoder.debug_check_bounds::<ManagedRealmOpenDiagnosticsDirectoryRequest>(offset);
3236 fidl::encoding::Encode::<
3238 ManagedRealmOpenDiagnosticsDirectoryRequest,
3239 fidl::encoding::DefaultFuchsiaResourceDialect,
3240 >::encode(
3241 (
3242 <fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(
3243 &self.child_name,
3244 ),
3245 <fidl::encoding::Endpoint<
3246 fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
3247 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
3248 &mut self.directory
3249 ),
3250 ),
3251 encoder,
3252 offset,
3253 _depth,
3254 )
3255 }
3256 }
3257 unsafe impl<
3258 T0: fidl::encoding::Encode<
3259 fidl::encoding::BoundedString<255>,
3260 fidl::encoding::DefaultFuchsiaResourceDialect,
3261 >,
3262 T1: fidl::encoding::Encode<
3263 fidl::encoding::Endpoint<
3264 fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
3265 >,
3266 fidl::encoding::DefaultFuchsiaResourceDialect,
3267 >,
3268 >
3269 fidl::encoding::Encode<
3270 ManagedRealmOpenDiagnosticsDirectoryRequest,
3271 fidl::encoding::DefaultFuchsiaResourceDialect,
3272 > for (T0, T1)
3273 {
3274 #[inline]
3275 unsafe fn encode(
3276 self,
3277 encoder: &mut fidl::encoding::Encoder<
3278 '_,
3279 fidl::encoding::DefaultFuchsiaResourceDialect,
3280 >,
3281 offset: usize,
3282 depth: fidl::encoding::Depth,
3283 ) -> fidl::Result<()> {
3284 encoder.debug_check_bounds::<ManagedRealmOpenDiagnosticsDirectoryRequest>(offset);
3285 unsafe {
3288 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
3289 (ptr as *mut u64).write_unaligned(0);
3290 }
3291 self.0.encode(encoder, offset + 0, depth)?;
3293 self.1.encode(encoder, offset + 16, depth)?;
3294 Ok(())
3295 }
3296 }
3297
3298 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3299 for ManagedRealmOpenDiagnosticsDirectoryRequest
3300 {
3301 #[inline(always)]
3302 fn new_empty() -> Self {
3303 Self {
3304 child_name: fidl::new_empty!(
3305 fidl::encoding::BoundedString<255>,
3306 fidl::encoding::DefaultFuchsiaResourceDialect
3307 ),
3308 directory: fidl::new_empty!(
3309 fidl::encoding::Endpoint<
3310 fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
3311 >,
3312 fidl::encoding::DefaultFuchsiaResourceDialect
3313 ),
3314 }
3315 }
3316
3317 #[inline]
3318 unsafe fn decode(
3319 &mut self,
3320 decoder: &mut fidl::encoding::Decoder<
3321 '_,
3322 fidl::encoding::DefaultFuchsiaResourceDialect,
3323 >,
3324 offset: usize,
3325 _depth: fidl::encoding::Depth,
3326 ) -> fidl::Result<()> {
3327 decoder.debug_check_bounds::<Self>(offset);
3328 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
3330 let padval = unsafe { (ptr as *const u64).read_unaligned() };
3331 let mask = 0xffffffff00000000u64;
3332 let maskedval = padval & mask;
3333 if maskedval != 0 {
3334 return Err(fidl::Error::NonZeroPadding {
3335 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
3336 });
3337 }
3338 fidl::decode!(
3339 fidl::encoding::BoundedString<255>,
3340 fidl::encoding::DefaultFuchsiaResourceDialect,
3341 &mut self.child_name,
3342 decoder,
3343 offset + 0,
3344 _depth
3345 )?;
3346 fidl::decode!(
3347 fidl::encoding::Endpoint<
3348 fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
3349 >,
3350 fidl::encoding::DefaultFuchsiaResourceDialect,
3351 &mut self.directory,
3352 decoder,
3353 offset + 16,
3354 _depth
3355 )?;
3356 Ok(())
3357 }
3358 }
3359
3360 impl fidl::encoding::ResourceTypeMarker for SandboxCreateRealmRequest {
3361 type Borrowed<'a> = &'a mut Self;
3362 fn take_or_borrow<'a>(
3363 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3364 ) -> Self::Borrowed<'a> {
3365 value
3366 }
3367 }
3368
3369 unsafe impl fidl::encoding::TypeMarker for SandboxCreateRealmRequest {
3370 type Owned = Self;
3371
3372 #[inline(always)]
3373 fn inline_align(_context: fidl::encoding::Context) -> usize {
3374 8
3375 }
3376
3377 #[inline(always)]
3378 fn inline_size(_context: fidl::encoding::Context) -> usize {
3379 24
3380 }
3381 }
3382
3383 unsafe impl
3384 fidl::encoding::Encode<
3385 SandboxCreateRealmRequest,
3386 fidl::encoding::DefaultFuchsiaResourceDialect,
3387 > for &mut SandboxCreateRealmRequest
3388 {
3389 #[inline]
3390 unsafe fn encode(
3391 self,
3392 encoder: &mut fidl::encoding::Encoder<
3393 '_,
3394 fidl::encoding::DefaultFuchsiaResourceDialect,
3395 >,
3396 offset: usize,
3397 _depth: fidl::encoding::Depth,
3398 ) -> fidl::Result<()> {
3399 encoder.debug_check_bounds::<SandboxCreateRealmRequest>(offset);
3400 fidl::encoding::Encode::<SandboxCreateRealmRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
3402 (
3403 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ManagedRealmMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.realm),
3404 <RealmOptions as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.options),
3405 ),
3406 encoder, offset, _depth
3407 )
3408 }
3409 }
3410 unsafe impl<
3411 T0: fidl::encoding::Encode<
3412 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ManagedRealmMarker>>,
3413 fidl::encoding::DefaultFuchsiaResourceDialect,
3414 >,
3415 T1: fidl::encoding::Encode<RealmOptions, fidl::encoding::DefaultFuchsiaResourceDialect>,
3416 >
3417 fidl::encoding::Encode<
3418 SandboxCreateRealmRequest,
3419 fidl::encoding::DefaultFuchsiaResourceDialect,
3420 > for (T0, T1)
3421 {
3422 #[inline]
3423 unsafe fn encode(
3424 self,
3425 encoder: &mut fidl::encoding::Encoder<
3426 '_,
3427 fidl::encoding::DefaultFuchsiaResourceDialect,
3428 >,
3429 offset: usize,
3430 depth: fidl::encoding::Depth,
3431 ) -> fidl::Result<()> {
3432 encoder.debug_check_bounds::<SandboxCreateRealmRequest>(offset);
3433 unsafe {
3436 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
3437 (ptr as *mut u64).write_unaligned(0);
3438 }
3439 self.0.encode(encoder, offset + 0, depth)?;
3441 self.1.encode(encoder, offset + 8, depth)?;
3442 Ok(())
3443 }
3444 }
3445
3446 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3447 for SandboxCreateRealmRequest
3448 {
3449 #[inline(always)]
3450 fn new_empty() -> Self {
3451 Self {
3452 realm: fidl::new_empty!(
3453 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ManagedRealmMarker>>,
3454 fidl::encoding::DefaultFuchsiaResourceDialect
3455 ),
3456 options: fidl::new_empty!(
3457 RealmOptions,
3458 fidl::encoding::DefaultFuchsiaResourceDialect
3459 ),
3460 }
3461 }
3462
3463 #[inline]
3464 unsafe fn decode(
3465 &mut self,
3466 decoder: &mut fidl::encoding::Decoder<
3467 '_,
3468 fidl::encoding::DefaultFuchsiaResourceDialect,
3469 >,
3470 offset: usize,
3471 _depth: fidl::encoding::Depth,
3472 ) -> fidl::Result<()> {
3473 decoder.debug_check_bounds::<Self>(offset);
3474 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
3476 let padval = unsafe { (ptr as *const u64).read_unaligned() };
3477 let mask = 0xffffffff00000000u64;
3478 let maskedval = padval & mask;
3479 if maskedval != 0 {
3480 return Err(fidl::Error::NonZeroPadding {
3481 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
3482 });
3483 }
3484 fidl::decode!(
3485 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ManagedRealmMarker>>,
3486 fidl::encoding::DefaultFuchsiaResourceDialect,
3487 &mut self.realm,
3488 decoder,
3489 offset + 0,
3490 _depth
3491 )?;
3492 fidl::decode!(
3493 RealmOptions,
3494 fidl::encoding::DefaultFuchsiaResourceDialect,
3495 &mut self.options,
3496 decoder,
3497 offset + 8,
3498 _depth
3499 )?;
3500 Ok(())
3501 }
3502 }
3503
3504 impl fidl::encoding::ResourceTypeMarker for SandboxGetNetworkContextRequest {
3505 type Borrowed<'a> = &'a mut Self;
3506 fn take_or_borrow<'a>(
3507 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3508 ) -> Self::Borrowed<'a> {
3509 value
3510 }
3511 }
3512
3513 unsafe impl fidl::encoding::TypeMarker for SandboxGetNetworkContextRequest {
3514 type Owned = Self;
3515
3516 #[inline(always)]
3517 fn inline_align(_context: fidl::encoding::Context) -> usize {
3518 4
3519 }
3520
3521 #[inline(always)]
3522 fn inline_size(_context: fidl::encoding::Context) -> usize {
3523 4
3524 }
3525 }
3526
3527 unsafe impl
3528 fidl::encoding::Encode<
3529 SandboxGetNetworkContextRequest,
3530 fidl::encoding::DefaultFuchsiaResourceDialect,
3531 > for &mut SandboxGetNetworkContextRequest
3532 {
3533 #[inline]
3534 unsafe fn encode(
3535 self,
3536 encoder: &mut fidl::encoding::Encoder<
3537 '_,
3538 fidl::encoding::DefaultFuchsiaResourceDialect,
3539 >,
3540 offset: usize,
3541 _depth: fidl::encoding::Depth,
3542 ) -> fidl::Result<()> {
3543 encoder.debug_check_bounds::<SandboxGetNetworkContextRequest>(offset);
3544 fidl::encoding::Encode::<
3546 SandboxGetNetworkContextRequest,
3547 fidl::encoding::DefaultFuchsiaResourceDialect,
3548 >::encode(
3549 (<fidl::encoding::Endpoint<
3550 fidl::endpoints::ServerEnd<fidl_fuchsia_netemul_network::NetworkContextMarker>,
3551 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
3552 &mut self.network_context,
3553 ),),
3554 encoder,
3555 offset,
3556 _depth,
3557 )
3558 }
3559 }
3560 unsafe impl<
3561 T0: fidl::encoding::Encode<
3562 fidl::encoding::Endpoint<
3563 fidl::endpoints::ServerEnd<fidl_fuchsia_netemul_network::NetworkContextMarker>,
3564 >,
3565 fidl::encoding::DefaultFuchsiaResourceDialect,
3566 >,
3567 >
3568 fidl::encoding::Encode<
3569 SandboxGetNetworkContextRequest,
3570 fidl::encoding::DefaultFuchsiaResourceDialect,
3571 > for (T0,)
3572 {
3573 #[inline]
3574 unsafe fn encode(
3575 self,
3576 encoder: &mut fidl::encoding::Encoder<
3577 '_,
3578 fidl::encoding::DefaultFuchsiaResourceDialect,
3579 >,
3580 offset: usize,
3581 depth: fidl::encoding::Depth,
3582 ) -> fidl::Result<()> {
3583 encoder.debug_check_bounds::<SandboxGetNetworkContextRequest>(offset);
3584 self.0.encode(encoder, offset + 0, depth)?;
3588 Ok(())
3589 }
3590 }
3591
3592 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3593 for SandboxGetNetworkContextRequest
3594 {
3595 #[inline(always)]
3596 fn new_empty() -> Self {
3597 Self {
3598 network_context: fidl::new_empty!(
3599 fidl::encoding::Endpoint<
3600 fidl::endpoints::ServerEnd<
3601 fidl_fuchsia_netemul_network::NetworkContextMarker,
3602 >,
3603 >,
3604 fidl::encoding::DefaultFuchsiaResourceDialect
3605 ),
3606 }
3607 }
3608
3609 #[inline]
3610 unsafe fn decode(
3611 &mut self,
3612 decoder: &mut fidl::encoding::Decoder<
3613 '_,
3614 fidl::encoding::DefaultFuchsiaResourceDialect,
3615 >,
3616 offset: usize,
3617 _depth: fidl::encoding::Depth,
3618 ) -> fidl::Result<()> {
3619 decoder.debug_check_bounds::<Self>(offset);
3620 fidl::decode!(
3622 fidl::encoding::Endpoint<
3623 fidl::endpoints::ServerEnd<fidl_fuchsia_netemul_network::NetworkContextMarker>,
3624 >,
3625 fidl::encoding::DefaultFuchsiaResourceDialect,
3626 &mut self.network_context,
3627 decoder,
3628 offset + 0,
3629 _depth
3630 )?;
3631 Ok(())
3632 }
3633 }
3634
3635 impl ChildDef {
3636 #[inline(always)]
3637 fn max_ordinal_present(&self) -> u64 {
3638 if let Some(_) = self.config_values {
3639 return 7;
3640 }
3641 if let Some(_) = self.eager {
3642 return 6;
3643 }
3644 if let Some(_) = self.program_args {
3645 return 5;
3646 }
3647 if let Some(_) = self.uses {
3648 return 4;
3649 }
3650 if let Some(_) = self.exposes {
3651 return 3;
3652 }
3653 if let Some(_) = self.name {
3654 return 2;
3655 }
3656 if let Some(_) = self.source {
3657 return 1;
3658 }
3659 0
3660 }
3661 }
3662
3663 impl fidl::encoding::ResourceTypeMarker for ChildDef {
3664 type Borrowed<'a> = &'a mut Self;
3665 fn take_or_borrow<'a>(
3666 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3667 ) -> Self::Borrowed<'a> {
3668 value
3669 }
3670 }
3671
3672 unsafe impl fidl::encoding::TypeMarker for ChildDef {
3673 type Owned = Self;
3674
3675 #[inline(always)]
3676 fn inline_align(_context: fidl::encoding::Context) -> usize {
3677 8
3678 }
3679
3680 #[inline(always)]
3681 fn inline_size(_context: fidl::encoding::Context) -> usize {
3682 16
3683 }
3684 }
3685
3686 unsafe impl fidl::encoding::Encode<ChildDef, fidl::encoding::DefaultFuchsiaResourceDialect>
3687 for &mut ChildDef
3688 {
3689 unsafe fn encode(
3690 self,
3691 encoder: &mut fidl::encoding::Encoder<
3692 '_,
3693 fidl::encoding::DefaultFuchsiaResourceDialect,
3694 >,
3695 offset: usize,
3696 mut depth: fidl::encoding::Depth,
3697 ) -> fidl::Result<()> {
3698 encoder.debug_check_bounds::<ChildDef>(offset);
3699 let max_ordinal: u64 = self.max_ordinal_present();
3701 encoder.write_num(max_ordinal, offset);
3702 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3703 if max_ordinal == 0 {
3705 return Ok(());
3706 }
3707 depth.increment()?;
3708 let envelope_size = 8;
3709 let bytes_len = max_ordinal as usize * envelope_size;
3710 #[allow(unused_variables)]
3711 let offset = encoder.out_of_line_offset(bytes_len);
3712 let mut _prev_end_offset: usize = 0;
3713 if 1 > max_ordinal {
3714 return Ok(());
3715 }
3716
3717 let cur_offset: usize = (1 - 1) * envelope_size;
3720
3721 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3723
3724 fidl::encoding::encode_in_envelope_optional::<
3729 ChildSource,
3730 fidl::encoding::DefaultFuchsiaResourceDialect,
3731 >(
3732 self.source
3733 .as_mut()
3734 .map(<ChildSource as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
3735 encoder,
3736 offset + cur_offset,
3737 depth,
3738 )?;
3739
3740 _prev_end_offset = cur_offset + envelope_size;
3741 if 2 > max_ordinal {
3742 return Ok(());
3743 }
3744
3745 let cur_offset: usize = (2 - 1) * envelope_size;
3748
3749 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3751
3752 fidl::encoding::encode_in_envelope_optional::<
3757 fidl::encoding::BoundedString<255>,
3758 fidl::encoding::DefaultFuchsiaResourceDialect,
3759 >(
3760 self.name.as_ref().map(
3761 <fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow,
3762 ),
3763 encoder,
3764 offset + cur_offset,
3765 depth,
3766 )?;
3767
3768 _prev_end_offset = cur_offset + envelope_size;
3769 if 3 > max_ordinal {
3770 return Ok(());
3771 }
3772
3773 let cur_offset: usize = (3 - 1) * envelope_size;
3776
3777 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3779
3780 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<255>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
3785 self.exposes.as_ref().map(<fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<255>> as fidl::encoding::ValueTypeMarker>::borrow),
3786 encoder, offset + cur_offset, depth
3787 )?;
3788
3789 _prev_end_offset = cur_offset + envelope_size;
3790 if 4 > max_ordinal {
3791 return Ok(());
3792 }
3793
3794 let cur_offset: usize = (4 - 1) * envelope_size;
3797
3798 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3800
3801 fidl::encoding::encode_in_envelope_optional::<
3806 ChildUses,
3807 fidl::encoding::DefaultFuchsiaResourceDialect,
3808 >(
3809 self.uses.as_ref().map(<ChildUses as fidl::encoding::ValueTypeMarker>::borrow),
3810 encoder,
3811 offset + cur_offset,
3812 depth,
3813 )?;
3814
3815 _prev_end_offset = cur_offset + envelope_size;
3816 if 5 > max_ordinal {
3817 return Ok(());
3818 }
3819
3820 let cur_offset: usize = (5 - 1) * envelope_size;
3823
3824 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3826
3827 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>, fidl::encoding::DefaultFuchsiaResourceDialect>(
3832 self.program_args.as_ref().map(<fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString> as fidl::encoding::ValueTypeMarker>::borrow),
3833 encoder, offset + cur_offset, depth
3834 )?;
3835
3836 _prev_end_offset = cur_offset + envelope_size;
3837 if 6 > max_ordinal {
3838 return Ok(());
3839 }
3840
3841 let cur_offset: usize = (6 - 1) * envelope_size;
3844
3845 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3847
3848 fidl::encoding::encode_in_envelope_optional::<
3853 bool,
3854 fidl::encoding::DefaultFuchsiaResourceDialect,
3855 >(
3856 self.eager.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
3857 encoder,
3858 offset + cur_offset,
3859 depth,
3860 )?;
3861
3862 _prev_end_offset = cur_offset + envelope_size;
3863 if 7 > max_ordinal {
3864 return Ok(());
3865 }
3866
3867 let cur_offset: usize = (7 - 1) * envelope_size;
3870
3871 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3873
3874 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<ChildConfigValue>, fidl::encoding::DefaultFuchsiaResourceDialect>(
3879 self.config_values.as_ref().map(<fidl::encoding::UnboundedVector<ChildConfigValue> as fidl::encoding::ValueTypeMarker>::borrow),
3880 encoder, offset + cur_offset, depth
3881 )?;
3882
3883 _prev_end_offset = cur_offset + envelope_size;
3884
3885 Ok(())
3886 }
3887 }
3888
3889 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for ChildDef {
3890 #[inline(always)]
3891 fn new_empty() -> Self {
3892 Self::default()
3893 }
3894
3895 unsafe fn decode(
3896 &mut self,
3897 decoder: &mut fidl::encoding::Decoder<
3898 '_,
3899 fidl::encoding::DefaultFuchsiaResourceDialect,
3900 >,
3901 offset: usize,
3902 mut depth: fidl::encoding::Depth,
3903 ) -> fidl::Result<()> {
3904 decoder.debug_check_bounds::<Self>(offset);
3905 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3906 None => return Err(fidl::Error::NotNullable),
3907 Some(len) => len,
3908 };
3909 if len == 0 {
3911 return Ok(());
3912 };
3913 depth.increment()?;
3914 let envelope_size = 8;
3915 let bytes_len = len * envelope_size;
3916 let offset = decoder.out_of_line_offset(bytes_len)?;
3917 let mut _next_ordinal_to_read = 0;
3919 let mut next_offset = offset;
3920 let end_offset = offset + bytes_len;
3921 _next_ordinal_to_read += 1;
3922 if next_offset >= end_offset {
3923 return Ok(());
3924 }
3925
3926 while _next_ordinal_to_read < 1 {
3928 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3929 _next_ordinal_to_read += 1;
3930 next_offset += envelope_size;
3931 }
3932
3933 let next_out_of_line = decoder.next_out_of_line();
3934 let handles_before = decoder.remaining_handles();
3935 if let Some((inlined, num_bytes, num_handles)) =
3936 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3937 {
3938 let member_inline_size =
3939 <ChildSource as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3940 if inlined != (member_inline_size <= 4) {
3941 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3942 }
3943 let inner_offset;
3944 let mut inner_depth = depth.clone();
3945 if inlined {
3946 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3947 inner_offset = next_offset;
3948 } else {
3949 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3950 inner_depth.increment()?;
3951 }
3952 let val_ref = self.source.get_or_insert_with(|| {
3953 fidl::new_empty!(ChildSource, fidl::encoding::DefaultFuchsiaResourceDialect)
3954 });
3955 fidl::decode!(
3956 ChildSource,
3957 fidl::encoding::DefaultFuchsiaResourceDialect,
3958 val_ref,
3959 decoder,
3960 inner_offset,
3961 inner_depth
3962 )?;
3963 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3964 {
3965 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3966 }
3967 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3968 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3969 }
3970 }
3971
3972 next_offset += envelope_size;
3973 _next_ordinal_to_read += 1;
3974 if next_offset >= end_offset {
3975 return Ok(());
3976 }
3977
3978 while _next_ordinal_to_read < 2 {
3980 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3981 _next_ordinal_to_read += 1;
3982 next_offset += envelope_size;
3983 }
3984
3985 let next_out_of_line = decoder.next_out_of_line();
3986 let handles_before = decoder.remaining_handles();
3987 if let Some((inlined, num_bytes, num_handles)) =
3988 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3989 {
3990 let member_inline_size =
3991 <fidl::encoding::BoundedString<255> as fidl::encoding::TypeMarker>::inline_size(
3992 decoder.context,
3993 );
3994 if inlined != (member_inline_size <= 4) {
3995 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3996 }
3997 let inner_offset;
3998 let mut inner_depth = depth.clone();
3999 if inlined {
4000 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4001 inner_offset = next_offset;
4002 } else {
4003 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4004 inner_depth.increment()?;
4005 }
4006 let val_ref = self.name.get_or_insert_with(|| {
4007 fidl::new_empty!(
4008 fidl::encoding::BoundedString<255>,
4009 fidl::encoding::DefaultFuchsiaResourceDialect
4010 )
4011 });
4012 fidl::decode!(
4013 fidl::encoding::BoundedString<255>,
4014 fidl::encoding::DefaultFuchsiaResourceDialect,
4015 val_ref,
4016 decoder,
4017 inner_offset,
4018 inner_depth
4019 )?;
4020 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4021 {
4022 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4023 }
4024 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4025 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4026 }
4027 }
4028
4029 next_offset += envelope_size;
4030 _next_ordinal_to_read += 1;
4031 if next_offset >= end_offset {
4032 return Ok(());
4033 }
4034
4035 while _next_ordinal_to_read < 3 {
4037 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4038 _next_ordinal_to_read += 1;
4039 next_offset += envelope_size;
4040 }
4041
4042 let next_out_of_line = decoder.next_out_of_line();
4043 let handles_before = decoder.remaining_handles();
4044 if let Some((inlined, num_bytes, num_handles)) =
4045 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4046 {
4047 let member_inline_size = <fidl::encoding::UnboundedVector<
4048 fidl::encoding::BoundedString<255>,
4049 > as fidl::encoding::TypeMarker>::inline_size(
4050 decoder.context
4051 );
4052 if inlined != (member_inline_size <= 4) {
4053 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4054 }
4055 let inner_offset;
4056 let mut inner_depth = depth.clone();
4057 if inlined {
4058 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4059 inner_offset = next_offset;
4060 } else {
4061 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4062 inner_depth.increment()?;
4063 }
4064 let val_ref = self.exposes.get_or_insert_with(|| {
4065 fidl::new_empty!(
4066 fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<255>>,
4067 fidl::encoding::DefaultFuchsiaResourceDialect
4068 )
4069 });
4070 fidl::decode!(
4071 fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<255>>,
4072 fidl::encoding::DefaultFuchsiaResourceDialect,
4073 val_ref,
4074 decoder,
4075 inner_offset,
4076 inner_depth
4077 )?;
4078 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4079 {
4080 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4081 }
4082 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4083 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4084 }
4085 }
4086
4087 next_offset += envelope_size;
4088 _next_ordinal_to_read += 1;
4089 if next_offset >= end_offset {
4090 return Ok(());
4091 }
4092
4093 while _next_ordinal_to_read < 4 {
4095 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4096 _next_ordinal_to_read += 1;
4097 next_offset += envelope_size;
4098 }
4099
4100 let next_out_of_line = decoder.next_out_of_line();
4101 let handles_before = decoder.remaining_handles();
4102 if let Some((inlined, num_bytes, num_handles)) =
4103 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4104 {
4105 let member_inline_size =
4106 <ChildUses as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4107 if inlined != (member_inline_size <= 4) {
4108 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4109 }
4110 let inner_offset;
4111 let mut inner_depth = depth.clone();
4112 if inlined {
4113 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4114 inner_offset = next_offset;
4115 } else {
4116 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4117 inner_depth.increment()?;
4118 }
4119 let val_ref = self.uses.get_or_insert_with(|| {
4120 fidl::new_empty!(ChildUses, fidl::encoding::DefaultFuchsiaResourceDialect)
4121 });
4122 fidl::decode!(
4123 ChildUses,
4124 fidl::encoding::DefaultFuchsiaResourceDialect,
4125 val_ref,
4126 decoder,
4127 inner_offset,
4128 inner_depth
4129 )?;
4130 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4131 {
4132 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4133 }
4134 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4135 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4136 }
4137 }
4138
4139 next_offset += envelope_size;
4140 _next_ordinal_to_read += 1;
4141 if next_offset >= end_offset {
4142 return Ok(());
4143 }
4144
4145 while _next_ordinal_to_read < 5 {
4147 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4148 _next_ordinal_to_read += 1;
4149 next_offset += envelope_size;
4150 }
4151
4152 let next_out_of_line = decoder.next_out_of_line();
4153 let handles_before = decoder.remaining_handles();
4154 if let Some((inlined, num_bytes, num_handles)) =
4155 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4156 {
4157 let member_inline_size = <fidl::encoding::UnboundedVector<
4158 fidl::encoding::UnboundedString,
4159 > as fidl::encoding::TypeMarker>::inline_size(
4160 decoder.context
4161 );
4162 if inlined != (member_inline_size <= 4) {
4163 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4164 }
4165 let inner_offset;
4166 let mut inner_depth = depth.clone();
4167 if inlined {
4168 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4169 inner_offset = next_offset;
4170 } else {
4171 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4172 inner_depth.increment()?;
4173 }
4174 let val_ref = self.program_args.get_or_insert_with(|| {
4175 fidl::new_empty!(
4176 fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>,
4177 fidl::encoding::DefaultFuchsiaResourceDialect
4178 )
4179 });
4180 fidl::decode!(
4181 fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>,
4182 fidl::encoding::DefaultFuchsiaResourceDialect,
4183 val_ref,
4184 decoder,
4185 inner_offset,
4186 inner_depth
4187 )?;
4188 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4189 {
4190 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4191 }
4192 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4193 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4194 }
4195 }
4196
4197 next_offset += envelope_size;
4198 _next_ordinal_to_read += 1;
4199 if next_offset >= end_offset {
4200 return Ok(());
4201 }
4202
4203 while _next_ordinal_to_read < 6 {
4205 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4206 _next_ordinal_to_read += 1;
4207 next_offset += envelope_size;
4208 }
4209
4210 let next_out_of_line = decoder.next_out_of_line();
4211 let handles_before = decoder.remaining_handles();
4212 if let Some((inlined, num_bytes, num_handles)) =
4213 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4214 {
4215 let member_inline_size =
4216 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4217 if inlined != (member_inline_size <= 4) {
4218 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4219 }
4220 let inner_offset;
4221 let mut inner_depth = depth.clone();
4222 if inlined {
4223 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4224 inner_offset = next_offset;
4225 } else {
4226 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4227 inner_depth.increment()?;
4228 }
4229 let val_ref = self.eager.get_or_insert_with(|| {
4230 fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
4231 });
4232 fidl::decode!(
4233 bool,
4234 fidl::encoding::DefaultFuchsiaResourceDialect,
4235 val_ref,
4236 decoder,
4237 inner_offset,
4238 inner_depth
4239 )?;
4240 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4241 {
4242 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4243 }
4244 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4245 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4246 }
4247 }
4248
4249 next_offset += envelope_size;
4250 _next_ordinal_to_read += 1;
4251 if next_offset >= end_offset {
4252 return Ok(());
4253 }
4254
4255 while _next_ordinal_to_read < 7 {
4257 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4258 _next_ordinal_to_read += 1;
4259 next_offset += envelope_size;
4260 }
4261
4262 let next_out_of_line = decoder.next_out_of_line();
4263 let handles_before = decoder.remaining_handles();
4264 if let Some((inlined, num_bytes, num_handles)) =
4265 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4266 {
4267 let member_inline_size = <fidl::encoding::UnboundedVector<ChildConfigValue> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4268 if inlined != (member_inline_size <= 4) {
4269 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4270 }
4271 let inner_offset;
4272 let mut inner_depth = depth.clone();
4273 if inlined {
4274 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4275 inner_offset = next_offset;
4276 } else {
4277 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4278 inner_depth.increment()?;
4279 }
4280 let val_ref = self.config_values.get_or_insert_with(|| {
4281 fidl::new_empty!(
4282 fidl::encoding::UnboundedVector<ChildConfigValue>,
4283 fidl::encoding::DefaultFuchsiaResourceDialect
4284 )
4285 });
4286 fidl::decode!(
4287 fidl::encoding::UnboundedVector<ChildConfigValue>,
4288 fidl::encoding::DefaultFuchsiaResourceDialect,
4289 val_ref,
4290 decoder,
4291 inner_offset,
4292 inner_depth
4293 )?;
4294 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4295 {
4296 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4297 }
4298 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4299 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4300 }
4301 }
4302
4303 next_offset += envelope_size;
4304
4305 while next_offset < end_offset {
4307 _next_ordinal_to_read += 1;
4308 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4309 next_offset += envelope_size;
4310 }
4311
4312 Ok(())
4313 }
4314 }
4315
4316 impl InterfaceOptions {
4317 #[inline(always)]
4318 fn max_ordinal_present(&self) -> u64 {
4319 if let Some(_) = self.ipv6_multicast_neighbor_solicitations {
4320 return 9;
4321 }
4322 if let Some(_) = self.ipv4_multicast_neighbor_solicitations {
4323 return 8;
4324 }
4325 if let Some(_) = self.enable_ipv6_forwarding {
4326 return 7;
4327 }
4328 if let Some(_) = self.enable_ipv4_forwarding {
4329 return 6;
4330 }
4331 if let Some(_) = self.gateway {
4332 return 5;
4333 }
4334 if let Some(_) = self.static_ips {
4335 return 4;
4336 }
4337 if let Some(_) = self.without_autogenerated_addresses {
4338 return 3;
4339 }
4340 if let Some(_) = self.device {
4341 return 2;
4342 }
4343 if let Some(_) = self.name {
4344 return 1;
4345 }
4346 0
4347 }
4348 }
4349
4350 impl fidl::encoding::ResourceTypeMarker for InterfaceOptions {
4351 type Borrowed<'a> = &'a mut Self;
4352 fn take_or_borrow<'a>(
4353 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4354 ) -> Self::Borrowed<'a> {
4355 value
4356 }
4357 }
4358
4359 unsafe impl fidl::encoding::TypeMarker for InterfaceOptions {
4360 type Owned = Self;
4361
4362 #[inline(always)]
4363 fn inline_align(_context: fidl::encoding::Context) -> usize {
4364 8
4365 }
4366
4367 #[inline(always)]
4368 fn inline_size(_context: fidl::encoding::Context) -> usize {
4369 16
4370 }
4371 }
4372
4373 unsafe impl
4374 fidl::encoding::Encode<InterfaceOptions, fidl::encoding::DefaultFuchsiaResourceDialect>
4375 for &mut InterfaceOptions
4376 {
4377 unsafe fn encode(
4378 self,
4379 encoder: &mut fidl::encoding::Encoder<
4380 '_,
4381 fidl::encoding::DefaultFuchsiaResourceDialect,
4382 >,
4383 offset: usize,
4384 mut depth: fidl::encoding::Depth,
4385 ) -> fidl::Result<()> {
4386 encoder.debug_check_bounds::<InterfaceOptions>(offset);
4387 let max_ordinal: u64 = self.max_ordinal_present();
4389 encoder.write_num(max_ordinal, offset);
4390 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4391 if max_ordinal == 0 {
4393 return Ok(());
4394 }
4395 depth.increment()?;
4396 let envelope_size = 8;
4397 let bytes_len = max_ordinal as usize * envelope_size;
4398 #[allow(unused_variables)]
4399 let offset = encoder.out_of_line_offset(bytes_len);
4400 let mut _prev_end_offset: usize = 0;
4401 if 1 > max_ordinal {
4402 return Ok(());
4403 }
4404
4405 let cur_offset: usize = (1 - 1) * envelope_size;
4408
4409 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4411
4412 fidl::encoding::encode_in_envelope_optional::<
4417 fidl::encoding::UnboundedString,
4418 fidl::encoding::DefaultFuchsiaResourceDialect,
4419 >(
4420 self.name.as_ref().map(
4421 <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow,
4422 ),
4423 encoder,
4424 offset + cur_offset,
4425 depth,
4426 )?;
4427
4428 _prev_end_offset = cur_offset + envelope_size;
4429 if 2 > max_ordinal {
4430 return Ok(());
4431 }
4432
4433 let cur_offset: usize = (2 - 1) * envelope_size;
4436
4437 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4439
4440 fidl::encoding::encode_in_envelope_optional::<
4445 fidl::encoding::Endpoint<
4446 fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_network::PortMarker>,
4447 >,
4448 fidl::encoding::DefaultFuchsiaResourceDialect,
4449 >(
4450 self.device.as_mut().map(
4451 <fidl::encoding::Endpoint<
4452 fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_network::PortMarker>,
4453 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
4454 ),
4455 encoder,
4456 offset + cur_offset,
4457 depth,
4458 )?;
4459
4460 _prev_end_offset = cur_offset + envelope_size;
4461 if 3 > max_ordinal {
4462 return Ok(());
4463 }
4464
4465 let cur_offset: usize = (3 - 1) * envelope_size;
4468
4469 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4471
4472 fidl::encoding::encode_in_envelope_optional::<
4477 bool,
4478 fidl::encoding::DefaultFuchsiaResourceDialect,
4479 >(
4480 self.without_autogenerated_addresses
4481 .as_ref()
4482 .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
4483 encoder,
4484 offset + cur_offset,
4485 depth,
4486 )?;
4487
4488 _prev_end_offset = cur_offset + envelope_size;
4489 if 4 > max_ordinal {
4490 return Ok(());
4491 }
4492
4493 let cur_offset: usize = (4 - 1) * envelope_size;
4496
4497 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4499
4500 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<fidl_fuchsia_net::Subnet>, fidl::encoding::DefaultFuchsiaResourceDialect>(
4505 self.static_ips.as_ref().map(<fidl::encoding::UnboundedVector<fidl_fuchsia_net::Subnet> as fidl::encoding::ValueTypeMarker>::borrow),
4506 encoder, offset + cur_offset, depth
4507 )?;
4508
4509 _prev_end_offset = cur_offset + envelope_size;
4510 if 5 > max_ordinal {
4511 return Ok(());
4512 }
4513
4514 let cur_offset: usize = (5 - 1) * envelope_size;
4517
4518 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4520
4521 fidl::encoding::encode_in_envelope_optional::<
4526 fidl_fuchsia_net::IpAddress,
4527 fidl::encoding::DefaultFuchsiaResourceDialect,
4528 >(
4529 self.gateway
4530 .as_ref()
4531 .map(<fidl_fuchsia_net::IpAddress as fidl::encoding::ValueTypeMarker>::borrow),
4532 encoder,
4533 offset + cur_offset,
4534 depth,
4535 )?;
4536
4537 _prev_end_offset = cur_offset + envelope_size;
4538 if 6 > max_ordinal {
4539 return Ok(());
4540 }
4541
4542 let cur_offset: usize = (6 - 1) * envelope_size;
4545
4546 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4548
4549 fidl::encoding::encode_in_envelope_optional::<
4554 bool,
4555 fidl::encoding::DefaultFuchsiaResourceDialect,
4556 >(
4557 self.enable_ipv4_forwarding
4558 .as_ref()
4559 .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
4560 encoder,
4561 offset + cur_offset,
4562 depth,
4563 )?;
4564
4565 _prev_end_offset = cur_offset + envelope_size;
4566 if 7 > max_ordinal {
4567 return Ok(());
4568 }
4569
4570 let cur_offset: usize = (7 - 1) * envelope_size;
4573
4574 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4576
4577 fidl::encoding::encode_in_envelope_optional::<
4582 bool,
4583 fidl::encoding::DefaultFuchsiaResourceDialect,
4584 >(
4585 self.enable_ipv6_forwarding
4586 .as_ref()
4587 .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
4588 encoder,
4589 offset + cur_offset,
4590 depth,
4591 )?;
4592
4593 _prev_end_offset = cur_offset + envelope_size;
4594 if 8 > max_ordinal {
4595 return Ok(());
4596 }
4597
4598 let cur_offset: usize = (8 - 1) * envelope_size;
4601
4602 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4604
4605 fidl::encoding::encode_in_envelope_optional::<
4610 u16,
4611 fidl::encoding::DefaultFuchsiaResourceDialect,
4612 >(
4613 self.ipv4_multicast_neighbor_solicitations
4614 .as_ref()
4615 .map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
4616 encoder,
4617 offset + cur_offset,
4618 depth,
4619 )?;
4620
4621 _prev_end_offset = cur_offset + envelope_size;
4622 if 9 > max_ordinal {
4623 return Ok(());
4624 }
4625
4626 let cur_offset: usize = (9 - 1) * envelope_size;
4629
4630 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4632
4633 fidl::encoding::encode_in_envelope_optional::<
4638 u16,
4639 fidl::encoding::DefaultFuchsiaResourceDialect,
4640 >(
4641 self.ipv6_multicast_neighbor_solicitations
4642 .as_ref()
4643 .map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
4644 encoder,
4645 offset + cur_offset,
4646 depth,
4647 )?;
4648
4649 _prev_end_offset = cur_offset + envelope_size;
4650
4651 Ok(())
4652 }
4653 }
4654
4655 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4656 for InterfaceOptions
4657 {
4658 #[inline(always)]
4659 fn new_empty() -> Self {
4660 Self::default()
4661 }
4662
4663 unsafe fn decode(
4664 &mut self,
4665 decoder: &mut fidl::encoding::Decoder<
4666 '_,
4667 fidl::encoding::DefaultFuchsiaResourceDialect,
4668 >,
4669 offset: usize,
4670 mut depth: fidl::encoding::Depth,
4671 ) -> fidl::Result<()> {
4672 decoder.debug_check_bounds::<Self>(offset);
4673 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4674 None => return Err(fidl::Error::NotNullable),
4675 Some(len) => len,
4676 };
4677 if len == 0 {
4679 return Ok(());
4680 };
4681 depth.increment()?;
4682 let envelope_size = 8;
4683 let bytes_len = len * envelope_size;
4684 let offset = decoder.out_of_line_offset(bytes_len)?;
4685 let mut _next_ordinal_to_read = 0;
4687 let mut next_offset = offset;
4688 let end_offset = offset + bytes_len;
4689 _next_ordinal_to_read += 1;
4690 if next_offset >= end_offset {
4691 return Ok(());
4692 }
4693
4694 while _next_ordinal_to_read < 1 {
4696 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4697 _next_ordinal_to_read += 1;
4698 next_offset += envelope_size;
4699 }
4700
4701 let next_out_of_line = decoder.next_out_of_line();
4702 let handles_before = decoder.remaining_handles();
4703 if let Some((inlined, num_bytes, num_handles)) =
4704 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4705 {
4706 let member_inline_size =
4707 <fidl::encoding::UnboundedString as fidl::encoding::TypeMarker>::inline_size(
4708 decoder.context,
4709 );
4710 if inlined != (member_inline_size <= 4) {
4711 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4712 }
4713 let inner_offset;
4714 let mut inner_depth = depth.clone();
4715 if inlined {
4716 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4717 inner_offset = next_offset;
4718 } else {
4719 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4720 inner_depth.increment()?;
4721 }
4722 let val_ref = self.name.get_or_insert_with(|| {
4723 fidl::new_empty!(
4724 fidl::encoding::UnboundedString,
4725 fidl::encoding::DefaultFuchsiaResourceDialect
4726 )
4727 });
4728 fidl::decode!(
4729 fidl::encoding::UnboundedString,
4730 fidl::encoding::DefaultFuchsiaResourceDialect,
4731 val_ref,
4732 decoder,
4733 inner_offset,
4734 inner_depth
4735 )?;
4736 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4737 {
4738 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4739 }
4740 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4741 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4742 }
4743 }
4744
4745 next_offset += envelope_size;
4746 _next_ordinal_to_read += 1;
4747 if next_offset >= end_offset {
4748 return Ok(());
4749 }
4750
4751 while _next_ordinal_to_read < 2 {
4753 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4754 _next_ordinal_to_read += 1;
4755 next_offset += envelope_size;
4756 }
4757
4758 let next_out_of_line = decoder.next_out_of_line();
4759 let handles_before = decoder.remaining_handles();
4760 if let Some((inlined, num_bytes, num_handles)) =
4761 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4762 {
4763 let member_inline_size = <fidl::encoding::Endpoint<
4764 fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_network::PortMarker>,
4765 > as fidl::encoding::TypeMarker>::inline_size(
4766 decoder.context
4767 );
4768 if inlined != (member_inline_size <= 4) {
4769 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4770 }
4771 let inner_offset;
4772 let mut inner_depth = depth.clone();
4773 if inlined {
4774 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4775 inner_offset = next_offset;
4776 } else {
4777 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4778 inner_depth.increment()?;
4779 }
4780 let val_ref = self.device.get_or_insert_with(|| {
4781 fidl::new_empty!(
4782 fidl::encoding::Endpoint<
4783 fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_network::PortMarker>,
4784 >,
4785 fidl::encoding::DefaultFuchsiaResourceDialect
4786 )
4787 });
4788 fidl::decode!(
4789 fidl::encoding::Endpoint<
4790 fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_network::PortMarker>,
4791 >,
4792 fidl::encoding::DefaultFuchsiaResourceDialect,
4793 val_ref,
4794 decoder,
4795 inner_offset,
4796 inner_depth
4797 )?;
4798 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4799 {
4800 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4801 }
4802 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4803 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4804 }
4805 }
4806
4807 next_offset += envelope_size;
4808 _next_ordinal_to_read += 1;
4809 if next_offset >= end_offset {
4810 return Ok(());
4811 }
4812
4813 while _next_ordinal_to_read < 3 {
4815 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4816 _next_ordinal_to_read += 1;
4817 next_offset += envelope_size;
4818 }
4819
4820 let next_out_of_line = decoder.next_out_of_line();
4821 let handles_before = decoder.remaining_handles();
4822 if let Some((inlined, num_bytes, num_handles)) =
4823 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4824 {
4825 let member_inline_size =
4826 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4827 if inlined != (member_inline_size <= 4) {
4828 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4829 }
4830 let inner_offset;
4831 let mut inner_depth = depth.clone();
4832 if inlined {
4833 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4834 inner_offset = next_offset;
4835 } else {
4836 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4837 inner_depth.increment()?;
4838 }
4839 let val_ref = self.without_autogenerated_addresses.get_or_insert_with(|| {
4840 fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
4841 });
4842 fidl::decode!(
4843 bool,
4844 fidl::encoding::DefaultFuchsiaResourceDialect,
4845 val_ref,
4846 decoder,
4847 inner_offset,
4848 inner_depth
4849 )?;
4850 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4851 {
4852 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4853 }
4854 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4855 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4856 }
4857 }
4858
4859 next_offset += envelope_size;
4860 _next_ordinal_to_read += 1;
4861 if next_offset >= end_offset {
4862 return Ok(());
4863 }
4864
4865 while _next_ordinal_to_read < 4 {
4867 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4868 _next_ordinal_to_read += 1;
4869 next_offset += envelope_size;
4870 }
4871
4872 let next_out_of_line = decoder.next_out_of_line();
4873 let handles_before = decoder.remaining_handles();
4874 if let Some((inlined, num_bytes, num_handles)) =
4875 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4876 {
4877 let member_inline_size = <fidl::encoding::UnboundedVector<fidl_fuchsia_net::Subnet> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4878 if inlined != (member_inline_size <= 4) {
4879 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4880 }
4881 let inner_offset;
4882 let mut inner_depth = depth.clone();
4883 if inlined {
4884 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4885 inner_offset = next_offset;
4886 } else {
4887 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4888 inner_depth.increment()?;
4889 }
4890 let val_ref = self.static_ips.get_or_insert_with(|| {
4891 fidl::new_empty!(
4892 fidl::encoding::UnboundedVector<fidl_fuchsia_net::Subnet>,
4893 fidl::encoding::DefaultFuchsiaResourceDialect
4894 )
4895 });
4896 fidl::decode!(
4897 fidl::encoding::UnboundedVector<fidl_fuchsia_net::Subnet>,
4898 fidl::encoding::DefaultFuchsiaResourceDialect,
4899 val_ref,
4900 decoder,
4901 inner_offset,
4902 inner_depth
4903 )?;
4904 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4905 {
4906 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4907 }
4908 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4909 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4910 }
4911 }
4912
4913 next_offset += envelope_size;
4914 _next_ordinal_to_read += 1;
4915 if next_offset >= end_offset {
4916 return Ok(());
4917 }
4918
4919 while _next_ordinal_to_read < 5 {
4921 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4922 _next_ordinal_to_read += 1;
4923 next_offset += envelope_size;
4924 }
4925
4926 let next_out_of_line = decoder.next_out_of_line();
4927 let handles_before = decoder.remaining_handles();
4928 if let Some((inlined, num_bytes, num_handles)) =
4929 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4930 {
4931 let member_inline_size =
4932 <fidl_fuchsia_net::IpAddress as fidl::encoding::TypeMarker>::inline_size(
4933 decoder.context,
4934 );
4935 if inlined != (member_inline_size <= 4) {
4936 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4937 }
4938 let inner_offset;
4939 let mut inner_depth = depth.clone();
4940 if inlined {
4941 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4942 inner_offset = next_offset;
4943 } else {
4944 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4945 inner_depth.increment()?;
4946 }
4947 let val_ref = self.gateway.get_or_insert_with(|| {
4948 fidl::new_empty!(
4949 fidl_fuchsia_net::IpAddress,
4950 fidl::encoding::DefaultFuchsiaResourceDialect
4951 )
4952 });
4953 fidl::decode!(
4954 fidl_fuchsia_net::IpAddress,
4955 fidl::encoding::DefaultFuchsiaResourceDialect,
4956 val_ref,
4957 decoder,
4958 inner_offset,
4959 inner_depth
4960 )?;
4961 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4962 {
4963 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4964 }
4965 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4966 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4967 }
4968 }
4969
4970 next_offset += envelope_size;
4971 _next_ordinal_to_read += 1;
4972 if next_offset >= end_offset {
4973 return Ok(());
4974 }
4975
4976 while _next_ordinal_to_read < 6 {
4978 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4979 _next_ordinal_to_read += 1;
4980 next_offset += envelope_size;
4981 }
4982
4983 let next_out_of_line = decoder.next_out_of_line();
4984 let handles_before = decoder.remaining_handles();
4985 if let Some((inlined, num_bytes, num_handles)) =
4986 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4987 {
4988 let member_inline_size =
4989 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4990 if inlined != (member_inline_size <= 4) {
4991 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4992 }
4993 let inner_offset;
4994 let mut inner_depth = depth.clone();
4995 if inlined {
4996 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4997 inner_offset = next_offset;
4998 } else {
4999 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5000 inner_depth.increment()?;
5001 }
5002 let val_ref = self.enable_ipv4_forwarding.get_or_insert_with(|| {
5003 fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
5004 });
5005 fidl::decode!(
5006 bool,
5007 fidl::encoding::DefaultFuchsiaResourceDialect,
5008 val_ref,
5009 decoder,
5010 inner_offset,
5011 inner_depth
5012 )?;
5013 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5014 {
5015 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5016 }
5017 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5018 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5019 }
5020 }
5021
5022 next_offset += envelope_size;
5023 _next_ordinal_to_read += 1;
5024 if next_offset >= end_offset {
5025 return Ok(());
5026 }
5027
5028 while _next_ordinal_to_read < 7 {
5030 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5031 _next_ordinal_to_read += 1;
5032 next_offset += envelope_size;
5033 }
5034
5035 let next_out_of_line = decoder.next_out_of_line();
5036 let handles_before = decoder.remaining_handles();
5037 if let Some((inlined, num_bytes, num_handles)) =
5038 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5039 {
5040 let member_inline_size =
5041 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5042 if inlined != (member_inline_size <= 4) {
5043 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5044 }
5045 let inner_offset;
5046 let mut inner_depth = depth.clone();
5047 if inlined {
5048 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5049 inner_offset = next_offset;
5050 } else {
5051 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5052 inner_depth.increment()?;
5053 }
5054 let val_ref = self.enable_ipv6_forwarding.get_or_insert_with(|| {
5055 fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
5056 });
5057 fidl::decode!(
5058 bool,
5059 fidl::encoding::DefaultFuchsiaResourceDialect,
5060 val_ref,
5061 decoder,
5062 inner_offset,
5063 inner_depth
5064 )?;
5065 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5066 {
5067 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5068 }
5069 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5070 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5071 }
5072 }
5073
5074 next_offset += envelope_size;
5075 _next_ordinal_to_read += 1;
5076 if next_offset >= end_offset {
5077 return Ok(());
5078 }
5079
5080 while _next_ordinal_to_read < 8 {
5082 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5083 _next_ordinal_to_read += 1;
5084 next_offset += envelope_size;
5085 }
5086
5087 let next_out_of_line = decoder.next_out_of_line();
5088 let handles_before = decoder.remaining_handles();
5089 if let Some((inlined, num_bytes, num_handles)) =
5090 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5091 {
5092 let member_inline_size =
5093 <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5094 if inlined != (member_inline_size <= 4) {
5095 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5096 }
5097 let inner_offset;
5098 let mut inner_depth = depth.clone();
5099 if inlined {
5100 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5101 inner_offset = next_offset;
5102 } else {
5103 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5104 inner_depth.increment()?;
5105 }
5106 let val_ref = self.ipv4_multicast_neighbor_solicitations.get_or_insert_with(|| {
5107 fidl::new_empty!(u16, fidl::encoding::DefaultFuchsiaResourceDialect)
5108 });
5109 fidl::decode!(
5110 u16,
5111 fidl::encoding::DefaultFuchsiaResourceDialect,
5112 val_ref,
5113 decoder,
5114 inner_offset,
5115 inner_depth
5116 )?;
5117 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5118 {
5119 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5120 }
5121 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5122 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5123 }
5124 }
5125
5126 next_offset += envelope_size;
5127 _next_ordinal_to_read += 1;
5128 if next_offset >= end_offset {
5129 return Ok(());
5130 }
5131
5132 while _next_ordinal_to_read < 9 {
5134 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5135 _next_ordinal_to_read += 1;
5136 next_offset += envelope_size;
5137 }
5138
5139 let next_out_of_line = decoder.next_out_of_line();
5140 let handles_before = decoder.remaining_handles();
5141 if let Some((inlined, num_bytes, num_handles)) =
5142 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5143 {
5144 let member_inline_size =
5145 <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5146 if inlined != (member_inline_size <= 4) {
5147 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5148 }
5149 let inner_offset;
5150 let mut inner_depth = depth.clone();
5151 if inlined {
5152 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5153 inner_offset = next_offset;
5154 } else {
5155 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5156 inner_depth.increment()?;
5157 }
5158 let val_ref = self.ipv6_multicast_neighbor_solicitations.get_or_insert_with(|| {
5159 fidl::new_empty!(u16, fidl::encoding::DefaultFuchsiaResourceDialect)
5160 });
5161 fidl::decode!(
5162 u16,
5163 fidl::encoding::DefaultFuchsiaResourceDialect,
5164 val_ref,
5165 decoder,
5166 inner_offset,
5167 inner_depth
5168 )?;
5169 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5170 {
5171 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5172 }
5173 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5174 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5175 }
5176 }
5177
5178 next_offset += envelope_size;
5179
5180 while next_offset < end_offset {
5182 _next_ordinal_to_read += 1;
5183 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5184 next_offset += envelope_size;
5185 }
5186
5187 Ok(())
5188 }
5189 }
5190
5191 impl RealmOptions {
5192 #[inline(always)]
5193 fn max_ordinal_present(&self) -> u64 {
5194 if let Some(_) = self.children {
5195 return 2;
5196 }
5197 if let Some(_) = self.name {
5198 return 1;
5199 }
5200 0
5201 }
5202 }
5203
5204 impl fidl::encoding::ResourceTypeMarker for RealmOptions {
5205 type Borrowed<'a> = &'a mut Self;
5206 fn take_or_borrow<'a>(
5207 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5208 ) -> Self::Borrowed<'a> {
5209 value
5210 }
5211 }
5212
5213 unsafe impl fidl::encoding::TypeMarker for RealmOptions {
5214 type Owned = Self;
5215
5216 #[inline(always)]
5217 fn inline_align(_context: fidl::encoding::Context) -> usize {
5218 8
5219 }
5220
5221 #[inline(always)]
5222 fn inline_size(_context: fidl::encoding::Context) -> usize {
5223 16
5224 }
5225 }
5226
5227 unsafe impl fidl::encoding::Encode<RealmOptions, fidl::encoding::DefaultFuchsiaResourceDialect>
5228 for &mut RealmOptions
5229 {
5230 unsafe fn encode(
5231 self,
5232 encoder: &mut fidl::encoding::Encoder<
5233 '_,
5234 fidl::encoding::DefaultFuchsiaResourceDialect,
5235 >,
5236 offset: usize,
5237 mut depth: fidl::encoding::Depth,
5238 ) -> fidl::Result<()> {
5239 encoder.debug_check_bounds::<RealmOptions>(offset);
5240 let max_ordinal: u64 = self.max_ordinal_present();
5242 encoder.write_num(max_ordinal, offset);
5243 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5244 if max_ordinal == 0 {
5246 return Ok(());
5247 }
5248 depth.increment()?;
5249 let envelope_size = 8;
5250 let bytes_len = max_ordinal as usize * envelope_size;
5251 #[allow(unused_variables)]
5252 let offset = encoder.out_of_line_offset(bytes_len);
5253 let mut _prev_end_offset: usize = 0;
5254 if 1 > max_ordinal {
5255 return Ok(());
5256 }
5257
5258 let cur_offset: usize = (1 - 1) * envelope_size;
5261
5262 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5264
5265 fidl::encoding::encode_in_envelope_optional::<
5270 fidl::encoding::UnboundedString,
5271 fidl::encoding::DefaultFuchsiaResourceDialect,
5272 >(
5273 self.name.as_ref().map(
5274 <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow,
5275 ),
5276 encoder,
5277 offset + cur_offset,
5278 depth,
5279 )?;
5280
5281 _prev_end_offset = cur_offset + envelope_size;
5282 if 2 > max_ordinal {
5283 return Ok(());
5284 }
5285
5286 let cur_offset: usize = (2 - 1) * envelope_size;
5289
5290 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5292
5293 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<ChildDef>, fidl::encoding::DefaultFuchsiaResourceDialect>(
5298 self.children.as_mut().map(<fidl::encoding::UnboundedVector<ChildDef> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
5299 encoder, offset + cur_offset, depth
5300 )?;
5301
5302 _prev_end_offset = cur_offset + envelope_size;
5303
5304 Ok(())
5305 }
5306 }
5307
5308 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for RealmOptions {
5309 #[inline(always)]
5310 fn new_empty() -> Self {
5311 Self::default()
5312 }
5313
5314 unsafe fn decode(
5315 &mut self,
5316 decoder: &mut fidl::encoding::Decoder<
5317 '_,
5318 fidl::encoding::DefaultFuchsiaResourceDialect,
5319 >,
5320 offset: usize,
5321 mut depth: fidl::encoding::Depth,
5322 ) -> fidl::Result<()> {
5323 decoder.debug_check_bounds::<Self>(offset);
5324 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5325 None => return Err(fidl::Error::NotNullable),
5326 Some(len) => len,
5327 };
5328 if len == 0 {
5330 return Ok(());
5331 };
5332 depth.increment()?;
5333 let envelope_size = 8;
5334 let bytes_len = len * envelope_size;
5335 let offset = decoder.out_of_line_offset(bytes_len)?;
5336 let mut _next_ordinal_to_read = 0;
5338 let mut next_offset = offset;
5339 let end_offset = offset + bytes_len;
5340 _next_ordinal_to_read += 1;
5341 if next_offset >= end_offset {
5342 return Ok(());
5343 }
5344
5345 while _next_ordinal_to_read < 1 {
5347 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5348 _next_ordinal_to_read += 1;
5349 next_offset += envelope_size;
5350 }
5351
5352 let next_out_of_line = decoder.next_out_of_line();
5353 let handles_before = decoder.remaining_handles();
5354 if let Some((inlined, num_bytes, num_handles)) =
5355 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5356 {
5357 let member_inline_size =
5358 <fidl::encoding::UnboundedString as fidl::encoding::TypeMarker>::inline_size(
5359 decoder.context,
5360 );
5361 if inlined != (member_inline_size <= 4) {
5362 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5363 }
5364 let inner_offset;
5365 let mut inner_depth = depth.clone();
5366 if inlined {
5367 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5368 inner_offset = next_offset;
5369 } else {
5370 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5371 inner_depth.increment()?;
5372 }
5373 let val_ref = self.name.get_or_insert_with(|| {
5374 fidl::new_empty!(
5375 fidl::encoding::UnboundedString,
5376 fidl::encoding::DefaultFuchsiaResourceDialect
5377 )
5378 });
5379 fidl::decode!(
5380 fidl::encoding::UnboundedString,
5381 fidl::encoding::DefaultFuchsiaResourceDialect,
5382 val_ref,
5383 decoder,
5384 inner_offset,
5385 inner_depth
5386 )?;
5387 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5388 {
5389 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5390 }
5391 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5392 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5393 }
5394 }
5395
5396 next_offset += envelope_size;
5397 _next_ordinal_to_read += 1;
5398 if next_offset >= end_offset {
5399 return Ok(());
5400 }
5401
5402 while _next_ordinal_to_read < 2 {
5404 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5405 _next_ordinal_to_read += 1;
5406 next_offset += envelope_size;
5407 }
5408
5409 let next_out_of_line = decoder.next_out_of_line();
5410 let handles_before = decoder.remaining_handles();
5411 if let Some((inlined, num_bytes, num_handles)) =
5412 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5413 {
5414 let member_inline_size = <fidl::encoding::UnboundedVector<ChildDef> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5415 if inlined != (member_inline_size <= 4) {
5416 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5417 }
5418 let inner_offset;
5419 let mut inner_depth = depth.clone();
5420 if inlined {
5421 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5422 inner_offset = next_offset;
5423 } else {
5424 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5425 inner_depth.increment()?;
5426 }
5427 let val_ref = self.children.get_or_insert_with(|| {
5428 fidl::new_empty!(
5429 fidl::encoding::UnboundedVector<ChildDef>,
5430 fidl::encoding::DefaultFuchsiaResourceDialect
5431 )
5432 });
5433 fidl::decode!(
5434 fidl::encoding::UnboundedVector<ChildDef>,
5435 fidl::encoding::DefaultFuchsiaResourceDialect,
5436 val_ref,
5437 decoder,
5438 inner_offset,
5439 inner_depth
5440 )?;
5441 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5442 {
5443 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5444 }
5445 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5446 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5447 }
5448 }
5449
5450 next_offset += envelope_size;
5451
5452 while next_offset < end_offset {
5454 _next_ordinal_to_read += 1;
5455 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5456 next_offset += envelope_size;
5457 }
5458
5459 Ok(())
5460 }
5461 }
5462
5463 impl fidl::encoding::ResourceTypeMarker for ChildSource {
5464 type Borrowed<'a> = &'a mut Self;
5465 fn take_or_borrow<'a>(
5466 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5467 ) -> Self::Borrowed<'a> {
5468 value
5469 }
5470 }
5471
5472 unsafe impl fidl::encoding::TypeMarker for ChildSource {
5473 type Owned = Self;
5474
5475 #[inline(always)]
5476 fn inline_align(_context: fidl::encoding::Context) -> usize {
5477 8
5478 }
5479
5480 #[inline(always)]
5481 fn inline_size(_context: fidl::encoding::Context) -> usize {
5482 16
5483 }
5484 }
5485
5486 unsafe impl fidl::encoding::Encode<ChildSource, fidl::encoding::DefaultFuchsiaResourceDialect>
5487 for &mut ChildSource
5488 {
5489 #[inline]
5490 unsafe fn encode(
5491 self,
5492 encoder: &mut fidl::encoding::Encoder<
5493 '_,
5494 fidl::encoding::DefaultFuchsiaResourceDialect,
5495 >,
5496 offset: usize,
5497 _depth: fidl::encoding::Depth,
5498 ) -> fidl::Result<()> {
5499 encoder.debug_check_bounds::<ChildSource>(offset);
5500 encoder.write_num::<u64>(self.ordinal(), offset);
5501 match self {
5502 ChildSource::Component(ref val) => {
5503 fidl::encoding::encode_in_envelope::<fidl::encoding::BoundedString<4096>, fidl::encoding::DefaultFuchsiaResourceDialect>(
5504 <fidl::encoding::BoundedString<4096> as fidl::encoding::ValueTypeMarker>::borrow(val),
5505 encoder, offset + 8, _depth
5506 )
5507 }
5508 ChildSource::Mock(ref mut val) => {
5509 fidl::encoding::encode_in_envelope::<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
5510 <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
5511 encoder, offset + 8, _depth
5512 )
5513 }
5514 }
5515 }
5516 }
5517
5518 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for ChildSource {
5519 #[inline(always)]
5520 fn new_empty() -> Self {
5521 Self::Component(fidl::new_empty!(
5522 fidl::encoding::BoundedString<4096>,
5523 fidl::encoding::DefaultFuchsiaResourceDialect
5524 ))
5525 }
5526
5527 #[inline]
5528 unsafe fn decode(
5529 &mut self,
5530 decoder: &mut fidl::encoding::Decoder<
5531 '_,
5532 fidl::encoding::DefaultFuchsiaResourceDialect,
5533 >,
5534 offset: usize,
5535 mut depth: fidl::encoding::Depth,
5536 ) -> fidl::Result<()> {
5537 decoder.debug_check_bounds::<Self>(offset);
5538 #[allow(unused_variables)]
5539 let next_out_of_line = decoder.next_out_of_line();
5540 let handles_before = decoder.remaining_handles();
5541 let (ordinal, inlined, num_bytes, num_handles) =
5542 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
5543
5544 let member_inline_size = match ordinal {
5545 1 => {
5546 <fidl::encoding::BoundedString<4096> as fidl::encoding::TypeMarker>::inline_size(
5547 decoder.context,
5548 )
5549 }
5550 2 => <fidl::encoding::Endpoint<
5551 fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
5552 > as fidl::encoding::TypeMarker>::inline_size(decoder.context),
5553 _ => return Err(fidl::Error::UnknownUnionTag),
5554 };
5555
5556 if inlined != (member_inline_size <= 4) {
5557 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5558 }
5559 let _inner_offset;
5560 if inlined {
5561 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
5562 _inner_offset = offset + 8;
5563 } else {
5564 depth.increment()?;
5565 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5566 }
5567 match ordinal {
5568 1 => {
5569 #[allow(irrefutable_let_patterns)]
5570 if let ChildSource::Component(_) = self {
5571 } else {
5573 *self = ChildSource::Component(fidl::new_empty!(
5575 fidl::encoding::BoundedString<4096>,
5576 fidl::encoding::DefaultFuchsiaResourceDialect
5577 ));
5578 }
5579 #[allow(irrefutable_let_patterns)]
5580 if let ChildSource::Component(ref mut val) = self {
5581 fidl::decode!(
5582 fidl::encoding::BoundedString<4096>,
5583 fidl::encoding::DefaultFuchsiaResourceDialect,
5584 val,
5585 decoder,
5586 _inner_offset,
5587 depth
5588 )?;
5589 } else {
5590 unreachable!()
5591 }
5592 }
5593 2 => {
5594 #[allow(irrefutable_let_patterns)]
5595 if let ChildSource::Mock(_) = self {
5596 } else {
5598 *self = ChildSource::Mock(fidl::new_empty!(
5600 fidl::encoding::Endpoint<
5601 fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
5602 >,
5603 fidl::encoding::DefaultFuchsiaResourceDialect
5604 ));
5605 }
5606 #[allow(irrefutable_let_patterns)]
5607 if let ChildSource::Mock(ref mut val) = self {
5608 fidl::decode!(
5609 fidl::encoding::Endpoint<
5610 fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
5611 >,
5612 fidl::encoding::DefaultFuchsiaResourceDialect,
5613 val,
5614 decoder,
5615 _inner_offset,
5616 depth
5617 )?;
5618 } else {
5619 unreachable!()
5620 }
5621 }
5622 ordinal => panic!("unexpected ordinal {:?}", ordinal),
5623 }
5624 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
5625 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5626 }
5627 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5628 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5629 }
5630 Ok(())
5631 }
5632 }
5633}