#![warn(clippy::all)]
#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
use bitflags::bitflags;
use fidl::client::QueryResponseFut;
use fidl::endpoints::{ControlHandle as _, Responder as _};
use fuchsia_zircon_status as zx_status;
use futures::future::{self, MaybeDone, TryFutureExt};
#[cfg(target_os = "fuchsia")]
use fuchsia_zircon as zx;
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(u32)]
pub enum ConfigurationError {
InvalidArguments = 1,
RejectedByNetstack = 2,
Internal = 4294967295,
}
impl ConfigurationError {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::InvalidArguments),
2 => Some(Self::RejectedByNetstack),
4294967295 => Some(Self::Internal),
_ => None,
}
}
#[inline]
pub const fn into_primitive(self) -> u32 {
self as u32
}
#[deprecated = "Strict enums should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(u8)]
pub enum StorageVariant {
Data = 0,
Cache = 1,
Tmp = 2,
}
impl StorageVariant {
#[inline]
pub fn from_primitive(prim: u8) -> Option<Self> {
match prim {
0 => Some(Self::Data),
1 => Some(Self::Cache),
2 => Some(Self::Tmp),
_ => None,
}
}
#[inline]
pub const fn into_primitive(self) -> u8 {
self as u8
}
#[deprecated = "Strict enums should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct Empty;
impl fidl::Persistable for Empty {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ManagedRealmAddDeviceRequest {
pub path: String,
pub device: fidl::endpoints::ClientEnd<fidl_fuchsia_netemul_network::DeviceProxy_Marker>,
}
impl fidl::Standalone for ManagedRealmAddDeviceRequest {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ManagedRealmConnectToProtocolRequest {
pub protocol_name: String,
pub child_name: Option<String>,
pub req: fidl::Channel,
}
impl fidl::Standalone for ManagedRealmConnectToProtocolRequest {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ManagedRealmGetDevfsRequest {
pub devfs: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
}
impl fidl::Standalone for ManagedRealmGetDevfsRequest {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ManagedRealmGetMonikerResponse {
pub moniker: String,
}
impl fidl::Persistable for ManagedRealmGetMonikerResponse {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ManagedRealmOpenDiagnosticsDirectoryRequest {
pub child_name: String,
pub directory: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
}
impl fidl::Standalone for ManagedRealmOpenDiagnosticsDirectoryRequest {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ManagedRealmRemoveDeviceRequest {
pub path: String,
}
impl fidl::Persistable for ManagedRealmRemoveDeviceRequest {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ManagedRealmStartChildComponentRequest {
pub child_name: String,
}
impl fidl::Persistable for ManagedRealmStartChildComponentRequest {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ManagedRealmStopChildComponentRequest {
pub child_name: String,
}
impl fidl::Persistable for ManagedRealmStopChildComponentRequest {}
#[derive(Debug, PartialEq)]
pub struct SandboxCreateRealmRequest {
pub realm: fidl::endpoints::ServerEnd<ManagedRealmMarker>,
pub options: RealmOptions,
}
impl fidl::Standalone for SandboxCreateRealmRequest {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct SandboxGetNetworkContextRequest {
pub network_context:
fidl::endpoints::ServerEnd<fidl_fuchsia_netemul_network::NetworkContextMarker>,
}
impl fidl::Standalone for SandboxGetNetworkContextRequest {}
#[derive(Debug, Default, PartialEq)]
pub struct ChildDef {
pub source: Option<ChildSource>,
pub name: Option<String>,
pub exposes: Option<Vec<String>>,
pub uses: Option<ChildUses>,
pub program_args: Option<Vec<String>>,
pub eager: Option<bool>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Standalone for ChildDef {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct ChildDep {
pub name: Option<String>,
pub capability: Option<ExposedCapability>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for ChildDep {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct DevfsDep {
pub name: Option<String>,
pub subdir: Option<String>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for DevfsDep {}
#[derive(Debug, Default, PartialEq)]
pub struct InterfaceOptions {
pub name: Option<String>,
pub device: Option<fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_network::PortMarker>>,
pub without_autogenerated_addresses: Option<bool>,
pub static_ips: Option<Vec<fidl_fuchsia_net::Subnet>>,
pub gateway: Option<fidl_fuchsia_net::IpAddress>,
pub enable_ipv4_forwarding: Option<bool>,
pub enable_ipv6_forwarding: Option<bool>,
pub ipv4_multicast_neighbor_solicitations: Option<u16>,
pub ipv6_multicast_neighbor_solicitations: Option<u16>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Standalone for InterfaceOptions {}
#[derive(Debug, Default, PartialEq)]
pub struct RealmOptions {
pub name: Option<String>,
pub children: Option<Vec<ChildDef>>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Standalone for RealmOptions {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct StorageDep {
pub variant: Option<StorageVariant>,
pub path: Option<String>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for StorageDep {}
#[derive(Clone, Debug, PartialEq)]
pub enum Capability {
NetemulDevfs(DevfsDep),
NetemulNetworkContext(Empty),
LogSink(Empty),
ChildDep(ChildDep),
StorageDep(StorageDep),
TracingProvider(Empty),
}
impl Capability {
#[inline]
pub fn ordinal(&self) -> u64 {
match *self {
Self::NetemulDevfs(_) => 1,
Self::NetemulNetworkContext(_) => 3,
Self::LogSink(_) => 4,
Self::ChildDep(_) => 5,
Self::StorageDep(_) => 6,
Self::TracingProvider(_) => 7,
}
}
#[deprecated = "Strict unions should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
impl fidl::Persistable for Capability {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub enum ChildSource {
Component(String),
Mock(fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>),
}
impl ChildSource {
#[inline]
pub fn ordinal(&self) -> u64 {
match *self {
Self::Component(_) => 1,
Self::Mock(_) => 2,
}
}
#[deprecated = "Strict unions should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
impl fidl::Standalone for ChildSource {}
#[derive(Clone, Debug, PartialEq)]
pub enum ChildUses {
Capabilities(Vec<Capability>),
}
impl ChildUses {
#[inline]
pub fn ordinal(&self) -> u64 {
match *self {
Self::Capabilities(_) => 1,
}
}
#[deprecated = "Strict unions should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
impl fidl::Persistable for ChildUses {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub enum ExposedCapability {
Protocol(String),
Configuration(String),
}
impl ExposedCapability {
#[inline]
pub fn ordinal(&self) -> u64 {
match *self {
Self::Protocol(_) => 1,
Self::Configuration(_) => 2,
}
}
#[deprecated = "Strict unions should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
impl fidl::Persistable for ExposedCapability {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct ConfigurableNetstackMarker;
impl fidl::endpoints::ProtocolMarker for ConfigurableNetstackMarker {
type Proxy = ConfigurableNetstackProxy;
type RequestStream = ConfigurableNetstackRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = ConfigurableNetstackSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.netemul.ConfigurableNetstack";
}
impl fidl::endpoints::DiscoverableProtocolMarker for ConfigurableNetstackMarker {}
pub type ConfigurableNetstackConfigureInterfaceResult = Result<(), ConfigurationError>;
pub trait ConfigurableNetstackProxyInterface: Send + Sync {
type ConfigureInterfaceResponseFut: std::future::Future<
Output = Result<ConfigurableNetstackConfigureInterfaceResult, fidl::Error>,
> + Send;
fn r#configure_interface(
&self,
payload: InterfaceOptions,
) -> Self::ConfigureInterfaceResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct ConfigurableNetstackSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for ConfigurableNetstackSynchronousProxy {
type Proxy = ConfigurableNetstackProxy;
type Protocol = ConfigurableNetstackMarker;
fn from_channel(inner: fidl::Channel) -> Self {
Self::new(inner)
}
fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
fn as_channel(&self) -> &fidl::Channel {
self.client.as_channel()
}
}
#[cfg(target_os = "fuchsia")]
impl ConfigurableNetstackSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name =
<ConfigurableNetstackMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
}
pub fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
pub fn wait_for_event(
&self,
deadline: zx::MonotonicTime,
) -> Result<ConfigurableNetstackEvent, fidl::Error> {
ConfigurableNetstackEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#configure_interface(
&self,
mut payload: InterfaceOptions,
___deadline: zx::MonotonicTime,
) -> Result<ConfigurableNetstackConfigureInterfaceResult, fidl::Error> {
let _response = self.client.send_query::<InterfaceOptions, fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
ConfigurationError,
>>(
&mut payload,
0x64db8deb981ee49,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
}
#[derive(Debug, Clone)]
pub struct ConfigurableNetstackProxy {
client: fidl::client::Client,
}
impl fidl::endpoints::Proxy for ConfigurableNetstackProxy {
type Protocol = ConfigurableNetstackMarker;
fn from_channel(inner: fidl::AsyncChannel) -> Self {
Self::new(inner)
}
fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
self.client.into_channel().map_err(|client| Self { client })
}
fn as_channel(&self) -> &::fidl::AsyncChannel {
self.client.as_channel()
}
}
impl ConfigurableNetstackProxy {
pub fn new(channel: fidl::AsyncChannel) -> Self {
let protocol_name =
<ConfigurableNetstackMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> ConfigurableNetstackEventStream {
ConfigurableNetstackEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#configure_interface(
&self,
mut payload: InterfaceOptions,
) -> fidl::client::QueryResponseFut<ConfigurableNetstackConfigureInterfaceResult> {
ConfigurableNetstackProxyInterface::r#configure_interface(self, payload)
}
}
impl ConfigurableNetstackProxyInterface for ConfigurableNetstackProxy {
type ConfigureInterfaceResponseFut =
fidl::client::QueryResponseFut<ConfigurableNetstackConfigureInterfaceResult>;
fn r#configure_interface(
&self,
mut payload: InterfaceOptions,
) -> Self::ConfigureInterfaceResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<ConfigurableNetstackConfigureInterfaceResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, ConfigurationError>,
0x64db8deb981ee49,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
InterfaceOptions,
ConfigurableNetstackConfigureInterfaceResult,
>(
&mut payload,
0x64db8deb981ee49,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct ConfigurableNetstackEventStream {
event_receiver: fidl::client::EventReceiver,
}
impl std::marker::Unpin for ConfigurableNetstackEventStream {}
impl futures::stream::FusedStream for ConfigurableNetstackEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for ConfigurableNetstackEventStream {
type Item = Result<ConfigurableNetstackEvent, fidl::Error>;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
&mut self.event_receiver,
cx
)?) {
Some(buf) => std::task::Poll::Ready(Some(ConfigurableNetstackEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum ConfigurableNetstackEvent {}
impl ConfigurableNetstackEvent {
fn decode(mut buf: fidl::MessageBufEtc) -> Result<ConfigurableNetstackEvent, fidl::Error> {
let (bytes, _handles) = buf.split_mut();
let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
debug_assert_eq!(tx_header.tx_id, 0);
match tx_header.ordinal {
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name:
<ConfigurableNetstackMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct ConfigurableNetstackRequestStream {
inner: std::sync::Arc<fidl::ServeInner>,
is_terminated: bool,
}
impl std::marker::Unpin for ConfigurableNetstackRequestStream {}
impl futures::stream::FusedStream for ConfigurableNetstackRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for ConfigurableNetstackRequestStream {
type Protocol = ConfigurableNetstackMarker;
type ControlHandle = ConfigurableNetstackControlHandle;
fn from_channel(channel: fidl::AsyncChannel) -> Self {
Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
}
fn control_handle(&self) -> Self::ControlHandle {
ConfigurableNetstackControlHandle { inner: self.inner.clone() }
}
fn into_inner(self) -> (::std::sync::Arc<fidl::ServeInner>, bool) {
(self.inner, self.is_terminated)
}
fn from_inner(inner: std::sync::Arc<fidl::ServeInner>, is_terminated: bool) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for ConfigurableNetstackRequestStream {
type Item = Result<ConfigurableNetstackRequest, fidl::Error>;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
let this = &mut *self;
if this.inner.check_shutdown(cx) {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
if this.is_terminated {
panic!("polled ConfigurableNetstackRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf(|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(e))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x64db8deb981ee49 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(InterfaceOptions);
fidl::encoding::Decoder::decode_into::<InterfaceOptions>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle =
ConfigurableNetstackControlHandle { inner: this.inner.clone() };
Ok(ConfigurableNetstackRequest::ConfigureInterface {
payload: req,
responder: ConfigurableNetstackConfigureInterfaceResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<ConfigurableNetstackMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
})
}
}
#[derive(Debug)]
pub enum ConfigurableNetstackRequest {
ConfigureInterface {
payload: InterfaceOptions,
responder: ConfigurableNetstackConfigureInterfaceResponder,
},
}
impl ConfigurableNetstackRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_configure_interface(
self,
) -> Option<(InterfaceOptions, ConfigurableNetstackConfigureInterfaceResponder)> {
if let ConfigurableNetstackRequest::ConfigureInterface { payload, responder } = self {
Some((payload, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
ConfigurableNetstackRequest::ConfigureInterface { .. } => "configure_interface",
}
}
}
#[derive(Debug, Clone)]
pub struct ConfigurableNetstackControlHandle {
inner: std::sync::Arc<fidl::ServeInner>,
}
impl fidl::endpoints::ControlHandle for ConfigurableNetstackControlHandle {
fn shutdown(&self) {
self.inner.shutdown()
}
fn shutdown_with_epitaph(&self, status: zx_status::Status) {
self.inner.shutdown_with_epitaph(status)
}
fn is_closed(&self) -> bool {
self.inner.channel().is_closed()
}
fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
}
impl ConfigurableNetstackControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct ConfigurableNetstackConfigureInterfaceResponder {
control_handle: std::mem::ManuallyDrop<ConfigurableNetstackControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for ConfigurableNetstackConfigureInterfaceResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for ConfigurableNetstackConfigureInterfaceResponder {
type ControlHandle = ConfigurableNetstackControlHandle;
fn control_handle(&self) -> &ConfigurableNetstackControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl ConfigurableNetstackConfigureInterfaceResponder {
pub fn send(self, mut result: Result<(), ConfigurationError>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut result: Result<(), ConfigurationError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), ConfigurationError>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
ConfigurationError,
>>(
result,
self.tx_id,
0x64db8deb981ee49,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct ManagedRealmMarker;
impl fidl::endpoints::ProtocolMarker for ManagedRealmMarker {
type Proxy = ManagedRealmProxy;
type RequestStream = ManagedRealmRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = ManagedRealmSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) ManagedRealm";
}
pub type ManagedRealmAddDeviceResult = Result<(), i32>;
pub type ManagedRealmRemoveDeviceResult = Result<(), i32>;
pub type ManagedRealmStartChildComponentResult = Result<(), i32>;
pub type ManagedRealmStopChildComponentResult = Result<(), i32>;
pub trait ManagedRealmProxyInterface: Send + Sync {
type GetMonikerResponseFut: std::future::Future<Output = Result<String, fidl::Error>> + Send;
fn r#get_moniker(&self) -> Self::GetMonikerResponseFut;
fn r#connect_to_protocol(
&self,
protocol_name: &str,
child_name: Option<&str>,
req: fidl::Channel,
) -> Result<(), fidl::Error>;
type AddDeviceResponseFut: std::future::Future<Output = Result<ManagedRealmAddDeviceResult, fidl::Error>>
+ Send;
fn r#add_device(
&self,
path: &str,
device: fidl::endpoints::ClientEnd<fidl_fuchsia_netemul_network::DeviceProxy_Marker>,
) -> Self::AddDeviceResponseFut;
type RemoveDeviceResponseFut: std::future::Future<Output = Result<ManagedRealmRemoveDeviceResult, fidl::Error>>
+ Send;
fn r#remove_device(&self, path: &str) -> Self::RemoveDeviceResponseFut;
fn r#get_devfs(
&self,
devfs: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
) -> Result<(), fidl::Error>;
type StartChildComponentResponseFut: std::future::Future<Output = Result<ManagedRealmStartChildComponentResult, fidl::Error>>
+ Send;
fn r#start_child_component(&self, child_name: &str) -> Self::StartChildComponentResponseFut;
type StopChildComponentResponseFut: std::future::Future<Output = Result<ManagedRealmStopChildComponentResult, fidl::Error>>
+ Send;
fn r#stop_child_component(&self, child_name: &str) -> Self::StopChildComponentResponseFut;
fn r#shutdown(&self) -> Result<(), fidl::Error>;
fn r#open_diagnostics_directory(
&self,
child_name: &str,
directory: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
) -> Result<(), fidl::Error>;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct ManagedRealmSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for ManagedRealmSynchronousProxy {
type Proxy = ManagedRealmProxy;
type Protocol = ManagedRealmMarker;
fn from_channel(inner: fidl::Channel) -> Self {
Self::new(inner)
}
fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
fn as_channel(&self) -> &fidl::Channel {
self.client.as_channel()
}
}
#[cfg(target_os = "fuchsia")]
impl ManagedRealmSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <ManagedRealmMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
}
pub fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
pub fn wait_for_event(
&self,
deadline: zx::MonotonicTime,
) -> Result<ManagedRealmEvent, fidl::Error> {
ManagedRealmEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#get_moniker(&self, ___deadline: zx::MonotonicTime) -> Result<String, fidl::Error> {
let _response = self
.client
.send_query::<fidl::encoding::EmptyPayload, ManagedRealmGetMonikerResponse>(
(),
0xec8f2bf894ddc5f,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.moniker)
}
pub fn r#connect_to_protocol(
&self,
mut protocol_name: &str,
mut child_name: Option<&str>,
mut req: fidl::Channel,
) -> Result<(), fidl::Error> {
self.client.send::<ManagedRealmConnectToProtocolRequest>(
(protocol_name, child_name, req),
0x20865b728239813d,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#add_device(
&self,
mut path: &str,
mut device: fidl::endpoints::ClientEnd<fidl_fuchsia_netemul_network::DeviceProxy_Marker>,
___deadline: zx::MonotonicTime,
) -> Result<ManagedRealmAddDeviceResult, fidl::Error> {
let _response = self.client.send_query::<
ManagedRealmAddDeviceRequest,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
>(
(path, device,),
0x789925e6f5d47c07,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#remove_device(
&self,
mut path: &str,
___deadline: zx::MonotonicTime,
) -> Result<ManagedRealmRemoveDeviceResult, fidl::Error> {
let _response = self.client.send_query::<
ManagedRealmRemoveDeviceRequest,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
>(
(path,),
0x6cffbba70ac757cc,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#get_devfs(
&self,
mut devfs: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<ManagedRealmGetDevfsRequest>(
(devfs,),
0x707e2b17f65fcadc,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#start_child_component(
&self,
mut child_name: &str,
___deadline: zx::MonotonicTime,
) -> Result<ManagedRealmStartChildComponentResult, fidl::Error> {
let _response = self.client.send_query::<
ManagedRealmStartChildComponentRequest,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
>(
(child_name,),
0x20dfa243752906a1,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#stop_child_component(
&self,
mut child_name: &str,
___deadline: zx::MonotonicTime,
) -> Result<ManagedRealmStopChildComponentResult, fidl::Error> {
let _response = self.client.send_query::<
ManagedRealmStopChildComponentRequest,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
>(
(child_name,),
0x5ecfe48430aeeca7,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#shutdown(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x4750920f723fba9d,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#open_diagnostics_directory(
&self,
mut child_name: &str,
mut directory: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<ManagedRealmOpenDiagnosticsDirectoryRequest>(
(child_name, directory),
0x7c5312484aa41c99,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Clone)]
pub struct ManagedRealmProxy {
client: fidl::client::Client,
}
impl fidl::endpoints::Proxy for ManagedRealmProxy {
type Protocol = ManagedRealmMarker;
fn from_channel(inner: fidl::AsyncChannel) -> Self {
Self::new(inner)
}
fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
self.client.into_channel().map_err(|client| Self { client })
}
fn as_channel(&self) -> &::fidl::AsyncChannel {
self.client.as_channel()
}
}
impl ManagedRealmProxy {
pub fn new(channel: fidl::AsyncChannel) -> Self {
let protocol_name = <ManagedRealmMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> ManagedRealmEventStream {
ManagedRealmEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#get_moniker(&self) -> fidl::client::QueryResponseFut<String> {
ManagedRealmProxyInterface::r#get_moniker(self)
}
pub fn r#connect_to_protocol(
&self,
mut protocol_name: &str,
mut child_name: Option<&str>,
mut req: fidl::Channel,
) -> Result<(), fidl::Error> {
ManagedRealmProxyInterface::r#connect_to_protocol(self, protocol_name, child_name, req)
}
pub fn r#add_device(
&self,
mut path: &str,
mut device: fidl::endpoints::ClientEnd<fidl_fuchsia_netemul_network::DeviceProxy_Marker>,
) -> fidl::client::QueryResponseFut<ManagedRealmAddDeviceResult> {
ManagedRealmProxyInterface::r#add_device(self, path, device)
}
pub fn r#remove_device(
&self,
mut path: &str,
) -> fidl::client::QueryResponseFut<ManagedRealmRemoveDeviceResult> {
ManagedRealmProxyInterface::r#remove_device(self, path)
}
pub fn r#get_devfs(
&self,
mut devfs: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
) -> Result<(), fidl::Error> {
ManagedRealmProxyInterface::r#get_devfs(self, devfs)
}
pub fn r#start_child_component(
&self,
mut child_name: &str,
) -> fidl::client::QueryResponseFut<ManagedRealmStartChildComponentResult> {
ManagedRealmProxyInterface::r#start_child_component(self, child_name)
}
pub fn r#stop_child_component(
&self,
mut child_name: &str,
) -> fidl::client::QueryResponseFut<ManagedRealmStopChildComponentResult> {
ManagedRealmProxyInterface::r#stop_child_component(self, child_name)
}
pub fn r#shutdown(&self) -> Result<(), fidl::Error> {
ManagedRealmProxyInterface::r#shutdown(self)
}
pub fn r#open_diagnostics_directory(
&self,
mut child_name: &str,
mut directory: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
) -> Result<(), fidl::Error> {
ManagedRealmProxyInterface::r#open_diagnostics_directory(self, child_name, directory)
}
}
impl ManagedRealmProxyInterface for ManagedRealmProxy {
type GetMonikerResponseFut = fidl::client::QueryResponseFut<String>;
fn r#get_moniker(&self) -> Self::GetMonikerResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<String, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
ManagedRealmGetMonikerResponse,
0xec8f2bf894ddc5f,
>(_buf?)?;
Ok(_response.moniker)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, String>(
(),
0xec8f2bf894ddc5f,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
fn r#connect_to_protocol(
&self,
mut protocol_name: &str,
mut child_name: Option<&str>,
mut req: fidl::Channel,
) -> Result<(), fidl::Error> {
self.client.send::<ManagedRealmConnectToProtocolRequest>(
(protocol_name, child_name, req),
0x20865b728239813d,
fidl::encoding::DynamicFlags::empty(),
)
}
type AddDeviceResponseFut = fidl::client::QueryResponseFut<ManagedRealmAddDeviceResult>;
fn r#add_device(
&self,
mut path: &str,
mut device: fidl::endpoints::ClientEnd<fidl_fuchsia_netemul_network::DeviceProxy_Marker>,
) -> Self::AddDeviceResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<ManagedRealmAddDeviceResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
0x789925e6f5d47c07,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client
.send_query_and_decode::<ManagedRealmAddDeviceRequest, ManagedRealmAddDeviceResult>(
(path, device),
0x789925e6f5d47c07,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type RemoveDeviceResponseFut = fidl::client::QueryResponseFut<ManagedRealmRemoveDeviceResult>;
fn r#remove_device(&self, mut path: &str) -> Self::RemoveDeviceResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<ManagedRealmRemoveDeviceResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
0x6cffbba70ac757cc,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
ManagedRealmRemoveDeviceRequest,
ManagedRealmRemoveDeviceResult,
>(
(path,),
0x6cffbba70ac757cc,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
fn r#get_devfs(
&self,
mut devfs: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<ManagedRealmGetDevfsRequest>(
(devfs,),
0x707e2b17f65fcadc,
fidl::encoding::DynamicFlags::empty(),
)
}
type StartChildComponentResponseFut =
fidl::client::QueryResponseFut<ManagedRealmStartChildComponentResult>;
fn r#start_child_component(
&self,
mut child_name: &str,
) -> Self::StartChildComponentResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<ManagedRealmStartChildComponentResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
0x20dfa243752906a1,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
ManagedRealmStartChildComponentRequest,
ManagedRealmStartChildComponentResult,
>(
(child_name,),
0x20dfa243752906a1,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type StopChildComponentResponseFut =
fidl::client::QueryResponseFut<ManagedRealmStopChildComponentResult>;
fn r#stop_child_component(&self, mut child_name: &str) -> Self::StopChildComponentResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<ManagedRealmStopChildComponentResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
0x5ecfe48430aeeca7,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
ManagedRealmStopChildComponentRequest,
ManagedRealmStopChildComponentResult,
>(
(child_name,),
0x5ecfe48430aeeca7,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
fn r#shutdown(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x4750920f723fba9d,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#open_diagnostics_directory(
&self,
mut child_name: &str,
mut directory: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<ManagedRealmOpenDiagnosticsDirectoryRequest>(
(child_name, directory),
0x7c5312484aa41c99,
fidl::encoding::DynamicFlags::empty(),
)
}
}
pub struct ManagedRealmEventStream {
event_receiver: fidl::client::EventReceiver,
}
impl std::marker::Unpin for ManagedRealmEventStream {}
impl futures::stream::FusedStream for ManagedRealmEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for ManagedRealmEventStream {
type Item = Result<ManagedRealmEvent, fidl::Error>;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
&mut self.event_receiver,
cx
)?) {
Some(buf) => std::task::Poll::Ready(Some(ManagedRealmEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum ManagedRealmEvent {
OnShutdown {},
}
impl ManagedRealmEvent {
#[allow(irrefutable_let_patterns)]
pub fn into_on_shutdown(self) -> Option<()> {
if let ManagedRealmEvent::OnShutdown {} = self {
Some(())
} else {
None
}
}
fn decode(mut buf: fidl::MessageBufEtc) -> Result<ManagedRealmEvent, fidl::Error> {
let (bytes, _handles) = buf.split_mut();
let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
debug_assert_eq!(tx_header.tx_id, 0);
match tx_header.ordinal {
0x1dff0b58a5b546be => {
let mut out = fidl::new_empty!(fidl::encoding::EmptyPayload);
fidl::encoding::Decoder::decode_into::<fidl::encoding::EmptyPayload>(
&tx_header,
_body_bytes,
_handles,
&mut out,
)?;
Ok((ManagedRealmEvent::OnShutdown {}))
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name: <ManagedRealmMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct ManagedRealmRequestStream {
inner: std::sync::Arc<fidl::ServeInner>,
is_terminated: bool,
}
impl std::marker::Unpin for ManagedRealmRequestStream {}
impl futures::stream::FusedStream for ManagedRealmRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for ManagedRealmRequestStream {
type Protocol = ManagedRealmMarker;
type ControlHandle = ManagedRealmControlHandle;
fn from_channel(channel: fidl::AsyncChannel) -> Self {
Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
}
fn control_handle(&self) -> Self::ControlHandle {
ManagedRealmControlHandle { inner: self.inner.clone() }
}
fn into_inner(self) -> (::std::sync::Arc<fidl::ServeInner>, bool) {
(self.inner, self.is_terminated)
}
fn from_inner(inner: std::sync::Arc<fidl::ServeInner>, is_terminated: bool) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for ManagedRealmRequestStream {
type Item = Result<ManagedRealmRequest, fidl::Error>;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
let this = &mut *self;
if this.inner.check_shutdown(cx) {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
if this.is_terminated {
panic!("polled ManagedRealmRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf(|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(e))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0xec8f2bf894ddc5f => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload);
fidl::encoding::Decoder::decode_into::<fidl::encoding::EmptyPayload>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = ManagedRealmControlHandle { inner: this.inner.clone() };
Ok(ManagedRealmRequest::GetMoniker {
responder: ManagedRealmGetMonikerResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x20865b728239813d => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(ManagedRealmConnectToProtocolRequest);
fidl::encoding::Decoder::decode_into::<ManagedRealmConnectToProtocolRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = ManagedRealmControlHandle { inner: this.inner.clone() };
Ok(ManagedRealmRequest::ConnectToProtocol {
protocol_name: req.protocol_name,
child_name: req.child_name,
req: req.req,
control_handle,
})
}
0x789925e6f5d47c07 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(ManagedRealmAddDeviceRequest);
fidl::encoding::Decoder::decode_into::<ManagedRealmAddDeviceRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = ManagedRealmControlHandle { inner: this.inner.clone() };
Ok(ManagedRealmRequest::AddDevice {
path: req.path,
device: req.device,
responder: ManagedRealmAddDeviceResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x6cffbba70ac757cc => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(ManagedRealmRemoveDeviceRequest);
fidl::encoding::Decoder::decode_into::<ManagedRealmRemoveDeviceRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = ManagedRealmControlHandle { inner: this.inner.clone() };
Ok(ManagedRealmRequest::RemoveDevice {
path: req.path,
responder: ManagedRealmRemoveDeviceResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x707e2b17f65fcadc => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(ManagedRealmGetDevfsRequest);
fidl::encoding::Decoder::decode_into::<ManagedRealmGetDevfsRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = ManagedRealmControlHandle { inner: this.inner.clone() };
Ok(ManagedRealmRequest::GetDevfs { devfs: req.devfs, control_handle })
}
0x20dfa243752906a1 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(ManagedRealmStartChildComponentRequest);
fidl::encoding::Decoder::decode_into::<ManagedRealmStartChildComponentRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = ManagedRealmControlHandle { inner: this.inner.clone() };
Ok(ManagedRealmRequest::StartChildComponent {
child_name: req.child_name,
responder: ManagedRealmStartChildComponentResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x5ecfe48430aeeca7 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(ManagedRealmStopChildComponentRequest);
fidl::encoding::Decoder::decode_into::<ManagedRealmStopChildComponentRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = ManagedRealmControlHandle { inner: this.inner.clone() };
Ok(ManagedRealmRequest::StopChildComponent {
child_name: req.child_name,
responder: ManagedRealmStopChildComponentResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x4750920f723fba9d => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload);
fidl::encoding::Decoder::decode_into::<fidl::encoding::EmptyPayload>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = ManagedRealmControlHandle { inner: this.inner.clone() };
Ok(ManagedRealmRequest::Shutdown { control_handle })
}
0x7c5312484aa41c99 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(ManagedRealmOpenDiagnosticsDirectoryRequest);
fidl::encoding::Decoder::decode_into::<
ManagedRealmOpenDiagnosticsDirectoryRequest,
>(&header, _body_bytes, handles, &mut req)?;
let control_handle = ManagedRealmControlHandle { inner: this.inner.clone() };
Ok(ManagedRealmRequest::OpenDiagnosticsDirectory {
child_name: req.child_name,
directory: req.directory,
control_handle,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<ManagedRealmMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
})
}
}
#[derive(Debug)]
pub enum ManagedRealmRequest {
GetMoniker { responder: ManagedRealmGetMonikerResponder },
ConnectToProtocol {
protocol_name: String,
child_name: Option<String>,
req: fidl::Channel,
control_handle: ManagedRealmControlHandle,
},
AddDevice {
path: String,
device: fidl::endpoints::ClientEnd<fidl_fuchsia_netemul_network::DeviceProxy_Marker>,
responder: ManagedRealmAddDeviceResponder,
},
RemoveDevice { path: String, responder: ManagedRealmRemoveDeviceResponder },
GetDevfs {
devfs: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
control_handle: ManagedRealmControlHandle,
},
StartChildComponent { child_name: String, responder: ManagedRealmStartChildComponentResponder },
StopChildComponent { child_name: String, responder: ManagedRealmStopChildComponentResponder },
Shutdown { control_handle: ManagedRealmControlHandle },
OpenDiagnosticsDirectory {
child_name: String,
directory: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
control_handle: ManagedRealmControlHandle,
},
}
impl ManagedRealmRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_get_moniker(self) -> Option<(ManagedRealmGetMonikerResponder)> {
if let ManagedRealmRequest::GetMoniker { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_connect_to_protocol(
self,
) -> Option<(String, Option<String>, fidl::Channel, ManagedRealmControlHandle)> {
if let ManagedRealmRequest::ConnectToProtocol {
protocol_name,
child_name,
req,
control_handle,
} = self
{
Some((protocol_name, child_name, req, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_add_device(
self,
) -> Option<(
String,
fidl::endpoints::ClientEnd<fidl_fuchsia_netemul_network::DeviceProxy_Marker>,
ManagedRealmAddDeviceResponder,
)> {
if let ManagedRealmRequest::AddDevice { path, device, responder } = self {
Some((path, device, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_remove_device(self) -> Option<(String, ManagedRealmRemoveDeviceResponder)> {
if let ManagedRealmRequest::RemoveDevice { path, responder } = self {
Some((path, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_get_devfs(
self,
) -> Option<(
fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
ManagedRealmControlHandle,
)> {
if let ManagedRealmRequest::GetDevfs { devfs, control_handle } = self {
Some((devfs, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_start_child_component(
self,
) -> Option<(String, ManagedRealmStartChildComponentResponder)> {
if let ManagedRealmRequest::StartChildComponent { child_name, responder } = self {
Some((child_name, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_stop_child_component(
self,
) -> Option<(String, ManagedRealmStopChildComponentResponder)> {
if let ManagedRealmRequest::StopChildComponent { child_name, responder } = self {
Some((child_name, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_shutdown(self) -> Option<(ManagedRealmControlHandle)> {
if let ManagedRealmRequest::Shutdown { control_handle } = self {
Some((control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_open_diagnostics_directory(
self,
) -> Option<(
String,
fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
ManagedRealmControlHandle,
)> {
if let ManagedRealmRequest::OpenDiagnosticsDirectory {
child_name,
directory,
control_handle,
} = self
{
Some((child_name, directory, control_handle))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
ManagedRealmRequest::GetMoniker { .. } => "get_moniker",
ManagedRealmRequest::ConnectToProtocol { .. } => "connect_to_protocol",
ManagedRealmRequest::AddDevice { .. } => "add_device",
ManagedRealmRequest::RemoveDevice { .. } => "remove_device",
ManagedRealmRequest::GetDevfs { .. } => "get_devfs",
ManagedRealmRequest::StartChildComponent { .. } => "start_child_component",
ManagedRealmRequest::StopChildComponent { .. } => "stop_child_component",
ManagedRealmRequest::Shutdown { .. } => "shutdown",
ManagedRealmRequest::OpenDiagnosticsDirectory { .. } => "open_diagnostics_directory",
}
}
}
#[derive(Debug, Clone)]
pub struct ManagedRealmControlHandle {
inner: std::sync::Arc<fidl::ServeInner>,
}
impl fidl::endpoints::ControlHandle for ManagedRealmControlHandle {
fn shutdown(&self) {
self.inner.shutdown()
}
fn shutdown_with_epitaph(&self, status: zx_status::Status) {
self.inner.shutdown_with_epitaph(status)
}
fn is_closed(&self) -> bool {
self.inner.channel().is_closed()
}
fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
}
impl ManagedRealmControlHandle {
pub fn send_on_shutdown(&self) -> Result<(), fidl::Error> {
self.inner.send::<fidl::encoding::EmptyPayload>(
(),
0,
0x1dff0b58a5b546be,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct ManagedRealmGetMonikerResponder {
control_handle: std::mem::ManuallyDrop<ManagedRealmControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for ManagedRealmGetMonikerResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for ManagedRealmGetMonikerResponder {
type ControlHandle = ManagedRealmControlHandle;
fn control_handle(&self) -> &ManagedRealmControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl ManagedRealmGetMonikerResponder {
pub fn send(self, mut moniker: &str) -> Result<(), fidl::Error> {
let _result = self.send_raw(moniker);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut moniker: &str) -> Result<(), fidl::Error> {
let _result = self.send_raw(moniker);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut moniker: &str) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<ManagedRealmGetMonikerResponse>(
(moniker,),
self.tx_id,
0xec8f2bf894ddc5f,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct ManagedRealmAddDeviceResponder {
control_handle: std::mem::ManuallyDrop<ManagedRealmControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for ManagedRealmAddDeviceResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for ManagedRealmAddDeviceResponder {
type ControlHandle = ManagedRealmControlHandle;
fn control_handle(&self) -> &ManagedRealmControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl ManagedRealmAddDeviceResponder {
pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
result,
self.tx_id,
0x789925e6f5d47c07,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct ManagedRealmRemoveDeviceResponder {
control_handle: std::mem::ManuallyDrop<ManagedRealmControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for ManagedRealmRemoveDeviceResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for ManagedRealmRemoveDeviceResponder {
type ControlHandle = ManagedRealmControlHandle;
fn control_handle(&self) -> &ManagedRealmControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl ManagedRealmRemoveDeviceResponder {
pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
result,
self.tx_id,
0x6cffbba70ac757cc,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct ManagedRealmStartChildComponentResponder {
control_handle: std::mem::ManuallyDrop<ManagedRealmControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for ManagedRealmStartChildComponentResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for ManagedRealmStartChildComponentResponder {
type ControlHandle = ManagedRealmControlHandle;
fn control_handle(&self) -> &ManagedRealmControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl ManagedRealmStartChildComponentResponder {
pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
result,
self.tx_id,
0x20dfa243752906a1,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct ManagedRealmStopChildComponentResponder {
control_handle: std::mem::ManuallyDrop<ManagedRealmControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for ManagedRealmStopChildComponentResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for ManagedRealmStopChildComponentResponder {
type ControlHandle = ManagedRealmControlHandle;
fn control_handle(&self) -> &ManagedRealmControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl ManagedRealmStopChildComponentResponder {
pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
result,
self.tx_id,
0x5ecfe48430aeeca7,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct SandboxMarker;
impl fidl::endpoints::ProtocolMarker for SandboxMarker {
type Proxy = SandboxProxy;
type RequestStream = SandboxRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = SandboxSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.netemul.Sandbox";
}
impl fidl::endpoints::DiscoverableProtocolMarker for SandboxMarker {}
pub trait SandboxProxyInterface: Send + Sync {
fn r#create_realm(
&self,
realm: fidl::endpoints::ServerEnd<ManagedRealmMarker>,
options: RealmOptions,
) -> Result<(), fidl::Error>;
fn r#get_network_context(
&self,
network_context: fidl::endpoints::ServerEnd<
fidl_fuchsia_netemul_network::NetworkContextMarker,
>,
) -> Result<(), fidl::Error>;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct SandboxSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for SandboxSynchronousProxy {
type Proxy = SandboxProxy;
type Protocol = SandboxMarker;
fn from_channel(inner: fidl::Channel) -> Self {
Self::new(inner)
}
fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
fn as_channel(&self) -> &fidl::Channel {
self.client.as_channel()
}
}
#[cfg(target_os = "fuchsia")]
impl SandboxSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <SandboxMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
}
pub fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
pub fn wait_for_event(&self, deadline: zx::MonotonicTime) -> Result<SandboxEvent, fidl::Error> {
SandboxEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#create_realm(
&self,
mut realm: fidl::endpoints::ServerEnd<ManagedRealmMarker>,
mut options: RealmOptions,
) -> Result<(), fidl::Error> {
self.client.send::<SandboxCreateRealmRequest>(
(realm, &mut options),
0x25d0bc5f1006a0c9,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#get_network_context(
&self,
mut network_context: fidl::endpoints::ServerEnd<
fidl_fuchsia_netemul_network::NetworkContextMarker,
>,
) -> Result<(), fidl::Error> {
self.client.send::<SandboxGetNetworkContextRequest>(
(network_context,),
0x140cb104c2605970,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Clone)]
pub struct SandboxProxy {
client: fidl::client::Client,
}
impl fidl::endpoints::Proxy for SandboxProxy {
type Protocol = SandboxMarker;
fn from_channel(inner: fidl::AsyncChannel) -> Self {
Self::new(inner)
}
fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
self.client.into_channel().map_err(|client| Self { client })
}
fn as_channel(&self) -> &::fidl::AsyncChannel {
self.client.as_channel()
}
}
impl SandboxProxy {
pub fn new(channel: fidl::AsyncChannel) -> Self {
let protocol_name = <SandboxMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> SandboxEventStream {
SandboxEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#create_realm(
&self,
mut realm: fidl::endpoints::ServerEnd<ManagedRealmMarker>,
mut options: RealmOptions,
) -> Result<(), fidl::Error> {
SandboxProxyInterface::r#create_realm(self, realm, options)
}
pub fn r#get_network_context(
&self,
mut network_context: fidl::endpoints::ServerEnd<
fidl_fuchsia_netemul_network::NetworkContextMarker,
>,
) -> Result<(), fidl::Error> {
SandboxProxyInterface::r#get_network_context(self, network_context)
}
}
impl SandboxProxyInterface for SandboxProxy {
fn r#create_realm(
&self,
mut realm: fidl::endpoints::ServerEnd<ManagedRealmMarker>,
mut options: RealmOptions,
) -> Result<(), fidl::Error> {
self.client.send::<SandboxCreateRealmRequest>(
(realm, &mut options),
0x25d0bc5f1006a0c9,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#get_network_context(
&self,
mut network_context: fidl::endpoints::ServerEnd<
fidl_fuchsia_netemul_network::NetworkContextMarker,
>,
) -> Result<(), fidl::Error> {
self.client.send::<SandboxGetNetworkContextRequest>(
(network_context,),
0x140cb104c2605970,
fidl::encoding::DynamicFlags::empty(),
)
}
}
pub struct SandboxEventStream {
event_receiver: fidl::client::EventReceiver,
}
impl std::marker::Unpin for SandboxEventStream {}
impl futures::stream::FusedStream for SandboxEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for SandboxEventStream {
type Item = Result<SandboxEvent, fidl::Error>;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
&mut self.event_receiver,
cx
)?) {
Some(buf) => std::task::Poll::Ready(Some(SandboxEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum SandboxEvent {}
impl SandboxEvent {
fn decode(mut buf: fidl::MessageBufEtc) -> Result<SandboxEvent, fidl::Error> {
let (bytes, _handles) = buf.split_mut();
let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
debug_assert_eq!(tx_header.tx_id, 0);
match tx_header.ordinal {
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name: <SandboxMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct SandboxRequestStream {
inner: std::sync::Arc<fidl::ServeInner>,
is_terminated: bool,
}
impl std::marker::Unpin for SandboxRequestStream {}
impl futures::stream::FusedStream for SandboxRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for SandboxRequestStream {
type Protocol = SandboxMarker;
type ControlHandle = SandboxControlHandle;
fn from_channel(channel: fidl::AsyncChannel) -> Self {
Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
}
fn control_handle(&self) -> Self::ControlHandle {
SandboxControlHandle { inner: self.inner.clone() }
}
fn into_inner(self) -> (::std::sync::Arc<fidl::ServeInner>, bool) {
(self.inner, self.is_terminated)
}
fn from_inner(inner: std::sync::Arc<fidl::ServeInner>, is_terminated: bool) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for SandboxRequestStream {
type Item = Result<SandboxRequest, fidl::Error>;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
let this = &mut *self;
if this.inner.check_shutdown(cx) {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
if this.is_terminated {
panic!("polled SandboxRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf(|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(e))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x25d0bc5f1006a0c9 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(SandboxCreateRealmRequest);
fidl::encoding::Decoder::decode_into::<SandboxCreateRealmRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = SandboxControlHandle { inner: this.inner.clone() };
Ok(SandboxRequest::CreateRealm {
realm: req.realm,
options: req.options,
control_handle,
})
}
0x140cb104c2605970 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(SandboxGetNetworkContextRequest);
fidl::encoding::Decoder::decode_into::<SandboxGetNetworkContextRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = SandboxControlHandle { inner: this.inner.clone() };
Ok(SandboxRequest::GetNetworkContext {
network_context: req.network_context,
control_handle,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <SandboxMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
})
}
}
#[derive(Debug)]
pub enum SandboxRequest {
CreateRealm {
realm: fidl::endpoints::ServerEnd<ManagedRealmMarker>,
options: RealmOptions,
control_handle: SandboxControlHandle,
},
GetNetworkContext {
network_context:
fidl::endpoints::ServerEnd<fidl_fuchsia_netemul_network::NetworkContextMarker>,
control_handle: SandboxControlHandle,
},
}
impl SandboxRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_create_realm(
self,
) -> Option<(fidl::endpoints::ServerEnd<ManagedRealmMarker>, RealmOptions, SandboxControlHandle)>
{
if let SandboxRequest::CreateRealm { realm, options, control_handle } = self {
Some((realm, options, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_get_network_context(
self,
) -> Option<(
fidl::endpoints::ServerEnd<fidl_fuchsia_netemul_network::NetworkContextMarker>,
SandboxControlHandle,
)> {
if let SandboxRequest::GetNetworkContext { network_context, control_handle } = self {
Some((network_context, control_handle))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
SandboxRequest::CreateRealm { .. } => "create_realm",
SandboxRequest::GetNetworkContext { .. } => "get_network_context",
}
}
}
#[derive(Debug, Clone)]
pub struct SandboxControlHandle {
inner: std::sync::Arc<fidl::ServeInner>,
}
impl fidl::endpoints::ControlHandle for SandboxControlHandle {
fn shutdown(&self) {
self.inner.shutdown()
}
fn shutdown_with_epitaph(&self, status: zx_status::Status) {
self.inner.shutdown_with_epitaph(status)
}
fn is_closed(&self) -> bool {
self.inner.channel().is_closed()
}
fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
}
impl SandboxControlHandle {}
mod internal {
use super::*;
unsafe impl fidl::encoding::TypeMarker for ConfigurationError {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
std::mem::align_of::<u32>()
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
std::mem::size_of::<u32>()
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for ConfigurationError {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
*value
}
}
unsafe impl fidl::encoding::Encode<Self> for ConfigurationError {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl fidl::encoding::Decode<Self> for ConfigurationError {
#[inline(always)]
fn new_empty() -> Self {
Self::InvalidArguments
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u32>(offset);
*self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for StorageVariant {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
std::mem::align_of::<u8>()
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
std::mem::size_of::<u8>()
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for StorageVariant {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
*value
}
}
unsafe impl fidl::encoding::Encode<Self> for StorageVariant {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl fidl::encoding::Decode<Self> for StorageVariant {
#[inline(always)]
fn new_empty() -> Self {
Self::Data
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u8>(offset);
*self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for Empty {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
1
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
1
}
}
impl fidl::encoding::ValueTypeMarker for Empty {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<Empty> for &Empty {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Empty>(offset);
encoder.write_num(0u8, offset);
Ok(())
}
}
impl fidl::encoding::Decode<Self> for Empty {
#[inline(always)]
fn new_empty() -> Self {
Self
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
match decoder.read_num::<u8>(offset) {
0 => Ok(()),
_ => Err(fidl::Error::Invalid),
}
}
}
unsafe impl fidl::encoding::TypeMarker for ManagedRealmAddDeviceRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
24
}
}
impl fidl::encoding::ResourceTypeMarker for ManagedRealmAddDeviceRequest {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<ManagedRealmAddDeviceRequest>
for &mut ManagedRealmAddDeviceRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ManagedRealmAddDeviceRequest>(offset);
fidl::encoding::Encode::<ManagedRealmAddDeviceRequest>::encode(
(
<fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
&self.path,
),
<fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<
fidl_fuchsia_netemul_network::DeviceProxy_Marker,
>,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.device
),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<fidl::encoding::UnboundedString>,
T1: fidl::encoding::Encode<
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_netemul_network::DeviceProxy_Marker>,
>,
>,
> fidl::encoding::Encode<ManagedRealmAddDeviceRequest> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ManagedRealmAddDeviceRequest>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for ManagedRealmAddDeviceRequest {
#[inline(always)]
fn new_empty() -> Self {
Self {
path: fidl::new_empty!(fidl::encoding::UnboundedString),
device: fidl::new_empty!(
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<
fidl_fuchsia_netemul_network::DeviceProxy_Marker,
>,
>
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffff00000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(
fidl::encoding::UnboundedString,
&mut self.path,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_netemul_network::DeviceProxy_Marker>,
>,
&mut self.device,
decoder,
offset + 16,
_depth
)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for ManagedRealmConnectToProtocolRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
40
}
}
impl fidl::encoding::ResourceTypeMarker for ManagedRealmConnectToProtocolRequest {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<ManagedRealmConnectToProtocolRequest>
for &mut ManagedRealmConnectToProtocolRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ManagedRealmConnectToProtocolRequest>(offset);
fidl::encoding::Encode::<ManagedRealmConnectToProtocolRequest>::encode(
(
<fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(&self.protocol_name),
<fidl::encoding::Optional<fidl::encoding::BoundedString<255>> as fidl::encoding::ValueTypeMarker>::borrow(&self.child_name),
<fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.req),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<fidl::encoding::BoundedString<255>>,
T1: fidl::encoding::Encode<fidl::encoding::Optional<fidl::encoding::BoundedString<255>>>,
T2: fidl::encoding::Encode<
fidl::encoding::HandleType<
fidl::Channel,
{ fidl::ObjectType::CHANNEL.into_raw() },
2147483648,
>,
>,
> fidl::encoding::Encode<ManagedRealmConnectToProtocolRequest> for (T0, T1, T2)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ManagedRealmConnectToProtocolRequest>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
self.2.encode(encoder, offset + 32, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for ManagedRealmConnectToProtocolRequest {
#[inline(always)]
fn new_empty() -> Self {
Self {
protocol_name: fidl::new_empty!(fidl::encoding::BoundedString<255>),
child_name: fidl::new_empty!(
fidl::encoding::Optional<fidl::encoding::BoundedString<255>>
),
req: fidl::new_empty!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffff00000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(
fidl::encoding::BoundedString<255>,
&mut self.protocol_name,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::Optional<fidl::encoding::BoundedString<255>>,
&mut self.child_name,
decoder,
offset + 16,
_depth
)?;
fidl::decode!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, &mut self.req, decoder, offset + 32, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for ManagedRealmGetDevfsRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
}
impl fidl::encoding::ResourceTypeMarker for ManagedRealmGetDevfsRequest {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<ManagedRealmGetDevfsRequest>
for &mut ManagedRealmGetDevfsRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ManagedRealmGetDevfsRequest>(offset);
fidl::encoding::Encode::<ManagedRealmGetDevfsRequest>::encode(
(<fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.devfs
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
>,
>,
> fidl::encoding::Encode<ManagedRealmGetDevfsRequest> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ManagedRealmGetDevfsRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for ManagedRealmGetDevfsRequest {
#[inline(always)]
fn new_empty() -> Self {
Self {
devfs: fidl::new_empty!(
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
>
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
>,
&mut self.devfs,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for ManagedRealmGetMonikerResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
impl fidl::encoding::ValueTypeMarker for ManagedRealmGetMonikerResponse {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<ManagedRealmGetMonikerResponse>
for &ManagedRealmGetMonikerResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ManagedRealmGetMonikerResponse>(offset);
fidl::encoding::Encode::<ManagedRealmGetMonikerResponse>::encode(
(<fidl::encoding::BoundedString<4096> as fidl::encoding::ValueTypeMarker>::borrow(
&self.moniker,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<T0: fidl::encoding::Encode<fidl::encoding::BoundedString<4096>>>
fidl::encoding::Encode<ManagedRealmGetMonikerResponse> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ManagedRealmGetMonikerResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for ManagedRealmGetMonikerResponse {
#[inline(always)]
fn new_empty() -> Self {
Self { moniker: fidl::new_empty!(fidl::encoding::BoundedString<4096>) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::BoundedString<4096>,
&mut self.moniker,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for ManagedRealmOpenDiagnosticsDirectoryRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
24
}
}
impl fidl::encoding::ResourceTypeMarker for ManagedRealmOpenDiagnosticsDirectoryRequest {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<ManagedRealmOpenDiagnosticsDirectoryRequest>
for &mut ManagedRealmOpenDiagnosticsDirectoryRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ManagedRealmOpenDiagnosticsDirectoryRequest>(offset);
fidl::encoding::Encode::<ManagedRealmOpenDiagnosticsDirectoryRequest>::encode(
(
<fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(
&self.child_name,
),
<fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.directory
),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<fidl::encoding::BoundedString<255>>,
T1: fidl::encoding::Encode<
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
>,
>,
> fidl::encoding::Encode<ManagedRealmOpenDiagnosticsDirectoryRequest> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ManagedRealmOpenDiagnosticsDirectoryRequest>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for ManagedRealmOpenDiagnosticsDirectoryRequest {
#[inline(always)]
fn new_empty() -> Self {
Self {
child_name: fidl::new_empty!(fidl::encoding::BoundedString<255>),
directory: fidl::new_empty!(
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
>
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffff00000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(
fidl::encoding::BoundedString<255>,
&mut self.child_name,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
>,
&mut self.directory,
decoder,
offset + 16,
_depth
)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for ManagedRealmRemoveDeviceRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
impl fidl::encoding::ValueTypeMarker for ManagedRealmRemoveDeviceRequest {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<ManagedRealmRemoveDeviceRequest>
for &ManagedRealmRemoveDeviceRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ManagedRealmRemoveDeviceRequest>(offset);
fidl::encoding::Encode::<ManagedRealmRemoveDeviceRequest>::encode(
(<fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
&self.path,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<T0: fidl::encoding::Encode<fidl::encoding::UnboundedString>>
fidl::encoding::Encode<ManagedRealmRemoveDeviceRequest> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ManagedRealmRemoveDeviceRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for ManagedRealmRemoveDeviceRequest {
#[inline(always)]
fn new_empty() -> Self {
Self { path: fidl::new_empty!(fidl::encoding::UnboundedString) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::UnboundedString,
&mut self.path,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for ManagedRealmStartChildComponentRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
impl fidl::encoding::ValueTypeMarker for ManagedRealmStartChildComponentRequest {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<ManagedRealmStartChildComponentRequest>
for &ManagedRealmStartChildComponentRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ManagedRealmStartChildComponentRequest>(offset);
fidl::encoding::Encode::<ManagedRealmStartChildComponentRequest>::encode(
(<fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(
&self.child_name,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<T0: fidl::encoding::Encode<fidl::encoding::BoundedString<255>>>
fidl::encoding::Encode<ManagedRealmStartChildComponentRequest> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ManagedRealmStartChildComponentRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for ManagedRealmStartChildComponentRequest {
#[inline(always)]
fn new_empty() -> Self {
Self { child_name: fidl::new_empty!(fidl::encoding::BoundedString<255>) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::BoundedString<255>,
&mut self.child_name,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for ManagedRealmStopChildComponentRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
impl fidl::encoding::ValueTypeMarker for ManagedRealmStopChildComponentRequest {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<ManagedRealmStopChildComponentRequest>
for &ManagedRealmStopChildComponentRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ManagedRealmStopChildComponentRequest>(offset);
fidl::encoding::Encode::<ManagedRealmStopChildComponentRequest>::encode(
(<fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(
&self.child_name,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<T0: fidl::encoding::Encode<fidl::encoding::BoundedString<255>>>
fidl::encoding::Encode<ManagedRealmStopChildComponentRequest> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ManagedRealmStopChildComponentRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for ManagedRealmStopChildComponentRequest {
#[inline(always)]
fn new_empty() -> Self {
Self { child_name: fidl::new_empty!(fidl::encoding::BoundedString<255>) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::BoundedString<255>,
&mut self.child_name,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for SandboxCreateRealmRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
24
}
}
impl fidl::encoding::ResourceTypeMarker for SandboxCreateRealmRequest {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<SandboxCreateRealmRequest> for &mut SandboxCreateRealmRequest {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<SandboxCreateRealmRequest>(offset);
fidl::encoding::Encode::<SandboxCreateRealmRequest>::encode(
(
<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ManagedRealmMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.realm),
<RealmOptions as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.options),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ManagedRealmMarker>>,
>,
T1: fidl::encoding::Encode<RealmOptions>,
> fidl::encoding::Encode<SandboxCreateRealmRequest> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<SandboxCreateRealmRequest>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for SandboxCreateRealmRequest {
#[inline(always)]
fn new_empty() -> Self {
Self {
realm: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ManagedRealmMarker>>
),
options: fidl::new_empty!(RealmOptions),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffff00000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ManagedRealmMarker>>,
&mut self.realm,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(RealmOptions, &mut self.options, decoder, offset + 8, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for SandboxGetNetworkContextRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
}
impl fidl::encoding::ResourceTypeMarker for SandboxGetNetworkContextRequest {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<SandboxGetNetworkContextRequest>
for &mut SandboxGetNetworkContextRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<SandboxGetNetworkContextRequest>(offset);
fidl::encoding::Encode::<SandboxGetNetworkContextRequest>::encode(
(<fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<fidl_fuchsia_netemul_network::NetworkContextMarker>,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.network_context,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<fidl_fuchsia_netemul_network::NetworkContextMarker>,
>,
>,
> fidl::encoding::Encode<SandboxGetNetworkContextRequest> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<SandboxGetNetworkContextRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for SandboxGetNetworkContextRequest {
#[inline(always)]
fn new_empty() -> Self {
Self {
network_context: fidl::new_empty!(
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<
fidl_fuchsia_netemul_network::NetworkContextMarker,
>,
>
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<fidl_fuchsia_netemul_network::NetworkContextMarker>,
>,
&mut self.network_context,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl ChildDef {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.eager {
return 6;
}
if let Some(_) = self.program_args {
return 5;
}
if let Some(_) = self.uses {
return 4;
}
if let Some(_) = self.exposes {
return 3;
}
if let Some(_) = self.name {
return 2;
}
if let Some(_) = self.source {
return 1;
}
0
}
}
unsafe impl fidl::encoding::TypeMarker for ChildDef {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
impl fidl::encoding::ResourceTypeMarker for ChildDef {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<ChildDef> for &mut ChildDef {
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ChildDef>(offset);
let max_ordinal: u64 = self.max_ordinal_present();
encoder.write_num(max_ordinal, offset);
encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
if max_ordinal == 0 {
return Ok(());
}
depth.increment()?;
let envelope_size = 8;
let bytes_len = max_ordinal as usize * envelope_size;
#[allow(unused_variables)]
let offset = encoder.out_of_line_offset(bytes_len);
let mut _prev_end_offset: usize = 0;
if 1 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (1 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<ChildSource>(
self.source
.as_mut()
.map(<ChildSource as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 2 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (2 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<255>>(
self.name.as_ref().map(
<fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow,
),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 3 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (3 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<255>>>(
self.exposes.as_ref().map(<fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<255>> as fidl::encoding::ValueTypeMarker>::borrow),
encoder, offset + cur_offset, depth
)?;
_prev_end_offset = cur_offset + envelope_size;
if 4 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (4 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<ChildUses>(
self.uses.as_ref().map(<ChildUses as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 5 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (5 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>>(
self.program_args.as_ref().map(<fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString> as fidl::encoding::ValueTypeMarker>::borrow),
encoder, offset + cur_offset, depth
)?;
_prev_end_offset = cur_offset + envelope_size;
if 6 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (6 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<bool>(
self.eager.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for ChildDef {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
if len == 0 {
return Ok(());
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 1 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<ChildSource as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.source.get_or_insert_with(|| fidl::new_empty!(ChildSource));
fidl::decode!(ChildSource, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 2 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<fidl::encoding::BoundedString<255> as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self
.name
.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<255>));
fidl::decode!(
fidl::encoding::BoundedString<255>,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 3 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size = <fidl::encoding::UnboundedVector<
fidl::encoding::BoundedString<255>,
> as fidl::encoding::TypeMarker>::inline_size(
decoder.context
);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.exposes.get_or_insert_with(|| {
fidl::new_empty!(
fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<255>>
)
});
fidl::decode!(
fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<255>>,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 4 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<ChildUses as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.uses.get_or_insert_with(|| fidl::new_empty!(ChildUses));
fidl::decode!(ChildUses, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 5 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size = <fidl::encoding::UnboundedVector<
fidl::encoding::UnboundedString,
> as fidl::encoding::TypeMarker>::inline_size(
decoder.context
);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.program_args.get_or_insert_with(|| {
fidl::new_empty!(
fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>
)
});
fidl::decode!(
fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 6 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.eager.get_or_insert_with(|| fidl::new_empty!(bool));
fidl::decode!(bool, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
while next_offset < end_offset {
_next_ordinal_to_read += 1;
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
next_offset += envelope_size;
}
Ok(())
}
}
impl ChildDep {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.capability {
return 2;
}
if let Some(_) = self.name {
return 1;
}
0
}
}
unsafe impl fidl::encoding::TypeMarker for ChildDep {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
impl fidl::encoding::ValueTypeMarker for ChildDep {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<ChildDep> for &ChildDep {
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ChildDep>(offset);
let max_ordinal: u64 = self.max_ordinal_present();
encoder.write_num(max_ordinal, offset);
encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
if max_ordinal == 0 {
return Ok(());
}
depth.increment()?;
let envelope_size = 8;
let bytes_len = max_ordinal as usize * envelope_size;
#[allow(unused_variables)]
let offset = encoder.out_of_line_offset(bytes_len);
let mut _prev_end_offset: usize = 0;
if 1 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (1 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<255>>(
self.name.as_ref().map(
<fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow,
),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 2 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (2 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<ExposedCapability>(
self.capability
.as_ref()
.map(<ExposedCapability as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for ChildDep {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
if len == 0 {
return Ok(());
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 1 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<fidl::encoding::BoundedString<255> as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self
.name
.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<255>));
fidl::decode!(
fidl::encoding::BoundedString<255>,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 2 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<ExposedCapability as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref =
self.capability.get_or_insert_with(|| fidl::new_empty!(ExposedCapability));
fidl::decode!(ExposedCapability, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
while next_offset < end_offset {
_next_ordinal_to_read += 1;
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
next_offset += envelope_size;
}
Ok(())
}
}
impl DevfsDep {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.subdir {
return 2;
}
if let Some(_) = self.name {
return 1;
}
0
}
}
unsafe impl fidl::encoding::TypeMarker for DevfsDep {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
impl fidl::encoding::ValueTypeMarker for DevfsDep {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<DevfsDep> for &DevfsDep {
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DevfsDep>(offset);
let max_ordinal: u64 = self.max_ordinal_present();
encoder.write_num(max_ordinal, offset);
encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
if max_ordinal == 0 {
return Ok(());
}
depth.increment()?;
let envelope_size = 8;
let bytes_len = max_ordinal as usize * envelope_size;
#[allow(unused_variables)]
let offset = encoder.out_of_line_offset(bytes_len);
let mut _prev_end_offset: usize = 0;
if 1 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (1 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<255>>(
self.name.as_ref().map(
<fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow,
),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 2 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (2 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<4095>>(
self.subdir.as_ref().map(<fidl::encoding::BoundedString<4095> as fidl::encoding::ValueTypeMarker>::borrow),
encoder, offset + cur_offset, depth
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for DevfsDep {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
if len == 0 {
return Ok(());
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 1 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<fidl::encoding::BoundedString<255> as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self
.name
.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<255>));
fidl::decode!(
fidl::encoding::BoundedString<255>,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 2 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size = <fidl::encoding::BoundedString<4095> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self
.subdir
.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<4095>));
fidl::decode!(
fidl::encoding::BoundedString<4095>,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
while next_offset < end_offset {
_next_ordinal_to_read += 1;
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
next_offset += envelope_size;
}
Ok(())
}
}
impl InterfaceOptions {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.ipv6_multicast_neighbor_solicitations {
return 9;
}
if let Some(_) = self.ipv4_multicast_neighbor_solicitations {
return 8;
}
if let Some(_) = self.enable_ipv6_forwarding {
return 7;
}
if let Some(_) = self.enable_ipv4_forwarding {
return 6;
}
if let Some(_) = self.gateway {
return 5;
}
if let Some(_) = self.static_ips {
return 4;
}
if let Some(_) = self.without_autogenerated_addresses {
return 3;
}
if let Some(_) = self.device {
return 2;
}
if let Some(_) = self.name {
return 1;
}
0
}
}
unsafe impl fidl::encoding::TypeMarker for InterfaceOptions {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
impl fidl::encoding::ResourceTypeMarker for InterfaceOptions {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<InterfaceOptions> for &mut InterfaceOptions {
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<InterfaceOptions>(offset);
let max_ordinal: u64 = self.max_ordinal_present();
encoder.write_num(max_ordinal, offset);
encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
if max_ordinal == 0 {
return Ok(());
}
depth.increment()?;
let envelope_size = 8;
let bytes_len = max_ordinal as usize * envelope_size;
#[allow(unused_variables)]
let offset = encoder.out_of_line_offset(bytes_len);
let mut _prev_end_offset: usize = 0;
if 1 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (1 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedString>(
self.name.as_ref().map(
<fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow,
),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 2 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (2 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_network::PortMarker>,
>,
>(
self.device.as_mut().map(
<fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_network::PortMarker>,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 3 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (3 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<bool>(
self.without_autogenerated_addresses
.as_ref()
.map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 4 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (4 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<fidl_fuchsia_net::Subnet>>(
self.static_ips.as_ref().map(<fidl::encoding::UnboundedVector<fidl_fuchsia_net::Subnet> as fidl::encoding::ValueTypeMarker>::borrow),
encoder, offset + cur_offset, depth
)?;
_prev_end_offset = cur_offset + envelope_size;
if 5 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (5 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_net::IpAddress>(
self.gateway
.as_ref()
.map(<fidl_fuchsia_net::IpAddress as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 6 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (6 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<bool>(
self.enable_ipv4_forwarding
.as_ref()
.map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 7 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (7 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<bool>(
self.enable_ipv6_forwarding
.as_ref()
.map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 8 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (8 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<u16>(
self.ipv4_multicast_neighbor_solicitations
.as_ref()
.map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 9 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (9 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<u16>(
self.ipv6_multicast_neighbor_solicitations
.as_ref()
.map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for InterfaceOptions {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
if len == 0 {
return Ok(());
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 1 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<fidl::encoding::UnboundedString as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self
.name
.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::UnboundedString));
fidl::decode!(
fidl::encoding::UnboundedString,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 2 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size = <fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_network::PortMarker>,
> as fidl::encoding::TypeMarker>::inline_size(
decoder.context
);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.device.get_or_insert_with(|| {
fidl::new_empty!(
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_network::PortMarker>,
>
)
});
fidl::decode!(
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_network::PortMarker>,
>,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 3 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self
.without_autogenerated_addresses
.get_or_insert_with(|| fidl::new_empty!(bool));
fidl::decode!(bool, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 4 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size = <fidl::encoding::UnboundedVector<fidl_fuchsia_net::Subnet> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.static_ips.get_or_insert_with(|| {
fidl::new_empty!(fidl::encoding::UnboundedVector<fidl_fuchsia_net::Subnet>)
});
fidl::decode!(
fidl::encoding::UnboundedVector<fidl_fuchsia_net::Subnet>,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 5 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<fidl_fuchsia_net::IpAddress as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self
.gateway
.get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_net::IpAddress));
fidl::decode!(
fidl_fuchsia_net::IpAddress,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 6 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref =
self.enable_ipv4_forwarding.get_or_insert_with(|| fidl::new_empty!(bool));
fidl::decode!(bool, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 7 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref =
self.enable_ipv6_forwarding.get_or_insert_with(|| fidl::new_empty!(bool));
fidl::decode!(bool, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 8 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self
.ipv4_multicast_neighbor_solicitations
.get_or_insert_with(|| fidl::new_empty!(u16));
fidl::decode!(u16, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 9 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self
.ipv6_multicast_neighbor_solicitations
.get_or_insert_with(|| fidl::new_empty!(u16));
fidl::decode!(u16, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
while next_offset < end_offset {
_next_ordinal_to_read += 1;
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
next_offset += envelope_size;
}
Ok(())
}
}
impl RealmOptions {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.children {
return 2;
}
if let Some(_) = self.name {
return 1;
}
0
}
}
unsafe impl fidl::encoding::TypeMarker for RealmOptions {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
impl fidl::encoding::ResourceTypeMarker for RealmOptions {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<RealmOptions> for &mut RealmOptions {
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RealmOptions>(offset);
let max_ordinal: u64 = self.max_ordinal_present();
encoder.write_num(max_ordinal, offset);
encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
if max_ordinal == 0 {
return Ok(());
}
depth.increment()?;
let envelope_size = 8;
let bytes_len = max_ordinal as usize * envelope_size;
#[allow(unused_variables)]
let offset = encoder.out_of_line_offset(bytes_len);
let mut _prev_end_offset: usize = 0;
if 1 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (1 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedString>(
self.name.as_ref().map(
<fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow,
),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 2 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (2 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<ChildDef>>(
self.children.as_mut().map(<fidl::encoding::UnboundedVector<ChildDef> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
encoder, offset + cur_offset, depth
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for RealmOptions {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
if len == 0 {
return Ok(());
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 1 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<fidl::encoding::UnboundedString as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self
.name
.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::UnboundedString));
fidl::decode!(
fidl::encoding::UnboundedString,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 2 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size = <fidl::encoding::UnboundedVector<ChildDef> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.children.get_or_insert_with(|| {
fidl::new_empty!(fidl::encoding::UnboundedVector<ChildDef>)
});
fidl::decode!(
fidl::encoding::UnboundedVector<ChildDef>,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
while next_offset < end_offset {
_next_ordinal_to_read += 1;
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
next_offset += envelope_size;
}
Ok(())
}
}
impl StorageDep {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.path {
return 2;
}
if let Some(_) = self.variant {
return 1;
}
0
}
}
unsafe impl fidl::encoding::TypeMarker for StorageDep {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
impl fidl::encoding::ValueTypeMarker for StorageDep {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<StorageDep> for &StorageDep {
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<StorageDep>(offset);
let max_ordinal: u64 = self.max_ordinal_present();
encoder.write_num(max_ordinal, offset);
encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
if max_ordinal == 0 {
return Ok(());
}
depth.increment()?;
let envelope_size = 8;
let bytes_len = max_ordinal as usize * envelope_size;
#[allow(unused_variables)]
let offset = encoder.out_of_line_offset(bytes_len);
let mut _prev_end_offset: usize = 0;
if 1 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (1 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<StorageVariant>(
self.variant
.as_ref()
.map(<StorageVariant as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 2 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (2 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<4095>>(
self.path.as_ref().map(<fidl::encoding::BoundedString<4095> as fidl::encoding::ValueTypeMarker>::borrow),
encoder, offset + cur_offset, depth
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for StorageDep {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
if len == 0 {
return Ok(());
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 1 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<StorageVariant as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.variant.get_or_insert_with(|| fidl::new_empty!(StorageVariant));
fidl::decode!(StorageVariant, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 2 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size = <fidl::encoding::BoundedString<4095> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self
.path
.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<4095>));
fidl::decode!(
fidl::encoding::BoundedString<4095>,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
while next_offset < end_offset {
_next_ordinal_to_read += 1;
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
next_offset += envelope_size;
}
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for Capability {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
impl fidl::encoding::ValueTypeMarker for Capability {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<Capability> for &Capability {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Capability>(offset);
encoder.write_num::<u64>(self.ordinal(), offset);
match self {
Capability::NetemulDevfs(ref val) => {
fidl::encoding::encode_in_envelope::<DevfsDep>(
<DevfsDep as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
Capability::NetemulNetworkContext(ref val) => {
fidl::encoding::encode_in_envelope::<Empty>(
<Empty as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
Capability::LogSink(ref val) => fidl::encoding::encode_in_envelope::<Empty>(
<Empty as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
),
Capability::ChildDep(ref val) => fidl::encoding::encode_in_envelope::<ChildDep>(
<ChildDep as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
),
Capability::StorageDep(ref val) => {
fidl::encoding::encode_in_envelope::<StorageDep>(
<StorageDep as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
Capability::TracingProvider(ref val) => {
fidl::encoding::encode_in_envelope::<Empty>(
<Empty as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
}
}
}
impl fidl::encoding::Decode<Self> for Capability {
#[inline(always)]
fn new_empty() -> Self {
Self::NetemulDevfs(fidl::new_empty!(DevfsDep))
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
#[allow(unused_variables)]
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
let (ordinal, inlined, num_bytes, num_handles) =
fidl::encoding::decode_union_inline_portion(decoder, offset)?;
let member_inline_size = match ordinal {
1 => <DevfsDep as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3 => <Empty as fidl::encoding::TypeMarker>::inline_size(decoder.context),
4 => <Empty as fidl::encoding::TypeMarker>::inline_size(decoder.context),
5 => <ChildDep as fidl::encoding::TypeMarker>::inline_size(decoder.context),
6 => <StorageDep as fidl::encoding::TypeMarker>::inline_size(decoder.context),
7 => <Empty as fidl::encoding::TypeMarker>::inline_size(decoder.context),
_ => return Err(fidl::Error::UnknownUnionTag),
};
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let _inner_offset;
if inlined {
decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
_inner_offset = offset + 8;
} else {
depth.increment()?;
_inner_offset = decoder.out_of_line_offset(member_inline_size)?;
}
match ordinal {
1 => {
#[allow(irrefutable_let_patterns)]
if let Capability::NetemulDevfs(_) = self {
} else {
*self = Capability::NetemulDevfs(fidl::new_empty!(DevfsDep));
}
#[allow(irrefutable_let_patterns)]
if let Capability::NetemulDevfs(ref mut val) = self {
fidl::decode!(DevfsDep, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
3 => {
#[allow(irrefutable_let_patterns)]
if let Capability::NetemulNetworkContext(_) = self {
} else {
*self = Capability::NetemulNetworkContext(fidl::new_empty!(Empty));
}
#[allow(irrefutable_let_patterns)]
if let Capability::NetemulNetworkContext(ref mut val) = self {
fidl::decode!(Empty, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
4 => {
#[allow(irrefutable_let_patterns)]
if let Capability::LogSink(_) = self {
} else {
*self = Capability::LogSink(fidl::new_empty!(Empty));
}
#[allow(irrefutable_let_patterns)]
if let Capability::LogSink(ref mut val) = self {
fidl::decode!(Empty, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
5 => {
#[allow(irrefutable_let_patterns)]
if let Capability::ChildDep(_) = self {
} else {
*self = Capability::ChildDep(fidl::new_empty!(ChildDep));
}
#[allow(irrefutable_let_patterns)]
if let Capability::ChildDep(ref mut val) = self {
fidl::decode!(ChildDep, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
6 => {
#[allow(irrefutable_let_patterns)]
if let Capability::StorageDep(_) = self {
} else {
*self = Capability::StorageDep(fidl::new_empty!(StorageDep));
}
#[allow(irrefutable_let_patterns)]
if let Capability::StorageDep(ref mut val) = self {
fidl::decode!(StorageDep, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
7 => {
#[allow(irrefutable_let_patterns)]
if let Capability::TracingProvider(_) = self {
} else {
*self = Capability::TracingProvider(fidl::new_empty!(Empty));
}
#[allow(irrefutable_let_patterns)]
if let Capability::TracingProvider(ref mut val) = self {
fidl::decode!(Empty, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
ordinal => panic!("unexpected ordinal {:?}", ordinal),
}
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for ChildSource {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
impl fidl::encoding::ResourceTypeMarker for ChildSource {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<ChildSource> for &mut ChildSource {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ChildSource>(offset);
encoder.write_num::<u64>(self.ordinal(), offset);
match self {
ChildSource::Component(ref val) => {
fidl::encoding::encode_in_envelope::<fidl::encoding::BoundedString<4096>>(
<fidl::encoding::BoundedString<4096> as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder, offset + 8, _depth
)
}
ChildSource::Mock(ref mut val) => {
fidl::encoding::encode_in_envelope::<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>>>(
<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
encoder, offset + 8, _depth
)
}
}
}
}
impl fidl::encoding::Decode<Self> for ChildSource {
#[inline(always)]
fn new_empty() -> Self {
Self::Component(fidl::new_empty!(fidl::encoding::BoundedString<4096>))
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
#[allow(unused_variables)]
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
let (ordinal, inlined, num_bytes, num_handles) =
fidl::encoding::decode_union_inline_portion(decoder, offset)?;
let member_inline_size = match ordinal {
1 => {
<fidl::encoding::BoundedString<4096> as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
)
}
2 => <fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
> as fidl::encoding::TypeMarker>::inline_size(decoder.context),
_ => return Err(fidl::Error::UnknownUnionTag),
};
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let _inner_offset;
if inlined {
decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
_inner_offset = offset + 8;
} else {
depth.increment()?;
_inner_offset = decoder.out_of_line_offset(member_inline_size)?;
}
match ordinal {
1 => {
#[allow(irrefutable_let_patterns)]
if let ChildSource::Component(_) = self {
} else {
*self = ChildSource::Component(fidl::new_empty!(
fidl::encoding::BoundedString<4096>
));
}
#[allow(irrefutable_let_patterns)]
if let ChildSource::Component(ref mut val) = self {
fidl::decode!(
fidl::encoding::BoundedString<4096>,
val,
decoder,
_inner_offset,
depth
)?;
} else {
unreachable!()
}
}
2 => {
#[allow(irrefutable_let_patterns)]
if let ChildSource::Mock(_) = self {
} else {
*self = ChildSource::Mock(fidl::new_empty!(
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
>
));
}
#[allow(irrefutable_let_patterns)]
if let ChildSource::Mock(ref mut val) = self {
fidl::decode!(
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
>,
val,
decoder,
_inner_offset,
depth
)?;
} else {
unreachable!()
}
}
ordinal => panic!("unexpected ordinal {:?}", ordinal),
}
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for ChildUses {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
impl fidl::encoding::ValueTypeMarker for ChildUses {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<ChildUses> for &ChildUses {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ChildUses>(offset);
encoder.write_num::<u64>(self.ordinal(), offset);
match self {
ChildUses::Capabilities(ref val) => {
fidl::encoding::encode_in_envelope::<fidl::encoding::UnboundedVector<Capability>>(
<fidl::encoding::UnboundedVector<Capability> as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder, offset + 8, _depth
)
}
}
}
}
impl fidl::encoding::Decode<Self> for ChildUses {
#[inline(always)]
fn new_empty() -> Self {
Self::Capabilities(fidl::new_empty!(fidl::encoding::UnboundedVector<Capability>))
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
#[allow(unused_variables)]
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
let (ordinal, inlined, num_bytes, num_handles) =
fidl::encoding::decode_union_inline_portion(decoder, offset)?;
let member_inline_size = match ordinal {
1 => <fidl::encoding::UnboundedVector<Capability> as fidl::encoding::TypeMarker>::inline_size(decoder.context),
_ => return Err(fidl::Error::UnknownUnionTag),
};
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let _inner_offset;
if inlined {
decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
_inner_offset = offset + 8;
} else {
depth.increment()?;
_inner_offset = decoder.out_of_line_offset(member_inline_size)?;
}
match ordinal {
1 => {
#[allow(irrefutable_let_patterns)]
if let ChildUses::Capabilities(_) = self {
} else {
*self = ChildUses::Capabilities(fidl::new_empty!(
fidl::encoding::UnboundedVector<Capability>
));
}
#[allow(irrefutable_let_patterns)]
if let ChildUses::Capabilities(ref mut val) = self {
fidl::decode!(
fidl::encoding::UnboundedVector<Capability>,
val,
decoder,
_inner_offset,
depth
)?;
} else {
unreachable!()
}
}
ordinal => panic!("unexpected ordinal {:?}", ordinal),
}
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for ExposedCapability {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
impl fidl::encoding::ValueTypeMarker for ExposedCapability {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<ExposedCapability> for &ExposedCapability {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ExposedCapability>(offset);
encoder.write_num::<u64>(self.ordinal(), offset);
match self {
ExposedCapability::Protocol(ref val) => fidl::encoding::encode_in_envelope::<
fidl::encoding::BoundedString<255>,
>(
<fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(
val,
),
encoder,
offset + 8,
_depth,
),
ExposedCapability::Configuration(ref val) => fidl::encoding::encode_in_envelope::<
fidl::encoding::BoundedString<255>,
>(
<fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(
val,
),
encoder,
offset + 8,
_depth,
),
}
}
}
impl fidl::encoding::Decode<Self> for ExposedCapability {
#[inline(always)]
fn new_empty() -> Self {
Self::Protocol(fidl::new_empty!(fidl::encoding::BoundedString<255>))
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
#[allow(unused_variables)]
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
let (ordinal, inlined, num_bytes, num_handles) =
fidl::encoding::decode_union_inline_portion(decoder, offset)?;
let member_inline_size = match ordinal {
1 => {
<fidl::encoding::BoundedString<255> as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
)
}
2 => {
<fidl::encoding::BoundedString<255> as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
)
}
_ => return Err(fidl::Error::UnknownUnionTag),
};
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let _inner_offset;
if inlined {
decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
_inner_offset = offset + 8;
} else {
depth.increment()?;
_inner_offset = decoder.out_of_line_offset(member_inline_size)?;
}
match ordinal {
1 => {
#[allow(irrefutable_let_patterns)]
if let ExposedCapability::Protocol(_) = self {
} else {
*self = ExposedCapability::Protocol(fidl::new_empty!(
fidl::encoding::BoundedString<255>
));
}
#[allow(irrefutable_let_patterns)]
if let ExposedCapability::Protocol(ref mut val) = self {
fidl::decode!(
fidl::encoding::BoundedString<255>,
val,
decoder,
_inner_offset,
depth
)?;
} else {
unreachable!()
}
}
2 => {
#[allow(irrefutable_let_patterns)]
if let ExposedCapability::Configuration(_) = self {
} else {
*self = ExposedCapability::Configuration(fidl::new_empty!(
fidl::encoding::BoundedString<255>
));
}
#[allow(irrefutable_let_patterns)]
if let ExposedCapability::Configuration(ref mut val) = self {
fidl::decode!(
fidl::encoding::BoundedString<255>,
val,
decoder,
_inner_offset,
depth
)?;
} else {
unreachable!()
}
}
ordinal => panic!("unexpected ordinal {:?}", ordinal),
}
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
Ok(())
}
}
}