#![warn(clippy::all)]
#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
use bitflags::bitflags;
use fidl::client::QueryResponseFut;
use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
use fidl::endpoints::{ControlHandle as _, Responder as _};
use futures::future::{self, MaybeDone, TryFutureExt};
use zx_status;
#[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,
CustomArtifacts = 3,
}
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),
3 => Some(Self::CustomArtifacts),
_ => 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, Debug, PartialEq)]
pub struct ChildConfigValue {
pub key: String,
pub value: fidl_fuchsia_component_decl::ConfigValue,
}
impl fidl::Persistable for ChildConfigValue {}
#[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<fidl::encoding::DefaultFuchsiaResourceDialect>
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<fidl::encoding::DefaultFuchsiaResourceDialect>
for ManagedRealmConnectToProtocolRequest
{
}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ManagedRealmGetDevfsRequest {
pub devfs: fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
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<fidl::encoding::DefaultFuchsiaResourceDialect>
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<fidl::encoding::DefaultFuchsiaResourceDialect> 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<fidl::encoding::DefaultFuchsiaResourceDialect>
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>,
pub config_values: Option<Vec<ChildConfigValue>>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> 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<fidl::encoding::DefaultFuchsiaResourceDialect> 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<fidl::encoding::DefaultFuchsiaResourceDialect> 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<fidl::encoding::DefaultFuchsiaResourceDialect> 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),
Service(String),
}
impl ExposedCapability {
#[inline]
pub fn ordinal(&self) -> u64 {
match *self {
Self::Protocol(_) => 1,
Self::Configuration(_) => 2,
Self::Service(_) => 3,
}
}
#[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::MonotonicInstant,
) -> Result<ConfigurableNetstackEvent, fidl::Error> {
ConfigurableNetstackEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#configure_interface(
&self,
mut payload: InterfaceOptions,
___deadline: zx::MonotonicInstant,
) -> 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<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
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,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
ConfigurableNetstackProxyInterface::r#configure_interface(self, payload)
}
}
impl ConfigurableNetstackProxyInterface for ConfigurableNetstackProxy {
type ConfigureInterfaceResponseFut = fidl::client::QueryResponseFut<
ConfigurableNetstackConfigureInterfaceResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#configure_interface(
&self,
mut payload: InterfaceOptions,
) -> Self::ConfigureInterfaceResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<ConfigurableNetstackConfigureInterfaceResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, ConfigurationError>,
fidl::encoding::DefaultFuchsiaResourceDialect,
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<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
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::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::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<fidl::encoding::DefaultFuchsiaResourceDialect>>,
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<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
{
(self.inner, self.is_terminated)
}
fn from_inner(
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
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::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
|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.into(),
))))
}
}
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::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::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<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
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()
}
#[cfg(target_os = "fuchsia")]
fn signal_peer(
&self,
clear_mask: zx::Signals,
set_mask: zx::Signals,
) -> Result<(), zx_status::Status> {
use fidl::Peered;
self.inner.channel().signal_peer(clear_mask, set_mask)
}
}
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::MonotonicInstant,
) -> Result<ManagedRealmEvent, fidl::Error> {
ManagedRealmEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#get_moniker(&self, ___deadline: zx::MonotonicInstant) -> 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::MonotonicInstant,
) -> 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::MonotonicInstant,
) -> 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::MonotonicInstant,
) -> 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::MonotonicInstant,
) -> 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<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
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, fidl::encoding::DefaultFuchsiaResourceDialect> {
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,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
ManagedRealmProxyInterface::r#add_device(self, path, device)
}
pub fn r#remove_device(
&self,
mut path: &str,
) -> fidl::client::QueryResponseFut<
ManagedRealmRemoveDeviceResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
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,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
ManagedRealmProxyInterface::r#start_child_component(self, child_name)
}
pub fn r#stop_child_component(
&self,
mut child_name: &str,
) -> fidl::client::QueryResponseFut<
ManagedRealmStopChildComponentResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
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, fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#get_moniker(&self) -> Self::GetMonikerResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<String, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
ManagedRealmGetMonikerResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
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,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
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::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<ManagedRealmAddDeviceResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
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,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#remove_device(&self, mut path: &str) -> Self::RemoveDeviceResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<ManagedRealmRemoveDeviceResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
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,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#start_child_component(
&self,
mut child_name: &str,
) -> Self::StartChildComponentResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<ManagedRealmStartChildComponentResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
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,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#stop_child_component(&self, mut child_name: &str) -> Self::StopChildComponentResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<ManagedRealmStopChildComponentResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
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<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
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::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::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::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::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<fidl::encoding::DefaultFuchsiaResourceDialect>>,
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<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
{
(self.inner, self.is_terminated)
}
fn from_inner(
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
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::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
|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.into(),
))))
}
}
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::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::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::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::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::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::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::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::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::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::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::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::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::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::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::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::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::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::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<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
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()
}
#[cfg(target_os = "fuchsia")]
fn signal_peer(
&self,
clear_mask: zx::Signals,
set_mask: zx::Signals,
) -> Result<(), zx_status::Status> {
use fidl::Peered;
self.inner.channel().signal_peer(clear_mask, set_mask)
}
}
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::MonotonicInstant,
) -> 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<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
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<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
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::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::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<fidl::encoding::DefaultFuchsiaResourceDialect>>,
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<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
{
(self.inner, self.is_terminated)
}
fn from_inner(
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
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::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
|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.into(),
))))
}
}
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::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::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::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::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<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
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()
}
#[cfg(target_os = "fuchsia")]
fn signal_peer(
&self,
clear_mask: zx::Signals,
set_mask: zx::Signals,
) -> Result<(), zx_status::Status> {
use fidl::Peered;
self.inner.channel().signal_peer(clear_mask, set_mask)
}
}
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(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
*value
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
for ConfigurationError
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ConfigurationError {
#[inline(always)]
fn new_empty() -> Self {
Self::InvalidArguments
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
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(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
*value
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for StorageVariant {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for StorageVariant {
#[inline(always)]
fn new_empty() -> Self {
Self::Data
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
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(())
}
}
impl fidl::encoding::ValueTypeMarker for ChildConfigValue {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ChildConfigValue {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
32
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ChildConfigValue, D>
for &ChildConfigValue
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ChildConfigValue>(offset);
fidl::encoding::Encode::<ChildConfigValue, D>::encode(
(
<fidl::encoding::BoundedString<64> as fidl::encoding::ValueTypeMarker>::borrow(&self.key),
<fidl_fuchsia_component_decl::ConfigValue as fidl::encoding::ValueTypeMarker>::borrow(&self.value),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::BoundedString<64>, D>,
T1: fidl::encoding::Encode<fidl_fuchsia_component_decl::ConfigValue, D>,
> fidl::encoding::Encode<ChildConfigValue, D> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ChildConfigValue>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ChildConfigValue {
#[inline(always)]
fn new_empty() -> Self {
Self {
key: fidl::new_empty!(fidl::encoding::BoundedString<64>, D),
value: fidl::new_empty!(fidl_fuchsia_component_decl::ConfigValue, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::BoundedString<64>,
D,
&mut self.key,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl_fuchsia_component_decl::ConfigValue,
D,
&mut self.value,
decoder,
offset + 16,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for Empty {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Empty, D> for &Empty {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Empty>(offset);
encoder.write_num(0u8, offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Empty {
#[inline(always)]
fn new_empty() -> Self {
Self
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
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),
}
}
}
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::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
}
}
unsafe impl
fidl::encoding::Encode<
ManagedRealmAddDeviceRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut ManagedRealmAddDeviceRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ManagedRealmAddDeviceRequest>(offset);
fidl::encoding::Encode::<
ManagedRealmAddDeviceRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::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,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T1: fidl::encoding::Encode<
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_netemul_network::DeviceProxy_Marker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
ManagedRealmAddDeviceRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
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, fidl::encoding::DefaultFuchsiaResourceDialect>
for ManagedRealmAddDeviceRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
path: fidl::new_empty!(
fidl::encoding::UnboundedString,
fidl::encoding::DefaultFuchsiaResourceDialect
),
device: fidl::new_empty!(
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<
fidl_fuchsia_netemul_network::DeviceProxy_Marker,
>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
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,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.path,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_netemul_network::DeviceProxy_Marker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.device,
decoder,
offset + 16,
_depth
)?;
Ok(())
}
}
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::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
}
}
unsafe impl
fidl::encoding::Encode<
ManagedRealmConnectToProtocolRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut ManagedRealmConnectToProtocolRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ManagedRealmConnectToProtocolRequest>(offset);
fidl::encoding::Encode::<ManagedRealmConnectToProtocolRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::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>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T1: fidl::encoding::Encode<
fidl::encoding::Optional<fidl::encoding::BoundedString<255>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T2: fidl::encoding::Encode<
fidl::encoding::HandleType<
fidl::Channel,
{ fidl::ObjectType::CHANNEL.into_raw() },
2147483648,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
ManagedRealmConnectToProtocolRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0, T1, T2)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
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, fidl::encoding::DefaultFuchsiaResourceDialect>
for ManagedRealmConnectToProtocolRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
protocol_name: fidl::new_empty!(
fidl::encoding::BoundedString<255>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
child_name: fidl::new_empty!(
fidl::encoding::Optional<fidl::encoding::BoundedString<255>>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
req: fidl::new_empty!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
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>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.protocol_name,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::Optional<fidl::encoding::BoundedString<255>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.child_name,
decoder,
offset + 16,
_depth
)?;
fidl::decode!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.req, decoder, offset + 32, _depth)?;
Ok(())
}
}
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::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
}
}
unsafe impl
fidl::encoding::Encode<
ManagedRealmGetDevfsRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut ManagedRealmGetDevfsRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ManagedRealmGetDevfsRequest>(offset);
fidl::encoding::Encode::<
ManagedRealmGetDevfsRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::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::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
ManagedRealmGetDevfsRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
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, fidl::encoding::DefaultFuchsiaResourceDialect>
for ManagedRealmGetDevfsRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
devfs: fidl::new_empty!(
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
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>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.devfs,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for ManagedRealmGetMonikerResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<ManagedRealmGetMonikerResponse, D>
for &ManagedRealmGetMonikerResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ManagedRealmGetMonikerResponse>(offset);
fidl::encoding::Encode::<ManagedRealmGetMonikerResponse, D>::encode(
(<fidl::encoding::BoundedString<4096> as fidl::encoding::ValueTypeMarker>::borrow(
&self.moniker,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::BoundedString<4096>, D>,
> fidl::encoding::Encode<ManagedRealmGetMonikerResponse, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ManagedRealmGetMonikerResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for ManagedRealmGetMonikerResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { moniker: fidl::new_empty!(fidl::encoding::BoundedString<4096>, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::BoundedString<4096>,
D,
&mut self.moniker,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
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::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
}
}
unsafe impl
fidl::encoding::Encode<
ManagedRealmOpenDiagnosticsDirectoryRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut ManagedRealmOpenDiagnosticsDirectoryRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ManagedRealmOpenDiagnosticsDirectoryRequest>(offset);
fidl::encoding::Encode::<
ManagedRealmOpenDiagnosticsDirectoryRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::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>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T1: fidl::encoding::Encode<
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
ManagedRealmOpenDiagnosticsDirectoryRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
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, fidl::encoding::DefaultFuchsiaResourceDialect>
for ManagedRealmOpenDiagnosticsDirectoryRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
child_name: fidl::new_empty!(
fidl::encoding::BoundedString<255>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
directory: fidl::new_empty!(
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
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>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.child_name,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<fidl_fuchsia_io::DirectoryMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.directory,
decoder,
offset + 16,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for ManagedRealmRemoveDeviceRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<ManagedRealmRemoveDeviceRequest, D>
for &ManagedRealmRemoveDeviceRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ManagedRealmRemoveDeviceRequest>(offset);
fidl::encoding::Encode::<ManagedRealmRemoveDeviceRequest, D>::encode(
(<fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
&self.path,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
> fidl::encoding::Encode<ManagedRealmRemoveDeviceRequest, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ManagedRealmRemoveDeviceRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for ManagedRealmRemoveDeviceRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { path: fidl::new_empty!(fidl::encoding::UnboundedString, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::UnboundedString,
D,
&mut self.path,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for ManagedRealmStartChildComponentRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<ManagedRealmStartChildComponentRequest, D>
for &ManagedRealmStartChildComponentRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ManagedRealmStartChildComponentRequest>(offset);
fidl::encoding::Encode::<ManagedRealmStartChildComponentRequest, D>::encode(
(<fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(
&self.child_name,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::BoundedString<255>, D>,
> fidl::encoding::Encode<ManagedRealmStartChildComponentRequest, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ManagedRealmStartChildComponentRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for ManagedRealmStartChildComponentRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { child_name: fidl::new_empty!(fidl::encoding::BoundedString<255>, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::BoundedString<255>,
D,
&mut self.child_name,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for ManagedRealmStopChildComponentRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<ManagedRealmStopChildComponentRequest, D>
for &ManagedRealmStopChildComponentRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ManagedRealmStopChildComponentRequest>(offset);
fidl::encoding::Encode::<ManagedRealmStopChildComponentRequest, D>::encode(
(<fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(
&self.child_name,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::BoundedString<255>, D>,
> fidl::encoding::Encode<ManagedRealmStopChildComponentRequest, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ManagedRealmStopChildComponentRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for ManagedRealmStopChildComponentRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { child_name: fidl::new_empty!(fidl::encoding::BoundedString<255>, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::BoundedString<255>,
D,
&mut self.child_name,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
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::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
}
}
unsafe impl
fidl::encoding::Encode<
SandboxCreateRealmRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut SandboxCreateRealmRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<SandboxCreateRealmRequest>(offset);
fidl::encoding::Encode::<SandboxCreateRealmRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::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>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T1: fidl::encoding::Encode<RealmOptions, fidl::encoding::DefaultFuchsiaResourceDialect>,
>
fidl::encoding::Encode<
SandboxCreateRealmRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
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, fidl::encoding::DefaultFuchsiaResourceDialect>
for SandboxCreateRealmRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
realm: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ManagedRealmMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
options: fidl::new_empty!(
RealmOptions,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
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>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.realm,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
RealmOptions,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.options,
decoder,
offset + 8,
_depth
)?;
Ok(())
}
}
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::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
}
}
unsafe impl
fidl::encoding::Encode<
SandboxGetNetworkContextRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut SandboxGetNetworkContextRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<SandboxGetNetworkContextRequest>(offset);
fidl::encoding::Encode::<
SandboxGetNetworkContextRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::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::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
SandboxGetNetworkContextRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
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, fidl::encoding::DefaultFuchsiaResourceDialect>
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,
>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
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>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.network_context,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl ChildDef {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.config_values {
return 7;
}
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
}
}
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::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
}
}
unsafe impl fidl::encoding::Encode<ChildDef, fidl::encoding::DefaultFuchsiaResourceDialect>
for &mut ChildDef
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
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,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
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>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
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>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
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,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
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>, fidl::encoding::DefaultFuchsiaResourceDialect>(
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,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
self.eager.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::<fidl::encoding::UnboundedVector<ChildConfigValue>, fidl::encoding::DefaultFuchsiaResourceDialect>(
self.config_values.as_ref().map(<fidl::encoding::UnboundedVector<ChildConfigValue> as fidl::encoding::ValueTypeMarker>::borrow),
encoder, offset + cur_offset, depth
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for ChildDef {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
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::encoding::DefaultFuchsiaResourceDialect)
});
fidl::decode!(
ChildSource,
fidl::encoding::DefaultFuchsiaResourceDialect,
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::encoding::DefaultFuchsiaResourceDialect
)
});
fidl::decode!(
fidl::encoding::BoundedString<255>,
fidl::encoding::DefaultFuchsiaResourceDialect,
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::encoding::DefaultFuchsiaResourceDialect
)
});
fidl::decode!(
fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<255>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
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::encoding::DefaultFuchsiaResourceDialect)
});
fidl::decode!(
ChildUses,
fidl::encoding::DefaultFuchsiaResourceDialect,
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::encoding::DefaultFuchsiaResourceDialect
)
});
fidl::decode!(
fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>,
fidl::encoding::DefaultFuchsiaResourceDialect,
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::encoding::DefaultFuchsiaResourceDialect)
});
fidl::decode!(
bool,
fidl::encoding::DefaultFuchsiaResourceDialect,
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 = <fidl::encoding::UnboundedVector<ChildConfigValue> 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.config_values.get_or_insert_with(|| {
fidl::new_empty!(
fidl::encoding::UnboundedVector<ChildConfigValue>,
fidl::encoding::DefaultFuchsiaResourceDialect
)
});
fidl::decode!(
fidl::encoding::UnboundedVector<ChildConfigValue>,
fidl::encoding::DefaultFuchsiaResourceDialect,
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
}
}
impl fidl::encoding::ValueTypeMarker for ChildDep {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ChildDep, D> for &ChildDep {
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
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>, D>(
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, D>(
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<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ChildDep {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
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>, D));
fidl::decode!(
fidl::encoding::BoundedString<255>,
D,
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, D));
fidl::decode!(ExposedCapability, D, 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
}
}
impl fidl::encoding::ValueTypeMarker for DevfsDep {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DevfsDep, D> for &DevfsDep {
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
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>, D>(
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>, D>(
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<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DevfsDep {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
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>, D));
fidl::decode!(
fidl::encoding::BoundedString<255>,
D,
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>, D)
});
fidl::decode!(
fidl::encoding::BoundedString<4095>,
D,
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
}
}
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::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
}
}
unsafe impl
fidl::encoding::Encode<InterfaceOptions, fidl::encoding::DefaultFuchsiaResourceDialect>
for &mut InterfaceOptions
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
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,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
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>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
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,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
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>, fidl::encoding::DefaultFuchsiaResourceDialect>(
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,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
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,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
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,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
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,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
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,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
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, fidl::encoding::DefaultFuchsiaResourceDialect>
for InterfaceOptions
{
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
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::encoding::DefaultFuchsiaResourceDialect
)
});
fidl::decode!(
fidl::encoding::UnboundedString,
fidl::encoding::DefaultFuchsiaResourceDialect,
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::encoding::DefaultFuchsiaResourceDialect
)
});
fidl::decode!(
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_network::PortMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
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::encoding::DefaultFuchsiaResourceDialect)
});
fidl::decode!(
bool,
fidl::encoding::DefaultFuchsiaResourceDialect,
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::encoding::DefaultFuchsiaResourceDialect
)
});
fidl::decode!(
fidl::encoding::UnboundedVector<fidl_fuchsia_net::Subnet>,
fidl::encoding::DefaultFuchsiaResourceDialect,
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::encoding::DefaultFuchsiaResourceDialect
)
});
fidl::decode!(
fidl_fuchsia_net::IpAddress,
fidl::encoding::DefaultFuchsiaResourceDialect,
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::encoding::DefaultFuchsiaResourceDialect)
});
fidl::decode!(
bool,
fidl::encoding::DefaultFuchsiaResourceDialect,
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::encoding::DefaultFuchsiaResourceDialect)
});
fidl::decode!(
bool,
fidl::encoding::DefaultFuchsiaResourceDialect,
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::encoding::DefaultFuchsiaResourceDialect)
});
fidl::decode!(
u16,
fidl::encoding::DefaultFuchsiaResourceDialect,
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::encoding::DefaultFuchsiaResourceDialect)
});
fidl::decode!(
u16,
fidl::encoding::DefaultFuchsiaResourceDialect,
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
}
}
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::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
}
}
unsafe impl fidl::encoding::Encode<RealmOptions, fidl::encoding::DefaultFuchsiaResourceDialect>
for &mut RealmOptions
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
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,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
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>, fidl::encoding::DefaultFuchsiaResourceDialect>(
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, fidl::encoding::DefaultFuchsiaResourceDialect> for RealmOptions {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
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::encoding::DefaultFuchsiaResourceDialect
)
});
fidl::decode!(
fidl::encoding::UnboundedString,
fidl::encoding::DefaultFuchsiaResourceDialect,
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::encoding::DefaultFuchsiaResourceDialect
)
});
fidl::decode!(
fidl::encoding::UnboundedVector<ChildDef>,
fidl::encoding::DefaultFuchsiaResourceDialect,
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
}
}
impl fidl::encoding::ValueTypeMarker for StorageDep {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<StorageDep, D>
for &StorageDep
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
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, D>(
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>, D>(
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<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for StorageDep {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
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, D));
fidl::decode!(StorageVariant, D, 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>, D)
});
fidl::decode!(
fidl::encoding::BoundedString<4095>,
D,
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 fidl::encoding::ValueTypeMarker for Capability {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Capability, D>
for &Capability
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
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, D>(
<DevfsDep as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
Capability::NetemulNetworkContext(ref val) => {
fidl::encoding::encode_in_envelope::<Empty, D>(
<Empty as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
Capability::LogSink(ref val) => fidl::encoding::encode_in_envelope::<Empty, D>(
<Empty as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
),
Capability::ChildDep(ref val) => fidl::encoding::encode_in_envelope::<ChildDep, D>(
<ChildDep as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
),
Capability::StorageDep(ref val) => {
fidl::encoding::encode_in_envelope::<StorageDep, D>(
<StorageDep as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
Capability::TracingProvider(ref val) => {
fidl::encoding::encode_in_envelope::<Empty, D>(
<Empty as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
}
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Capability {
#[inline(always)]
fn new_empty() -> Self {
Self::NetemulDevfs(fidl::new_empty!(DevfsDep, D))
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
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, D));
}
#[allow(irrefutable_let_patterns)]
if let Capability::NetemulDevfs(ref mut val) = self {
fidl::decode!(DevfsDep, D, 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, D));
}
#[allow(irrefutable_let_patterns)]
if let Capability::NetemulNetworkContext(ref mut val) = self {
fidl::decode!(Empty, D, 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, D));
}
#[allow(irrefutable_let_patterns)]
if let Capability::LogSink(ref mut val) = self {
fidl::decode!(Empty, D, 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, D));
}
#[allow(irrefutable_let_patterns)]
if let Capability::ChildDep(ref mut val) = self {
fidl::decode!(ChildDep, D, 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, D));
}
#[allow(irrefutable_let_patterns)]
if let Capability::StorageDep(ref mut val) = self {
fidl::decode!(StorageDep, D, 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, D));
}
#[allow(irrefutable_let_patterns)]
if let Capability::TracingProvider(ref mut val) = self {
fidl::decode!(Empty, D, 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(())
}
}
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::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
}
}
unsafe impl fidl::encoding::Encode<ChildSource, fidl::encoding::DefaultFuchsiaResourceDialect>
for &mut ChildSource
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
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::DefaultFuchsiaResourceDialect>(
<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::DefaultFuchsiaResourceDialect>(
<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, fidl::encoding::DefaultFuchsiaResourceDialect> for ChildSource {
#[inline(always)]
fn new_empty() -> Self {
Self::Component(fidl::new_empty!(
fidl::encoding::BoundedString<4096>,
fidl::encoding::DefaultFuchsiaResourceDialect
))
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
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>,
fidl::encoding::DefaultFuchsiaResourceDialect
));
}
#[allow(irrefutable_let_patterns)]
if let ChildSource::Component(ref mut val) = self {
fidl::decode!(
fidl::encoding::BoundedString<4096>,
fidl::encoding::DefaultFuchsiaResourceDialect,
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>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect
));
}
#[allow(irrefutable_let_patterns)]
if let ChildSource::Mock(ref mut val) = self {
fidl::decode!(
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
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(())
}
}
impl fidl::encoding::ValueTypeMarker for ChildUses {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ChildUses, D>
for &ChildUses
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
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>, D>(
<fidl::encoding::UnboundedVector<Capability> as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder, offset + 8, _depth
)
}
}
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ChildUses {
#[inline(always)]
fn new_empty() -> Self {
Self::Capabilities(fidl::new_empty!(fidl::encoding::UnboundedVector<Capability>, D))
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
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>,
D
));
}
#[allow(irrefutable_let_patterns)]
if let ChildUses::Capabilities(ref mut val) = self {
fidl::decode!(
fidl::encoding::UnboundedVector<Capability>,
D,
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(())
}
}
impl fidl::encoding::ValueTypeMarker for ExposedCapability {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ExposedCapability, D>
for &ExposedCapability
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
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>,
D,
>(
<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>,
D,
>(
<fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(
val,
),
encoder,
offset + 8,
_depth,
),
ExposedCapability::Service(ref val) => fidl::encoding::encode_in_envelope::<
fidl::encoding::BoundedString<255>,
D,
>(
<fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(
val,
),
encoder,
offset + 8,
_depth,
),
}
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ExposedCapability {
#[inline(always)]
fn new_empty() -> Self {
Self::Protocol(fidl::new_empty!(fidl::encoding::BoundedString<255>, D))
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
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,
)
}
3 => {
<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>,
D
));
}
#[allow(irrefutable_let_patterns)]
if let ExposedCapability::Protocol(ref mut val) = self {
fidl::decode!(
fidl::encoding::BoundedString<255>,
D,
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>,
D
));
}
#[allow(irrefutable_let_patterns)]
if let ExposedCapability::Configuration(ref mut val) = self {
fidl::decode!(
fidl::encoding::BoundedString<255>,
D,
val,
decoder,
_inner_offset,
depth
)?;
} else {
unreachable!()
}
}
3 => {
#[allow(irrefutable_let_patterns)]
if let ExposedCapability::Service(_) = self {
} else {
*self = ExposedCapability::Service(fidl::new_empty!(
fidl::encoding::BoundedString<255>,
D
));
}
#[allow(irrefutable_let_patterns)]
if let ExposedCapability::Service(ref mut val) = self {
fidl::decode!(
fidl::encoding::BoundedString<255>,
D,
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(())
}
}
}