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 ManagedRealmGetCrashListenerRequest {
39 pub listener: fidl::endpoints::ServerEnd<CrashListenerMarker>,
40}
41
42impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
43 for ManagedRealmGetCrashListenerRequest
44{
45}
46
47#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
48pub struct ManagedRealmGetDevfsRequest {
49 pub devfs: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
50}
51
52impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
53 for ManagedRealmGetDevfsRequest
54{
55}
56
57#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
58pub struct ManagedRealmOpenDiagnosticsDirectoryRequest {
59 pub child_name: String,
60 pub directory: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
61}
62
63impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
64 for ManagedRealmOpenDiagnosticsDirectoryRequest
65{
66}
67
68#[derive(Debug, PartialEq)]
69pub struct SandboxCreateRealmRequest {
70 pub realm: fidl::endpoints::ServerEnd<ManagedRealmMarker>,
71 pub options: RealmOptions,
72}
73
74impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for SandboxCreateRealmRequest {}
75
76#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
77pub struct SandboxGetNetworkContextRequest {
78 pub network_context:
79 fidl::endpoints::ServerEnd<fidl_fuchsia_netemul_network::NetworkContextMarker>,
80}
81
82impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
83 for SandboxGetNetworkContextRequest
84{
85}
86
87#[derive(Debug, Default, PartialEq)]
88pub struct ChildDef {
89 pub source: Option<ChildSource>,
93 pub name: Option<String>,
97 pub exposes: Option<Vec<String>>,
101 pub uses: Option<ChildUses>,
105 pub program_args: Option<Vec<String>>,
112 pub eager: Option<bool>,
117 pub config_values: Option<Vec<ChildConfigValue>>,
122 #[doc(hidden)]
123 pub __source_breaking: fidl::marker::SourceBreaking,
124}
125
126impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ChildDef {}
127
128#[derive(Debug, Default, PartialEq)]
129pub struct InterfaceOptions {
130 pub name: Option<String>,
134 pub device: Option<fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_network::PortMarker>>,
138 pub without_autogenerated_addresses: Option<bool>,
143 pub static_ips: Option<Vec<fidl_fuchsia_net::Subnet>>,
149 pub gateway: Option<fidl_fuchsia_net::IpAddress>,
153 pub enable_ipv4_forwarding: Option<bool>,
157 pub enable_ipv6_forwarding: Option<bool>,
161 pub ipv4_multicast_neighbor_solicitations: Option<u16>,
165 pub ipv6_multicast_neighbor_solicitations: Option<u16>,
169 #[doc(hidden)]
170 pub __source_breaking: fidl::marker::SourceBreaking,
171}
172
173impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for InterfaceOptions {}
174
175#[derive(Debug, Default, PartialEq)]
176pub struct RealmOptions {
177 pub name: Option<String>,
185 pub children: Option<Vec<ChildDef>>,
189 #[doc(hidden)]
190 pub __source_breaking: fidl::marker::SourceBreaking,
191}
192
193impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for RealmOptions {}
194
195#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
196pub enum ChildSource {
197 Component(String),
199 Mock(fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>),
202}
203
204impl ChildSource {
205 #[inline]
206 pub fn ordinal(&self) -> u64 {
207 match *self {
208 Self::Component(_) => 1,
209 Self::Mock(_) => 2,
210 }
211 }
212}
213
214impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ChildSource {}
215
216#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
217pub struct ConfigurableNetstackMarker;
218
219impl fidl::endpoints::ProtocolMarker for ConfigurableNetstackMarker {
220 type Proxy = ConfigurableNetstackProxy;
221 type RequestStream = ConfigurableNetstackRequestStream;
222 #[cfg(target_os = "fuchsia")]
223 type SynchronousProxy = ConfigurableNetstackSynchronousProxy;
224
225 const DEBUG_NAME: &'static str = "fuchsia.netemul.ConfigurableNetstack";
226}
227impl fidl::endpoints::DiscoverableProtocolMarker for ConfigurableNetstackMarker {}
228pub type ConfigurableNetstackConfigureInterfaceResult = Result<(), ConfigurationError>;
229
230pub trait ConfigurableNetstackProxyInterface: Send + Sync {
231 type ConfigureInterfaceResponseFut: std::future::Future<
232 Output = Result<ConfigurableNetstackConfigureInterfaceResult, fidl::Error>,
233 > + Send;
234 fn r#configure_interface(
235 &self,
236 payload: InterfaceOptions,
237 ) -> Self::ConfigureInterfaceResponseFut;
238}
239#[derive(Debug)]
240#[cfg(target_os = "fuchsia")]
241pub struct ConfigurableNetstackSynchronousProxy {
242 client: fidl::client::sync::Client,
243}
244
245#[cfg(target_os = "fuchsia")]
246impl fidl::endpoints::SynchronousProxy for ConfigurableNetstackSynchronousProxy {
247 type Proxy = ConfigurableNetstackProxy;
248 type Protocol = ConfigurableNetstackMarker;
249
250 fn from_channel(inner: fidl::Channel) -> Self {
251 Self::new(inner)
252 }
253
254 fn into_channel(self) -> fidl::Channel {
255 self.client.into_channel()
256 }
257
258 fn as_channel(&self) -> &fidl::Channel {
259 self.client.as_channel()
260 }
261}
262
263#[cfg(target_os = "fuchsia")]
264impl ConfigurableNetstackSynchronousProxy {
265 pub fn new(channel: fidl::Channel) -> Self {
266 let protocol_name =
267 <ConfigurableNetstackMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
268 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
269 }
270
271 pub fn into_channel(self) -> fidl::Channel {
272 self.client.into_channel()
273 }
274
275 pub fn wait_for_event(
278 &self,
279 deadline: zx::MonotonicInstant,
280 ) -> Result<ConfigurableNetstackEvent, fidl::Error> {
281 ConfigurableNetstackEvent::decode(self.client.wait_for_event(deadline)?)
282 }
283
284 pub fn r#configure_interface(
295 &self,
296 mut payload: InterfaceOptions,
297 ___deadline: zx::MonotonicInstant,
298 ) -> Result<ConfigurableNetstackConfigureInterfaceResult, fidl::Error> {
299 let _response = self.client.send_query::<InterfaceOptions, fidl::encoding::ResultType<
300 fidl::encoding::EmptyStruct,
301 ConfigurationError,
302 >>(
303 &mut payload,
304 0x64db8deb981ee49,
305 fidl::encoding::DynamicFlags::empty(),
306 ___deadline,
307 )?;
308 Ok(_response.map(|x| x))
309 }
310}
311
312#[cfg(target_os = "fuchsia")]
313impl From<ConfigurableNetstackSynchronousProxy> for zx::Handle {
314 fn from(value: ConfigurableNetstackSynchronousProxy) -> Self {
315 value.into_channel().into()
316 }
317}
318
319#[cfg(target_os = "fuchsia")]
320impl From<fidl::Channel> for ConfigurableNetstackSynchronousProxy {
321 fn from(value: fidl::Channel) -> Self {
322 Self::new(value)
323 }
324}
325
326#[derive(Debug, Clone)]
327pub struct ConfigurableNetstackProxy {
328 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
329}
330
331impl fidl::endpoints::Proxy for ConfigurableNetstackProxy {
332 type Protocol = ConfigurableNetstackMarker;
333
334 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
335 Self::new(inner)
336 }
337
338 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
339 self.client.into_channel().map_err(|client| Self { client })
340 }
341
342 fn as_channel(&self) -> &::fidl::AsyncChannel {
343 self.client.as_channel()
344 }
345}
346
347impl ConfigurableNetstackProxy {
348 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
350 let protocol_name =
351 <ConfigurableNetstackMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
352 Self { client: fidl::client::Client::new(channel, protocol_name) }
353 }
354
355 pub fn take_event_stream(&self) -> ConfigurableNetstackEventStream {
361 ConfigurableNetstackEventStream { event_receiver: self.client.take_event_receiver() }
362 }
363
364 pub fn r#configure_interface(
375 &self,
376 mut payload: InterfaceOptions,
377 ) -> fidl::client::QueryResponseFut<
378 ConfigurableNetstackConfigureInterfaceResult,
379 fidl::encoding::DefaultFuchsiaResourceDialect,
380 > {
381 ConfigurableNetstackProxyInterface::r#configure_interface(self, payload)
382 }
383}
384
385impl ConfigurableNetstackProxyInterface for ConfigurableNetstackProxy {
386 type ConfigureInterfaceResponseFut = fidl::client::QueryResponseFut<
387 ConfigurableNetstackConfigureInterfaceResult,
388 fidl::encoding::DefaultFuchsiaResourceDialect,
389 >;
390 fn r#configure_interface(
391 &self,
392 mut payload: InterfaceOptions,
393 ) -> Self::ConfigureInterfaceResponseFut {
394 fn _decode(
395 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
396 ) -> Result<ConfigurableNetstackConfigureInterfaceResult, fidl::Error> {
397 let _response = fidl::client::decode_transaction_body::<
398 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, ConfigurationError>,
399 fidl::encoding::DefaultFuchsiaResourceDialect,
400 0x64db8deb981ee49,
401 >(_buf?)?;
402 Ok(_response.map(|x| x))
403 }
404 self.client.send_query_and_decode::<
405 InterfaceOptions,
406 ConfigurableNetstackConfigureInterfaceResult,
407 >(
408 &mut payload,
409 0x64db8deb981ee49,
410 fidl::encoding::DynamicFlags::empty(),
411 _decode,
412 )
413 }
414}
415
416pub struct ConfigurableNetstackEventStream {
417 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
418}
419
420impl std::marker::Unpin for ConfigurableNetstackEventStream {}
421
422impl futures::stream::FusedStream for ConfigurableNetstackEventStream {
423 fn is_terminated(&self) -> bool {
424 self.event_receiver.is_terminated()
425 }
426}
427
428impl futures::Stream for ConfigurableNetstackEventStream {
429 type Item = Result<ConfigurableNetstackEvent, fidl::Error>;
430
431 fn poll_next(
432 mut self: std::pin::Pin<&mut Self>,
433 cx: &mut std::task::Context<'_>,
434 ) -> std::task::Poll<Option<Self::Item>> {
435 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
436 &mut self.event_receiver,
437 cx
438 )?) {
439 Some(buf) => std::task::Poll::Ready(Some(ConfigurableNetstackEvent::decode(buf))),
440 None => std::task::Poll::Ready(None),
441 }
442 }
443}
444
445#[derive(Debug)]
446pub enum ConfigurableNetstackEvent {}
447
448impl ConfigurableNetstackEvent {
449 fn decode(
451 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
452 ) -> Result<ConfigurableNetstackEvent, fidl::Error> {
453 let (bytes, _handles) = buf.split_mut();
454 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
455 debug_assert_eq!(tx_header.tx_id, 0);
456 match tx_header.ordinal {
457 _ => Err(fidl::Error::UnknownOrdinal {
458 ordinal: tx_header.ordinal,
459 protocol_name:
460 <ConfigurableNetstackMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
461 }),
462 }
463 }
464}
465
466pub struct ConfigurableNetstackRequestStream {
468 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
469 is_terminated: bool,
470}
471
472impl std::marker::Unpin for ConfigurableNetstackRequestStream {}
473
474impl futures::stream::FusedStream for ConfigurableNetstackRequestStream {
475 fn is_terminated(&self) -> bool {
476 self.is_terminated
477 }
478}
479
480impl fidl::endpoints::RequestStream for ConfigurableNetstackRequestStream {
481 type Protocol = ConfigurableNetstackMarker;
482 type ControlHandle = ConfigurableNetstackControlHandle;
483
484 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
485 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
486 }
487
488 fn control_handle(&self) -> Self::ControlHandle {
489 ConfigurableNetstackControlHandle { inner: self.inner.clone() }
490 }
491
492 fn into_inner(
493 self,
494 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
495 {
496 (self.inner, self.is_terminated)
497 }
498
499 fn from_inner(
500 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
501 is_terminated: bool,
502 ) -> Self {
503 Self { inner, is_terminated }
504 }
505}
506
507impl futures::Stream for ConfigurableNetstackRequestStream {
508 type Item = Result<ConfigurableNetstackRequest, fidl::Error>;
509
510 fn poll_next(
511 mut self: std::pin::Pin<&mut Self>,
512 cx: &mut std::task::Context<'_>,
513 ) -> std::task::Poll<Option<Self::Item>> {
514 let this = &mut *self;
515 if this.inner.check_shutdown(cx) {
516 this.is_terminated = true;
517 return std::task::Poll::Ready(None);
518 }
519 if this.is_terminated {
520 panic!("polled ConfigurableNetstackRequestStream after completion");
521 }
522 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
523 |bytes, handles| {
524 match this.inner.channel().read_etc(cx, bytes, handles) {
525 std::task::Poll::Ready(Ok(())) => {}
526 std::task::Poll::Pending => return std::task::Poll::Pending,
527 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
528 this.is_terminated = true;
529 return std::task::Poll::Ready(None);
530 }
531 std::task::Poll::Ready(Err(e)) => {
532 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
533 e.into(),
534 ))))
535 }
536 }
537
538 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
540
541 std::task::Poll::Ready(Some(match header.ordinal {
542 0x64db8deb981ee49 => {
543 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
544 let mut req = fidl::new_empty!(InterfaceOptions, fidl::encoding::DefaultFuchsiaResourceDialect);
545 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InterfaceOptions>(&header, _body_bytes, handles, &mut req)?;
546 let control_handle = ConfigurableNetstackControlHandle {
547 inner: this.inner.clone(),
548 };
549 Ok(ConfigurableNetstackRequest::ConfigureInterface {payload: req,
550 responder: ConfigurableNetstackConfigureInterfaceResponder {
551 control_handle: std::mem::ManuallyDrop::new(control_handle),
552 tx_id: header.tx_id,
553 },
554 })
555 }
556 _ => Err(fidl::Error::UnknownOrdinal {
557 ordinal: header.ordinal,
558 protocol_name: <ConfigurableNetstackMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
559 }),
560 }))
561 },
562 )
563 }
564}
565
566#[derive(Debug)]
571pub enum ConfigurableNetstackRequest {
572 ConfigureInterface {
583 payload: InterfaceOptions,
584 responder: ConfigurableNetstackConfigureInterfaceResponder,
585 },
586}
587
588impl ConfigurableNetstackRequest {
589 #[allow(irrefutable_let_patterns)]
590 pub fn into_configure_interface(
591 self,
592 ) -> Option<(InterfaceOptions, ConfigurableNetstackConfigureInterfaceResponder)> {
593 if let ConfigurableNetstackRequest::ConfigureInterface { payload, responder } = self {
594 Some((payload, responder))
595 } else {
596 None
597 }
598 }
599
600 pub fn method_name(&self) -> &'static str {
602 match *self {
603 ConfigurableNetstackRequest::ConfigureInterface { .. } => "configure_interface",
604 }
605 }
606}
607
608#[derive(Debug, Clone)]
609pub struct ConfigurableNetstackControlHandle {
610 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
611}
612
613impl fidl::endpoints::ControlHandle for ConfigurableNetstackControlHandle {
614 fn shutdown(&self) {
615 self.inner.shutdown()
616 }
617 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
618 self.inner.shutdown_with_epitaph(status)
619 }
620
621 fn is_closed(&self) -> bool {
622 self.inner.channel().is_closed()
623 }
624 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
625 self.inner.channel().on_closed()
626 }
627
628 #[cfg(target_os = "fuchsia")]
629 fn signal_peer(
630 &self,
631 clear_mask: zx::Signals,
632 set_mask: zx::Signals,
633 ) -> Result<(), zx_status::Status> {
634 use fidl::Peered;
635 self.inner.channel().signal_peer(clear_mask, set_mask)
636 }
637}
638
639impl ConfigurableNetstackControlHandle {}
640
641#[must_use = "FIDL methods require a response to be sent"]
642#[derive(Debug)]
643pub struct ConfigurableNetstackConfigureInterfaceResponder {
644 control_handle: std::mem::ManuallyDrop<ConfigurableNetstackControlHandle>,
645 tx_id: u32,
646}
647
648impl std::ops::Drop for ConfigurableNetstackConfigureInterfaceResponder {
652 fn drop(&mut self) {
653 self.control_handle.shutdown();
654 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
656 }
657}
658
659impl fidl::endpoints::Responder for ConfigurableNetstackConfigureInterfaceResponder {
660 type ControlHandle = ConfigurableNetstackControlHandle;
661
662 fn control_handle(&self) -> &ConfigurableNetstackControlHandle {
663 &self.control_handle
664 }
665
666 fn drop_without_shutdown(mut self) {
667 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
669 std::mem::forget(self);
671 }
672}
673
674impl ConfigurableNetstackConfigureInterfaceResponder {
675 pub fn send(self, mut result: Result<(), ConfigurationError>) -> Result<(), fidl::Error> {
679 let _result = self.send_raw(result);
680 if _result.is_err() {
681 self.control_handle.shutdown();
682 }
683 self.drop_without_shutdown();
684 _result
685 }
686
687 pub fn send_no_shutdown_on_err(
689 self,
690 mut result: Result<(), ConfigurationError>,
691 ) -> Result<(), fidl::Error> {
692 let _result = self.send_raw(result);
693 self.drop_without_shutdown();
694 _result
695 }
696
697 fn send_raw(&self, mut result: Result<(), ConfigurationError>) -> Result<(), fidl::Error> {
698 self.control_handle.inner.send::<fidl::encoding::ResultType<
699 fidl::encoding::EmptyStruct,
700 ConfigurationError,
701 >>(
702 result,
703 self.tx_id,
704 0x64db8deb981ee49,
705 fidl::encoding::DynamicFlags::empty(),
706 )
707 }
708}
709
710#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
711pub struct CrashListenerMarker;
712
713impl fidl::endpoints::ProtocolMarker for CrashListenerMarker {
714 type Proxy = CrashListenerProxy;
715 type RequestStream = CrashListenerRequestStream;
716 #[cfg(target_os = "fuchsia")]
717 type SynchronousProxy = CrashListenerSynchronousProxy;
718
719 const DEBUG_NAME: &'static str = "(anonymous) CrashListener";
720}
721
722pub trait CrashListenerProxyInterface: Send + Sync {
723 type NextResponseFut: std::future::Future<Output = Result<Vec<String>, fidl::Error>> + Send;
724 fn r#next(&self) -> Self::NextResponseFut;
725}
726#[derive(Debug)]
727#[cfg(target_os = "fuchsia")]
728pub struct CrashListenerSynchronousProxy {
729 client: fidl::client::sync::Client,
730}
731
732#[cfg(target_os = "fuchsia")]
733impl fidl::endpoints::SynchronousProxy for CrashListenerSynchronousProxy {
734 type Proxy = CrashListenerProxy;
735 type Protocol = CrashListenerMarker;
736
737 fn from_channel(inner: fidl::Channel) -> Self {
738 Self::new(inner)
739 }
740
741 fn into_channel(self) -> fidl::Channel {
742 self.client.into_channel()
743 }
744
745 fn as_channel(&self) -> &fidl::Channel {
746 self.client.as_channel()
747 }
748}
749
750#[cfg(target_os = "fuchsia")]
751impl CrashListenerSynchronousProxy {
752 pub fn new(channel: fidl::Channel) -> Self {
753 let protocol_name = <CrashListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
754 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
755 }
756
757 pub fn into_channel(self) -> fidl::Channel {
758 self.client.into_channel()
759 }
760
761 pub fn wait_for_event(
764 &self,
765 deadline: zx::MonotonicInstant,
766 ) -> Result<CrashListenerEvent, fidl::Error> {
767 CrashListenerEvent::decode(self.client.wait_for_event(deadline)?)
768 }
769
770 pub fn r#next(&self, ___deadline: zx::MonotonicInstant) -> Result<Vec<String>, fidl::Error> {
776 let _response =
777 self.client.send_query::<fidl::encoding::EmptyPayload, CrashListenerNextResponse>(
778 (),
779 0x4ad26b66c3a90dfb,
780 fidl::encoding::DynamicFlags::empty(),
781 ___deadline,
782 )?;
783 Ok(_response.crashed_monikers)
784 }
785}
786
787#[cfg(target_os = "fuchsia")]
788impl From<CrashListenerSynchronousProxy> for zx::Handle {
789 fn from(value: CrashListenerSynchronousProxy) -> Self {
790 value.into_channel().into()
791 }
792}
793
794#[cfg(target_os = "fuchsia")]
795impl From<fidl::Channel> for CrashListenerSynchronousProxy {
796 fn from(value: fidl::Channel) -> Self {
797 Self::new(value)
798 }
799}
800
801#[derive(Debug, Clone)]
802pub struct CrashListenerProxy {
803 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
804}
805
806impl fidl::endpoints::Proxy for CrashListenerProxy {
807 type Protocol = CrashListenerMarker;
808
809 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
810 Self::new(inner)
811 }
812
813 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
814 self.client.into_channel().map_err(|client| Self { client })
815 }
816
817 fn as_channel(&self) -> &::fidl::AsyncChannel {
818 self.client.as_channel()
819 }
820}
821
822impl CrashListenerProxy {
823 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
825 let protocol_name = <CrashListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
826 Self { client: fidl::client::Client::new(channel, protocol_name) }
827 }
828
829 pub fn take_event_stream(&self) -> CrashListenerEventStream {
835 CrashListenerEventStream { event_receiver: self.client.take_event_receiver() }
836 }
837
838 pub fn r#next(
844 &self,
845 ) -> fidl::client::QueryResponseFut<Vec<String>, fidl::encoding::DefaultFuchsiaResourceDialect>
846 {
847 CrashListenerProxyInterface::r#next(self)
848 }
849}
850
851impl CrashListenerProxyInterface for CrashListenerProxy {
852 type NextResponseFut =
853 fidl::client::QueryResponseFut<Vec<String>, fidl::encoding::DefaultFuchsiaResourceDialect>;
854 fn r#next(&self) -> Self::NextResponseFut {
855 fn _decode(
856 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
857 ) -> Result<Vec<String>, fidl::Error> {
858 let _response = fidl::client::decode_transaction_body::<
859 CrashListenerNextResponse,
860 fidl::encoding::DefaultFuchsiaResourceDialect,
861 0x4ad26b66c3a90dfb,
862 >(_buf?)?;
863 Ok(_response.crashed_monikers)
864 }
865 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<String>>(
866 (),
867 0x4ad26b66c3a90dfb,
868 fidl::encoding::DynamicFlags::empty(),
869 _decode,
870 )
871 }
872}
873
874pub struct CrashListenerEventStream {
875 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
876}
877
878impl std::marker::Unpin for CrashListenerEventStream {}
879
880impl futures::stream::FusedStream for CrashListenerEventStream {
881 fn is_terminated(&self) -> bool {
882 self.event_receiver.is_terminated()
883 }
884}
885
886impl futures::Stream for CrashListenerEventStream {
887 type Item = Result<CrashListenerEvent, fidl::Error>;
888
889 fn poll_next(
890 mut self: std::pin::Pin<&mut Self>,
891 cx: &mut std::task::Context<'_>,
892 ) -> std::task::Poll<Option<Self::Item>> {
893 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
894 &mut self.event_receiver,
895 cx
896 )?) {
897 Some(buf) => std::task::Poll::Ready(Some(CrashListenerEvent::decode(buf))),
898 None => std::task::Poll::Ready(None),
899 }
900 }
901}
902
903#[derive(Debug)]
904pub enum CrashListenerEvent {}
905
906impl CrashListenerEvent {
907 fn decode(
909 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
910 ) -> Result<CrashListenerEvent, fidl::Error> {
911 let (bytes, _handles) = buf.split_mut();
912 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
913 debug_assert_eq!(tx_header.tx_id, 0);
914 match tx_header.ordinal {
915 _ => Err(fidl::Error::UnknownOrdinal {
916 ordinal: tx_header.ordinal,
917 protocol_name: <CrashListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
918 }),
919 }
920 }
921}
922
923pub struct CrashListenerRequestStream {
925 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
926 is_terminated: bool,
927}
928
929impl std::marker::Unpin for CrashListenerRequestStream {}
930
931impl futures::stream::FusedStream for CrashListenerRequestStream {
932 fn is_terminated(&self) -> bool {
933 self.is_terminated
934 }
935}
936
937impl fidl::endpoints::RequestStream for CrashListenerRequestStream {
938 type Protocol = CrashListenerMarker;
939 type ControlHandle = CrashListenerControlHandle;
940
941 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
942 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
943 }
944
945 fn control_handle(&self) -> Self::ControlHandle {
946 CrashListenerControlHandle { inner: self.inner.clone() }
947 }
948
949 fn into_inner(
950 self,
951 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
952 {
953 (self.inner, self.is_terminated)
954 }
955
956 fn from_inner(
957 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
958 is_terminated: bool,
959 ) -> Self {
960 Self { inner, is_terminated }
961 }
962}
963
964impl futures::Stream for CrashListenerRequestStream {
965 type Item = Result<CrashListenerRequest, fidl::Error>;
966
967 fn poll_next(
968 mut self: std::pin::Pin<&mut Self>,
969 cx: &mut std::task::Context<'_>,
970 ) -> std::task::Poll<Option<Self::Item>> {
971 let this = &mut *self;
972 if this.inner.check_shutdown(cx) {
973 this.is_terminated = true;
974 return std::task::Poll::Ready(None);
975 }
976 if this.is_terminated {
977 panic!("polled CrashListenerRequestStream after completion");
978 }
979 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
980 |bytes, handles| {
981 match this.inner.channel().read_etc(cx, bytes, handles) {
982 std::task::Poll::Ready(Ok(())) => {}
983 std::task::Poll::Pending => return std::task::Poll::Pending,
984 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
985 this.is_terminated = true;
986 return std::task::Poll::Ready(None);
987 }
988 std::task::Poll::Ready(Err(e)) => {
989 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
990 e.into(),
991 ))))
992 }
993 }
994
995 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
997
998 std::task::Poll::Ready(Some(match header.ordinal {
999 0x4ad26b66c3a90dfb => {
1000 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1001 let mut req = fidl::new_empty!(
1002 fidl::encoding::EmptyPayload,
1003 fidl::encoding::DefaultFuchsiaResourceDialect
1004 );
1005 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1006 let control_handle =
1007 CrashListenerControlHandle { inner: this.inner.clone() };
1008 Ok(CrashListenerRequest::Next {
1009 responder: CrashListenerNextResponder {
1010 control_handle: std::mem::ManuallyDrop::new(control_handle),
1011 tx_id: header.tx_id,
1012 },
1013 })
1014 }
1015 _ => Err(fidl::Error::UnknownOrdinal {
1016 ordinal: header.ordinal,
1017 protocol_name:
1018 <CrashListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1019 }),
1020 }))
1021 },
1022 )
1023 }
1024}
1025
1026#[derive(Debug)]
1030pub enum CrashListenerRequest {
1031 Next { responder: CrashListenerNextResponder },
1037}
1038
1039impl CrashListenerRequest {
1040 #[allow(irrefutable_let_patterns)]
1041 pub fn into_next(self) -> Option<(CrashListenerNextResponder)> {
1042 if let CrashListenerRequest::Next { responder } = self {
1043 Some((responder))
1044 } else {
1045 None
1046 }
1047 }
1048
1049 pub fn method_name(&self) -> &'static str {
1051 match *self {
1052 CrashListenerRequest::Next { .. } => "next",
1053 }
1054 }
1055}
1056
1057#[derive(Debug, Clone)]
1058pub struct CrashListenerControlHandle {
1059 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1060}
1061
1062impl fidl::endpoints::ControlHandle for CrashListenerControlHandle {
1063 fn shutdown(&self) {
1064 self.inner.shutdown()
1065 }
1066 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1067 self.inner.shutdown_with_epitaph(status)
1068 }
1069
1070 fn is_closed(&self) -> bool {
1071 self.inner.channel().is_closed()
1072 }
1073 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1074 self.inner.channel().on_closed()
1075 }
1076
1077 #[cfg(target_os = "fuchsia")]
1078 fn signal_peer(
1079 &self,
1080 clear_mask: zx::Signals,
1081 set_mask: zx::Signals,
1082 ) -> Result<(), zx_status::Status> {
1083 use fidl::Peered;
1084 self.inner.channel().signal_peer(clear_mask, set_mask)
1085 }
1086}
1087
1088impl CrashListenerControlHandle {}
1089
1090#[must_use = "FIDL methods require a response to be sent"]
1091#[derive(Debug)]
1092pub struct CrashListenerNextResponder {
1093 control_handle: std::mem::ManuallyDrop<CrashListenerControlHandle>,
1094 tx_id: u32,
1095}
1096
1097impl std::ops::Drop for CrashListenerNextResponder {
1101 fn drop(&mut self) {
1102 self.control_handle.shutdown();
1103 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1105 }
1106}
1107
1108impl fidl::endpoints::Responder for CrashListenerNextResponder {
1109 type ControlHandle = CrashListenerControlHandle;
1110
1111 fn control_handle(&self) -> &CrashListenerControlHandle {
1112 &self.control_handle
1113 }
1114
1115 fn drop_without_shutdown(mut self) {
1116 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1118 std::mem::forget(self);
1120 }
1121}
1122
1123impl CrashListenerNextResponder {
1124 pub fn send(self, mut crashed_monikers: &[String]) -> Result<(), fidl::Error> {
1128 let _result = self.send_raw(crashed_monikers);
1129 if _result.is_err() {
1130 self.control_handle.shutdown();
1131 }
1132 self.drop_without_shutdown();
1133 _result
1134 }
1135
1136 pub fn send_no_shutdown_on_err(
1138 self,
1139 mut crashed_monikers: &[String],
1140 ) -> Result<(), fidl::Error> {
1141 let _result = self.send_raw(crashed_monikers);
1142 self.drop_without_shutdown();
1143 _result
1144 }
1145
1146 fn send_raw(&self, mut crashed_monikers: &[String]) -> Result<(), fidl::Error> {
1147 self.control_handle.inner.send::<CrashListenerNextResponse>(
1148 (crashed_monikers,),
1149 self.tx_id,
1150 0x4ad26b66c3a90dfb,
1151 fidl::encoding::DynamicFlags::empty(),
1152 )
1153 }
1154}
1155
1156#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1157pub struct ManagedRealmMarker;
1158
1159impl fidl::endpoints::ProtocolMarker for ManagedRealmMarker {
1160 type Proxy = ManagedRealmProxy;
1161 type RequestStream = ManagedRealmRequestStream;
1162 #[cfg(target_os = "fuchsia")]
1163 type SynchronousProxy = ManagedRealmSynchronousProxy;
1164
1165 const DEBUG_NAME: &'static str = "(anonymous) ManagedRealm";
1166}
1167pub type ManagedRealmAddDeviceResult = Result<(), i32>;
1168pub type ManagedRealmRemoveDeviceResult = Result<(), i32>;
1169pub type ManagedRealmStartChildComponentResult = Result<(), i32>;
1170pub type ManagedRealmStopChildComponentResult = Result<(), i32>;
1171
1172pub trait ManagedRealmProxyInterface: Send + Sync {
1173 type GetMonikerResponseFut: std::future::Future<Output = Result<String, fidl::Error>> + Send;
1174 fn r#get_moniker(&self) -> Self::GetMonikerResponseFut;
1175 fn r#connect_to_protocol(
1176 &self,
1177 protocol_name: &str,
1178 child_name: Option<&str>,
1179 req: fidl::Channel,
1180 ) -> Result<(), fidl::Error>;
1181 type AddDeviceResponseFut: std::future::Future<Output = Result<ManagedRealmAddDeviceResult, fidl::Error>>
1182 + Send;
1183 fn r#add_device(
1184 &self,
1185 path: &str,
1186 device: fidl::endpoints::ClientEnd<fidl_fuchsia_netemul_network::DeviceProxy_Marker>,
1187 ) -> Self::AddDeviceResponseFut;
1188 type RemoveDeviceResponseFut: std::future::Future<Output = Result<ManagedRealmRemoveDeviceResult, fidl::Error>>
1189 + Send;
1190 fn r#remove_device(&self, path: &str) -> Self::RemoveDeviceResponseFut;
1191 fn r#get_devfs(
1192 &self,
1193 devfs: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
1194 ) -> Result<(), fidl::Error>;
1195 type StartChildComponentResponseFut: std::future::Future<Output = Result<ManagedRealmStartChildComponentResult, fidl::Error>>
1196 + Send;
1197 fn r#start_child_component(&self, child_name: &str) -> Self::StartChildComponentResponseFut;
1198 type StopChildComponentResponseFut: std::future::Future<Output = Result<ManagedRealmStopChildComponentResult, fidl::Error>>
1199 + Send;
1200 fn r#stop_child_component(&self, child_name: &str) -> Self::StopChildComponentResponseFut;
1201 fn r#shutdown(&self) -> Result<(), fidl::Error>;
1202 fn r#open_diagnostics_directory(
1203 &self,
1204 child_name: &str,
1205 directory: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
1206 ) -> Result<(), fidl::Error>;
1207 fn r#get_crash_listener(
1208 &self,
1209 listener: fidl::endpoints::ServerEnd<CrashListenerMarker>,
1210 ) -> Result<(), fidl::Error>;
1211}
1212#[derive(Debug)]
1213#[cfg(target_os = "fuchsia")]
1214pub struct ManagedRealmSynchronousProxy {
1215 client: fidl::client::sync::Client,
1216}
1217
1218#[cfg(target_os = "fuchsia")]
1219impl fidl::endpoints::SynchronousProxy for ManagedRealmSynchronousProxy {
1220 type Proxy = ManagedRealmProxy;
1221 type Protocol = ManagedRealmMarker;
1222
1223 fn from_channel(inner: fidl::Channel) -> Self {
1224 Self::new(inner)
1225 }
1226
1227 fn into_channel(self) -> fidl::Channel {
1228 self.client.into_channel()
1229 }
1230
1231 fn as_channel(&self) -> &fidl::Channel {
1232 self.client.as_channel()
1233 }
1234}
1235
1236#[cfg(target_os = "fuchsia")]
1237impl ManagedRealmSynchronousProxy {
1238 pub fn new(channel: fidl::Channel) -> Self {
1239 let protocol_name = <ManagedRealmMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1240 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1241 }
1242
1243 pub fn into_channel(self) -> fidl::Channel {
1244 self.client.into_channel()
1245 }
1246
1247 pub fn wait_for_event(
1250 &self,
1251 deadline: zx::MonotonicInstant,
1252 ) -> Result<ManagedRealmEvent, fidl::Error> {
1253 ManagedRealmEvent::decode(self.client.wait_for_event(deadline)?)
1254 }
1255
1256 pub fn r#get_moniker(&self, ___deadline: zx::MonotonicInstant) -> Result<String, fidl::Error> {
1261 let _response = self
1262 .client
1263 .send_query::<fidl::encoding::EmptyPayload, ManagedRealmGetMonikerResponse>(
1264 (),
1265 0xec8f2bf894ddc5f,
1266 fidl::encoding::DynamicFlags::empty(),
1267 ___deadline,
1268 )?;
1269 Ok(_response.moniker)
1270 }
1271
1272 pub fn r#connect_to_protocol(
1284 &self,
1285 mut protocol_name: &str,
1286 mut child_name: Option<&str>,
1287 mut req: fidl::Channel,
1288 ) -> Result<(), fidl::Error> {
1289 self.client.send::<ManagedRealmConnectToProtocolRequest>(
1290 (protocol_name, child_name, req),
1291 0x20865b728239813d,
1292 fidl::encoding::DynamicFlags::empty(),
1293 )
1294 }
1295
1296 pub fn r#add_device(
1309 &self,
1310 mut path: &str,
1311 mut device: fidl::endpoints::ClientEnd<fidl_fuchsia_netemul_network::DeviceProxy_Marker>,
1312 ___deadline: zx::MonotonicInstant,
1313 ) -> Result<ManagedRealmAddDeviceResult, fidl::Error> {
1314 let _response = self.client.send_query::<
1315 ManagedRealmAddDeviceRequest,
1316 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1317 >(
1318 (path, device,),
1319 0x789925e6f5d47c07,
1320 fidl::encoding::DynamicFlags::empty(),
1321 ___deadline,
1322 )?;
1323 Ok(_response.map(|x| x))
1324 }
1325
1326 pub fn r#remove_device(
1334 &self,
1335 mut path: &str,
1336 ___deadline: zx::MonotonicInstant,
1337 ) -> Result<ManagedRealmRemoveDeviceResult, fidl::Error> {
1338 let _response = self.client.send_query::<
1339 ManagedRealmRemoveDeviceRequest,
1340 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1341 >(
1342 (path,),
1343 0x6cffbba70ac757cc,
1344 fidl::encoding::DynamicFlags::empty(),
1345 ___deadline,
1346 )?;
1347 Ok(_response.map(|x| x))
1348 }
1349
1350 pub fn r#get_devfs(
1354 &self,
1355 mut devfs: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
1356 ) -> Result<(), fidl::Error> {
1357 self.client.send::<ManagedRealmGetDevfsRequest>(
1358 (devfs,),
1359 0x707e2b17f65fcadc,
1360 fidl::encoding::DynamicFlags::empty(),
1361 )
1362 }
1363
1364 pub fn r#start_child_component(
1374 &self,
1375 mut child_name: &str,
1376 ___deadline: zx::MonotonicInstant,
1377 ) -> Result<ManagedRealmStartChildComponentResult, fidl::Error> {
1378 let _response = self.client.send_query::<
1379 ManagedRealmStartChildComponentRequest,
1380 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1381 >(
1382 (child_name,),
1383 0x20dfa243752906a1,
1384 fidl::encoding::DynamicFlags::empty(),
1385 ___deadline,
1386 )?;
1387 Ok(_response.map(|x| x))
1388 }
1389
1390 pub fn r#stop_child_component(
1400 &self,
1401 mut child_name: &str,
1402 ___deadline: zx::MonotonicInstant,
1403 ) -> Result<ManagedRealmStopChildComponentResult, fidl::Error> {
1404 let _response = self.client.send_query::<
1405 ManagedRealmStopChildComponentRequest,
1406 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1407 >(
1408 (child_name,),
1409 0x5ecfe48430aeeca7,
1410 fidl::encoding::DynamicFlags::empty(),
1411 ___deadline,
1412 )?;
1413 Ok(_response.map(|x| x))
1414 }
1415
1416 pub fn r#shutdown(&self) -> Result<(), fidl::Error> {
1421 self.client.send::<fidl::encoding::EmptyPayload>(
1422 (),
1423 0x4750920f723fba9d,
1424 fidl::encoding::DynamicFlags::empty(),
1425 )
1426 }
1427
1428 pub fn r#open_diagnostics_directory(
1430 &self,
1431 mut child_name: &str,
1432 mut directory: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
1433 ) -> Result<(), fidl::Error> {
1434 self.client.send::<ManagedRealmOpenDiagnosticsDirectoryRequest>(
1435 (child_name, directory),
1436 0x7c5312484aa41c99,
1437 fidl::encoding::DynamicFlags::empty(),
1438 )
1439 }
1440
1441 pub fn r#get_crash_listener(
1443 &self,
1444 mut listener: fidl::endpoints::ServerEnd<CrashListenerMarker>,
1445 ) -> Result<(), fidl::Error> {
1446 self.client.send::<ManagedRealmGetCrashListenerRequest>(
1447 (listener,),
1448 0x407bab14357e8913,
1449 fidl::encoding::DynamicFlags::empty(),
1450 )
1451 }
1452}
1453
1454#[cfg(target_os = "fuchsia")]
1455impl From<ManagedRealmSynchronousProxy> for zx::Handle {
1456 fn from(value: ManagedRealmSynchronousProxy) -> Self {
1457 value.into_channel().into()
1458 }
1459}
1460
1461#[cfg(target_os = "fuchsia")]
1462impl From<fidl::Channel> for ManagedRealmSynchronousProxy {
1463 fn from(value: fidl::Channel) -> Self {
1464 Self::new(value)
1465 }
1466}
1467
1468#[derive(Debug, Clone)]
1469pub struct ManagedRealmProxy {
1470 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1471}
1472
1473impl fidl::endpoints::Proxy for ManagedRealmProxy {
1474 type Protocol = ManagedRealmMarker;
1475
1476 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1477 Self::new(inner)
1478 }
1479
1480 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1481 self.client.into_channel().map_err(|client| Self { client })
1482 }
1483
1484 fn as_channel(&self) -> &::fidl::AsyncChannel {
1485 self.client.as_channel()
1486 }
1487}
1488
1489impl ManagedRealmProxy {
1490 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1492 let protocol_name = <ManagedRealmMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1493 Self { client: fidl::client::Client::new(channel, protocol_name) }
1494 }
1495
1496 pub fn take_event_stream(&self) -> ManagedRealmEventStream {
1502 ManagedRealmEventStream { event_receiver: self.client.take_event_receiver() }
1503 }
1504
1505 pub fn r#get_moniker(
1510 &self,
1511 ) -> fidl::client::QueryResponseFut<String, fidl::encoding::DefaultFuchsiaResourceDialect> {
1512 ManagedRealmProxyInterface::r#get_moniker(self)
1513 }
1514
1515 pub fn r#connect_to_protocol(
1527 &self,
1528 mut protocol_name: &str,
1529 mut child_name: Option<&str>,
1530 mut req: fidl::Channel,
1531 ) -> Result<(), fidl::Error> {
1532 ManagedRealmProxyInterface::r#connect_to_protocol(self, protocol_name, child_name, req)
1533 }
1534
1535 pub fn r#add_device(
1548 &self,
1549 mut path: &str,
1550 mut device: fidl::endpoints::ClientEnd<fidl_fuchsia_netemul_network::DeviceProxy_Marker>,
1551 ) -> fidl::client::QueryResponseFut<
1552 ManagedRealmAddDeviceResult,
1553 fidl::encoding::DefaultFuchsiaResourceDialect,
1554 > {
1555 ManagedRealmProxyInterface::r#add_device(self, path, device)
1556 }
1557
1558 pub fn r#remove_device(
1566 &self,
1567 mut path: &str,
1568 ) -> fidl::client::QueryResponseFut<
1569 ManagedRealmRemoveDeviceResult,
1570 fidl::encoding::DefaultFuchsiaResourceDialect,
1571 > {
1572 ManagedRealmProxyInterface::r#remove_device(self, path)
1573 }
1574
1575 pub fn r#get_devfs(
1579 &self,
1580 mut devfs: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
1581 ) -> Result<(), fidl::Error> {
1582 ManagedRealmProxyInterface::r#get_devfs(self, devfs)
1583 }
1584
1585 pub fn r#start_child_component(
1595 &self,
1596 mut child_name: &str,
1597 ) -> fidl::client::QueryResponseFut<
1598 ManagedRealmStartChildComponentResult,
1599 fidl::encoding::DefaultFuchsiaResourceDialect,
1600 > {
1601 ManagedRealmProxyInterface::r#start_child_component(self, child_name)
1602 }
1603
1604 pub fn r#stop_child_component(
1614 &self,
1615 mut child_name: &str,
1616 ) -> fidl::client::QueryResponseFut<
1617 ManagedRealmStopChildComponentResult,
1618 fidl::encoding::DefaultFuchsiaResourceDialect,
1619 > {
1620 ManagedRealmProxyInterface::r#stop_child_component(self, child_name)
1621 }
1622
1623 pub fn r#shutdown(&self) -> Result<(), fidl::Error> {
1628 ManagedRealmProxyInterface::r#shutdown(self)
1629 }
1630
1631 pub fn r#open_diagnostics_directory(
1633 &self,
1634 mut child_name: &str,
1635 mut directory: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
1636 ) -> Result<(), fidl::Error> {
1637 ManagedRealmProxyInterface::r#open_diagnostics_directory(self, child_name, directory)
1638 }
1639
1640 pub fn r#get_crash_listener(
1642 &self,
1643 mut listener: fidl::endpoints::ServerEnd<CrashListenerMarker>,
1644 ) -> Result<(), fidl::Error> {
1645 ManagedRealmProxyInterface::r#get_crash_listener(self, listener)
1646 }
1647}
1648
1649impl ManagedRealmProxyInterface for ManagedRealmProxy {
1650 type GetMonikerResponseFut =
1651 fidl::client::QueryResponseFut<String, fidl::encoding::DefaultFuchsiaResourceDialect>;
1652 fn r#get_moniker(&self) -> Self::GetMonikerResponseFut {
1653 fn _decode(
1654 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1655 ) -> Result<String, fidl::Error> {
1656 let _response = fidl::client::decode_transaction_body::<
1657 ManagedRealmGetMonikerResponse,
1658 fidl::encoding::DefaultFuchsiaResourceDialect,
1659 0xec8f2bf894ddc5f,
1660 >(_buf?)?;
1661 Ok(_response.moniker)
1662 }
1663 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, String>(
1664 (),
1665 0xec8f2bf894ddc5f,
1666 fidl::encoding::DynamicFlags::empty(),
1667 _decode,
1668 )
1669 }
1670
1671 fn r#connect_to_protocol(
1672 &self,
1673 mut protocol_name: &str,
1674 mut child_name: Option<&str>,
1675 mut req: fidl::Channel,
1676 ) -> Result<(), fidl::Error> {
1677 self.client.send::<ManagedRealmConnectToProtocolRequest>(
1678 (protocol_name, child_name, req),
1679 0x20865b728239813d,
1680 fidl::encoding::DynamicFlags::empty(),
1681 )
1682 }
1683
1684 type AddDeviceResponseFut = fidl::client::QueryResponseFut<
1685 ManagedRealmAddDeviceResult,
1686 fidl::encoding::DefaultFuchsiaResourceDialect,
1687 >;
1688 fn r#add_device(
1689 &self,
1690 mut path: &str,
1691 mut device: fidl::endpoints::ClientEnd<fidl_fuchsia_netemul_network::DeviceProxy_Marker>,
1692 ) -> Self::AddDeviceResponseFut {
1693 fn _decode(
1694 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1695 ) -> Result<ManagedRealmAddDeviceResult, fidl::Error> {
1696 let _response = fidl::client::decode_transaction_body::<
1697 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1698 fidl::encoding::DefaultFuchsiaResourceDialect,
1699 0x789925e6f5d47c07,
1700 >(_buf?)?;
1701 Ok(_response.map(|x| x))
1702 }
1703 self.client
1704 .send_query_and_decode::<ManagedRealmAddDeviceRequest, ManagedRealmAddDeviceResult>(
1705 (path, device),
1706 0x789925e6f5d47c07,
1707 fidl::encoding::DynamicFlags::empty(),
1708 _decode,
1709 )
1710 }
1711
1712 type RemoveDeviceResponseFut = fidl::client::QueryResponseFut<
1713 ManagedRealmRemoveDeviceResult,
1714 fidl::encoding::DefaultFuchsiaResourceDialect,
1715 >;
1716 fn r#remove_device(&self, mut path: &str) -> Self::RemoveDeviceResponseFut {
1717 fn _decode(
1718 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1719 ) -> Result<ManagedRealmRemoveDeviceResult, fidl::Error> {
1720 let _response = fidl::client::decode_transaction_body::<
1721 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1722 fidl::encoding::DefaultFuchsiaResourceDialect,
1723 0x6cffbba70ac757cc,
1724 >(_buf?)?;
1725 Ok(_response.map(|x| x))
1726 }
1727 self.client.send_query_and_decode::<
1728 ManagedRealmRemoveDeviceRequest,
1729 ManagedRealmRemoveDeviceResult,
1730 >(
1731 (path,),
1732 0x6cffbba70ac757cc,
1733 fidl::encoding::DynamicFlags::empty(),
1734 _decode,
1735 )
1736 }
1737
1738 fn r#get_devfs(
1739 &self,
1740 mut devfs: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
1741 ) -> Result<(), fidl::Error> {
1742 self.client.send::<ManagedRealmGetDevfsRequest>(
1743 (devfs,),
1744 0x707e2b17f65fcadc,
1745 fidl::encoding::DynamicFlags::empty(),
1746 )
1747 }
1748
1749 type StartChildComponentResponseFut = fidl::client::QueryResponseFut<
1750 ManagedRealmStartChildComponentResult,
1751 fidl::encoding::DefaultFuchsiaResourceDialect,
1752 >;
1753 fn r#start_child_component(
1754 &self,
1755 mut child_name: &str,
1756 ) -> Self::StartChildComponentResponseFut {
1757 fn _decode(
1758 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1759 ) -> Result<ManagedRealmStartChildComponentResult, fidl::Error> {
1760 let _response = fidl::client::decode_transaction_body::<
1761 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1762 fidl::encoding::DefaultFuchsiaResourceDialect,
1763 0x20dfa243752906a1,
1764 >(_buf?)?;
1765 Ok(_response.map(|x| x))
1766 }
1767 self.client.send_query_and_decode::<
1768 ManagedRealmStartChildComponentRequest,
1769 ManagedRealmStartChildComponentResult,
1770 >(
1771 (child_name,),
1772 0x20dfa243752906a1,
1773 fidl::encoding::DynamicFlags::empty(),
1774 _decode,
1775 )
1776 }
1777
1778 type StopChildComponentResponseFut = fidl::client::QueryResponseFut<
1779 ManagedRealmStopChildComponentResult,
1780 fidl::encoding::DefaultFuchsiaResourceDialect,
1781 >;
1782 fn r#stop_child_component(&self, mut child_name: &str) -> Self::StopChildComponentResponseFut {
1783 fn _decode(
1784 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1785 ) -> Result<ManagedRealmStopChildComponentResult, fidl::Error> {
1786 let _response = fidl::client::decode_transaction_body::<
1787 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1788 fidl::encoding::DefaultFuchsiaResourceDialect,
1789 0x5ecfe48430aeeca7,
1790 >(_buf?)?;
1791 Ok(_response.map(|x| x))
1792 }
1793 self.client.send_query_and_decode::<
1794 ManagedRealmStopChildComponentRequest,
1795 ManagedRealmStopChildComponentResult,
1796 >(
1797 (child_name,),
1798 0x5ecfe48430aeeca7,
1799 fidl::encoding::DynamicFlags::empty(),
1800 _decode,
1801 )
1802 }
1803
1804 fn r#shutdown(&self) -> Result<(), fidl::Error> {
1805 self.client.send::<fidl::encoding::EmptyPayload>(
1806 (),
1807 0x4750920f723fba9d,
1808 fidl::encoding::DynamicFlags::empty(),
1809 )
1810 }
1811
1812 fn r#open_diagnostics_directory(
1813 &self,
1814 mut child_name: &str,
1815 mut directory: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
1816 ) -> Result<(), fidl::Error> {
1817 self.client.send::<ManagedRealmOpenDiagnosticsDirectoryRequest>(
1818 (child_name, directory),
1819 0x7c5312484aa41c99,
1820 fidl::encoding::DynamicFlags::empty(),
1821 )
1822 }
1823
1824 fn r#get_crash_listener(
1825 &self,
1826 mut listener: fidl::endpoints::ServerEnd<CrashListenerMarker>,
1827 ) -> Result<(), fidl::Error> {
1828 self.client.send::<ManagedRealmGetCrashListenerRequest>(
1829 (listener,),
1830 0x407bab14357e8913,
1831 fidl::encoding::DynamicFlags::empty(),
1832 )
1833 }
1834}
1835
1836pub struct ManagedRealmEventStream {
1837 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1838}
1839
1840impl std::marker::Unpin for ManagedRealmEventStream {}
1841
1842impl futures::stream::FusedStream for ManagedRealmEventStream {
1843 fn is_terminated(&self) -> bool {
1844 self.event_receiver.is_terminated()
1845 }
1846}
1847
1848impl futures::Stream for ManagedRealmEventStream {
1849 type Item = Result<ManagedRealmEvent, fidl::Error>;
1850
1851 fn poll_next(
1852 mut self: std::pin::Pin<&mut Self>,
1853 cx: &mut std::task::Context<'_>,
1854 ) -> std::task::Poll<Option<Self::Item>> {
1855 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1856 &mut self.event_receiver,
1857 cx
1858 )?) {
1859 Some(buf) => std::task::Poll::Ready(Some(ManagedRealmEvent::decode(buf))),
1860 None => std::task::Poll::Ready(None),
1861 }
1862 }
1863}
1864
1865#[derive(Debug)]
1866pub enum ManagedRealmEvent {
1867 OnShutdown {},
1868}
1869
1870impl ManagedRealmEvent {
1871 #[allow(irrefutable_let_patterns)]
1872 pub fn into_on_shutdown(self) -> Option<()> {
1873 if let ManagedRealmEvent::OnShutdown {} = self {
1874 Some(())
1875 } else {
1876 None
1877 }
1878 }
1879
1880 fn decode(
1882 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1883 ) -> Result<ManagedRealmEvent, fidl::Error> {
1884 let (bytes, _handles) = buf.split_mut();
1885 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1886 debug_assert_eq!(tx_header.tx_id, 0);
1887 match tx_header.ordinal {
1888 0x1dff0b58a5b546be => {
1889 let mut out = fidl::new_empty!(
1890 fidl::encoding::EmptyPayload,
1891 fidl::encoding::DefaultFuchsiaResourceDialect
1892 );
1893 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&tx_header, _body_bytes, _handles, &mut out)?;
1894 Ok((ManagedRealmEvent::OnShutdown {}))
1895 }
1896 _ => Err(fidl::Error::UnknownOrdinal {
1897 ordinal: tx_header.ordinal,
1898 protocol_name: <ManagedRealmMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1899 }),
1900 }
1901 }
1902}
1903
1904pub struct ManagedRealmRequestStream {
1906 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1907 is_terminated: bool,
1908}
1909
1910impl std::marker::Unpin for ManagedRealmRequestStream {}
1911
1912impl futures::stream::FusedStream for ManagedRealmRequestStream {
1913 fn is_terminated(&self) -> bool {
1914 self.is_terminated
1915 }
1916}
1917
1918impl fidl::endpoints::RequestStream for ManagedRealmRequestStream {
1919 type Protocol = ManagedRealmMarker;
1920 type ControlHandle = ManagedRealmControlHandle;
1921
1922 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1923 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1924 }
1925
1926 fn control_handle(&self) -> Self::ControlHandle {
1927 ManagedRealmControlHandle { inner: self.inner.clone() }
1928 }
1929
1930 fn into_inner(
1931 self,
1932 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1933 {
1934 (self.inner, self.is_terminated)
1935 }
1936
1937 fn from_inner(
1938 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1939 is_terminated: bool,
1940 ) -> Self {
1941 Self { inner, is_terminated }
1942 }
1943}
1944
1945impl futures::Stream for ManagedRealmRequestStream {
1946 type Item = Result<ManagedRealmRequest, fidl::Error>;
1947
1948 fn poll_next(
1949 mut self: std::pin::Pin<&mut Self>,
1950 cx: &mut std::task::Context<'_>,
1951 ) -> std::task::Poll<Option<Self::Item>> {
1952 let this = &mut *self;
1953 if this.inner.check_shutdown(cx) {
1954 this.is_terminated = true;
1955 return std::task::Poll::Ready(None);
1956 }
1957 if this.is_terminated {
1958 panic!("polled ManagedRealmRequestStream after completion");
1959 }
1960 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1961 |bytes, handles| {
1962 match this.inner.channel().read_etc(cx, bytes, handles) {
1963 std::task::Poll::Ready(Ok(())) => {}
1964 std::task::Poll::Pending => return std::task::Poll::Pending,
1965 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1966 this.is_terminated = true;
1967 return std::task::Poll::Ready(None);
1968 }
1969 std::task::Poll::Ready(Err(e)) => {
1970 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1971 e.into(),
1972 ))))
1973 }
1974 }
1975
1976 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1978
1979 std::task::Poll::Ready(Some(match header.ordinal {
1980 0xec8f2bf894ddc5f => {
1981 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1982 let mut req = fidl::new_empty!(
1983 fidl::encoding::EmptyPayload,
1984 fidl::encoding::DefaultFuchsiaResourceDialect
1985 );
1986 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1987 let control_handle =
1988 ManagedRealmControlHandle { inner: this.inner.clone() };
1989 Ok(ManagedRealmRequest::GetMoniker {
1990 responder: ManagedRealmGetMonikerResponder {
1991 control_handle: std::mem::ManuallyDrop::new(control_handle),
1992 tx_id: header.tx_id,
1993 },
1994 })
1995 }
1996 0x20865b728239813d => {
1997 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1998 let mut req = fidl::new_empty!(
1999 ManagedRealmConnectToProtocolRequest,
2000 fidl::encoding::DefaultFuchsiaResourceDialect
2001 );
2002 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ManagedRealmConnectToProtocolRequest>(&header, _body_bytes, handles, &mut req)?;
2003 let control_handle =
2004 ManagedRealmControlHandle { inner: this.inner.clone() };
2005 Ok(ManagedRealmRequest::ConnectToProtocol {
2006 protocol_name: req.protocol_name,
2007 child_name: req.child_name,
2008 req: req.req,
2009
2010 control_handle,
2011 })
2012 }
2013 0x789925e6f5d47c07 => {
2014 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2015 let mut req = fidl::new_empty!(
2016 ManagedRealmAddDeviceRequest,
2017 fidl::encoding::DefaultFuchsiaResourceDialect
2018 );
2019 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ManagedRealmAddDeviceRequest>(&header, _body_bytes, handles, &mut req)?;
2020 let control_handle =
2021 ManagedRealmControlHandle { inner: this.inner.clone() };
2022 Ok(ManagedRealmRequest::AddDevice {
2023 path: req.path,
2024 device: req.device,
2025
2026 responder: ManagedRealmAddDeviceResponder {
2027 control_handle: std::mem::ManuallyDrop::new(control_handle),
2028 tx_id: header.tx_id,
2029 },
2030 })
2031 }
2032 0x6cffbba70ac757cc => {
2033 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2034 let mut req = fidl::new_empty!(
2035 ManagedRealmRemoveDeviceRequest,
2036 fidl::encoding::DefaultFuchsiaResourceDialect
2037 );
2038 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ManagedRealmRemoveDeviceRequest>(&header, _body_bytes, handles, &mut req)?;
2039 let control_handle =
2040 ManagedRealmControlHandle { inner: this.inner.clone() };
2041 Ok(ManagedRealmRequest::RemoveDevice {
2042 path: req.path,
2043
2044 responder: ManagedRealmRemoveDeviceResponder {
2045 control_handle: std::mem::ManuallyDrop::new(control_handle),
2046 tx_id: header.tx_id,
2047 },
2048 })
2049 }
2050 0x707e2b17f65fcadc => {
2051 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2052 let mut req = fidl::new_empty!(
2053 ManagedRealmGetDevfsRequest,
2054 fidl::encoding::DefaultFuchsiaResourceDialect
2055 );
2056 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ManagedRealmGetDevfsRequest>(&header, _body_bytes, handles, &mut req)?;
2057 let control_handle =
2058 ManagedRealmControlHandle { inner: this.inner.clone() };
2059 Ok(ManagedRealmRequest::GetDevfs { devfs: req.devfs, control_handle })
2060 }
2061 0x20dfa243752906a1 => {
2062 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2063 let mut req = fidl::new_empty!(
2064 ManagedRealmStartChildComponentRequest,
2065 fidl::encoding::DefaultFuchsiaResourceDialect
2066 );
2067 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ManagedRealmStartChildComponentRequest>(&header, _body_bytes, handles, &mut req)?;
2068 let control_handle =
2069 ManagedRealmControlHandle { inner: this.inner.clone() };
2070 Ok(ManagedRealmRequest::StartChildComponent {
2071 child_name: req.child_name,
2072
2073 responder: ManagedRealmStartChildComponentResponder {
2074 control_handle: std::mem::ManuallyDrop::new(control_handle),
2075 tx_id: header.tx_id,
2076 },
2077 })
2078 }
2079 0x5ecfe48430aeeca7 => {
2080 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2081 let mut req = fidl::new_empty!(
2082 ManagedRealmStopChildComponentRequest,
2083 fidl::encoding::DefaultFuchsiaResourceDialect
2084 );
2085 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ManagedRealmStopChildComponentRequest>(&header, _body_bytes, handles, &mut req)?;
2086 let control_handle =
2087 ManagedRealmControlHandle { inner: this.inner.clone() };
2088 Ok(ManagedRealmRequest::StopChildComponent {
2089 child_name: req.child_name,
2090
2091 responder: ManagedRealmStopChildComponentResponder {
2092 control_handle: std::mem::ManuallyDrop::new(control_handle),
2093 tx_id: header.tx_id,
2094 },
2095 })
2096 }
2097 0x4750920f723fba9d => {
2098 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2099 let mut req = fidl::new_empty!(
2100 fidl::encoding::EmptyPayload,
2101 fidl::encoding::DefaultFuchsiaResourceDialect
2102 );
2103 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2104 let control_handle =
2105 ManagedRealmControlHandle { inner: this.inner.clone() };
2106 Ok(ManagedRealmRequest::Shutdown { control_handle })
2107 }
2108 0x7c5312484aa41c99 => {
2109 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2110 let mut req = fidl::new_empty!(
2111 ManagedRealmOpenDiagnosticsDirectoryRequest,
2112 fidl::encoding::DefaultFuchsiaResourceDialect
2113 );
2114 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ManagedRealmOpenDiagnosticsDirectoryRequest>(&header, _body_bytes, handles, &mut req)?;
2115 let control_handle =
2116 ManagedRealmControlHandle { inner: this.inner.clone() };
2117 Ok(ManagedRealmRequest::OpenDiagnosticsDirectory {
2118 child_name: req.child_name,
2119 directory: req.directory,
2120
2121 control_handle,
2122 })
2123 }
2124 0x407bab14357e8913 => {
2125 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2126 let mut req = fidl::new_empty!(
2127 ManagedRealmGetCrashListenerRequest,
2128 fidl::encoding::DefaultFuchsiaResourceDialect
2129 );
2130 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ManagedRealmGetCrashListenerRequest>(&header, _body_bytes, handles, &mut req)?;
2131 let control_handle =
2132 ManagedRealmControlHandle { inner: this.inner.clone() };
2133 Ok(ManagedRealmRequest::GetCrashListener {
2134 listener: req.listener,
2135
2136 control_handle,
2137 })
2138 }
2139 _ => Err(fidl::Error::UnknownOrdinal {
2140 ordinal: header.ordinal,
2141 protocol_name:
2142 <ManagedRealmMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2143 }),
2144 }))
2145 },
2146 )
2147 }
2148}
2149
2150#[derive(Debug)]
2163pub enum ManagedRealmRequest {
2164 GetMoniker { responder: ManagedRealmGetMonikerResponder },
2169 ConnectToProtocol {
2181 protocol_name: String,
2182 child_name: Option<String>,
2183 req: fidl::Channel,
2184 control_handle: ManagedRealmControlHandle,
2185 },
2186 AddDevice {
2199 path: String,
2200 device: fidl::endpoints::ClientEnd<fidl_fuchsia_netemul_network::DeviceProxy_Marker>,
2201 responder: ManagedRealmAddDeviceResponder,
2202 },
2203 RemoveDevice { path: String, responder: ManagedRealmRemoveDeviceResponder },
2211 GetDevfs {
2215 devfs: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
2216 control_handle: ManagedRealmControlHandle,
2217 },
2218 StartChildComponent { child_name: String, responder: ManagedRealmStartChildComponentResponder },
2228 StopChildComponent { child_name: String, responder: ManagedRealmStopChildComponentResponder },
2238 Shutdown { control_handle: ManagedRealmControlHandle },
2243 OpenDiagnosticsDirectory {
2245 child_name: String,
2246 directory: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
2247 control_handle: ManagedRealmControlHandle,
2248 },
2249 GetCrashListener {
2251 listener: fidl::endpoints::ServerEnd<CrashListenerMarker>,
2252 control_handle: ManagedRealmControlHandle,
2253 },
2254}
2255
2256impl ManagedRealmRequest {
2257 #[allow(irrefutable_let_patterns)]
2258 pub fn into_get_moniker(self) -> Option<(ManagedRealmGetMonikerResponder)> {
2259 if let ManagedRealmRequest::GetMoniker { responder } = self {
2260 Some((responder))
2261 } else {
2262 None
2263 }
2264 }
2265
2266 #[allow(irrefutable_let_patterns)]
2267 pub fn into_connect_to_protocol(
2268 self,
2269 ) -> Option<(String, Option<String>, fidl::Channel, ManagedRealmControlHandle)> {
2270 if let ManagedRealmRequest::ConnectToProtocol {
2271 protocol_name,
2272 child_name,
2273 req,
2274 control_handle,
2275 } = self
2276 {
2277 Some((protocol_name, child_name, req, control_handle))
2278 } else {
2279 None
2280 }
2281 }
2282
2283 #[allow(irrefutable_let_patterns)]
2284 pub fn into_add_device(
2285 self,
2286 ) -> Option<(
2287 String,
2288 fidl::endpoints::ClientEnd<fidl_fuchsia_netemul_network::DeviceProxy_Marker>,
2289 ManagedRealmAddDeviceResponder,
2290 )> {
2291 if let ManagedRealmRequest::AddDevice { path, device, responder } = self {
2292 Some((path, device, responder))
2293 } else {
2294 None
2295 }
2296 }
2297
2298 #[allow(irrefutable_let_patterns)]
2299 pub fn into_remove_device(self) -> Option<(String, ManagedRealmRemoveDeviceResponder)> {
2300 if let ManagedRealmRequest::RemoveDevice { path, responder } = self {
2301 Some((path, responder))
2302 } else {
2303 None
2304 }
2305 }
2306
2307 #[allow(irrefutable_let_patterns)]
2308 pub fn into_get_devfs(
2309 self,
2310 ) -> Option<(
2311 fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
2312 ManagedRealmControlHandle,
2313 )> {
2314 if let ManagedRealmRequest::GetDevfs { devfs, control_handle } = self {
2315 Some((devfs, control_handle))
2316 } else {
2317 None
2318 }
2319 }
2320
2321 #[allow(irrefutable_let_patterns)]
2322 pub fn into_start_child_component(
2323 self,
2324 ) -> Option<(String, ManagedRealmStartChildComponentResponder)> {
2325 if let ManagedRealmRequest::StartChildComponent { child_name, responder } = self {
2326 Some((child_name, responder))
2327 } else {
2328 None
2329 }
2330 }
2331
2332 #[allow(irrefutable_let_patterns)]
2333 pub fn into_stop_child_component(
2334 self,
2335 ) -> Option<(String, ManagedRealmStopChildComponentResponder)> {
2336 if let ManagedRealmRequest::StopChildComponent { child_name, responder } = self {
2337 Some((child_name, responder))
2338 } else {
2339 None
2340 }
2341 }
2342
2343 #[allow(irrefutable_let_patterns)]
2344 pub fn into_shutdown(self) -> Option<(ManagedRealmControlHandle)> {
2345 if let ManagedRealmRequest::Shutdown { control_handle } = self {
2346 Some((control_handle))
2347 } else {
2348 None
2349 }
2350 }
2351
2352 #[allow(irrefutable_let_patterns)]
2353 pub fn into_open_diagnostics_directory(
2354 self,
2355 ) -> Option<(
2356 String,
2357 fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
2358 ManagedRealmControlHandle,
2359 )> {
2360 if let ManagedRealmRequest::OpenDiagnosticsDirectory {
2361 child_name,
2362 directory,
2363 control_handle,
2364 } = self
2365 {
2366 Some((child_name, directory, control_handle))
2367 } else {
2368 None
2369 }
2370 }
2371
2372 #[allow(irrefutable_let_patterns)]
2373 pub fn into_get_crash_listener(
2374 self,
2375 ) -> Option<(fidl::endpoints::ServerEnd<CrashListenerMarker>, ManagedRealmControlHandle)> {
2376 if let ManagedRealmRequest::GetCrashListener { listener, control_handle } = self {
2377 Some((listener, control_handle))
2378 } else {
2379 None
2380 }
2381 }
2382
2383 pub fn method_name(&self) -> &'static str {
2385 match *self {
2386 ManagedRealmRequest::GetMoniker { .. } => "get_moniker",
2387 ManagedRealmRequest::ConnectToProtocol { .. } => "connect_to_protocol",
2388 ManagedRealmRequest::AddDevice { .. } => "add_device",
2389 ManagedRealmRequest::RemoveDevice { .. } => "remove_device",
2390 ManagedRealmRequest::GetDevfs { .. } => "get_devfs",
2391 ManagedRealmRequest::StartChildComponent { .. } => "start_child_component",
2392 ManagedRealmRequest::StopChildComponent { .. } => "stop_child_component",
2393 ManagedRealmRequest::Shutdown { .. } => "shutdown",
2394 ManagedRealmRequest::OpenDiagnosticsDirectory { .. } => "open_diagnostics_directory",
2395 ManagedRealmRequest::GetCrashListener { .. } => "get_crash_listener",
2396 }
2397 }
2398}
2399
2400#[derive(Debug, Clone)]
2401pub struct ManagedRealmControlHandle {
2402 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2403}
2404
2405impl fidl::endpoints::ControlHandle for ManagedRealmControlHandle {
2406 fn shutdown(&self) {
2407 self.inner.shutdown()
2408 }
2409 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2410 self.inner.shutdown_with_epitaph(status)
2411 }
2412
2413 fn is_closed(&self) -> bool {
2414 self.inner.channel().is_closed()
2415 }
2416 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2417 self.inner.channel().on_closed()
2418 }
2419
2420 #[cfg(target_os = "fuchsia")]
2421 fn signal_peer(
2422 &self,
2423 clear_mask: zx::Signals,
2424 set_mask: zx::Signals,
2425 ) -> Result<(), zx_status::Status> {
2426 use fidl::Peered;
2427 self.inner.channel().signal_peer(clear_mask, set_mask)
2428 }
2429}
2430
2431impl ManagedRealmControlHandle {
2432 pub fn send_on_shutdown(&self) -> Result<(), fidl::Error> {
2433 self.inner.send::<fidl::encoding::EmptyPayload>(
2434 (),
2435 0,
2436 0x1dff0b58a5b546be,
2437 fidl::encoding::DynamicFlags::empty(),
2438 )
2439 }
2440}
2441
2442#[must_use = "FIDL methods require a response to be sent"]
2443#[derive(Debug)]
2444pub struct ManagedRealmGetMonikerResponder {
2445 control_handle: std::mem::ManuallyDrop<ManagedRealmControlHandle>,
2446 tx_id: u32,
2447}
2448
2449impl std::ops::Drop for ManagedRealmGetMonikerResponder {
2453 fn drop(&mut self) {
2454 self.control_handle.shutdown();
2455 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2457 }
2458}
2459
2460impl fidl::endpoints::Responder for ManagedRealmGetMonikerResponder {
2461 type ControlHandle = ManagedRealmControlHandle;
2462
2463 fn control_handle(&self) -> &ManagedRealmControlHandle {
2464 &self.control_handle
2465 }
2466
2467 fn drop_without_shutdown(mut self) {
2468 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2470 std::mem::forget(self);
2472 }
2473}
2474
2475impl ManagedRealmGetMonikerResponder {
2476 pub fn send(self, mut moniker: &str) -> Result<(), fidl::Error> {
2480 let _result = self.send_raw(moniker);
2481 if _result.is_err() {
2482 self.control_handle.shutdown();
2483 }
2484 self.drop_without_shutdown();
2485 _result
2486 }
2487
2488 pub fn send_no_shutdown_on_err(self, mut moniker: &str) -> Result<(), fidl::Error> {
2490 let _result = self.send_raw(moniker);
2491 self.drop_without_shutdown();
2492 _result
2493 }
2494
2495 fn send_raw(&self, mut moniker: &str) -> Result<(), fidl::Error> {
2496 self.control_handle.inner.send::<ManagedRealmGetMonikerResponse>(
2497 (moniker,),
2498 self.tx_id,
2499 0xec8f2bf894ddc5f,
2500 fidl::encoding::DynamicFlags::empty(),
2501 )
2502 }
2503}
2504
2505#[must_use = "FIDL methods require a response to be sent"]
2506#[derive(Debug)]
2507pub struct ManagedRealmAddDeviceResponder {
2508 control_handle: std::mem::ManuallyDrop<ManagedRealmControlHandle>,
2509 tx_id: u32,
2510}
2511
2512impl std::ops::Drop for ManagedRealmAddDeviceResponder {
2516 fn drop(&mut self) {
2517 self.control_handle.shutdown();
2518 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2520 }
2521}
2522
2523impl fidl::endpoints::Responder for ManagedRealmAddDeviceResponder {
2524 type ControlHandle = ManagedRealmControlHandle;
2525
2526 fn control_handle(&self) -> &ManagedRealmControlHandle {
2527 &self.control_handle
2528 }
2529
2530 fn drop_without_shutdown(mut self) {
2531 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2533 std::mem::forget(self);
2535 }
2536}
2537
2538impl ManagedRealmAddDeviceResponder {
2539 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2543 let _result = self.send_raw(result);
2544 if _result.is_err() {
2545 self.control_handle.shutdown();
2546 }
2547 self.drop_without_shutdown();
2548 _result
2549 }
2550
2551 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2553 let _result = self.send_raw(result);
2554 self.drop_without_shutdown();
2555 _result
2556 }
2557
2558 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2559 self.control_handle
2560 .inner
2561 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
2562 result,
2563 self.tx_id,
2564 0x789925e6f5d47c07,
2565 fidl::encoding::DynamicFlags::empty(),
2566 )
2567 }
2568}
2569
2570#[must_use = "FIDL methods require a response to be sent"]
2571#[derive(Debug)]
2572pub struct ManagedRealmRemoveDeviceResponder {
2573 control_handle: std::mem::ManuallyDrop<ManagedRealmControlHandle>,
2574 tx_id: u32,
2575}
2576
2577impl std::ops::Drop for ManagedRealmRemoveDeviceResponder {
2581 fn drop(&mut self) {
2582 self.control_handle.shutdown();
2583 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2585 }
2586}
2587
2588impl fidl::endpoints::Responder for ManagedRealmRemoveDeviceResponder {
2589 type ControlHandle = ManagedRealmControlHandle;
2590
2591 fn control_handle(&self) -> &ManagedRealmControlHandle {
2592 &self.control_handle
2593 }
2594
2595 fn drop_without_shutdown(mut self) {
2596 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2598 std::mem::forget(self);
2600 }
2601}
2602
2603impl ManagedRealmRemoveDeviceResponder {
2604 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2608 let _result = self.send_raw(result);
2609 if _result.is_err() {
2610 self.control_handle.shutdown();
2611 }
2612 self.drop_without_shutdown();
2613 _result
2614 }
2615
2616 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2618 let _result = self.send_raw(result);
2619 self.drop_without_shutdown();
2620 _result
2621 }
2622
2623 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2624 self.control_handle
2625 .inner
2626 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
2627 result,
2628 self.tx_id,
2629 0x6cffbba70ac757cc,
2630 fidl::encoding::DynamicFlags::empty(),
2631 )
2632 }
2633}
2634
2635#[must_use = "FIDL methods require a response to be sent"]
2636#[derive(Debug)]
2637pub struct ManagedRealmStartChildComponentResponder {
2638 control_handle: std::mem::ManuallyDrop<ManagedRealmControlHandle>,
2639 tx_id: u32,
2640}
2641
2642impl std::ops::Drop for ManagedRealmStartChildComponentResponder {
2646 fn drop(&mut self) {
2647 self.control_handle.shutdown();
2648 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2650 }
2651}
2652
2653impl fidl::endpoints::Responder for ManagedRealmStartChildComponentResponder {
2654 type ControlHandle = ManagedRealmControlHandle;
2655
2656 fn control_handle(&self) -> &ManagedRealmControlHandle {
2657 &self.control_handle
2658 }
2659
2660 fn drop_without_shutdown(mut self) {
2661 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2663 std::mem::forget(self);
2665 }
2666}
2667
2668impl ManagedRealmStartChildComponentResponder {
2669 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2673 let _result = self.send_raw(result);
2674 if _result.is_err() {
2675 self.control_handle.shutdown();
2676 }
2677 self.drop_without_shutdown();
2678 _result
2679 }
2680
2681 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2683 let _result = self.send_raw(result);
2684 self.drop_without_shutdown();
2685 _result
2686 }
2687
2688 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2689 self.control_handle
2690 .inner
2691 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
2692 result,
2693 self.tx_id,
2694 0x20dfa243752906a1,
2695 fidl::encoding::DynamicFlags::empty(),
2696 )
2697 }
2698}
2699
2700#[must_use = "FIDL methods require a response to be sent"]
2701#[derive(Debug)]
2702pub struct ManagedRealmStopChildComponentResponder {
2703 control_handle: std::mem::ManuallyDrop<ManagedRealmControlHandle>,
2704 tx_id: u32,
2705}
2706
2707impl std::ops::Drop for ManagedRealmStopChildComponentResponder {
2711 fn drop(&mut self) {
2712 self.control_handle.shutdown();
2713 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2715 }
2716}
2717
2718impl fidl::endpoints::Responder for ManagedRealmStopChildComponentResponder {
2719 type ControlHandle = ManagedRealmControlHandle;
2720
2721 fn control_handle(&self) -> &ManagedRealmControlHandle {
2722 &self.control_handle
2723 }
2724
2725 fn drop_without_shutdown(mut self) {
2726 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2728 std::mem::forget(self);
2730 }
2731}
2732
2733impl ManagedRealmStopChildComponentResponder {
2734 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2738 let _result = self.send_raw(result);
2739 if _result.is_err() {
2740 self.control_handle.shutdown();
2741 }
2742 self.drop_without_shutdown();
2743 _result
2744 }
2745
2746 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2748 let _result = self.send_raw(result);
2749 self.drop_without_shutdown();
2750 _result
2751 }
2752
2753 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2754 self.control_handle
2755 .inner
2756 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
2757 result,
2758 self.tx_id,
2759 0x5ecfe48430aeeca7,
2760 fidl::encoding::DynamicFlags::empty(),
2761 )
2762 }
2763}
2764
2765#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2766pub struct SandboxMarker;
2767
2768impl fidl::endpoints::ProtocolMarker for SandboxMarker {
2769 type Proxy = SandboxProxy;
2770 type RequestStream = SandboxRequestStream;
2771 #[cfg(target_os = "fuchsia")]
2772 type SynchronousProxy = SandboxSynchronousProxy;
2773
2774 const DEBUG_NAME: &'static str = "fuchsia.netemul.Sandbox";
2775}
2776impl fidl::endpoints::DiscoverableProtocolMarker for SandboxMarker {}
2777
2778pub trait SandboxProxyInterface: Send + Sync {
2779 fn r#create_realm(
2780 &self,
2781 realm: fidl::endpoints::ServerEnd<ManagedRealmMarker>,
2782 options: RealmOptions,
2783 ) -> Result<(), fidl::Error>;
2784 fn r#get_network_context(
2785 &self,
2786 network_context: fidl::endpoints::ServerEnd<
2787 fidl_fuchsia_netemul_network::NetworkContextMarker,
2788 >,
2789 ) -> Result<(), fidl::Error>;
2790}
2791#[derive(Debug)]
2792#[cfg(target_os = "fuchsia")]
2793pub struct SandboxSynchronousProxy {
2794 client: fidl::client::sync::Client,
2795}
2796
2797#[cfg(target_os = "fuchsia")]
2798impl fidl::endpoints::SynchronousProxy for SandboxSynchronousProxy {
2799 type Proxy = SandboxProxy;
2800 type Protocol = SandboxMarker;
2801
2802 fn from_channel(inner: fidl::Channel) -> Self {
2803 Self::new(inner)
2804 }
2805
2806 fn into_channel(self) -> fidl::Channel {
2807 self.client.into_channel()
2808 }
2809
2810 fn as_channel(&self) -> &fidl::Channel {
2811 self.client.as_channel()
2812 }
2813}
2814
2815#[cfg(target_os = "fuchsia")]
2816impl SandboxSynchronousProxy {
2817 pub fn new(channel: fidl::Channel) -> Self {
2818 let protocol_name = <SandboxMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2819 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2820 }
2821
2822 pub fn into_channel(self) -> fidl::Channel {
2823 self.client.into_channel()
2824 }
2825
2826 pub fn wait_for_event(
2829 &self,
2830 deadline: zx::MonotonicInstant,
2831 ) -> Result<SandboxEvent, fidl::Error> {
2832 SandboxEvent::decode(self.client.wait_for_event(deadline)?)
2833 }
2834
2835 pub fn r#create_realm(
2846 &self,
2847 mut realm: fidl::endpoints::ServerEnd<ManagedRealmMarker>,
2848 mut options: RealmOptions,
2849 ) -> Result<(), fidl::Error> {
2850 self.client.send::<SandboxCreateRealmRequest>(
2851 (realm, &mut options),
2852 0x25d0bc5f1006a0c9,
2853 fidl::encoding::DynamicFlags::empty(),
2854 )
2855 }
2856
2857 pub fn r#get_network_context(
2861 &self,
2862 mut network_context: fidl::endpoints::ServerEnd<
2863 fidl_fuchsia_netemul_network::NetworkContextMarker,
2864 >,
2865 ) -> Result<(), fidl::Error> {
2866 self.client.send::<SandboxGetNetworkContextRequest>(
2867 (network_context,),
2868 0x140cb104c2605970,
2869 fidl::encoding::DynamicFlags::empty(),
2870 )
2871 }
2872}
2873
2874#[cfg(target_os = "fuchsia")]
2875impl From<SandboxSynchronousProxy> for zx::Handle {
2876 fn from(value: SandboxSynchronousProxy) -> Self {
2877 value.into_channel().into()
2878 }
2879}
2880
2881#[cfg(target_os = "fuchsia")]
2882impl From<fidl::Channel> for SandboxSynchronousProxy {
2883 fn from(value: fidl::Channel) -> Self {
2884 Self::new(value)
2885 }
2886}
2887
2888#[derive(Debug, Clone)]
2889pub struct SandboxProxy {
2890 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2891}
2892
2893impl fidl::endpoints::Proxy for SandboxProxy {
2894 type Protocol = SandboxMarker;
2895
2896 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2897 Self::new(inner)
2898 }
2899
2900 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2901 self.client.into_channel().map_err(|client| Self { client })
2902 }
2903
2904 fn as_channel(&self) -> &::fidl::AsyncChannel {
2905 self.client.as_channel()
2906 }
2907}
2908
2909impl SandboxProxy {
2910 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2912 let protocol_name = <SandboxMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2913 Self { client: fidl::client::Client::new(channel, protocol_name) }
2914 }
2915
2916 pub fn take_event_stream(&self) -> SandboxEventStream {
2922 SandboxEventStream { event_receiver: self.client.take_event_receiver() }
2923 }
2924
2925 pub fn r#create_realm(
2936 &self,
2937 mut realm: fidl::endpoints::ServerEnd<ManagedRealmMarker>,
2938 mut options: RealmOptions,
2939 ) -> Result<(), fidl::Error> {
2940 SandboxProxyInterface::r#create_realm(self, realm, options)
2941 }
2942
2943 pub fn r#get_network_context(
2947 &self,
2948 mut network_context: fidl::endpoints::ServerEnd<
2949 fidl_fuchsia_netemul_network::NetworkContextMarker,
2950 >,
2951 ) -> Result<(), fidl::Error> {
2952 SandboxProxyInterface::r#get_network_context(self, network_context)
2953 }
2954}
2955
2956impl SandboxProxyInterface for SandboxProxy {
2957 fn r#create_realm(
2958 &self,
2959 mut realm: fidl::endpoints::ServerEnd<ManagedRealmMarker>,
2960 mut options: RealmOptions,
2961 ) -> Result<(), fidl::Error> {
2962 self.client.send::<SandboxCreateRealmRequest>(
2963 (realm, &mut options),
2964 0x25d0bc5f1006a0c9,
2965 fidl::encoding::DynamicFlags::empty(),
2966 )
2967 }
2968
2969 fn r#get_network_context(
2970 &self,
2971 mut network_context: fidl::endpoints::ServerEnd<
2972 fidl_fuchsia_netemul_network::NetworkContextMarker,
2973 >,
2974 ) -> Result<(), fidl::Error> {
2975 self.client.send::<SandboxGetNetworkContextRequest>(
2976 (network_context,),
2977 0x140cb104c2605970,
2978 fidl::encoding::DynamicFlags::empty(),
2979 )
2980 }
2981}
2982
2983pub struct SandboxEventStream {
2984 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2985}
2986
2987impl std::marker::Unpin for SandboxEventStream {}
2988
2989impl futures::stream::FusedStream for SandboxEventStream {
2990 fn is_terminated(&self) -> bool {
2991 self.event_receiver.is_terminated()
2992 }
2993}
2994
2995impl futures::Stream for SandboxEventStream {
2996 type Item = Result<SandboxEvent, fidl::Error>;
2997
2998 fn poll_next(
2999 mut self: std::pin::Pin<&mut Self>,
3000 cx: &mut std::task::Context<'_>,
3001 ) -> std::task::Poll<Option<Self::Item>> {
3002 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3003 &mut self.event_receiver,
3004 cx
3005 )?) {
3006 Some(buf) => std::task::Poll::Ready(Some(SandboxEvent::decode(buf))),
3007 None => std::task::Poll::Ready(None),
3008 }
3009 }
3010}
3011
3012#[derive(Debug)]
3013pub enum SandboxEvent {}
3014
3015impl SandboxEvent {
3016 fn decode(
3018 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3019 ) -> Result<SandboxEvent, fidl::Error> {
3020 let (bytes, _handles) = buf.split_mut();
3021 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3022 debug_assert_eq!(tx_header.tx_id, 0);
3023 match tx_header.ordinal {
3024 _ => Err(fidl::Error::UnknownOrdinal {
3025 ordinal: tx_header.ordinal,
3026 protocol_name: <SandboxMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3027 }),
3028 }
3029 }
3030}
3031
3032pub struct SandboxRequestStream {
3034 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3035 is_terminated: bool,
3036}
3037
3038impl std::marker::Unpin for SandboxRequestStream {}
3039
3040impl futures::stream::FusedStream for SandboxRequestStream {
3041 fn is_terminated(&self) -> bool {
3042 self.is_terminated
3043 }
3044}
3045
3046impl fidl::endpoints::RequestStream for SandboxRequestStream {
3047 type Protocol = SandboxMarker;
3048 type ControlHandle = SandboxControlHandle;
3049
3050 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3051 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3052 }
3053
3054 fn control_handle(&self) -> Self::ControlHandle {
3055 SandboxControlHandle { inner: self.inner.clone() }
3056 }
3057
3058 fn into_inner(
3059 self,
3060 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3061 {
3062 (self.inner, self.is_terminated)
3063 }
3064
3065 fn from_inner(
3066 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3067 is_terminated: bool,
3068 ) -> Self {
3069 Self { inner, is_terminated }
3070 }
3071}
3072
3073impl futures::Stream for SandboxRequestStream {
3074 type Item = Result<SandboxRequest, fidl::Error>;
3075
3076 fn poll_next(
3077 mut self: std::pin::Pin<&mut Self>,
3078 cx: &mut std::task::Context<'_>,
3079 ) -> std::task::Poll<Option<Self::Item>> {
3080 let this = &mut *self;
3081 if this.inner.check_shutdown(cx) {
3082 this.is_terminated = true;
3083 return std::task::Poll::Ready(None);
3084 }
3085 if this.is_terminated {
3086 panic!("polled SandboxRequestStream after completion");
3087 }
3088 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3089 |bytes, handles| {
3090 match this.inner.channel().read_etc(cx, bytes, handles) {
3091 std::task::Poll::Ready(Ok(())) => {}
3092 std::task::Poll::Pending => return std::task::Poll::Pending,
3093 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3094 this.is_terminated = true;
3095 return std::task::Poll::Ready(None);
3096 }
3097 std::task::Poll::Ready(Err(e)) => {
3098 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3099 e.into(),
3100 ))))
3101 }
3102 }
3103
3104 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3106
3107 std::task::Poll::Ready(Some(match header.ordinal {
3108 0x25d0bc5f1006a0c9 => {
3109 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3110 let mut req = fidl::new_empty!(
3111 SandboxCreateRealmRequest,
3112 fidl::encoding::DefaultFuchsiaResourceDialect
3113 );
3114 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SandboxCreateRealmRequest>(&header, _body_bytes, handles, &mut req)?;
3115 let control_handle = SandboxControlHandle { inner: this.inner.clone() };
3116 Ok(SandboxRequest::CreateRealm {
3117 realm: req.realm,
3118 options: req.options,
3119
3120 control_handle,
3121 })
3122 }
3123 0x140cb104c2605970 => {
3124 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3125 let mut req = fidl::new_empty!(
3126 SandboxGetNetworkContextRequest,
3127 fidl::encoding::DefaultFuchsiaResourceDialect
3128 );
3129 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SandboxGetNetworkContextRequest>(&header, _body_bytes, handles, &mut req)?;
3130 let control_handle = SandboxControlHandle { inner: this.inner.clone() };
3131 Ok(SandboxRequest::GetNetworkContext {
3132 network_context: req.network_context,
3133
3134 control_handle,
3135 })
3136 }
3137 _ => Err(fidl::Error::UnknownOrdinal {
3138 ordinal: header.ordinal,
3139 protocol_name:
3140 <SandboxMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3141 }),
3142 }))
3143 },
3144 )
3145 }
3146}
3147
3148#[derive(Debug)]
3159pub enum SandboxRequest {
3160 CreateRealm {
3171 realm: fidl::endpoints::ServerEnd<ManagedRealmMarker>,
3172 options: RealmOptions,
3173 control_handle: SandboxControlHandle,
3174 },
3175 GetNetworkContext {
3179 network_context:
3180 fidl::endpoints::ServerEnd<fidl_fuchsia_netemul_network::NetworkContextMarker>,
3181 control_handle: SandboxControlHandle,
3182 },
3183}
3184
3185impl SandboxRequest {
3186 #[allow(irrefutable_let_patterns)]
3187 pub fn into_create_realm(
3188 self,
3189 ) -> Option<(fidl::endpoints::ServerEnd<ManagedRealmMarker>, RealmOptions, SandboxControlHandle)>
3190 {
3191 if let SandboxRequest::CreateRealm { realm, options, control_handle } = self {
3192 Some((realm, options, control_handle))
3193 } else {
3194 None
3195 }
3196 }
3197
3198 #[allow(irrefutable_let_patterns)]
3199 pub fn into_get_network_context(
3200 self,
3201 ) -> Option<(
3202 fidl::endpoints::ServerEnd<fidl_fuchsia_netemul_network::NetworkContextMarker>,
3203 SandboxControlHandle,
3204 )> {
3205 if let SandboxRequest::GetNetworkContext { network_context, control_handle } = self {
3206 Some((network_context, control_handle))
3207 } else {
3208 None
3209 }
3210 }
3211
3212 pub fn method_name(&self) -> &'static str {
3214 match *self {
3215 SandboxRequest::CreateRealm { .. } => "create_realm",
3216 SandboxRequest::GetNetworkContext { .. } => "get_network_context",
3217 }
3218 }
3219}
3220
3221#[derive(Debug, Clone)]
3222pub struct SandboxControlHandle {
3223 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3224}
3225
3226impl fidl::endpoints::ControlHandle for SandboxControlHandle {
3227 fn shutdown(&self) {
3228 self.inner.shutdown()
3229 }
3230 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3231 self.inner.shutdown_with_epitaph(status)
3232 }
3233
3234 fn is_closed(&self) -> bool {
3235 self.inner.channel().is_closed()
3236 }
3237 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3238 self.inner.channel().on_closed()
3239 }
3240
3241 #[cfg(target_os = "fuchsia")]
3242 fn signal_peer(
3243 &self,
3244 clear_mask: zx::Signals,
3245 set_mask: zx::Signals,
3246 ) -> Result<(), zx_status::Status> {
3247 use fidl::Peered;
3248 self.inner.channel().signal_peer(clear_mask, set_mask)
3249 }
3250}
3251
3252impl SandboxControlHandle {}
3253
3254mod internal {
3255 use super::*;
3256
3257 impl fidl::encoding::ResourceTypeMarker for ManagedRealmAddDeviceRequest {
3258 type Borrowed<'a> = &'a mut Self;
3259 fn take_or_borrow<'a>(
3260 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3261 ) -> Self::Borrowed<'a> {
3262 value
3263 }
3264 }
3265
3266 unsafe impl fidl::encoding::TypeMarker for ManagedRealmAddDeviceRequest {
3267 type Owned = Self;
3268
3269 #[inline(always)]
3270 fn inline_align(_context: fidl::encoding::Context) -> usize {
3271 8
3272 }
3273
3274 #[inline(always)]
3275 fn inline_size(_context: fidl::encoding::Context) -> usize {
3276 24
3277 }
3278 }
3279
3280 unsafe impl
3281 fidl::encoding::Encode<
3282 ManagedRealmAddDeviceRequest,
3283 fidl::encoding::DefaultFuchsiaResourceDialect,
3284 > for &mut ManagedRealmAddDeviceRequest
3285 {
3286 #[inline]
3287 unsafe fn encode(
3288 self,
3289 encoder: &mut fidl::encoding::Encoder<
3290 '_,
3291 fidl::encoding::DefaultFuchsiaResourceDialect,
3292 >,
3293 offset: usize,
3294 _depth: fidl::encoding::Depth,
3295 ) -> fidl::Result<()> {
3296 encoder.debug_check_bounds::<ManagedRealmAddDeviceRequest>(offset);
3297 fidl::encoding::Encode::<
3299 ManagedRealmAddDeviceRequest,
3300 fidl::encoding::DefaultFuchsiaResourceDialect,
3301 >::encode(
3302 (
3303 <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
3304 &self.path,
3305 ),
3306 <fidl::encoding::Endpoint<
3307 fidl::endpoints::ClientEnd<
3308 fidl_fuchsia_netemul_network::DeviceProxy_Marker,
3309 >,
3310 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
3311 &mut self.device
3312 ),
3313 ),
3314 encoder,
3315 offset,
3316 _depth,
3317 )
3318 }
3319 }
3320 unsafe impl<
3321 T0: fidl::encoding::Encode<
3322 fidl::encoding::UnboundedString,
3323 fidl::encoding::DefaultFuchsiaResourceDialect,
3324 >,
3325 T1: fidl::encoding::Encode<
3326 fidl::encoding::Endpoint<
3327 fidl::endpoints::ClientEnd<fidl_fuchsia_netemul_network::DeviceProxy_Marker>,
3328 >,
3329 fidl::encoding::DefaultFuchsiaResourceDialect,
3330 >,
3331 >
3332 fidl::encoding::Encode<
3333 ManagedRealmAddDeviceRequest,
3334 fidl::encoding::DefaultFuchsiaResourceDialect,
3335 > for (T0, T1)
3336 {
3337 #[inline]
3338 unsafe fn encode(
3339 self,
3340 encoder: &mut fidl::encoding::Encoder<
3341 '_,
3342 fidl::encoding::DefaultFuchsiaResourceDialect,
3343 >,
3344 offset: usize,
3345 depth: fidl::encoding::Depth,
3346 ) -> fidl::Result<()> {
3347 encoder.debug_check_bounds::<ManagedRealmAddDeviceRequest>(offset);
3348 unsafe {
3351 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
3352 (ptr as *mut u64).write_unaligned(0);
3353 }
3354 self.0.encode(encoder, offset + 0, depth)?;
3356 self.1.encode(encoder, offset + 16, depth)?;
3357 Ok(())
3358 }
3359 }
3360
3361 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3362 for ManagedRealmAddDeviceRequest
3363 {
3364 #[inline(always)]
3365 fn new_empty() -> Self {
3366 Self {
3367 path: fidl::new_empty!(
3368 fidl::encoding::UnboundedString,
3369 fidl::encoding::DefaultFuchsiaResourceDialect
3370 ),
3371 device: fidl::new_empty!(
3372 fidl::encoding::Endpoint<
3373 fidl::endpoints::ClientEnd<
3374 fidl_fuchsia_netemul_network::DeviceProxy_Marker,
3375 >,
3376 >,
3377 fidl::encoding::DefaultFuchsiaResourceDialect
3378 ),
3379 }
3380 }
3381
3382 #[inline]
3383 unsafe fn decode(
3384 &mut self,
3385 decoder: &mut fidl::encoding::Decoder<
3386 '_,
3387 fidl::encoding::DefaultFuchsiaResourceDialect,
3388 >,
3389 offset: usize,
3390 _depth: fidl::encoding::Depth,
3391 ) -> fidl::Result<()> {
3392 decoder.debug_check_bounds::<Self>(offset);
3393 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
3395 let padval = unsafe { (ptr as *const u64).read_unaligned() };
3396 let mask = 0xffffffff00000000u64;
3397 let maskedval = padval & mask;
3398 if maskedval != 0 {
3399 return Err(fidl::Error::NonZeroPadding {
3400 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
3401 });
3402 }
3403 fidl::decode!(
3404 fidl::encoding::UnboundedString,
3405 fidl::encoding::DefaultFuchsiaResourceDialect,
3406 &mut self.path,
3407 decoder,
3408 offset + 0,
3409 _depth
3410 )?;
3411 fidl::decode!(
3412 fidl::encoding::Endpoint<
3413 fidl::endpoints::ClientEnd<fidl_fuchsia_netemul_network::DeviceProxy_Marker>,
3414 >,
3415 fidl::encoding::DefaultFuchsiaResourceDialect,
3416 &mut self.device,
3417 decoder,
3418 offset + 16,
3419 _depth
3420 )?;
3421 Ok(())
3422 }
3423 }
3424
3425 impl fidl::encoding::ResourceTypeMarker for ManagedRealmConnectToProtocolRequest {
3426 type Borrowed<'a> = &'a mut Self;
3427 fn take_or_borrow<'a>(
3428 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3429 ) -> Self::Borrowed<'a> {
3430 value
3431 }
3432 }
3433
3434 unsafe impl fidl::encoding::TypeMarker for ManagedRealmConnectToProtocolRequest {
3435 type Owned = Self;
3436
3437 #[inline(always)]
3438 fn inline_align(_context: fidl::encoding::Context) -> usize {
3439 8
3440 }
3441
3442 #[inline(always)]
3443 fn inline_size(_context: fidl::encoding::Context) -> usize {
3444 40
3445 }
3446 }
3447
3448 unsafe impl
3449 fidl::encoding::Encode<
3450 ManagedRealmConnectToProtocolRequest,
3451 fidl::encoding::DefaultFuchsiaResourceDialect,
3452 > for &mut ManagedRealmConnectToProtocolRequest
3453 {
3454 #[inline]
3455 unsafe fn encode(
3456 self,
3457 encoder: &mut fidl::encoding::Encoder<
3458 '_,
3459 fidl::encoding::DefaultFuchsiaResourceDialect,
3460 >,
3461 offset: usize,
3462 _depth: fidl::encoding::Depth,
3463 ) -> fidl::Result<()> {
3464 encoder.debug_check_bounds::<ManagedRealmConnectToProtocolRequest>(offset);
3465 fidl::encoding::Encode::<ManagedRealmConnectToProtocolRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
3467 (
3468 <fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(&self.protocol_name),
3469 <fidl::encoding::Optional<fidl::encoding::BoundedString<255>> as fidl::encoding::ValueTypeMarker>::borrow(&self.child_name),
3470 <fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.req),
3471 ),
3472 encoder, offset, _depth
3473 )
3474 }
3475 }
3476 unsafe impl<
3477 T0: fidl::encoding::Encode<
3478 fidl::encoding::BoundedString<255>,
3479 fidl::encoding::DefaultFuchsiaResourceDialect,
3480 >,
3481 T1: fidl::encoding::Encode<
3482 fidl::encoding::Optional<fidl::encoding::BoundedString<255>>,
3483 fidl::encoding::DefaultFuchsiaResourceDialect,
3484 >,
3485 T2: fidl::encoding::Encode<
3486 fidl::encoding::HandleType<
3487 fidl::Channel,
3488 { fidl::ObjectType::CHANNEL.into_raw() },
3489 2147483648,
3490 >,
3491 fidl::encoding::DefaultFuchsiaResourceDialect,
3492 >,
3493 >
3494 fidl::encoding::Encode<
3495 ManagedRealmConnectToProtocolRequest,
3496 fidl::encoding::DefaultFuchsiaResourceDialect,
3497 > for (T0, T1, T2)
3498 {
3499 #[inline]
3500 unsafe fn encode(
3501 self,
3502 encoder: &mut fidl::encoding::Encoder<
3503 '_,
3504 fidl::encoding::DefaultFuchsiaResourceDialect,
3505 >,
3506 offset: usize,
3507 depth: fidl::encoding::Depth,
3508 ) -> fidl::Result<()> {
3509 encoder.debug_check_bounds::<ManagedRealmConnectToProtocolRequest>(offset);
3510 unsafe {
3513 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
3514 (ptr as *mut u64).write_unaligned(0);
3515 }
3516 self.0.encode(encoder, offset + 0, depth)?;
3518 self.1.encode(encoder, offset + 16, depth)?;
3519 self.2.encode(encoder, offset + 32, depth)?;
3520 Ok(())
3521 }
3522 }
3523
3524 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3525 for ManagedRealmConnectToProtocolRequest
3526 {
3527 #[inline(always)]
3528 fn new_empty() -> Self {
3529 Self {
3530 protocol_name: fidl::new_empty!(
3531 fidl::encoding::BoundedString<255>,
3532 fidl::encoding::DefaultFuchsiaResourceDialect
3533 ),
3534 child_name: fidl::new_empty!(
3535 fidl::encoding::Optional<fidl::encoding::BoundedString<255>>,
3536 fidl::encoding::DefaultFuchsiaResourceDialect
3537 ),
3538 req: fidl::new_empty!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
3539 }
3540 }
3541
3542 #[inline]
3543 unsafe fn decode(
3544 &mut self,
3545 decoder: &mut fidl::encoding::Decoder<
3546 '_,
3547 fidl::encoding::DefaultFuchsiaResourceDialect,
3548 >,
3549 offset: usize,
3550 _depth: fidl::encoding::Depth,
3551 ) -> fidl::Result<()> {
3552 decoder.debug_check_bounds::<Self>(offset);
3553 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
3555 let padval = unsafe { (ptr as *const u64).read_unaligned() };
3556 let mask = 0xffffffff00000000u64;
3557 let maskedval = padval & mask;
3558 if maskedval != 0 {
3559 return Err(fidl::Error::NonZeroPadding {
3560 padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
3561 });
3562 }
3563 fidl::decode!(
3564 fidl::encoding::BoundedString<255>,
3565 fidl::encoding::DefaultFuchsiaResourceDialect,
3566 &mut self.protocol_name,
3567 decoder,
3568 offset + 0,
3569 _depth
3570 )?;
3571 fidl::decode!(
3572 fidl::encoding::Optional<fidl::encoding::BoundedString<255>>,
3573 fidl::encoding::DefaultFuchsiaResourceDialect,
3574 &mut self.child_name,
3575 decoder,
3576 offset + 16,
3577 _depth
3578 )?;
3579 fidl::decode!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.req, decoder, offset + 32, _depth)?;
3580 Ok(())
3581 }
3582 }
3583
3584 impl fidl::encoding::ResourceTypeMarker for ManagedRealmGetCrashListenerRequest {
3585 type Borrowed<'a> = &'a mut Self;
3586 fn take_or_borrow<'a>(
3587 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3588 ) -> Self::Borrowed<'a> {
3589 value
3590 }
3591 }
3592
3593 unsafe impl fidl::encoding::TypeMarker for ManagedRealmGetCrashListenerRequest {
3594 type Owned = Self;
3595
3596 #[inline(always)]
3597 fn inline_align(_context: fidl::encoding::Context) -> usize {
3598 4
3599 }
3600
3601 #[inline(always)]
3602 fn inline_size(_context: fidl::encoding::Context) -> usize {
3603 4
3604 }
3605 }
3606
3607 unsafe impl
3608 fidl::encoding::Encode<
3609 ManagedRealmGetCrashListenerRequest,
3610 fidl::encoding::DefaultFuchsiaResourceDialect,
3611 > for &mut ManagedRealmGetCrashListenerRequest
3612 {
3613 #[inline]
3614 unsafe fn encode(
3615 self,
3616 encoder: &mut fidl::encoding::Encoder<
3617 '_,
3618 fidl::encoding::DefaultFuchsiaResourceDialect,
3619 >,
3620 offset: usize,
3621 _depth: fidl::encoding::Depth,
3622 ) -> fidl::Result<()> {
3623 encoder.debug_check_bounds::<ManagedRealmGetCrashListenerRequest>(offset);
3624 fidl::encoding::Encode::<ManagedRealmGetCrashListenerRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
3626 (
3627 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CrashListenerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.listener),
3628 ),
3629 encoder, offset, _depth
3630 )
3631 }
3632 }
3633 unsafe impl<
3634 T0: fidl::encoding::Encode<
3635 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CrashListenerMarker>>,
3636 fidl::encoding::DefaultFuchsiaResourceDialect,
3637 >,
3638 >
3639 fidl::encoding::Encode<
3640 ManagedRealmGetCrashListenerRequest,
3641 fidl::encoding::DefaultFuchsiaResourceDialect,
3642 > for (T0,)
3643 {
3644 #[inline]
3645 unsafe fn encode(
3646 self,
3647 encoder: &mut fidl::encoding::Encoder<
3648 '_,
3649 fidl::encoding::DefaultFuchsiaResourceDialect,
3650 >,
3651 offset: usize,
3652 depth: fidl::encoding::Depth,
3653 ) -> fidl::Result<()> {
3654 encoder.debug_check_bounds::<ManagedRealmGetCrashListenerRequest>(offset);
3655 self.0.encode(encoder, offset + 0, depth)?;
3659 Ok(())
3660 }
3661 }
3662
3663 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3664 for ManagedRealmGetCrashListenerRequest
3665 {
3666 #[inline(always)]
3667 fn new_empty() -> Self {
3668 Self {
3669 listener: fidl::new_empty!(
3670 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CrashListenerMarker>>,
3671 fidl::encoding::DefaultFuchsiaResourceDialect
3672 ),
3673 }
3674 }
3675
3676 #[inline]
3677 unsafe fn decode(
3678 &mut self,
3679 decoder: &mut fidl::encoding::Decoder<
3680 '_,
3681 fidl::encoding::DefaultFuchsiaResourceDialect,
3682 >,
3683 offset: usize,
3684 _depth: fidl::encoding::Depth,
3685 ) -> fidl::Result<()> {
3686 decoder.debug_check_bounds::<Self>(offset);
3687 fidl::decode!(
3689 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CrashListenerMarker>>,
3690 fidl::encoding::DefaultFuchsiaResourceDialect,
3691 &mut self.listener,
3692 decoder,
3693 offset + 0,
3694 _depth
3695 )?;
3696 Ok(())
3697 }
3698 }
3699
3700 impl fidl::encoding::ResourceTypeMarker for ManagedRealmGetDevfsRequest {
3701 type Borrowed<'a> = &'a mut Self;
3702 fn take_or_borrow<'a>(
3703 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3704 ) -> Self::Borrowed<'a> {
3705 value
3706 }
3707 }
3708
3709 unsafe impl fidl::encoding::TypeMarker for ManagedRealmGetDevfsRequest {
3710 type Owned = Self;
3711
3712 #[inline(always)]
3713 fn inline_align(_context: fidl::encoding::Context) -> usize {
3714 4
3715 }
3716
3717 #[inline(always)]
3718 fn inline_size(_context: fidl::encoding::Context) -> usize {
3719 4
3720 }
3721 }
3722
3723 unsafe impl
3724 fidl::encoding::Encode<
3725 ManagedRealmGetDevfsRequest,
3726 fidl::encoding::DefaultFuchsiaResourceDialect,
3727 > for &mut ManagedRealmGetDevfsRequest
3728 {
3729 #[inline]
3730 unsafe fn encode(
3731 self,
3732 encoder: &mut fidl::encoding::Encoder<
3733 '_,
3734 fidl::encoding::DefaultFuchsiaResourceDialect,
3735 >,
3736 offset: usize,
3737 _depth: fidl::encoding::Depth,
3738 ) -> fidl::Result<()> {
3739 encoder.debug_check_bounds::<ManagedRealmGetDevfsRequest>(offset);
3740 fidl::encoding::Encode::<
3742 ManagedRealmGetDevfsRequest,
3743 fidl::encoding::DefaultFuchsiaResourceDialect,
3744 >::encode(
3745 (<fidl::encoding::Endpoint<
3746 fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
3747 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
3748 &mut self.devfs
3749 ),),
3750 encoder,
3751 offset,
3752 _depth,
3753 )
3754 }
3755 }
3756 unsafe impl<
3757 T0: fidl::encoding::Encode<
3758 fidl::encoding::Endpoint<
3759 fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
3760 >,
3761 fidl::encoding::DefaultFuchsiaResourceDialect,
3762 >,
3763 >
3764 fidl::encoding::Encode<
3765 ManagedRealmGetDevfsRequest,
3766 fidl::encoding::DefaultFuchsiaResourceDialect,
3767 > for (T0,)
3768 {
3769 #[inline]
3770 unsafe fn encode(
3771 self,
3772 encoder: &mut fidl::encoding::Encoder<
3773 '_,
3774 fidl::encoding::DefaultFuchsiaResourceDialect,
3775 >,
3776 offset: usize,
3777 depth: fidl::encoding::Depth,
3778 ) -> fidl::Result<()> {
3779 encoder.debug_check_bounds::<ManagedRealmGetDevfsRequest>(offset);
3780 self.0.encode(encoder, offset + 0, depth)?;
3784 Ok(())
3785 }
3786 }
3787
3788 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3789 for ManagedRealmGetDevfsRequest
3790 {
3791 #[inline(always)]
3792 fn new_empty() -> Self {
3793 Self {
3794 devfs: fidl::new_empty!(
3795 fidl::encoding::Endpoint<
3796 fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
3797 >,
3798 fidl::encoding::DefaultFuchsiaResourceDialect
3799 ),
3800 }
3801 }
3802
3803 #[inline]
3804 unsafe fn decode(
3805 &mut self,
3806 decoder: &mut fidl::encoding::Decoder<
3807 '_,
3808 fidl::encoding::DefaultFuchsiaResourceDialect,
3809 >,
3810 offset: usize,
3811 _depth: fidl::encoding::Depth,
3812 ) -> fidl::Result<()> {
3813 decoder.debug_check_bounds::<Self>(offset);
3814 fidl::decode!(
3816 fidl::encoding::Endpoint<
3817 fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
3818 >,
3819 fidl::encoding::DefaultFuchsiaResourceDialect,
3820 &mut self.devfs,
3821 decoder,
3822 offset + 0,
3823 _depth
3824 )?;
3825 Ok(())
3826 }
3827 }
3828
3829 impl fidl::encoding::ResourceTypeMarker for ManagedRealmOpenDiagnosticsDirectoryRequest {
3830 type Borrowed<'a> = &'a mut Self;
3831 fn take_or_borrow<'a>(
3832 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3833 ) -> Self::Borrowed<'a> {
3834 value
3835 }
3836 }
3837
3838 unsafe impl fidl::encoding::TypeMarker for ManagedRealmOpenDiagnosticsDirectoryRequest {
3839 type Owned = Self;
3840
3841 #[inline(always)]
3842 fn inline_align(_context: fidl::encoding::Context) -> usize {
3843 8
3844 }
3845
3846 #[inline(always)]
3847 fn inline_size(_context: fidl::encoding::Context) -> usize {
3848 24
3849 }
3850 }
3851
3852 unsafe impl
3853 fidl::encoding::Encode<
3854 ManagedRealmOpenDiagnosticsDirectoryRequest,
3855 fidl::encoding::DefaultFuchsiaResourceDialect,
3856 > for &mut ManagedRealmOpenDiagnosticsDirectoryRequest
3857 {
3858 #[inline]
3859 unsafe fn encode(
3860 self,
3861 encoder: &mut fidl::encoding::Encoder<
3862 '_,
3863 fidl::encoding::DefaultFuchsiaResourceDialect,
3864 >,
3865 offset: usize,
3866 _depth: fidl::encoding::Depth,
3867 ) -> fidl::Result<()> {
3868 encoder.debug_check_bounds::<ManagedRealmOpenDiagnosticsDirectoryRequest>(offset);
3869 fidl::encoding::Encode::<
3871 ManagedRealmOpenDiagnosticsDirectoryRequest,
3872 fidl::encoding::DefaultFuchsiaResourceDialect,
3873 >::encode(
3874 (
3875 <fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(
3876 &self.child_name,
3877 ),
3878 <fidl::encoding::Endpoint<
3879 fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
3880 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
3881 &mut self.directory
3882 ),
3883 ),
3884 encoder,
3885 offset,
3886 _depth,
3887 )
3888 }
3889 }
3890 unsafe impl<
3891 T0: fidl::encoding::Encode<
3892 fidl::encoding::BoundedString<255>,
3893 fidl::encoding::DefaultFuchsiaResourceDialect,
3894 >,
3895 T1: fidl::encoding::Encode<
3896 fidl::encoding::Endpoint<
3897 fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
3898 >,
3899 fidl::encoding::DefaultFuchsiaResourceDialect,
3900 >,
3901 >
3902 fidl::encoding::Encode<
3903 ManagedRealmOpenDiagnosticsDirectoryRequest,
3904 fidl::encoding::DefaultFuchsiaResourceDialect,
3905 > for (T0, T1)
3906 {
3907 #[inline]
3908 unsafe fn encode(
3909 self,
3910 encoder: &mut fidl::encoding::Encoder<
3911 '_,
3912 fidl::encoding::DefaultFuchsiaResourceDialect,
3913 >,
3914 offset: usize,
3915 depth: fidl::encoding::Depth,
3916 ) -> fidl::Result<()> {
3917 encoder.debug_check_bounds::<ManagedRealmOpenDiagnosticsDirectoryRequest>(offset);
3918 unsafe {
3921 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
3922 (ptr as *mut u64).write_unaligned(0);
3923 }
3924 self.0.encode(encoder, offset + 0, depth)?;
3926 self.1.encode(encoder, offset + 16, depth)?;
3927 Ok(())
3928 }
3929 }
3930
3931 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3932 for ManagedRealmOpenDiagnosticsDirectoryRequest
3933 {
3934 #[inline(always)]
3935 fn new_empty() -> Self {
3936 Self {
3937 child_name: fidl::new_empty!(
3938 fidl::encoding::BoundedString<255>,
3939 fidl::encoding::DefaultFuchsiaResourceDialect
3940 ),
3941 directory: fidl::new_empty!(
3942 fidl::encoding::Endpoint<
3943 fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
3944 >,
3945 fidl::encoding::DefaultFuchsiaResourceDialect
3946 ),
3947 }
3948 }
3949
3950 #[inline]
3951 unsafe fn decode(
3952 &mut self,
3953 decoder: &mut fidl::encoding::Decoder<
3954 '_,
3955 fidl::encoding::DefaultFuchsiaResourceDialect,
3956 >,
3957 offset: usize,
3958 _depth: fidl::encoding::Depth,
3959 ) -> fidl::Result<()> {
3960 decoder.debug_check_bounds::<Self>(offset);
3961 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
3963 let padval = unsafe { (ptr as *const u64).read_unaligned() };
3964 let mask = 0xffffffff00000000u64;
3965 let maskedval = padval & mask;
3966 if maskedval != 0 {
3967 return Err(fidl::Error::NonZeroPadding {
3968 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
3969 });
3970 }
3971 fidl::decode!(
3972 fidl::encoding::BoundedString<255>,
3973 fidl::encoding::DefaultFuchsiaResourceDialect,
3974 &mut self.child_name,
3975 decoder,
3976 offset + 0,
3977 _depth
3978 )?;
3979 fidl::decode!(
3980 fidl::encoding::Endpoint<
3981 fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
3982 >,
3983 fidl::encoding::DefaultFuchsiaResourceDialect,
3984 &mut self.directory,
3985 decoder,
3986 offset + 16,
3987 _depth
3988 )?;
3989 Ok(())
3990 }
3991 }
3992
3993 impl fidl::encoding::ResourceTypeMarker for SandboxCreateRealmRequest {
3994 type Borrowed<'a> = &'a mut Self;
3995 fn take_or_borrow<'a>(
3996 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3997 ) -> Self::Borrowed<'a> {
3998 value
3999 }
4000 }
4001
4002 unsafe impl fidl::encoding::TypeMarker for SandboxCreateRealmRequest {
4003 type Owned = Self;
4004
4005 #[inline(always)]
4006 fn inline_align(_context: fidl::encoding::Context) -> usize {
4007 8
4008 }
4009
4010 #[inline(always)]
4011 fn inline_size(_context: fidl::encoding::Context) -> usize {
4012 24
4013 }
4014 }
4015
4016 unsafe impl
4017 fidl::encoding::Encode<
4018 SandboxCreateRealmRequest,
4019 fidl::encoding::DefaultFuchsiaResourceDialect,
4020 > for &mut SandboxCreateRealmRequest
4021 {
4022 #[inline]
4023 unsafe fn encode(
4024 self,
4025 encoder: &mut fidl::encoding::Encoder<
4026 '_,
4027 fidl::encoding::DefaultFuchsiaResourceDialect,
4028 >,
4029 offset: usize,
4030 _depth: fidl::encoding::Depth,
4031 ) -> fidl::Result<()> {
4032 encoder.debug_check_bounds::<SandboxCreateRealmRequest>(offset);
4033 fidl::encoding::Encode::<SandboxCreateRealmRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
4035 (
4036 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ManagedRealmMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.realm),
4037 <RealmOptions as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.options),
4038 ),
4039 encoder, offset, _depth
4040 )
4041 }
4042 }
4043 unsafe impl<
4044 T0: fidl::encoding::Encode<
4045 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ManagedRealmMarker>>,
4046 fidl::encoding::DefaultFuchsiaResourceDialect,
4047 >,
4048 T1: fidl::encoding::Encode<RealmOptions, fidl::encoding::DefaultFuchsiaResourceDialect>,
4049 >
4050 fidl::encoding::Encode<
4051 SandboxCreateRealmRequest,
4052 fidl::encoding::DefaultFuchsiaResourceDialect,
4053 > for (T0, T1)
4054 {
4055 #[inline]
4056 unsafe fn encode(
4057 self,
4058 encoder: &mut fidl::encoding::Encoder<
4059 '_,
4060 fidl::encoding::DefaultFuchsiaResourceDialect,
4061 >,
4062 offset: usize,
4063 depth: fidl::encoding::Depth,
4064 ) -> fidl::Result<()> {
4065 encoder.debug_check_bounds::<SandboxCreateRealmRequest>(offset);
4066 unsafe {
4069 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
4070 (ptr as *mut u64).write_unaligned(0);
4071 }
4072 self.0.encode(encoder, offset + 0, depth)?;
4074 self.1.encode(encoder, offset + 8, depth)?;
4075 Ok(())
4076 }
4077 }
4078
4079 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4080 for SandboxCreateRealmRequest
4081 {
4082 #[inline(always)]
4083 fn new_empty() -> Self {
4084 Self {
4085 realm: fidl::new_empty!(
4086 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ManagedRealmMarker>>,
4087 fidl::encoding::DefaultFuchsiaResourceDialect
4088 ),
4089 options: fidl::new_empty!(
4090 RealmOptions,
4091 fidl::encoding::DefaultFuchsiaResourceDialect
4092 ),
4093 }
4094 }
4095
4096 #[inline]
4097 unsafe fn decode(
4098 &mut self,
4099 decoder: &mut fidl::encoding::Decoder<
4100 '_,
4101 fidl::encoding::DefaultFuchsiaResourceDialect,
4102 >,
4103 offset: usize,
4104 _depth: fidl::encoding::Depth,
4105 ) -> fidl::Result<()> {
4106 decoder.debug_check_bounds::<Self>(offset);
4107 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
4109 let padval = unsafe { (ptr as *const u64).read_unaligned() };
4110 let mask = 0xffffffff00000000u64;
4111 let maskedval = padval & mask;
4112 if maskedval != 0 {
4113 return Err(fidl::Error::NonZeroPadding {
4114 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
4115 });
4116 }
4117 fidl::decode!(
4118 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ManagedRealmMarker>>,
4119 fidl::encoding::DefaultFuchsiaResourceDialect,
4120 &mut self.realm,
4121 decoder,
4122 offset + 0,
4123 _depth
4124 )?;
4125 fidl::decode!(
4126 RealmOptions,
4127 fidl::encoding::DefaultFuchsiaResourceDialect,
4128 &mut self.options,
4129 decoder,
4130 offset + 8,
4131 _depth
4132 )?;
4133 Ok(())
4134 }
4135 }
4136
4137 impl fidl::encoding::ResourceTypeMarker for SandboxGetNetworkContextRequest {
4138 type Borrowed<'a> = &'a mut Self;
4139 fn take_or_borrow<'a>(
4140 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4141 ) -> Self::Borrowed<'a> {
4142 value
4143 }
4144 }
4145
4146 unsafe impl fidl::encoding::TypeMarker for SandboxGetNetworkContextRequest {
4147 type Owned = Self;
4148
4149 #[inline(always)]
4150 fn inline_align(_context: fidl::encoding::Context) -> usize {
4151 4
4152 }
4153
4154 #[inline(always)]
4155 fn inline_size(_context: fidl::encoding::Context) -> usize {
4156 4
4157 }
4158 }
4159
4160 unsafe impl
4161 fidl::encoding::Encode<
4162 SandboxGetNetworkContextRequest,
4163 fidl::encoding::DefaultFuchsiaResourceDialect,
4164 > for &mut SandboxGetNetworkContextRequest
4165 {
4166 #[inline]
4167 unsafe fn encode(
4168 self,
4169 encoder: &mut fidl::encoding::Encoder<
4170 '_,
4171 fidl::encoding::DefaultFuchsiaResourceDialect,
4172 >,
4173 offset: usize,
4174 _depth: fidl::encoding::Depth,
4175 ) -> fidl::Result<()> {
4176 encoder.debug_check_bounds::<SandboxGetNetworkContextRequest>(offset);
4177 fidl::encoding::Encode::<
4179 SandboxGetNetworkContextRequest,
4180 fidl::encoding::DefaultFuchsiaResourceDialect,
4181 >::encode(
4182 (<fidl::encoding::Endpoint<
4183 fidl::endpoints::ServerEnd<fidl_fuchsia_netemul_network::NetworkContextMarker>,
4184 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
4185 &mut self.network_context,
4186 ),),
4187 encoder,
4188 offset,
4189 _depth,
4190 )
4191 }
4192 }
4193 unsafe impl<
4194 T0: fidl::encoding::Encode<
4195 fidl::encoding::Endpoint<
4196 fidl::endpoints::ServerEnd<fidl_fuchsia_netemul_network::NetworkContextMarker>,
4197 >,
4198 fidl::encoding::DefaultFuchsiaResourceDialect,
4199 >,
4200 >
4201 fidl::encoding::Encode<
4202 SandboxGetNetworkContextRequest,
4203 fidl::encoding::DefaultFuchsiaResourceDialect,
4204 > for (T0,)
4205 {
4206 #[inline]
4207 unsafe fn encode(
4208 self,
4209 encoder: &mut fidl::encoding::Encoder<
4210 '_,
4211 fidl::encoding::DefaultFuchsiaResourceDialect,
4212 >,
4213 offset: usize,
4214 depth: fidl::encoding::Depth,
4215 ) -> fidl::Result<()> {
4216 encoder.debug_check_bounds::<SandboxGetNetworkContextRequest>(offset);
4217 self.0.encode(encoder, offset + 0, depth)?;
4221 Ok(())
4222 }
4223 }
4224
4225 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4226 for SandboxGetNetworkContextRequest
4227 {
4228 #[inline(always)]
4229 fn new_empty() -> Self {
4230 Self {
4231 network_context: fidl::new_empty!(
4232 fidl::encoding::Endpoint<
4233 fidl::endpoints::ServerEnd<
4234 fidl_fuchsia_netemul_network::NetworkContextMarker,
4235 >,
4236 >,
4237 fidl::encoding::DefaultFuchsiaResourceDialect
4238 ),
4239 }
4240 }
4241
4242 #[inline]
4243 unsafe fn decode(
4244 &mut self,
4245 decoder: &mut fidl::encoding::Decoder<
4246 '_,
4247 fidl::encoding::DefaultFuchsiaResourceDialect,
4248 >,
4249 offset: usize,
4250 _depth: fidl::encoding::Depth,
4251 ) -> fidl::Result<()> {
4252 decoder.debug_check_bounds::<Self>(offset);
4253 fidl::decode!(
4255 fidl::encoding::Endpoint<
4256 fidl::endpoints::ServerEnd<fidl_fuchsia_netemul_network::NetworkContextMarker>,
4257 >,
4258 fidl::encoding::DefaultFuchsiaResourceDialect,
4259 &mut self.network_context,
4260 decoder,
4261 offset + 0,
4262 _depth
4263 )?;
4264 Ok(())
4265 }
4266 }
4267
4268 impl ChildDef {
4269 #[inline(always)]
4270 fn max_ordinal_present(&self) -> u64 {
4271 if let Some(_) = self.config_values {
4272 return 7;
4273 }
4274 if let Some(_) = self.eager {
4275 return 6;
4276 }
4277 if let Some(_) = self.program_args {
4278 return 5;
4279 }
4280 if let Some(_) = self.uses {
4281 return 4;
4282 }
4283 if let Some(_) = self.exposes {
4284 return 3;
4285 }
4286 if let Some(_) = self.name {
4287 return 2;
4288 }
4289 if let Some(_) = self.source {
4290 return 1;
4291 }
4292 0
4293 }
4294 }
4295
4296 impl fidl::encoding::ResourceTypeMarker for ChildDef {
4297 type Borrowed<'a> = &'a mut Self;
4298 fn take_or_borrow<'a>(
4299 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4300 ) -> Self::Borrowed<'a> {
4301 value
4302 }
4303 }
4304
4305 unsafe impl fidl::encoding::TypeMarker for ChildDef {
4306 type Owned = Self;
4307
4308 #[inline(always)]
4309 fn inline_align(_context: fidl::encoding::Context) -> usize {
4310 8
4311 }
4312
4313 #[inline(always)]
4314 fn inline_size(_context: fidl::encoding::Context) -> usize {
4315 16
4316 }
4317 }
4318
4319 unsafe impl fidl::encoding::Encode<ChildDef, fidl::encoding::DefaultFuchsiaResourceDialect>
4320 for &mut ChildDef
4321 {
4322 unsafe fn encode(
4323 self,
4324 encoder: &mut fidl::encoding::Encoder<
4325 '_,
4326 fidl::encoding::DefaultFuchsiaResourceDialect,
4327 >,
4328 offset: usize,
4329 mut depth: fidl::encoding::Depth,
4330 ) -> fidl::Result<()> {
4331 encoder.debug_check_bounds::<ChildDef>(offset);
4332 let max_ordinal: u64 = self.max_ordinal_present();
4334 encoder.write_num(max_ordinal, offset);
4335 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4336 if max_ordinal == 0 {
4338 return Ok(());
4339 }
4340 depth.increment()?;
4341 let envelope_size = 8;
4342 let bytes_len = max_ordinal as usize * envelope_size;
4343 #[allow(unused_variables)]
4344 let offset = encoder.out_of_line_offset(bytes_len);
4345 let mut _prev_end_offset: usize = 0;
4346 if 1 > max_ordinal {
4347 return Ok(());
4348 }
4349
4350 let cur_offset: usize = (1 - 1) * envelope_size;
4353
4354 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4356
4357 fidl::encoding::encode_in_envelope_optional::<
4362 ChildSource,
4363 fidl::encoding::DefaultFuchsiaResourceDialect,
4364 >(
4365 self.source
4366 .as_mut()
4367 .map(<ChildSource as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
4368 encoder,
4369 offset + cur_offset,
4370 depth,
4371 )?;
4372
4373 _prev_end_offset = cur_offset + envelope_size;
4374 if 2 > max_ordinal {
4375 return Ok(());
4376 }
4377
4378 let cur_offset: usize = (2 - 1) * envelope_size;
4381
4382 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4384
4385 fidl::encoding::encode_in_envelope_optional::<
4390 fidl::encoding::BoundedString<255>,
4391 fidl::encoding::DefaultFuchsiaResourceDialect,
4392 >(
4393 self.name.as_ref().map(
4394 <fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow,
4395 ),
4396 encoder,
4397 offset + cur_offset,
4398 depth,
4399 )?;
4400
4401 _prev_end_offset = cur_offset + envelope_size;
4402 if 3 > max_ordinal {
4403 return Ok(());
4404 }
4405
4406 let cur_offset: usize = (3 - 1) * envelope_size;
4409
4410 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4412
4413 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<255>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
4418 self.exposes.as_ref().map(<fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<255>> as fidl::encoding::ValueTypeMarker>::borrow),
4419 encoder, offset + cur_offset, depth
4420 )?;
4421
4422 _prev_end_offset = cur_offset + envelope_size;
4423 if 4 > max_ordinal {
4424 return Ok(());
4425 }
4426
4427 let cur_offset: usize = (4 - 1) * envelope_size;
4430
4431 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4433
4434 fidl::encoding::encode_in_envelope_optional::<
4439 ChildUses,
4440 fidl::encoding::DefaultFuchsiaResourceDialect,
4441 >(
4442 self.uses.as_ref().map(<ChildUses as fidl::encoding::ValueTypeMarker>::borrow),
4443 encoder,
4444 offset + cur_offset,
4445 depth,
4446 )?;
4447
4448 _prev_end_offset = cur_offset + envelope_size;
4449 if 5 > max_ordinal {
4450 return Ok(());
4451 }
4452
4453 let cur_offset: usize = (5 - 1) * envelope_size;
4456
4457 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4459
4460 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>, fidl::encoding::DefaultFuchsiaResourceDialect>(
4465 self.program_args.as_ref().map(<fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString> as fidl::encoding::ValueTypeMarker>::borrow),
4466 encoder, offset + cur_offset, depth
4467 )?;
4468
4469 _prev_end_offset = cur_offset + envelope_size;
4470 if 6 > max_ordinal {
4471 return Ok(());
4472 }
4473
4474 let cur_offset: usize = (6 - 1) * envelope_size;
4477
4478 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4480
4481 fidl::encoding::encode_in_envelope_optional::<
4486 bool,
4487 fidl::encoding::DefaultFuchsiaResourceDialect,
4488 >(
4489 self.eager.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
4490 encoder,
4491 offset + cur_offset,
4492 depth,
4493 )?;
4494
4495 _prev_end_offset = cur_offset + envelope_size;
4496 if 7 > max_ordinal {
4497 return Ok(());
4498 }
4499
4500 let cur_offset: usize = (7 - 1) * envelope_size;
4503
4504 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4506
4507 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<ChildConfigValue>, fidl::encoding::DefaultFuchsiaResourceDialect>(
4512 self.config_values.as_ref().map(<fidl::encoding::UnboundedVector<ChildConfigValue> as fidl::encoding::ValueTypeMarker>::borrow),
4513 encoder, offset + cur_offset, depth
4514 )?;
4515
4516 _prev_end_offset = cur_offset + envelope_size;
4517
4518 Ok(())
4519 }
4520 }
4521
4522 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for ChildDef {
4523 #[inline(always)]
4524 fn new_empty() -> Self {
4525 Self::default()
4526 }
4527
4528 unsafe fn decode(
4529 &mut self,
4530 decoder: &mut fidl::encoding::Decoder<
4531 '_,
4532 fidl::encoding::DefaultFuchsiaResourceDialect,
4533 >,
4534 offset: usize,
4535 mut depth: fidl::encoding::Depth,
4536 ) -> fidl::Result<()> {
4537 decoder.debug_check_bounds::<Self>(offset);
4538 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4539 None => return Err(fidl::Error::NotNullable),
4540 Some(len) => len,
4541 };
4542 if len == 0 {
4544 return Ok(());
4545 };
4546 depth.increment()?;
4547 let envelope_size = 8;
4548 let bytes_len = len * envelope_size;
4549 let offset = decoder.out_of_line_offset(bytes_len)?;
4550 let mut _next_ordinal_to_read = 0;
4552 let mut next_offset = offset;
4553 let end_offset = offset + bytes_len;
4554 _next_ordinal_to_read += 1;
4555 if next_offset >= end_offset {
4556 return Ok(());
4557 }
4558
4559 while _next_ordinal_to_read < 1 {
4561 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4562 _next_ordinal_to_read += 1;
4563 next_offset += envelope_size;
4564 }
4565
4566 let next_out_of_line = decoder.next_out_of_line();
4567 let handles_before = decoder.remaining_handles();
4568 if let Some((inlined, num_bytes, num_handles)) =
4569 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4570 {
4571 let member_inline_size =
4572 <ChildSource as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4573 if inlined != (member_inline_size <= 4) {
4574 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4575 }
4576 let inner_offset;
4577 let mut inner_depth = depth.clone();
4578 if inlined {
4579 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4580 inner_offset = next_offset;
4581 } else {
4582 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4583 inner_depth.increment()?;
4584 }
4585 let val_ref = self.source.get_or_insert_with(|| {
4586 fidl::new_empty!(ChildSource, fidl::encoding::DefaultFuchsiaResourceDialect)
4587 });
4588 fidl::decode!(
4589 ChildSource,
4590 fidl::encoding::DefaultFuchsiaResourceDialect,
4591 val_ref,
4592 decoder,
4593 inner_offset,
4594 inner_depth
4595 )?;
4596 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4597 {
4598 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4599 }
4600 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4601 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4602 }
4603 }
4604
4605 next_offset += envelope_size;
4606 _next_ordinal_to_read += 1;
4607 if next_offset >= end_offset {
4608 return Ok(());
4609 }
4610
4611 while _next_ordinal_to_read < 2 {
4613 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4614 _next_ordinal_to_read += 1;
4615 next_offset += envelope_size;
4616 }
4617
4618 let next_out_of_line = decoder.next_out_of_line();
4619 let handles_before = decoder.remaining_handles();
4620 if let Some((inlined, num_bytes, num_handles)) =
4621 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4622 {
4623 let member_inline_size =
4624 <fidl::encoding::BoundedString<255> as fidl::encoding::TypeMarker>::inline_size(
4625 decoder.context,
4626 );
4627 if inlined != (member_inline_size <= 4) {
4628 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4629 }
4630 let inner_offset;
4631 let mut inner_depth = depth.clone();
4632 if inlined {
4633 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4634 inner_offset = next_offset;
4635 } else {
4636 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4637 inner_depth.increment()?;
4638 }
4639 let val_ref = self.name.get_or_insert_with(|| {
4640 fidl::new_empty!(
4641 fidl::encoding::BoundedString<255>,
4642 fidl::encoding::DefaultFuchsiaResourceDialect
4643 )
4644 });
4645 fidl::decode!(
4646 fidl::encoding::BoundedString<255>,
4647 fidl::encoding::DefaultFuchsiaResourceDialect,
4648 val_ref,
4649 decoder,
4650 inner_offset,
4651 inner_depth
4652 )?;
4653 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4654 {
4655 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4656 }
4657 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4658 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4659 }
4660 }
4661
4662 next_offset += envelope_size;
4663 _next_ordinal_to_read += 1;
4664 if next_offset >= end_offset {
4665 return Ok(());
4666 }
4667
4668 while _next_ordinal_to_read < 3 {
4670 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4671 _next_ordinal_to_read += 1;
4672 next_offset += envelope_size;
4673 }
4674
4675 let next_out_of_line = decoder.next_out_of_line();
4676 let handles_before = decoder.remaining_handles();
4677 if let Some((inlined, num_bytes, num_handles)) =
4678 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4679 {
4680 let member_inline_size = <fidl::encoding::UnboundedVector<
4681 fidl::encoding::BoundedString<255>,
4682 > as fidl::encoding::TypeMarker>::inline_size(
4683 decoder.context
4684 );
4685 if inlined != (member_inline_size <= 4) {
4686 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4687 }
4688 let inner_offset;
4689 let mut inner_depth = depth.clone();
4690 if inlined {
4691 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4692 inner_offset = next_offset;
4693 } else {
4694 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4695 inner_depth.increment()?;
4696 }
4697 let val_ref = self.exposes.get_or_insert_with(|| {
4698 fidl::new_empty!(
4699 fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<255>>,
4700 fidl::encoding::DefaultFuchsiaResourceDialect
4701 )
4702 });
4703 fidl::decode!(
4704 fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<255>>,
4705 fidl::encoding::DefaultFuchsiaResourceDialect,
4706 val_ref,
4707 decoder,
4708 inner_offset,
4709 inner_depth
4710 )?;
4711 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4712 {
4713 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4714 }
4715 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4716 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4717 }
4718 }
4719
4720 next_offset += envelope_size;
4721 _next_ordinal_to_read += 1;
4722 if next_offset >= end_offset {
4723 return Ok(());
4724 }
4725
4726 while _next_ordinal_to_read < 4 {
4728 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4729 _next_ordinal_to_read += 1;
4730 next_offset += envelope_size;
4731 }
4732
4733 let next_out_of_line = decoder.next_out_of_line();
4734 let handles_before = decoder.remaining_handles();
4735 if let Some((inlined, num_bytes, num_handles)) =
4736 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4737 {
4738 let member_inline_size =
4739 <ChildUses as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4740 if inlined != (member_inline_size <= 4) {
4741 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4742 }
4743 let inner_offset;
4744 let mut inner_depth = depth.clone();
4745 if inlined {
4746 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4747 inner_offset = next_offset;
4748 } else {
4749 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4750 inner_depth.increment()?;
4751 }
4752 let val_ref = self.uses.get_or_insert_with(|| {
4753 fidl::new_empty!(ChildUses, fidl::encoding::DefaultFuchsiaResourceDialect)
4754 });
4755 fidl::decode!(
4756 ChildUses,
4757 fidl::encoding::DefaultFuchsiaResourceDialect,
4758 val_ref,
4759 decoder,
4760 inner_offset,
4761 inner_depth
4762 )?;
4763 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4764 {
4765 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4766 }
4767 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4768 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4769 }
4770 }
4771
4772 next_offset += envelope_size;
4773 _next_ordinal_to_read += 1;
4774 if next_offset >= end_offset {
4775 return Ok(());
4776 }
4777
4778 while _next_ordinal_to_read < 5 {
4780 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4781 _next_ordinal_to_read += 1;
4782 next_offset += envelope_size;
4783 }
4784
4785 let next_out_of_line = decoder.next_out_of_line();
4786 let handles_before = decoder.remaining_handles();
4787 if let Some((inlined, num_bytes, num_handles)) =
4788 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4789 {
4790 let member_inline_size = <fidl::encoding::UnboundedVector<
4791 fidl::encoding::UnboundedString,
4792 > as fidl::encoding::TypeMarker>::inline_size(
4793 decoder.context
4794 );
4795 if inlined != (member_inline_size <= 4) {
4796 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4797 }
4798 let inner_offset;
4799 let mut inner_depth = depth.clone();
4800 if inlined {
4801 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4802 inner_offset = next_offset;
4803 } else {
4804 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4805 inner_depth.increment()?;
4806 }
4807 let val_ref = self.program_args.get_or_insert_with(|| {
4808 fidl::new_empty!(
4809 fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>,
4810 fidl::encoding::DefaultFuchsiaResourceDialect
4811 )
4812 });
4813 fidl::decode!(
4814 fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>,
4815 fidl::encoding::DefaultFuchsiaResourceDialect,
4816 val_ref,
4817 decoder,
4818 inner_offset,
4819 inner_depth
4820 )?;
4821 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4822 {
4823 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4824 }
4825 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4826 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4827 }
4828 }
4829
4830 next_offset += envelope_size;
4831 _next_ordinal_to_read += 1;
4832 if next_offset >= end_offset {
4833 return Ok(());
4834 }
4835
4836 while _next_ordinal_to_read < 6 {
4838 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4839 _next_ordinal_to_read += 1;
4840 next_offset += envelope_size;
4841 }
4842
4843 let next_out_of_line = decoder.next_out_of_line();
4844 let handles_before = decoder.remaining_handles();
4845 if let Some((inlined, num_bytes, num_handles)) =
4846 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4847 {
4848 let member_inline_size =
4849 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4850 if inlined != (member_inline_size <= 4) {
4851 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4852 }
4853 let inner_offset;
4854 let mut inner_depth = depth.clone();
4855 if inlined {
4856 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4857 inner_offset = next_offset;
4858 } else {
4859 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4860 inner_depth.increment()?;
4861 }
4862 let val_ref = self.eager.get_or_insert_with(|| {
4863 fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
4864 });
4865 fidl::decode!(
4866 bool,
4867 fidl::encoding::DefaultFuchsiaResourceDialect,
4868 val_ref,
4869 decoder,
4870 inner_offset,
4871 inner_depth
4872 )?;
4873 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4874 {
4875 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4876 }
4877 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4878 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4879 }
4880 }
4881
4882 next_offset += envelope_size;
4883 _next_ordinal_to_read += 1;
4884 if next_offset >= end_offset {
4885 return Ok(());
4886 }
4887
4888 while _next_ordinal_to_read < 7 {
4890 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4891 _next_ordinal_to_read += 1;
4892 next_offset += envelope_size;
4893 }
4894
4895 let next_out_of_line = decoder.next_out_of_line();
4896 let handles_before = decoder.remaining_handles();
4897 if let Some((inlined, num_bytes, num_handles)) =
4898 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4899 {
4900 let member_inline_size = <fidl::encoding::UnboundedVector<ChildConfigValue> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4901 if inlined != (member_inline_size <= 4) {
4902 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4903 }
4904 let inner_offset;
4905 let mut inner_depth = depth.clone();
4906 if inlined {
4907 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4908 inner_offset = next_offset;
4909 } else {
4910 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4911 inner_depth.increment()?;
4912 }
4913 let val_ref = self.config_values.get_or_insert_with(|| {
4914 fidl::new_empty!(
4915 fidl::encoding::UnboundedVector<ChildConfigValue>,
4916 fidl::encoding::DefaultFuchsiaResourceDialect
4917 )
4918 });
4919 fidl::decode!(
4920 fidl::encoding::UnboundedVector<ChildConfigValue>,
4921 fidl::encoding::DefaultFuchsiaResourceDialect,
4922 val_ref,
4923 decoder,
4924 inner_offset,
4925 inner_depth
4926 )?;
4927 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4928 {
4929 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4930 }
4931 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4932 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4933 }
4934 }
4935
4936 next_offset += envelope_size;
4937
4938 while next_offset < end_offset {
4940 _next_ordinal_to_read += 1;
4941 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4942 next_offset += envelope_size;
4943 }
4944
4945 Ok(())
4946 }
4947 }
4948
4949 impl InterfaceOptions {
4950 #[inline(always)]
4951 fn max_ordinal_present(&self) -> u64 {
4952 if let Some(_) = self.ipv6_multicast_neighbor_solicitations {
4953 return 9;
4954 }
4955 if let Some(_) = self.ipv4_multicast_neighbor_solicitations {
4956 return 8;
4957 }
4958 if let Some(_) = self.enable_ipv6_forwarding {
4959 return 7;
4960 }
4961 if let Some(_) = self.enable_ipv4_forwarding {
4962 return 6;
4963 }
4964 if let Some(_) = self.gateway {
4965 return 5;
4966 }
4967 if let Some(_) = self.static_ips {
4968 return 4;
4969 }
4970 if let Some(_) = self.without_autogenerated_addresses {
4971 return 3;
4972 }
4973 if let Some(_) = self.device {
4974 return 2;
4975 }
4976 if let Some(_) = self.name {
4977 return 1;
4978 }
4979 0
4980 }
4981 }
4982
4983 impl fidl::encoding::ResourceTypeMarker for InterfaceOptions {
4984 type Borrowed<'a> = &'a mut Self;
4985 fn take_or_borrow<'a>(
4986 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4987 ) -> Self::Borrowed<'a> {
4988 value
4989 }
4990 }
4991
4992 unsafe impl fidl::encoding::TypeMarker for InterfaceOptions {
4993 type Owned = Self;
4994
4995 #[inline(always)]
4996 fn inline_align(_context: fidl::encoding::Context) -> usize {
4997 8
4998 }
4999
5000 #[inline(always)]
5001 fn inline_size(_context: fidl::encoding::Context) -> usize {
5002 16
5003 }
5004 }
5005
5006 unsafe impl
5007 fidl::encoding::Encode<InterfaceOptions, fidl::encoding::DefaultFuchsiaResourceDialect>
5008 for &mut InterfaceOptions
5009 {
5010 unsafe fn encode(
5011 self,
5012 encoder: &mut fidl::encoding::Encoder<
5013 '_,
5014 fidl::encoding::DefaultFuchsiaResourceDialect,
5015 >,
5016 offset: usize,
5017 mut depth: fidl::encoding::Depth,
5018 ) -> fidl::Result<()> {
5019 encoder.debug_check_bounds::<InterfaceOptions>(offset);
5020 let max_ordinal: u64 = self.max_ordinal_present();
5022 encoder.write_num(max_ordinal, offset);
5023 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5024 if max_ordinal == 0 {
5026 return Ok(());
5027 }
5028 depth.increment()?;
5029 let envelope_size = 8;
5030 let bytes_len = max_ordinal as usize * envelope_size;
5031 #[allow(unused_variables)]
5032 let offset = encoder.out_of_line_offset(bytes_len);
5033 let mut _prev_end_offset: usize = 0;
5034 if 1 > max_ordinal {
5035 return Ok(());
5036 }
5037
5038 let cur_offset: usize = (1 - 1) * envelope_size;
5041
5042 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5044
5045 fidl::encoding::encode_in_envelope_optional::<
5050 fidl::encoding::UnboundedString,
5051 fidl::encoding::DefaultFuchsiaResourceDialect,
5052 >(
5053 self.name.as_ref().map(
5054 <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow,
5055 ),
5056 encoder,
5057 offset + cur_offset,
5058 depth,
5059 )?;
5060
5061 _prev_end_offset = cur_offset + envelope_size;
5062 if 2 > max_ordinal {
5063 return Ok(());
5064 }
5065
5066 let cur_offset: usize = (2 - 1) * envelope_size;
5069
5070 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5072
5073 fidl::encoding::encode_in_envelope_optional::<
5078 fidl::encoding::Endpoint<
5079 fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_network::PortMarker>,
5080 >,
5081 fidl::encoding::DefaultFuchsiaResourceDialect,
5082 >(
5083 self.device.as_mut().map(
5084 <fidl::encoding::Endpoint<
5085 fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_network::PortMarker>,
5086 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
5087 ),
5088 encoder,
5089 offset + cur_offset,
5090 depth,
5091 )?;
5092
5093 _prev_end_offset = cur_offset + envelope_size;
5094 if 3 > max_ordinal {
5095 return Ok(());
5096 }
5097
5098 let cur_offset: usize = (3 - 1) * envelope_size;
5101
5102 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5104
5105 fidl::encoding::encode_in_envelope_optional::<
5110 bool,
5111 fidl::encoding::DefaultFuchsiaResourceDialect,
5112 >(
5113 self.without_autogenerated_addresses
5114 .as_ref()
5115 .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
5116 encoder,
5117 offset + cur_offset,
5118 depth,
5119 )?;
5120
5121 _prev_end_offset = cur_offset + envelope_size;
5122 if 4 > max_ordinal {
5123 return Ok(());
5124 }
5125
5126 let cur_offset: usize = (4 - 1) * envelope_size;
5129
5130 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5132
5133 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<fidl_fuchsia_net::Subnet>, fidl::encoding::DefaultFuchsiaResourceDialect>(
5138 self.static_ips.as_ref().map(<fidl::encoding::UnboundedVector<fidl_fuchsia_net::Subnet> as fidl::encoding::ValueTypeMarker>::borrow),
5139 encoder, offset + cur_offset, depth
5140 )?;
5141
5142 _prev_end_offset = cur_offset + envelope_size;
5143 if 5 > max_ordinal {
5144 return Ok(());
5145 }
5146
5147 let cur_offset: usize = (5 - 1) * envelope_size;
5150
5151 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5153
5154 fidl::encoding::encode_in_envelope_optional::<
5159 fidl_fuchsia_net::IpAddress,
5160 fidl::encoding::DefaultFuchsiaResourceDialect,
5161 >(
5162 self.gateway
5163 .as_ref()
5164 .map(<fidl_fuchsia_net::IpAddress as fidl::encoding::ValueTypeMarker>::borrow),
5165 encoder,
5166 offset + cur_offset,
5167 depth,
5168 )?;
5169
5170 _prev_end_offset = cur_offset + envelope_size;
5171 if 6 > max_ordinal {
5172 return Ok(());
5173 }
5174
5175 let cur_offset: usize = (6 - 1) * envelope_size;
5178
5179 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5181
5182 fidl::encoding::encode_in_envelope_optional::<
5187 bool,
5188 fidl::encoding::DefaultFuchsiaResourceDialect,
5189 >(
5190 self.enable_ipv4_forwarding
5191 .as_ref()
5192 .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
5193 encoder,
5194 offset + cur_offset,
5195 depth,
5196 )?;
5197
5198 _prev_end_offset = cur_offset + envelope_size;
5199 if 7 > max_ordinal {
5200 return Ok(());
5201 }
5202
5203 let cur_offset: usize = (7 - 1) * envelope_size;
5206
5207 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5209
5210 fidl::encoding::encode_in_envelope_optional::<
5215 bool,
5216 fidl::encoding::DefaultFuchsiaResourceDialect,
5217 >(
5218 self.enable_ipv6_forwarding
5219 .as_ref()
5220 .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
5221 encoder,
5222 offset + cur_offset,
5223 depth,
5224 )?;
5225
5226 _prev_end_offset = cur_offset + envelope_size;
5227 if 8 > max_ordinal {
5228 return Ok(());
5229 }
5230
5231 let cur_offset: usize = (8 - 1) * envelope_size;
5234
5235 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5237
5238 fidl::encoding::encode_in_envelope_optional::<
5243 u16,
5244 fidl::encoding::DefaultFuchsiaResourceDialect,
5245 >(
5246 self.ipv4_multicast_neighbor_solicitations
5247 .as_ref()
5248 .map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
5249 encoder,
5250 offset + cur_offset,
5251 depth,
5252 )?;
5253
5254 _prev_end_offset = cur_offset + envelope_size;
5255 if 9 > max_ordinal {
5256 return Ok(());
5257 }
5258
5259 let cur_offset: usize = (9 - 1) * envelope_size;
5262
5263 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5265
5266 fidl::encoding::encode_in_envelope_optional::<
5271 u16,
5272 fidl::encoding::DefaultFuchsiaResourceDialect,
5273 >(
5274 self.ipv6_multicast_neighbor_solicitations
5275 .as_ref()
5276 .map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
5277 encoder,
5278 offset + cur_offset,
5279 depth,
5280 )?;
5281
5282 _prev_end_offset = cur_offset + envelope_size;
5283
5284 Ok(())
5285 }
5286 }
5287
5288 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5289 for InterfaceOptions
5290 {
5291 #[inline(always)]
5292 fn new_empty() -> Self {
5293 Self::default()
5294 }
5295
5296 unsafe fn decode(
5297 &mut self,
5298 decoder: &mut fidl::encoding::Decoder<
5299 '_,
5300 fidl::encoding::DefaultFuchsiaResourceDialect,
5301 >,
5302 offset: usize,
5303 mut depth: fidl::encoding::Depth,
5304 ) -> fidl::Result<()> {
5305 decoder.debug_check_bounds::<Self>(offset);
5306 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5307 None => return Err(fidl::Error::NotNullable),
5308 Some(len) => len,
5309 };
5310 if len == 0 {
5312 return Ok(());
5313 };
5314 depth.increment()?;
5315 let envelope_size = 8;
5316 let bytes_len = len * envelope_size;
5317 let offset = decoder.out_of_line_offset(bytes_len)?;
5318 let mut _next_ordinal_to_read = 0;
5320 let mut next_offset = offset;
5321 let end_offset = offset + bytes_len;
5322 _next_ordinal_to_read += 1;
5323 if next_offset >= end_offset {
5324 return Ok(());
5325 }
5326
5327 while _next_ordinal_to_read < 1 {
5329 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5330 _next_ordinal_to_read += 1;
5331 next_offset += envelope_size;
5332 }
5333
5334 let next_out_of_line = decoder.next_out_of_line();
5335 let handles_before = decoder.remaining_handles();
5336 if let Some((inlined, num_bytes, num_handles)) =
5337 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5338 {
5339 let member_inline_size =
5340 <fidl::encoding::UnboundedString as fidl::encoding::TypeMarker>::inline_size(
5341 decoder.context,
5342 );
5343 if inlined != (member_inline_size <= 4) {
5344 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5345 }
5346 let inner_offset;
5347 let mut inner_depth = depth.clone();
5348 if inlined {
5349 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5350 inner_offset = next_offset;
5351 } else {
5352 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5353 inner_depth.increment()?;
5354 }
5355 let val_ref = self.name.get_or_insert_with(|| {
5356 fidl::new_empty!(
5357 fidl::encoding::UnboundedString,
5358 fidl::encoding::DefaultFuchsiaResourceDialect
5359 )
5360 });
5361 fidl::decode!(
5362 fidl::encoding::UnboundedString,
5363 fidl::encoding::DefaultFuchsiaResourceDialect,
5364 val_ref,
5365 decoder,
5366 inner_offset,
5367 inner_depth
5368 )?;
5369 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5370 {
5371 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5372 }
5373 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5374 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5375 }
5376 }
5377
5378 next_offset += envelope_size;
5379 _next_ordinal_to_read += 1;
5380 if next_offset >= end_offset {
5381 return Ok(());
5382 }
5383
5384 while _next_ordinal_to_read < 2 {
5386 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5387 _next_ordinal_to_read += 1;
5388 next_offset += envelope_size;
5389 }
5390
5391 let next_out_of_line = decoder.next_out_of_line();
5392 let handles_before = decoder.remaining_handles();
5393 if let Some((inlined, num_bytes, num_handles)) =
5394 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5395 {
5396 let member_inline_size = <fidl::encoding::Endpoint<
5397 fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_network::PortMarker>,
5398 > as fidl::encoding::TypeMarker>::inline_size(
5399 decoder.context
5400 );
5401 if inlined != (member_inline_size <= 4) {
5402 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5403 }
5404 let inner_offset;
5405 let mut inner_depth = depth.clone();
5406 if inlined {
5407 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5408 inner_offset = next_offset;
5409 } else {
5410 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5411 inner_depth.increment()?;
5412 }
5413 let val_ref = self.device.get_or_insert_with(|| {
5414 fidl::new_empty!(
5415 fidl::encoding::Endpoint<
5416 fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_network::PortMarker>,
5417 >,
5418 fidl::encoding::DefaultFuchsiaResourceDialect
5419 )
5420 });
5421 fidl::decode!(
5422 fidl::encoding::Endpoint<
5423 fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_network::PortMarker>,
5424 >,
5425 fidl::encoding::DefaultFuchsiaResourceDialect,
5426 val_ref,
5427 decoder,
5428 inner_offset,
5429 inner_depth
5430 )?;
5431 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5432 {
5433 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5434 }
5435 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5436 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5437 }
5438 }
5439
5440 next_offset += envelope_size;
5441 _next_ordinal_to_read += 1;
5442 if next_offset >= end_offset {
5443 return Ok(());
5444 }
5445
5446 while _next_ordinal_to_read < 3 {
5448 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5449 _next_ordinal_to_read += 1;
5450 next_offset += envelope_size;
5451 }
5452
5453 let next_out_of_line = decoder.next_out_of_line();
5454 let handles_before = decoder.remaining_handles();
5455 if let Some((inlined, num_bytes, num_handles)) =
5456 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5457 {
5458 let member_inline_size =
5459 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5460 if inlined != (member_inline_size <= 4) {
5461 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5462 }
5463 let inner_offset;
5464 let mut inner_depth = depth.clone();
5465 if inlined {
5466 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5467 inner_offset = next_offset;
5468 } else {
5469 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5470 inner_depth.increment()?;
5471 }
5472 let val_ref = self.without_autogenerated_addresses.get_or_insert_with(|| {
5473 fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
5474 });
5475 fidl::decode!(
5476 bool,
5477 fidl::encoding::DefaultFuchsiaResourceDialect,
5478 val_ref,
5479 decoder,
5480 inner_offset,
5481 inner_depth
5482 )?;
5483 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5484 {
5485 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5486 }
5487 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5488 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5489 }
5490 }
5491
5492 next_offset += envelope_size;
5493 _next_ordinal_to_read += 1;
5494 if next_offset >= end_offset {
5495 return Ok(());
5496 }
5497
5498 while _next_ordinal_to_read < 4 {
5500 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5501 _next_ordinal_to_read += 1;
5502 next_offset += envelope_size;
5503 }
5504
5505 let next_out_of_line = decoder.next_out_of_line();
5506 let handles_before = decoder.remaining_handles();
5507 if let Some((inlined, num_bytes, num_handles)) =
5508 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5509 {
5510 let member_inline_size = <fidl::encoding::UnboundedVector<fidl_fuchsia_net::Subnet> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5511 if inlined != (member_inline_size <= 4) {
5512 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5513 }
5514 let inner_offset;
5515 let mut inner_depth = depth.clone();
5516 if inlined {
5517 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5518 inner_offset = next_offset;
5519 } else {
5520 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5521 inner_depth.increment()?;
5522 }
5523 let val_ref = self.static_ips.get_or_insert_with(|| {
5524 fidl::new_empty!(
5525 fidl::encoding::UnboundedVector<fidl_fuchsia_net::Subnet>,
5526 fidl::encoding::DefaultFuchsiaResourceDialect
5527 )
5528 });
5529 fidl::decode!(
5530 fidl::encoding::UnboundedVector<fidl_fuchsia_net::Subnet>,
5531 fidl::encoding::DefaultFuchsiaResourceDialect,
5532 val_ref,
5533 decoder,
5534 inner_offset,
5535 inner_depth
5536 )?;
5537 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5538 {
5539 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5540 }
5541 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5542 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5543 }
5544 }
5545
5546 next_offset += envelope_size;
5547 _next_ordinal_to_read += 1;
5548 if next_offset >= end_offset {
5549 return Ok(());
5550 }
5551
5552 while _next_ordinal_to_read < 5 {
5554 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5555 _next_ordinal_to_read += 1;
5556 next_offset += envelope_size;
5557 }
5558
5559 let next_out_of_line = decoder.next_out_of_line();
5560 let handles_before = decoder.remaining_handles();
5561 if let Some((inlined, num_bytes, num_handles)) =
5562 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5563 {
5564 let member_inline_size =
5565 <fidl_fuchsia_net::IpAddress as fidl::encoding::TypeMarker>::inline_size(
5566 decoder.context,
5567 );
5568 if inlined != (member_inline_size <= 4) {
5569 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5570 }
5571 let inner_offset;
5572 let mut inner_depth = depth.clone();
5573 if inlined {
5574 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5575 inner_offset = next_offset;
5576 } else {
5577 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5578 inner_depth.increment()?;
5579 }
5580 let val_ref = self.gateway.get_or_insert_with(|| {
5581 fidl::new_empty!(
5582 fidl_fuchsia_net::IpAddress,
5583 fidl::encoding::DefaultFuchsiaResourceDialect
5584 )
5585 });
5586 fidl::decode!(
5587 fidl_fuchsia_net::IpAddress,
5588 fidl::encoding::DefaultFuchsiaResourceDialect,
5589 val_ref,
5590 decoder,
5591 inner_offset,
5592 inner_depth
5593 )?;
5594 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5595 {
5596 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5597 }
5598 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5599 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5600 }
5601 }
5602
5603 next_offset += envelope_size;
5604 _next_ordinal_to_read += 1;
5605 if next_offset >= end_offset {
5606 return Ok(());
5607 }
5608
5609 while _next_ordinal_to_read < 6 {
5611 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5612 _next_ordinal_to_read += 1;
5613 next_offset += envelope_size;
5614 }
5615
5616 let next_out_of_line = decoder.next_out_of_line();
5617 let handles_before = decoder.remaining_handles();
5618 if let Some((inlined, num_bytes, num_handles)) =
5619 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5620 {
5621 let member_inline_size =
5622 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5623 if inlined != (member_inline_size <= 4) {
5624 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5625 }
5626 let inner_offset;
5627 let mut inner_depth = depth.clone();
5628 if inlined {
5629 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5630 inner_offset = next_offset;
5631 } else {
5632 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5633 inner_depth.increment()?;
5634 }
5635 let val_ref = self.enable_ipv4_forwarding.get_or_insert_with(|| {
5636 fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
5637 });
5638 fidl::decode!(
5639 bool,
5640 fidl::encoding::DefaultFuchsiaResourceDialect,
5641 val_ref,
5642 decoder,
5643 inner_offset,
5644 inner_depth
5645 )?;
5646 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5647 {
5648 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5649 }
5650 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5651 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5652 }
5653 }
5654
5655 next_offset += envelope_size;
5656 _next_ordinal_to_read += 1;
5657 if next_offset >= end_offset {
5658 return Ok(());
5659 }
5660
5661 while _next_ordinal_to_read < 7 {
5663 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5664 _next_ordinal_to_read += 1;
5665 next_offset += envelope_size;
5666 }
5667
5668 let next_out_of_line = decoder.next_out_of_line();
5669 let handles_before = decoder.remaining_handles();
5670 if let Some((inlined, num_bytes, num_handles)) =
5671 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5672 {
5673 let member_inline_size =
5674 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5675 if inlined != (member_inline_size <= 4) {
5676 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5677 }
5678 let inner_offset;
5679 let mut inner_depth = depth.clone();
5680 if inlined {
5681 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5682 inner_offset = next_offset;
5683 } else {
5684 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5685 inner_depth.increment()?;
5686 }
5687 let val_ref = self.enable_ipv6_forwarding.get_or_insert_with(|| {
5688 fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
5689 });
5690 fidl::decode!(
5691 bool,
5692 fidl::encoding::DefaultFuchsiaResourceDialect,
5693 val_ref,
5694 decoder,
5695 inner_offset,
5696 inner_depth
5697 )?;
5698 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5699 {
5700 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5701 }
5702 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5703 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5704 }
5705 }
5706
5707 next_offset += envelope_size;
5708 _next_ordinal_to_read += 1;
5709 if next_offset >= end_offset {
5710 return Ok(());
5711 }
5712
5713 while _next_ordinal_to_read < 8 {
5715 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5716 _next_ordinal_to_read += 1;
5717 next_offset += envelope_size;
5718 }
5719
5720 let next_out_of_line = decoder.next_out_of_line();
5721 let handles_before = decoder.remaining_handles();
5722 if let Some((inlined, num_bytes, num_handles)) =
5723 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5724 {
5725 let member_inline_size =
5726 <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5727 if inlined != (member_inline_size <= 4) {
5728 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5729 }
5730 let inner_offset;
5731 let mut inner_depth = depth.clone();
5732 if inlined {
5733 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5734 inner_offset = next_offset;
5735 } else {
5736 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5737 inner_depth.increment()?;
5738 }
5739 let val_ref = self.ipv4_multicast_neighbor_solicitations.get_or_insert_with(|| {
5740 fidl::new_empty!(u16, fidl::encoding::DefaultFuchsiaResourceDialect)
5741 });
5742 fidl::decode!(
5743 u16,
5744 fidl::encoding::DefaultFuchsiaResourceDialect,
5745 val_ref,
5746 decoder,
5747 inner_offset,
5748 inner_depth
5749 )?;
5750 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5751 {
5752 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5753 }
5754 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5755 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5756 }
5757 }
5758
5759 next_offset += envelope_size;
5760 _next_ordinal_to_read += 1;
5761 if next_offset >= end_offset {
5762 return Ok(());
5763 }
5764
5765 while _next_ordinal_to_read < 9 {
5767 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5768 _next_ordinal_to_read += 1;
5769 next_offset += envelope_size;
5770 }
5771
5772 let next_out_of_line = decoder.next_out_of_line();
5773 let handles_before = decoder.remaining_handles();
5774 if let Some((inlined, num_bytes, num_handles)) =
5775 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5776 {
5777 let member_inline_size =
5778 <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5779 if inlined != (member_inline_size <= 4) {
5780 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5781 }
5782 let inner_offset;
5783 let mut inner_depth = depth.clone();
5784 if inlined {
5785 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5786 inner_offset = next_offset;
5787 } else {
5788 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5789 inner_depth.increment()?;
5790 }
5791 let val_ref = self.ipv6_multicast_neighbor_solicitations.get_or_insert_with(|| {
5792 fidl::new_empty!(u16, fidl::encoding::DefaultFuchsiaResourceDialect)
5793 });
5794 fidl::decode!(
5795 u16,
5796 fidl::encoding::DefaultFuchsiaResourceDialect,
5797 val_ref,
5798 decoder,
5799 inner_offset,
5800 inner_depth
5801 )?;
5802 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5803 {
5804 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5805 }
5806 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5807 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5808 }
5809 }
5810
5811 next_offset += envelope_size;
5812
5813 while next_offset < end_offset {
5815 _next_ordinal_to_read += 1;
5816 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5817 next_offset += envelope_size;
5818 }
5819
5820 Ok(())
5821 }
5822 }
5823
5824 impl RealmOptions {
5825 #[inline(always)]
5826 fn max_ordinal_present(&self) -> u64 {
5827 if let Some(_) = self.children {
5828 return 2;
5829 }
5830 if let Some(_) = self.name {
5831 return 1;
5832 }
5833 0
5834 }
5835 }
5836
5837 impl fidl::encoding::ResourceTypeMarker for RealmOptions {
5838 type Borrowed<'a> = &'a mut Self;
5839 fn take_or_borrow<'a>(
5840 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5841 ) -> Self::Borrowed<'a> {
5842 value
5843 }
5844 }
5845
5846 unsafe impl fidl::encoding::TypeMarker for RealmOptions {
5847 type Owned = Self;
5848
5849 #[inline(always)]
5850 fn inline_align(_context: fidl::encoding::Context) -> usize {
5851 8
5852 }
5853
5854 #[inline(always)]
5855 fn inline_size(_context: fidl::encoding::Context) -> usize {
5856 16
5857 }
5858 }
5859
5860 unsafe impl fidl::encoding::Encode<RealmOptions, fidl::encoding::DefaultFuchsiaResourceDialect>
5861 for &mut RealmOptions
5862 {
5863 unsafe fn encode(
5864 self,
5865 encoder: &mut fidl::encoding::Encoder<
5866 '_,
5867 fidl::encoding::DefaultFuchsiaResourceDialect,
5868 >,
5869 offset: usize,
5870 mut depth: fidl::encoding::Depth,
5871 ) -> fidl::Result<()> {
5872 encoder.debug_check_bounds::<RealmOptions>(offset);
5873 let max_ordinal: u64 = self.max_ordinal_present();
5875 encoder.write_num(max_ordinal, offset);
5876 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5877 if max_ordinal == 0 {
5879 return Ok(());
5880 }
5881 depth.increment()?;
5882 let envelope_size = 8;
5883 let bytes_len = max_ordinal as usize * envelope_size;
5884 #[allow(unused_variables)]
5885 let offset = encoder.out_of_line_offset(bytes_len);
5886 let mut _prev_end_offset: usize = 0;
5887 if 1 > max_ordinal {
5888 return Ok(());
5889 }
5890
5891 let cur_offset: usize = (1 - 1) * envelope_size;
5894
5895 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5897
5898 fidl::encoding::encode_in_envelope_optional::<
5903 fidl::encoding::UnboundedString,
5904 fidl::encoding::DefaultFuchsiaResourceDialect,
5905 >(
5906 self.name.as_ref().map(
5907 <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow,
5908 ),
5909 encoder,
5910 offset + cur_offset,
5911 depth,
5912 )?;
5913
5914 _prev_end_offset = cur_offset + envelope_size;
5915 if 2 > max_ordinal {
5916 return Ok(());
5917 }
5918
5919 let cur_offset: usize = (2 - 1) * envelope_size;
5922
5923 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5925
5926 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<ChildDef>, fidl::encoding::DefaultFuchsiaResourceDialect>(
5931 self.children.as_mut().map(<fidl::encoding::UnboundedVector<ChildDef> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
5932 encoder, offset + cur_offset, depth
5933 )?;
5934
5935 _prev_end_offset = cur_offset + envelope_size;
5936
5937 Ok(())
5938 }
5939 }
5940
5941 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for RealmOptions {
5942 #[inline(always)]
5943 fn new_empty() -> Self {
5944 Self::default()
5945 }
5946
5947 unsafe fn decode(
5948 &mut self,
5949 decoder: &mut fidl::encoding::Decoder<
5950 '_,
5951 fidl::encoding::DefaultFuchsiaResourceDialect,
5952 >,
5953 offset: usize,
5954 mut depth: fidl::encoding::Depth,
5955 ) -> fidl::Result<()> {
5956 decoder.debug_check_bounds::<Self>(offset);
5957 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5958 None => return Err(fidl::Error::NotNullable),
5959 Some(len) => len,
5960 };
5961 if len == 0 {
5963 return Ok(());
5964 };
5965 depth.increment()?;
5966 let envelope_size = 8;
5967 let bytes_len = len * envelope_size;
5968 let offset = decoder.out_of_line_offset(bytes_len)?;
5969 let mut _next_ordinal_to_read = 0;
5971 let mut next_offset = offset;
5972 let end_offset = offset + bytes_len;
5973 _next_ordinal_to_read += 1;
5974 if next_offset >= end_offset {
5975 return Ok(());
5976 }
5977
5978 while _next_ordinal_to_read < 1 {
5980 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5981 _next_ordinal_to_read += 1;
5982 next_offset += envelope_size;
5983 }
5984
5985 let next_out_of_line = decoder.next_out_of_line();
5986 let handles_before = decoder.remaining_handles();
5987 if let Some((inlined, num_bytes, num_handles)) =
5988 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5989 {
5990 let member_inline_size =
5991 <fidl::encoding::UnboundedString as fidl::encoding::TypeMarker>::inline_size(
5992 decoder.context,
5993 );
5994 if inlined != (member_inline_size <= 4) {
5995 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5996 }
5997 let inner_offset;
5998 let mut inner_depth = depth.clone();
5999 if inlined {
6000 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6001 inner_offset = next_offset;
6002 } else {
6003 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6004 inner_depth.increment()?;
6005 }
6006 let val_ref = self.name.get_or_insert_with(|| {
6007 fidl::new_empty!(
6008 fidl::encoding::UnboundedString,
6009 fidl::encoding::DefaultFuchsiaResourceDialect
6010 )
6011 });
6012 fidl::decode!(
6013 fidl::encoding::UnboundedString,
6014 fidl::encoding::DefaultFuchsiaResourceDialect,
6015 val_ref,
6016 decoder,
6017 inner_offset,
6018 inner_depth
6019 )?;
6020 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6021 {
6022 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6023 }
6024 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6025 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6026 }
6027 }
6028
6029 next_offset += envelope_size;
6030 _next_ordinal_to_read += 1;
6031 if next_offset >= end_offset {
6032 return Ok(());
6033 }
6034
6035 while _next_ordinal_to_read < 2 {
6037 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6038 _next_ordinal_to_read += 1;
6039 next_offset += envelope_size;
6040 }
6041
6042 let next_out_of_line = decoder.next_out_of_line();
6043 let handles_before = decoder.remaining_handles();
6044 if let Some((inlined, num_bytes, num_handles)) =
6045 fidl::encoding::decode_envelope_header(decoder, next_offset)?
6046 {
6047 let member_inline_size = <fidl::encoding::UnboundedVector<ChildDef> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6048 if inlined != (member_inline_size <= 4) {
6049 return Err(fidl::Error::InvalidInlineBitInEnvelope);
6050 }
6051 let inner_offset;
6052 let mut inner_depth = depth.clone();
6053 if inlined {
6054 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6055 inner_offset = next_offset;
6056 } else {
6057 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6058 inner_depth.increment()?;
6059 }
6060 let val_ref = self.children.get_or_insert_with(|| {
6061 fidl::new_empty!(
6062 fidl::encoding::UnboundedVector<ChildDef>,
6063 fidl::encoding::DefaultFuchsiaResourceDialect
6064 )
6065 });
6066 fidl::decode!(
6067 fidl::encoding::UnboundedVector<ChildDef>,
6068 fidl::encoding::DefaultFuchsiaResourceDialect,
6069 val_ref,
6070 decoder,
6071 inner_offset,
6072 inner_depth
6073 )?;
6074 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6075 {
6076 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6077 }
6078 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6079 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6080 }
6081 }
6082
6083 next_offset += envelope_size;
6084
6085 while next_offset < end_offset {
6087 _next_ordinal_to_read += 1;
6088 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6089 next_offset += envelope_size;
6090 }
6091
6092 Ok(())
6093 }
6094 }
6095
6096 impl fidl::encoding::ResourceTypeMarker for ChildSource {
6097 type Borrowed<'a> = &'a mut Self;
6098 fn take_or_borrow<'a>(
6099 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6100 ) -> Self::Borrowed<'a> {
6101 value
6102 }
6103 }
6104
6105 unsafe impl fidl::encoding::TypeMarker for ChildSource {
6106 type Owned = Self;
6107
6108 #[inline(always)]
6109 fn inline_align(_context: fidl::encoding::Context) -> usize {
6110 8
6111 }
6112
6113 #[inline(always)]
6114 fn inline_size(_context: fidl::encoding::Context) -> usize {
6115 16
6116 }
6117 }
6118
6119 unsafe impl fidl::encoding::Encode<ChildSource, fidl::encoding::DefaultFuchsiaResourceDialect>
6120 for &mut ChildSource
6121 {
6122 #[inline]
6123 unsafe fn encode(
6124 self,
6125 encoder: &mut fidl::encoding::Encoder<
6126 '_,
6127 fidl::encoding::DefaultFuchsiaResourceDialect,
6128 >,
6129 offset: usize,
6130 _depth: fidl::encoding::Depth,
6131 ) -> fidl::Result<()> {
6132 encoder.debug_check_bounds::<ChildSource>(offset);
6133 encoder.write_num::<u64>(self.ordinal(), offset);
6134 match self {
6135 ChildSource::Component(ref val) => {
6136 fidl::encoding::encode_in_envelope::<fidl::encoding::BoundedString<4096>, fidl::encoding::DefaultFuchsiaResourceDialect>(
6137 <fidl::encoding::BoundedString<4096> as fidl::encoding::ValueTypeMarker>::borrow(val),
6138 encoder, offset + 8, _depth
6139 )
6140 }
6141 ChildSource::Mock(ref mut val) => {
6142 fidl::encoding::encode_in_envelope::<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
6143 <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
6144 encoder, offset + 8, _depth
6145 )
6146 }
6147 }
6148 }
6149 }
6150
6151 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for ChildSource {
6152 #[inline(always)]
6153 fn new_empty() -> Self {
6154 Self::Component(fidl::new_empty!(
6155 fidl::encoding::BoundedString<4096>,
6156 fidl::encoding::DefaultFuchsiaResourceDialect
6157 ))
6158 }
6159
6160 #[inline]
6161 unsafe fn decode(
6162 &mut self,
6163 decoder: &mut fidl::encoding::Decoder<
6164 '_,
6165 fidl::encoding::DefaultFuchsiaResourceDialect,
6166 >,
6167 offset: usize,
6168 mut depth: fidl::encoding::Depth,
6169 ) -> fidl::Result<()> {
6170 decoder.debug_check_bounds::<Self>(offset);
6171 #[allow(unused_variables)]
6172 let next_out_of_line = decoder.next_out_of_line();
6173 let handles_before = decoder.remaining_handles();
6174 let (ordinal, inlined, num_bytes, num_handles) =
6175 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
6176
6177 let member_inline_size = match ordinal {
6178 1 => {
6179 <fidl::encoding::BoundedString<4096> as fidl::encoding::TypeMarker>::inline_size(
6180 decoder.context,
6181 )
6182 }
6183 2 => <fidl::encoding::Endpoint<
6184 fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
6185 > as fidl::encoding::TypeMarker>::inline_size(decoder.context),
6186 _ => return Err(fidl::Error::UnknownUnionTag),
6187 };
6188
6189 if inlined != (member_inline_size <= 4) {
6190 return Err(fidl::Error::InvalidInlineBitInEnvelope);
6191 }
6192 let _inner_offset;
6193 if inlined {
6194 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
6195 _inner_offset = offset + 8;
6196 } else {
6197 depth.increment()?;
6198 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6199 }
6200 match ordinal {
6201 1 => {
6202 #[allow(irrefutable_let_patterns)]
6203 if let ChildSource::Component(_) = self {
6204 } else {
6206 *self = ChildSource::Component(fidl::new_empty!(
6208 fidl::encoding::BoundedString<4096>,
6209 fidl::encoding::DefaultFuchsiaResourceDialect
6210 ));
6211 }
6212 #[allow(irrefutable_let_patterns)]
6213 if let ChildSource::Component(ref mut val) = self {
6214 fidl::decode!(
6215 fidl::encoding::BoundedString<4096>,
6216 fidl::encoding::DefaultFuchsiaResourceDialect,
6217 val,
6218 decoder,
6219 _inner_offset,
6220 depth
6221 )?;
6222 } else {
6223 unreachable!()
6224 }
6225 }
6226 2 => {
6227 #[allow(irrefutable_let_patterns)]
6228 if let ChildSource::Mock(_) = self {
6229 } else {
6231 *self = ChildSource::Mock(fidl::new_empty!(
6233 fidl::encoding::Endpoint<
6234 fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
6235 >,
6236 fidl::encoding::DefaultFuchsiaResourceDialect
6237 ));
6238 }
6239 #[allow(irrefutable_let_patterns)]
6240 if let ChildSource::Mock(ref mut val) = self {
6241 fidl::decode!(
6242 fidl::encoding::Endpoint<
6243 fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
6244 >,
6245 fidl::encoding::DefaultFuchsiaResourceDialect,
6246 val,
6247 decoder,
6248 _inner_offset,
6249 depth
6250 )?;
6251 } else {
6252 unreachable!()
6253 }
6254 }
6255 ordinal => panic!("unexpected ordinal {:?}", ordinal),
6256 }
6257 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
6258 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6259 }
6260 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6261 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6262 }
6263 Ok(())
6264 }
6265 }
6266}