#![warn(clippy::all)]
#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
use {
bitflags::bitflags,
fidl::{
client::QueryResponseFut,
endpoints::{ControlHandle as _, Responder as _},
},
fuchsia_zircon_status as zx_status,
futures::future::{self, MaybeDone, TryFutureExt},
};
#[cfg(target_os = "fuchsia")]
use fuchsia_zircon as zx;
pub const LOCAL_COMPONENT_NAME_KEY: &str = "LOCAL_COMPONENT_NAME";
pub const MAX_DIRECTORY_ENTRIES: u32 = 1024;
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(u32)]
pub enum RealmBuilderError {
ChildAlreadyExists = 0,
InvalidManifestExtension = 1,
InvalidComponentDecl = 2,
NoSuchChild = 3,
ChildDeclNotVisible = 4,
NoSuchSource = 5,
NoSuchTarget = 6,
CapabilitiesEmpty = 7,
TargetsEmpty = 8,
SourceAndTargetMatch = 9,
DeclNotFound = 10,
DeclReadError = 11,
BuildAlreadyCalled = 12,
CapabilityInvalid = 13,
InvalidChildRealmHandle = 14,
ImmutableProgram = 15,
UrlIsNotRelative = 16,
InvalidPkgDirHandle = 17,
NoConfigSchema = 18,
NoSuchConfigField = 19,
ConfigValueInvalid = 20,
ConfigOverrideUnsupported = 21,
InvalidChildDecl = 22,
}
impl RealmBuilderError {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
0 => Some(Self::ChildAlreadyExists),
1 => Some(Self::InvalidManifestExtension),
2 => Some(Self::InvalidComponentDecl),
3 => Some(Self::NoSuchChild),
4 => Some(Self::ChildDeclNotVisible),
5 => Some(Self::NoSuchSource),
6 => Some(Self::NoSuchTarget),
7 => Some(Self::CapabilitiesEmpty),
8 => Some(Self::TargetsEmpty),
9 => Some(Self::SourceAndTargetMatch),
10 => Some(Self::DeclNotFound),
11 => Some(Self::DeclReadError),
12 => Some(Self::BuildAlreadyCalled),
13 => Some(Self::CapabilityInvalid),
14 => Some(Self::InvalidChildRealmHandle),
15 => Some(Self::ImmutableProgram),
16 => Some(Self::UrlIsNotRelative),
17 => Some(Self::InvalidPkgDirHandle),
18 => Some(Self::NoConfigSchema),
19 => Some(Self::NoSuchConfigField),
20 => Some(Self::ConfigValueInvalid),
21 => Some(Self::ConfigOverrideUnsupported),
22 => Some(Self::InvalidChildDecl),
_ => 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(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct BuilderBuildRequest {
pub runner: fidl::endpoints::ClientEnd<fidl_fuchsia_component_runner::ComponentRunnerMarker>,
}
impl fidl::Standalone for BuilderBuildRequest {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct BuilderBuildResponse {
pub root_component_url: String,
}
impl fidl::Persistable for BuilderBuildResponse {}
#[derive(Debug, PartialEq)]
pub struct DirectoryContents {
pub entries: Vec<DirectoryEntry>,
}
impl fidl::Standalone for DirectoryContents {}
#[derive(Debug, PartialEq)]
pub struct DirectoryEntry {
pub file_path: String,
pub file_contents: fidl_fuchsia_mem::Buffer,
}
impl fidl::Standalone for DirectoryEntry {}
#[derive(Clone, Debug, PartialEq)]
pub struct RealmAddCapabilityRequest {
pub capability: fidl_fuchsia_component_decl::Capability,
}
impl fidl::Persistable for RealmAddCapabilityRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct RealmAddChildFromDeclRequest {
pub name: String,
pub decl: fidl_fuchsia_component_decl::Component,
pub options: ChildOptions,
}
impl fidl::Persistable for RealmAddChildFromDeclRequest {}
#[derive(Debug, PartialEq)]
pub struct RealmAddChildRealmRequest {
pub name: String,
pub options: ChildOptions,
pub child_realm: fidl::endpoints::ServerEnd<RealmMarker>,
}
impl fidl::Standalone for RealmAddChildRealmRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct RealmAddChildRequest {
pub name: String,
pub url: String,
pub options: ChildOptions,
}
impl fidl::Persistable for RealmAddChildRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct RealmAddLocalChildRequest {
pub name: String,
pub options: ChildOptions,
}
impl fidl::Persistable for RealmAddLocalChildRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct RealmAddRouteRequest {
pub capabilities: Vec<Capability>,
pub from: fidl_fuchsia_component_decl::Ref,
pub to: Vec<fidl_fuchsia_component_decl::Ref>,
}
impl fidl::Persistable for RealmAddRouteRequest {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct RealmBuilderFactoryCreateFromRelativeUrlRequest {
pub pkg_dir_handle: fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
pub relative_url: String,
pub realm_server_end: fidl::endpoints::ServerEnd<RealmMarker>,
pub builder_server_end: fidl::endpoints::ServerEnd<BuilderMarker>,
}
impl fidl::Standalone for RealmBuilderFactoryCreateFromRelativeUrlRequest {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct RealmBuilderFactoryCreateRequest {
pub pkg_dir_handle: fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
pub realm_server_end: fidl::endpoints::ServerEnd<RealmMarker>,
pub builder_server_end: fidl::endpoints::ServerEnd<BuilderMarker>,
}
impl fidl::Standalone for RealmBuilderFactoryCreateRequest {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct RealmGetComponentDeclRequest {
pub name: String,
}
impl fidl::Persistable for RealmGetComponentDeclRequest {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct RealmInitMutableConfigFromPackageRequest {
pub name: String,
}
impl fidl::Persistable for RealmInitMutableConfigFromPackageRequest {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct RealmInitMutableConfigToEmptyRequest {
pub name: String,
}
impl fidl::Persistable for RealmInitMutableConfigToEmptyRequest {}
#[derive(Debug, PartialEq)]
pub struct RealmReadOnlyDirectoryRequest {
pub name: String,
pub to: Vec<fidl_fuchsia_component_decl::Ref>,
pub directory_contents: DirectoryContents,
}
impl fidl::Standalone for RealmReadOnlyDirectoryRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct RealmReplaceComponentDeclRequest {
pub name: String,
pub component_decl: fidl_fuchsia_component_decl::Component,
}
impl fidl::Persistable for RealmReplaceComponentDeclRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct RealmReplaceRealmDeclRequest {
pub component_decl: fidl_fuchsia_component_decl::Component,
}
impl fidl::Persistable for RealmReplaceRealmDeclRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct RealmSetConfigValueRequest {
pub name: String,
pub key: String,
pub value: fidl_fuchsia_component_decl::ConfigValueSpec,
}
impl fidl::Persistable for RealmSetConfigValueRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct RealmGetComponentDeclResponse {
pub component_decl: fidl_fuchsia_component_decl::Component,
}
impl fidl::Persistable for RealmGetComponentDeclResponse {}
#[derive(Clone, Debug, PartialEq)]
pub struct RealmGetRealmDeclResponse {
pub component_decl: fidl_fuchsia_component_decl::Component,
}
impl fidl::Persistable for RealmGetRealmDeclResponse {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct ChildOptions {
pub startup: Option<fidl_fuchsia_component_decl::StartupMode>,
pub environment: Option<String>,
pub on_terminate: Option<fidl_fuchsia_component_decl::OnTerminate>,
pub config_overrides: Option<Vec<fidl_fuchsia_component_decl::ConfigOverride>>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for ChildOptions {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct Config {
pub name: Option<String>,
pub as_: Option<String>,
pub availability: Option<fidl_fuchsia_component_decl::Availability>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for Config {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct Directory {
pub name: Option<String>,
pub as_: Option<String>,
pub type_: Option<fidl_fuchsia_component_decl::DependencyType>,
pub subdir: Option<String>,
pub rights: Option<fidl_fuchsia_io::Operations>,
pub path: Option<String>,
pub availability: Option<fidl_fuchsia_component_decl::Availability>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for Directory {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct Event {
pub name: Option<String>,
pub as_: Option<String>,
pub filter: Option<fidl_fuchsia_data::Dictionary>,
pub availability: Option<fidl_fuchsia_component_decl::Availability>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for Event {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct EventStream {
pub name: Option<String>,
pub as_: Option<String>,
pub path: Option<String>,
pub filter: Option<fidl_fuchsia_data::Dictionary>,
pub scope: Option<Vec<fidl_fuchsia_component_decl::Ref>>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for EventStream {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct Protocol {
pub name: Option<String>,
pub as_: Option<String>,
pub type_: Option<fidl_fuchsia_component_decl::DependencyType>,
pub path: Option<String>,
pub availability: Option<fidl_fuchsia_component_decl::Availability>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for Protocol {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct Service {
pub name: Option<String>,
pub as_: Option<String>,
pub path: Option<String>,
pub availability: Option<fidl_fuchsia_component_decl::Availability>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for Service {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct Storage {
pub name: Option<String>,
pub as_: Option<String>,
pub path: Option<String>,
pub availability: Option<fidl_fuchsia_component_decl::Availability>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for Storage {}
#[derive(Clone, Debug)]
pub enum Capability {
Protocol(Protocol),
Directory(Directory),
Storage(Storage),
Service(Service),
EventStream(EventStream),
Config(Config),
#[doc(hidden)]
__SourceBreaking {
unknown_ordinal: u64,
},
}
#[macro_export]
macro_rules! CapabilityUnknown {
() => {
_
};
}
impl PartialEq for Capability {
fn eq(&self, other: &Self) -> bool {
match (self, other) {
(Self::Protocol(x), Self::Protocol(y)) => *x == *y,
(Self::Directory(x), Self::Directory(y)) => *x == *y,
(Self::Storage(x), Self::Storage(y)) => *x == *y,
(Self::Service(x), Self::Service(y)) => *x == *y,
(Self::EventStream(x), Self::EventStream(y)) => *x == *y,
(Self::Config(x), Self::Config(y)) => *x == *y,
_ => false,
}
}
}
impl Capability {
#[inline]
pub fn ordinal(&self) -> u64 {
match *self {
Self::Protocol(_) => 1,
Self::Directory(_) => 2,
Self::Storage(_) => 3,
Self::Service(_) => 4,
Self::EventStream(_) => 6,
Self::Config(_) => 7,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn unknown_variant_for_testing() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0 }
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { .. } => true,
_ => false,
}
}
}
impl fidl::Persistable for Capability {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct BuilderMarker;
impl fidl::endpoints::ProtocolMarker for BuilderMarker {
type Proxy = BuilderProxy;
type RequestStream = BuilderRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = BuilderSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) Builder";
}
pub type BuilderBuildResult = Result<String, RealmBuilderError>;
pub trait BuilderProxyInterface: Send + Sync {
type BuildResponseFut: std::future::Future<Output = Result<BuilderBuildResult, fidl::Error>>
+ Send;
fn r#build(
&self,
runner: fidl::endpoints::ClientEnd<fidl_fuchsia_component_runner::ComponentRunnerMarker>,
) -> Self::BuildResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct BuilderSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for BuilderSynchronousProxy {
type Proxy = BuilderProxy;
type Protocol = BuilderMarker;
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 BuilderSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <BuilderMarker 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::Time) -> Result<BuilderEvent, fidl::Error> {
BuilderEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#build(
&self,
mut runner: fidl::endpoints::ClientEnd<
fidl_fuchsia_component_runner::ComponentRunnerMarker,
>,
___deadline: zx::Time,
) -> Result<BuilderBuildResult, fidl::Error> {
let _response = self.client.send_query::<BuilderBuildRequest, fidl::encoding::ResultType<
BuilderBuildResponse,
RealmBuilderError,
>>(
(runner,),
0x172ba0923ec91575,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x.root_component_url))
}
}
#[derive(Debug, Clone)]
pub struct BuilderProxy {
client: fidl::client::Client,
}
impl fidl::endpoints::Proxy for BuilderProxy {
type Protocol = BuilderMarker;
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 BuilderProxy {
pub fn new(channel: fidl::AsyncChannel) -> Self {
let protocol_name = <BuilderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> BuilderEventStream {
BuilderEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#build(
&self,
mut runner: fidl::endpoints::ClientEnd<
fidl_fuchsia_component_runner::ComponentRunnerMarker,
>,
) -> fidl::client::QueryResponseFut<BuilderBuildResult> {
BuilderProxyInterface::r#build(self, runner)
}
}
impl BuilderProxyInterface for BuilderProxy {
type BuildResponseFut = fidl::client::QueryResponseFut<BuilderBuildResult>;
fn r#build(
&self,
mut runner: fidl::endpoints::ClientEnd<
fidl_fuchsia_component_runner::ComponentRunnerMarker,
>,
) -> Self::BuildResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<BuilderBuildResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<BuilderBuildResponse, RealmBuilderError>,
0x172ba0923ec91575,
>(_buf?)?;
Ok(_response.map(|x| x.root_component_url))
}
self.client.send_query_and_decode::<BuilderBuildRequest, BuilderBuildResult>(
(runner,),
0x172ba0923ec91575,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct BuilderEventStream {
event_receiver: fidl::client::EventReceiver,
}
impl std::marker::Unpin for BuilderEventStream {}
impl futures::stream::FusedStream for BuilderEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for BuilderEventStream {
type Item = Result<BuilderEvent, 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(BuilderEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum BuilderEvent {}
impl BuilderEvent {
fn decode(mut buf: fidl::MessageBufEtc) -> Result<BuilderEvent, 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: <BuilderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct BuilderRequestStream {
inner: std::sync::Arc<fidl::ServeInner>,
is_terminated: bool,
}
impl std::marker::Unpin for BuilderRequestStream {}
impl futures::stream::FusedStream for BuilderRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for BuilderRequestStream {
type Protocol = BuilderMarker;
type ControlHandle = BuilderControlHandle;
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 {
BuilderControlHandle { inner: self.inner.clone() }
}
fn into_inner(self) -> (::std::sync::Arc<fidl::ServeInner>, bool) {
(self.inner, self.is_terminated)
}
fn from_inner(inner: std::sync::Arc<fidl::ServeInner>, is_terminated: bool) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for BuilderRequestStream {
type Item = Result<BuilderRequest, 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 BuilderRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf(|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(e))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x172ba0923ec91575 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(BuilderBuildRequest);
fidl::encoding::Decoder::decode_into::<BuilderBuildRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = BuilderControlHandle { inner: this.inner.clone() };
Ok(BuilderRequest::Build {
runner: req.runner,
responder: BuilderBuildResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <BuilderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
})
}
}
#[derive(Debug)]
pub enum BuilderRequest {
Build {
runner: fidl::endpoints::ClientEnd<fidl_fuchsia_component_runner::ComponentRunnerMarker>,
responder: BuilderBuildResponder,
},
}
impl BuilderRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_build(
self,
) -> Option<(
fidl::endpoints::ClientEnd<fidl_fuchsia_component_runner::ComponentRunnerMarker>,
BuilderBuildResponder,
)> {
if let BuilderRequest::Build { runner, responder } = self {
Some((runner, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
BuilderRequest::Build { .. } => "build",
}
}
}
#[derive(Debug, Clone)]
pub struct BuilderControlHandle {
inner: std::sync::Arc<fidl::ServeInner>,
}
impl fidl::endpoints::ControlHandle for BuilderControlHandle {
fn shutdown(&self) {
self.inner.shutdown()
}
fn shutdown_with_epitaph(&self, status: zx_status::Status) {
self.inner.shutdown_with_epitaph(status)
}
fn is_closed(&self) -> bool {
self.inner.channel().is_closed()
}
fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
}
impl BuilderControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct BuilderBuildResponder {
control_handle: std::mem::ManuallyDrop<BuilderControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for BuilderBuildResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for BuilderBuildResponder {
type ControlHandle = BuilderControlHandle;
fn control_handle(&self) -> &BuilderControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl BuilderBuildResponder {
pub fn send(self, mut result: Result<&str, RealmBuilderError>) -> 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<&str, RealmBuilderError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<&str, RealmBuilderError>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<BuilderBuildResponse, RealmBuilderError>>(
result.map(|root_component_url| (root_component_url,)),
self.tx_id,
0x172ba0923ec91575,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct RealmMarker;
impl fidl::endpoints::ProtocolMarker for RealmMarker {
type Proxy = RealmProxy;
type RequestStream = RealmRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = RealmSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) Realm";
}
pub type RealmAddChildResult = Result<(), RealmBuilderError>;
pub type RealmAddChildFromDeclResult = Result<(), RealmBuilderError>;
pub type RealmAddLocalChildResult = Result<(), RealmBuilderError>;
pub type RealmAddChildRealmResult = Result<(), RealmBuilderError>;
pub type RealmGetComponentDeclResult =
Result<fidl_fuchsia_component_decl::Component, RealmBuilderError>;
pub type RealmReplaceComponentDeclResult = Result<(), RealmBuilderError>;
pub type RealmGetRealmDeclResult =
Result<fidl_fuchsia_component_decl::Component, RealmBuilderError>;
pub type RealmReplaceRealmDeclResult = Result<(), RealmBuilderError>;
pub type RealmAddRouteResult = Result<(), RealmBuilderError>;
pub type RealmReadOnlyDirectoryResult = Result<(), RealmBuilderError>;
pub type RealmInitMutableConfigFromPackageResult = Result<(), RealmBuilderError>;
pub type RealmInitMutableConfigToEmptyResult = Result<(), RealmBuilderError>;
pub type RealmAddCapabilityResult = Result<(), RealmBuilderError>;
pub type RealmSetConfigValueResult = Result<(), RealmBuilderError>;
pub trait RealmProxyInterface: Send + Sync {
type AddChildResponseFut: std::future::Future<Output = Result<RealmAddChildResult, fidl::Error>>
+ Send;
fn r#add_child(
&self,
name: &str,
url: &str,
options: &ChildOptions,
) -> Self::AddChildResponseFut;
type AddChildFromDeclResponseFut: std::future::Future<Output = Result<RealmAddChildFromDeclResult, fidl::Error>>
+ Send;
fn r#add_child_from_decl(
&self,
name: &str,
decl: &fidl_fuchsia_component_decl::Component,
options: &ChildOptions,
) -> Self::AddChildFromDeclResponseFut;
type AddLocalChildResponseFut: std::future::Future<Output = Result<RealmAddLocalChildResult, fidl::Error>>
+ Send;
fn r#add_local_child(
&self,
name: &str,
options: &ChildOptions,
) -> Self::AddLocalChildResponseFut;
type AddChildRealmResponseFut: std::future::Future<Output = Result<RealmAddChildRealmResult, fidl::Error>>
+ Send;
fn r#add_child_realm(
&self,
name: &str,
options: &ChildOptions,
child_realm: fidl::endpoints::ServerEnd<RealmMarker>,
) -> Self::AddChildRealmResponseFut;
type GetComponentDeclResponseFut: std::future::Future<Output = Result<RealmGetComponentDeclResult, fidl::Error>>
+ Send;
fn r#get_component_decl(&self, name: &str) -> Self::GetComponentDeclResponseFut;
type ReplaceComponentDeclResponseFut: std::future::Future<Output = Result<RealmReplaceComponentDeclResult, fidl::Error>>
+ Send;
fn r#replace_component_decl(
&self,
name: &str,
component_decl: &fidl_fuchsia_component_decl::Component,
) -> Self::ReplaceComponentDeclResponseFut;
type GetRealmDeclResponseFut: std::future::Future<Output = Result<RealmGetRealmDeclResult, fidl::Error>>
+ Send;
fn r#get_realm_decl(&self) -> Self::GetRealmDeclResponseFut;
type ReplaceRealmDeclResponseFut: std::future::Future<Output = Result<RealmReplaceRealmDeclResult, fidl::Error>>
+ Send;
fn r#replace_realm_decl(
&self,
component_decl: &fidl_fuchsia_component_decl::Component,
) -> Self::ReplaceRealmDeclResponseFut;
type AddRouteResponseFut: std::future::Future<Output = Result<RealmAddRouteResult, fidl::Error>>
+ Send;
fn r#add_route(
&self,
capabilities: &[Capability],
from: &fidl_fuchsia_component_decl::Ref,
to: &[fidl_fuchsia_component_decl::Ref],
) -> Self::AddRouteResponseFut;
type ReadOnlyDirectoryResponseFut: std::future::Future<Output = Result<RealmReadOnlyDirectoryResult, fidl::Error>>
+ Send;
fn r#read_only_directory(
&self,
name: &str,
to: &[fidl_fuchsia_component_decl::Ref],
directory_contents: DirectoryContents,
) -> Self::ReadOnlyDirectoryResponseFut;
type InitMutableConfigFromPackageResponseFut: std::future::Future<Output = Result<RealmInitMutableConfigFromPackageResult, fidl::Error>>
+ Send;
fn r#init_mutable_config_from_package(
&self,
name: &str,
) -> Self::InitMutableConfigFromPackageResponseFut;
type InitMutableConfigToEmptyResponseFut: std::future::Future<Output = Result<RealmInitMutableConfigToEmptyResult, fidl::Error>>
+ Send;
fn r#init_mutable_config_to_empty(
&self,
name: &str,
) -> Self::InitMutableConfigToEmptyResponseFut;
type AddCapabilityResponseFut: std::future::Future<Output = Result<RealmAddCapabilityResult, fidl::Error>>
+ Send;
fn r#add_capability(
&self,
capability: &fidl_fuchsia_component_decl::Capability,
) -> Self::AddCapabilityResponseFut;
type SetConfigValueResponseFut: std::future::Future<Output = Result<RealmSetConfigValueResult, fidl::Error>>
+ Send;
fn r#set_config_value(
&self,
name: &str,
key: &str,
value: &fidl_fuchsia_component_decl::ConfigValueSpec,
) -> Self::SetConfigValueResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct RealmSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for RealmSynchronousProxy {
type Proxy = RealmProxy;
type Protocol = RealmMarker;
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 RealmSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <RealmMarker 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::Time) -> Result<RealmEvent, fidl::Error> {
RealmEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#add_child(
&self,
mut name: &str,
mut url: &str,
mut options: &ChildOptions,
___deadline: zx::Time,
) -> Result<RealmAddChildResult, fidl::Error> {
let _response = self.client.send_query::<RealmAddChildRequest, fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
RealmBuilderError,
>>(
(name, url, options),
0x3f6c07627303d801,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#add_child_from_decl(
&self,
mut name: &str,
mut decl: &fidl_fuchsia_component_decl::Component,
mut options: &ChildOptions,
___deadline: zx::Time,
) -> Result<RealmAddChildFromDeclResult, fidl::Error> {
let _response =
self.client.send_query::<RealmAddChildFromDeclRequest, fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
RealmBuilderError,
>>(
(name, decl, options),
0x3950ad500258156d,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#add_local_child(
&self,
mut name: &str,
mut options: &ChildOptions,
___deadline: zx::Time,
) -> Result<RealmAddLocalChildResult, fidl::Error> {
let _response =
self.client.send_query::<RealmAddLocalChildRequest, fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
RealmBuilderError,
>>(
(name, options),
0x3249817bae10abbb,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#add_child_realm(
&self,
mut name: &str,
mut options: &ChildOptions,
mut child_realm: fidl::endpoints::ServerEnd<RealmMarker>,
___deadline: zx::Time,
) -> Result<RealmAddChildRealmResult, fidl::Error> {
let _response =
self.client.send_query::<RealmAddChildRealmRequest, fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
RealmBuilderError,
>>(
(name, options, child_realm),
0x3fdf98db373b9458,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#get_component_decl(
&self,
mut name: &str,
___deadline: zx::Time,
) -> Result<RealmGetComponentDeclResult, fidl::Error> {
let _response =
self.client.send_query::<RealmGetComponentDeclRequest, fidl::encoding::ResultType<
RealmGetComponentDeclResponse,
RealmBuilderError,
>>(
(name,),
0x320832af6a4cbac6,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x.component_decl))
}
pub fn r#replace_component_decl(
&self,
mut name: &str,
mut component_decl: &fidl_fuchsia_component_decl::Component,
___deadline: zx::Time,
) -> Result<RealmReplaceComponentDeclResult, fidl::Error> {
let _response =
self.client.send_query::<RealmReplaceComponentDeclRequest, fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
RealmBuilderError,
>>(
(name, component_decl),
0x59cecf31b314cd5f,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#get_realm_decl(
&self,
___deadline: zx::Time,
) -> Result<RealmGetRealmDeclResult, fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
fidl::encoding::ResultType<RealmGetRealmDeclResponse, RealmBuilderError>,
>(
(),
0x46fa05b17bd64269,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x.component_decl))
}
pub fn r#replace_realm_decl(
&self,
mut component_decl: &fidl_fuchsia_component_decl::Component,
___deadline: zx::Time,
) -> Result<RealmReplaceRealmDeclResult, fidl::Error> {
let _response =
self.client.send_query::<RealmReplaceRealmDeclRequest, fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
RealmBuilderError,
>>(
(component_decl,),
0x48fcba4ac1338da9,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#add_route(
&self,
mut capabilities: &[Capability],
mut from: &fidl_fuchsia_component_decl::Ref,
mut to: &[fidl_fuchsia_component_decl::Ref],
___deadline: zx::Time,
) -> Result<RealmAddRouteResult, fidl::Error> {
let _response = self.client.send_query::<RealmAddRouteRequest, fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
RealmBuilderError,
>>(
(capabilities, from, to),
0x9d523295be53a0a,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#read_only_directory(
&self,
mut name: &str,
mut to: &[fidl_fuchsia_component_decl::Ref],
mut directory_contents: DirectoryContents,
___deadline: zx::Time,
) -> Result<RealmReadOnlyDirectoryResult, fidl::Error> {
let _response =
self.client.send_query::<RealmReadOnlyDirectoryRequest, fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
RealmBuilderError,
>>(
(name, to, &mut directory_contents),
0x78a6d150a66e00dc,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#init_mutable_config_from_package(
&self,
mut name: &str,
___deadline: zx::Time,
) -> Result<RealmInitMutableConfigFromPackageResult, fidl::Error> {
let _response = self.client.send_query::<
RealmInitMutableConfigFromPackageRequest,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RealmBuilderError>,
>(
(name,),
0x36a30c9837c64216,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#init_mutable_config_to_empty(
&self,
mut name: &str,
___deadline: zx::Time,
) -> Result<RealmInitMutableConfigToEmptyResult, fidl::Error> {
let _response = self.client.send_query::<
RealmInitMutableConfigToEmptyRequest,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RealmBuilderError>,
>(
(name,),
0x772cb99e2e0dccc5,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#add_capability(
&self,
mut capability: &fidl_fuchsia_component_decl::Capability,
___deadline: zx::Time,
) -> Result<RealmAddCapabilityResult, fidl::Error> {
let _response =
self.client.send_query::<RealmAddCapabilityRequest, fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
RealmBuilderError,
>>(
(capability,),
0x23a6499eb6080249,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#set_config_value(
&self,
mut name: &str,
mut key: &str,
mut value: &fidl_fuchsia_component_decl::ConfigValueSpec,
___deadline: zx::Time,
) -> Result<RealmSetConfigValueResult, fidl::Error> {
let _response =
self.client.send_query::<RealmSetConfigValueRequest, fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
RealmBuilderError,
>>(
(name, key, value),
0x886450d291217f2,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
}
#[derive(Debug, Clone)]
pub struct RealmProxy {
client: fidl::client::Client,
}
impl fidl::endpoints::Proxy for RealmProxy {
type Protocol = RealmMarker;
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 RealmProxy {
pub fn new(channel: fidl::AsyncChannel) -> Self {
let protocol_name = <RealmMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> RealmEventStream {
RealmEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#add_child(
&self,
mut name: &str,
mut url: &str,
mut options: &ChildOptions,
) -> fidl::client::QueryResponseFut<RealmAddChildResult> {
RealmProxyInterface::r#add_child(self, name, url, options)
}
pub fn r#add_child_from_decl(
&self,
mut name: &str,
mut decl: &fidl_fuchsia_component_decl::Component,
mut options: &ChildOptions,
) -> fidl::client::QueryResponseFut<RealmAddChildFromDeclResult> {
RealmProxyInterface::r#add_child_from_decl(self, name, decl, options)
}
pub fn r#add_local_child(
&self,
mut name: &str,
mut options: &ChildOptions,
) -> fidl::client::QueryResponseFut<RealmAddLocalChildResult> {
RealmProxyInterface::r#add_local_child(self, name, options)
}
pub fn r#add_child_realm(
&self,
mut name: &str,
mut options: &ChildOptions,
mut child_realm: fidl::endpoints::ServerEnd<RealmMarker>,
) -> fidl::client::QueryResponseFut<RealmAddChildRealmResult> {
RealmProxyInterface::r#add_child_realm(self, name, options, child_realm)
}
pub fn r#get_component_decl(
&self,
mut name: &str,
) -> fidl::client::QueryResponseFut<RealmGetComponentDeclResult> {
RealmProxyInterface::r#get_component_decl(self, name)
}
pub fn r#replace_component_decl(
&self,
mut name: &str,
mut component_decl: &fidl_fuchsia_component_decl::Component,
) -> fidl::client::QueryResponseFut<RealmReplaceComponentDeclResult> {
RealmProxyInterface::r#replace_component_decl(self, name, component_decl)
}
pub fn r#get_realm_decl(&self) -> fidl::client::QueryResponseFut<RealmGetRealmDeclResult> {
RealmProxyInterface::r#get_realm_decl(self)
}
pub fn r#replace_realm_decl(
&self,
mut component_decl: &fidl_fuchsia_component_decl::Component,
) -> fidl::client::QueryResponseFut<RealmReplaceRealmDeclResult> {
RealmProxyInterface::r#replace_realm_decl(self, component_decl)
}
pub fn r#add_route(
&self,
mut capabilities: &[Capability],
mut from: &fidl_fuchsia_component_decl::Ref,
mut to: &[fidl_fuchsia_component_decl::Ref],
) -> fidl::client::QueryResponseFut<RealmAddRouteResult> {
RealmProxyInterface::r#add_route(self, capabilities, from, to)
}
pub fn r#read_only_directory(
&self,
mut name: &str,
mut to: &[fidl_fuchsia_component_decl::Ref],
mut directory_contents: DirectoryContents,
) -> fidl::client::QueryResponseFut<RealmReadOnlyDirectoryResult> {
RealmProxyInterface::r#read_only_directory(self, name, to, directory_contents)
}
pub fn r#init_mutable_config_from_package(
&self,
mut name: &str,
) -> fidl::client::QueryResponseFut<RealmInitMutableConfigFromPackageResult> {
RealmProxyInterface::r#init_mutable_config_from_package(self, name)
}
pub fn r#init_mutable_config_to_empty(
&self,
mut name: &str,
) -> fidl::client::QueryResponseFut<RealmInitMutableConfigToEmptyResult> {
RealmProxyInterface::r#init_mutable_config_to_empty(self, name)
}
pub fn r#add_capability(
&self,
mut capability: &fidl_fuchsia_component_decl::Capability,
) -> fidl::client::QueryResponseFut<RealmAddCapabilityResult> {
RealmProxyInterface::r#add_capability(self, capability)
}
pub fn r#set_config_value(
&self,
mut name: &str,
mut key: &str,
mut value: &fidl_fuchsia_component_decl::ConfigValueSpec,
) -> fidl::client::QueryResponseFut<RealmSetConfigValueResult> {
RealmProxyInterface::r#set_config_value(self, name, key, value)
}
}
impl RealmProxyInterface for RealmProxy {
type AddChildResponseFut = fidl::client::QueryResponseFut<RealmAddChildResult>;
fn r#add_child(
&self,
mut name: &str,
mut url: &str,
mut options: &ChildOptions,
) -> Self::AddChildResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<RealmAddChildResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RealmBuilderError>,
0x3f6c07627303d801,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<RealmAddChildRequest, RealmAddChildResult>(
(name, url, options),
0x3f6c07627303d801,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type AddChildFromDeclResponseFut = fidl::client::QueryResponseFut<RealmAddChildFromDeclResult>;
fn r#add_child_from_decl(
&self,
mut name: &str,
mut decl: &fidl_fuchsia_component_decl::Component,
mut options: &ChildOptions,
) -> Self::AddChildFromDeclResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<RealmAddChildFromDeclResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RealmBuilderError>,
0x3950ad500258156d,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client
.send_query_and_decode::<RealmAddChildFromDeclRequest, RealmAddChildFromDeclResult>(
(name, decl, options),
0x3950ad500258156d,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type AddLocalChildResponseFut = fidl::client::QueryResponseFut<RealmAddLocalChildResult>;
fn r#add_local_child(
&self,
mut name: &str,
mut options: &ChildOptions,
) -> Self::AddLocalChildResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<RealmAddLocalChildResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RealmBuilderError>,
0x3249817bae10abbb,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<RealmAddLocalChildRequest, RealmAddLocalChildResult>(
(name, options),
0x3249817bae10abbb,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type AddChildRealmResponseFut = fidl::client::QueryResponseFut<RealmAddChildRealmResult>;
fn r#add_child_realm(
&self,
mut name: &str,
mut options: &ChildOptions,
mut child_realm: fidl::endpoints::ServerEnd<RealmMarker>,
) -> Self::AddChildRealmResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<RealmAddChildRealmResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RealmBuilderError>,
0x3fdf98db373b9458,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<RealmAddChildRealmRequest, RealmAddChildRealmResult>(
(name, options, child_realm),
0x3fdf98db373b9458,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type GetComponentDeclResponseFut = fidl::client::QueryResponseFut<RealmGetComponentDeclResult>;
fn r#get_component_decl(&self, mut name: &str) -> Self::GetComponentDeclResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<RealmGetComponentDeclResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<RealmGetComponentDeclResponse, RealmBuilderError>,
0x320832af6a4cbac6,
>(_buf?)?;
Ok(_response.map(|x| x.component_decl))
}
self.client
.send_query_and_decode::<RealmGetComponentDeclRequest, RealmGetComponentDeclResult>(
(name,),
0x320832af6a4cbac6,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type ReplaceComponentDeclResponseFut =
fidl::client::QueryResponseFut<RealmReplaceComponentDeclResult>;
fn r#replace_component_decl(
&self,
mut name: &str,
mut component_decl: &fidl_fuchsia_component_decl::Component,
) -> Self::ReplaceComponentDeclResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<RealmReplaceComponentDeclResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RealmBuilderError>,
0x59cecf31b314cd5f,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
RealmReplaceComponentDeclRequest,
RealmReplaceComponentDeclResult,
>(
(name, component_decl,),
0x59cecf31b314cd5f,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type GetRealmDeclResponseFut = fidl::client::QueryResponseFut<RealmGetRealmDeclResult>;
fn r#get_realm_decl(&self) -> Self::GetRealmDeclResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<RealmGetRealmDeclResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<RealmGetRealmDeclResponse, RealmBuilderError>,
0x46fa05b17bd64269,
>(_buf?)?;
Ok(_response.map(|x| x.component_decl))
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, RealmGetRealmDeclResult>(
(),
0x46fa05b17bd64269,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type ReplaceRealmDeclResponseFut = fidl::client::QueryResponseFut<RealmReplaceRealmDeclResult>;
fn r#replace_realm_decl(
&self,
mut component_decl: &fidl_fuchsia_component_decl::Component,
) -> Self::ReplaceRealmDeclResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<RealmReplaceRealmDeclResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RealmBuilderError>,
0x48fcba4ac1338da9,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client
.send_query_and_decode::<RealmReplaceRealmDeclRequest, RealmReplaceRealmDeclResult>(
(component_decl,),
0x48fcba4ac1338da9,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type AddRouteResponseFut = fidl::client::QueryResponseFut<RealmAddRouteResult>;
fn r#add_route(
&self,
mut capabilities: &[Capability],
mut from: &fidl_fuchsia_component_decl::Ref,
mut to: &[fidl_fuchsia_component_decl::Ref],
) -> Self::AddRouteResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<RealmAddRouteResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RealmBuilderError>,
0x9d523295be53a0a,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<RealmAddRouteRequest, RealmAddRouteResult>(
(capabilities, from, to),
0x9d523295be53a0a,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type ReadOnlyDirectoryResponseFut =
fidl::client::QueryResponseFut<RealmReadOnlyDirectoryResult>;
fn r#read_only_directory(
&self,
mut name: &str,
mut to: &[fidl_fuchsia_component_decl::Ref],
mut directory_contents: DirectoryContents,
) -> Self::ReadOnlyDirectoryResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<RealmReadOnlyDirectoryResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RealmBuilderError>,
0x78a6d150a66e00dc,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client
.send_query_and_decode::<RealmReadOnlyDirectoryRequest, RealmReadOnlyDirectoryResult>(
(name, to, &mut directory_contents),
0x78a6d150a66e00dc,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type InitMutableConfigFromPackageResponseFut =
fidl::client::QueryResponseFut<RealmInitMutableConfigFromPackageResult>;
fn r#init_mutable_config_from_package(
&self,
mut name: &str,
) -> Self::InitMutableConfigFromPackageResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<RealmInitMutableConfigFromPackageResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RealmBuilderError>,
0x36a30c9837c64216,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
RealmInitMutableConfigFromPackageRequest,
RealmInitMutableConfigFromPackageResult,
>(
(name,),
0x36a30c9837c64216,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type InitMutableConfigToEmptyResponseFut =
fidl::client::QueryResponseFut<RealmInitMutableConfigToEmptyResult>;
fn r#init_mutable_config_to_empty(
&self,
mut name: &str,
) -> Self::InitMutableConfigToEmptyResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<RealmInitMutableConfigToEmptyResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RealmBuilderError>,
0x772cb99e2e0dccc5,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
RealmInitMutableConfigToEmptyRequest,
RealmInitMutableConfigToEmptyResult,
>(
(name,),
0x772cb99e2e0dccc5,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type AddCapabilityResponseFut = fidl::client::QueryResponseFut<RealmAddCapabilityResult>;
fn r#add_capability(
&self,
mut capability: &fidl_fuchsia_component_decl::Capability,
) -> Self::AddCapabilityResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<RealmAddCapabilityResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RealmBuilderError>,
0x23a6499eb6080249,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<RealmAddCapabilityRequest, RealmAddCapabilityResult>(
(capability,),
0x23a6499eb6080249,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type SetConfigValueResponseFut = fidl::client::QueryResponseFut<RealmSetConfigValueResult>;
fn r#set_config_value(
&self,
mut name: &str,
mut key: &str,
mut value: &fidl_fuchsia_component_decl::ConfigValueSpec,
) -> Self::SetConfigValueResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<RealmSetConfigValueResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RealmBuilderError>,
0x886450d291217f2,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<RealmSetConfigValueRequest, RealmSetConfigValueResult>(
(name, key, value),
0x886450d291217f2,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct RealmEventStream {
event_receiver: fidl::client::EventReceiver,
}
impl std::marker::Unpin for RealmEventStream {}
impl futures::stream::FusedStream for RealmEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for RealmEventStream {
type Item = Result<RealmEvent, 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(RealmEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum RealmEvent {}
impl RealmEvent {
fn decode(mut buf: fidl::MessageBufEtc) -> Result<RealmEvent, 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: <RealmMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct RealmRequestStream {
inner: std::sync::Arc<fidl::ServeInner>,
is_terminated: bool,
}
impl std::marker::Unpin for RealmRequestStream {}
impl futures::stream::FusedStream for RealmRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for RealmRequestStream {
type Protocol = RealmMarker;
type ControlHandle = RealmControlHandle;
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 {
RealmControlHandle { inner: self.inner.clone() }
}
fn into_inner(self) -> (::std::sync::Arc<fidl::ServeInner>, bool) {
(self.inner, self.is_terminated)
}
fn from_inner(inner: std::sync::Arc<fidl::ServeInner>, is_terminated: bool) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for RealmRequestStream {
type Item = Result<RealmRequest, 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 RealmRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf(|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(e))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x3f6c07627303d801 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(RealmAddChildRequest);
fidl::encoding::Decoder::decode_into::<RealmAddChildRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = RealmControlHandle { inner: this.inner.clone() };
Ok(RealmRequest::AddChild {
name: req.name,
url: req.url,
options: req.options,
responder: RealmAddChildResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x3950ad500258156d => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(RealmAddChildFromDeclRequest);
fidl::encoding::Decoder::decode_into::<RealmAddChildFromDeclRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = RealmControlHandle { inner: this.inner.clone() };
Ok(RealmRequest::AddChildFromDecl {
name: req.name,
decl: req.decl,
options: req.options,
responder: RealmAddChildFromDeclResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x3249817bae10abbb => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(RealmAddLocalChildRequest);
fidl::encoding::Decoder::decode_into::<RealmAddLocalChildRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = RealmControlHandle { inner: this.inner.clone() };
Ok(RealmRequest::AddLocalChild {
name: req.name,
options: req.options,
responder: RealmAddLocalChildResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x3fdf98db373b9458 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(RealmAddChildRealmRequest);
fidl::encoding::Decoder::decode_into::<RealmAddChildRealmRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = RealmControlHandle { inner: this.inner.clone() };
Ok(RealmRequest::AddChildRealm {
name: req.name,
options: req.options,
child_realm: req.child_realm,
responder: RealmAddChildRealmResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x320832af6a4cbac6 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(RealmGetComponentDeclRequest);
fidl::encoding::Decoder::decode_into::<RealmGetComponentDeclRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = RealmControlHandle { inner: this.inner.clone() };
Ok(RealmRequest::GetComponentDecl {
name: req.name,
responder: RealmGetComponentDeclResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x59cecf31b314cd5f => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(RealmReplaceComponentDeclRequest);
fidl::encoding::Decoder::decode_into::<RealmReplaceComponentDeclRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = RealmControlHandle { inner: this.inner.clone() };
Ok(RealmRequest::ReplaceComponentDecl {
name: req.name,
component_decl: req.component_decl,
responder: RealmReplaceComponentDeclResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x46fa05b17bd64269 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload);
fidl::encoding::Decoder::decode_into::<fidl::encoding::EmptyPayload>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = RealmControlHandle { inner: this.inner.clone() };
Ok(RealmRequest::GetRealmDecl {
responder: RealmGetRealmDeclResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x48fcba4ac1338da9 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(RealmReplaceRealmDeclRequest);
fidl::encoding::Decoder::decode_into::<RealmReplaceRealmDeclRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = RealmControlHandle { inner: this.inner.clone() };
Ok(RealmRequest::ReplaceRealmDecl {
component_decl: req.component_decl,
responder: RealmReplaceRealmDeclResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x9d523295be53a0a => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(RealmAddRouteRequest);
fidl::encoding::Decoder::decode_into::<RealmAddRouteRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = RealmControlHandle { inner: this.inner.clone() };
Ok(RealmRequest::AddRoute {
capabilities: req.capabilities,
from: req.from,
to: req.to,
responder: RealmAddRouteResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x78a6d150a66e00dc => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(RealmReadOnlyDirectoryRequest);
fidl::encoding::Decoder::decode_into::<RealmReadOnlyDirectoryRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = RealmControlHandle { inner: this.inner.clone() };
Ok(RealmRequest::ReadOnlyDirectory {
name: req.name,
to: req.to,
directory_contents: req.directory_contents,
responder: RealmReadOnlyDirectoryResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x36a30c9837c64216 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(RealmInitMutableConfigFromPackageRequest);
fidl::encoding::Decoder::decode_into::<RealmInitMutableConfigFromPackageRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = RealmControlHandle { inner: this.inner.clone() };
Ok(RealmRequest::InitMutableConfigFromPackage {
name: req.name,
responder: RealmInitMutableConfigFromPackageResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x772cb99e2e0dccc5 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(RealmInitMutableConfigToEmptyRequest);
fidl::encoding::Decoder::decode_into::<RealmInitMutableConfigToEmptyRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = RealmControlHandle { inner: this.inner.clone() };
Ok(RealmRequest::InitMutableConfigToEmpty {
name: req.name,
responder: RealmInitMutableConfigToEmptyResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x23a6499eb6080249 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(RealmAddCapabilityRequest);
fidl::encoding::Decoder::decode_into::<RealmAddCapabilityRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = RealmControlHandle { inner: this.inner.clone() };
Ok(RealmRequest::AddCapability {
capability: req.capability,
responder: RealmAddCapabilityResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x886450d291217f2 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(RealmSetConfigValueRequest);
fidl::encoding::Decoder::decode_into::<RealmSetConfigValueRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = RealmControlHandle { inner: this.inner.clone() };
Ok(RealmRequest::SetConfigValue {
name: req.name,
key: req.key,
value: req.value,
responder: RealmSetConfigValueResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <RealmMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
})
}
}
#[derive(Debug)]
pub enum RealmRequest {
AddChild { name: String, url: String, options: ChildOptions, responder: RealmAddChildResponder },
AddChildFromDecl {
name: String,
decl: fidl_fuchsia_component_decl::Component,
options: ChildOptions,
responder: RealmAddChildFromDeclResponder,
},
AddLocalChild { name: String, options: ChildOptions, responder: RealmAddLocalChildResponder },
AddChildRealm {
name: String,
options: ChildOptions,
child_realm: fidl::endpoints::ServerEnd<RealmMarker>,
responder: RealmAddChildRealmResponder,
},
GetComponentDecl { name: String, responder: RealmGetComponentDeclResponder },
ReplaceComponentDecl {
name: String,
component_decl: fidl_fuchsia_component_decl::Component,
responder: RealmReplaceComponentDeclResponder,
},
GetRealmDecl { responder: RealmGetRealmDeclResponder },
ReplaceRealmDecl {
component_decl: fidl_fuchsia_component_decl::Component,
responder: RealmReplaceRealmDeclResponder,
},
AddRoute {
capabilities: Vec<Capability>,
from: fidl_fuchsia_component_decl::Ref,
to: Vec<fidl_fuchsia_component_decl::Ref>,
responder: RealmAddRouteResponder,
},
ReadOnlyDirectory {
name: String,
to: Vec<fidl_fuchsia_component_decl::Ref>,
directory_contents: DirectoryContents,
responder: RealmReadOnlyDirectoryResponder,
},
InitMutableConfigFromPackage {
name: String,
responder: RealmInitMutableConfigFromPackageResponder,
},
InitMutableConfigToEmpty { name: String, responder: RealmInitMutableConfigToEmptyResponder },
AddCapability {
capability: fidl_fuchsia_component_decl::Capability,
responder: RealmAddCapabilityResponder,
},
SetConfigValue {
name: String,
key: String,
value: fidl_fuchsia_component_decl::ConfigValueSpec,
responder: RealmSetConfigValueResponder,
},
}
impl RealmRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_add_child(self) -> Option<(String, String, ChildOptions, RealmAddChildResponder)> {
if let RealmRequest::AddChild { name, url, options, responder } = self {
Some((name, url, options, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_add_child_from_decl(
self,
) -> Option<(
String,
fidl_fuchsia_component_decl::Component,
ChildOptions,
RealmAddChildFromDeclResponder,
)> {
if let RealmRequest::AddChildFromDecl { name, decl, options, responder } = self {
Some((name, decl, options, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_add_local_child(
self,
) -> Option<(String, ChildOptions, RealmAddLocalChildResponder)> {
if let RealmRequest::AddLocalChild { name, options, responder } = self {
Some((name, options, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_add_child_realm(
self,
) -> Option<(
String,
ChildOptions,
fidl::endpoints::ServerEnd<RealmMarker>,
RealmAddChildRealmResponder,
)> {
if let RealmRequest::AddChildRealm { name, options, child_realm, responder } = self {
Some((name, options, child_realm, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_get_component_decl(self) -> Option<(String, RealmGetComponentDeclResponder)> {
if let RealmRequest::GetComponentDecl { name, responder } = self {
Some((name, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_replace_component_decl(
self,
) -> Option<(String, fidl_fuchsia_component_decl::Component, RealmReplaceComponentDeclResponder)>
{
if let RealmRequest::ReplaceComponentDecl { name, component_decl, responder } = self {
Some((name, component_decl, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_get_realm_decl(self) -> Option<(RealmGetRealmDeclResponder)> {
if let RealmRequest::GetRealmDecl { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_replace_realm_decl(
self,
) -> Option<(fidl_fuchsia_component_decl::Component, RealmReplaceRealmDeclResponder)> {
if let RealmRequest::ReplaceRealmDecl { component_decl, responder } = self {
Some((component_decl, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_add_route(
self,
) -> Option<(
Vec<Capability>,
fidl_fuchsia_component_decl::Ref,
Vec<fidl_fuchsia_component_decl::Ref>,
RealmAddRouteResponder,
)> {
if let RealmRequest::AddRoute { capabilities, from, to, responder } = self {
Some((capabilities, from, to, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_read_only_directory(
self,
) -> Option<(
String,
Vec<fidl_fuchsia_component_decl::Ref>,
DirectoryContents,
RealmReadOnlyDirectoryResponder,
)> {
if let RealmRequest::ReadOnlyDirectory { name, to, directory_contents, responder } = self {
Some((name, to, directory_contents, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_init_mutable_config_from_package(
self,
) -> Option<(String, RealmInitMutableConfigFromPackageResponder)> {
if let RealmRequest::InitMutableConfigFromPackage { name, responder } = self {
Some((name, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_init_mutable_config_to_empty(
self,
) -> Option<(String, RealmInitMutableConfigToEmptyResponder)> {
if let RealmRequest::InitMutableConfigToEmpty { name, responder } = self {
Some((name, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_add_capability(
self,
) -> Option<(fidl_fuchsia_component_decl::Capability, RealmAddCapabilityResponder)> {
if let RealmRequest::AddCapability { capability, responder } = self {
Some((capability, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_set_config_value(
self,
) -> Option<(
String,
String,
fidl_fuchsia_component_decl::ConfigValueSpec,
RealmSetConfigValueResponder,
)> {
if let RealmRequest::SetConfigValue { name, key, value, responder } = self {
Some((name, key, value, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
RealmRequest::AddChild { .. } => "add_child",
RealmRequest::AddChildFromDecl { .. } => "add_child_from_decl",
RealmRequest::AddLocalChild { .. } => "add_local_child",
RealmRequest::AddChildRealm { .. } => "add_child_realm",
RealmRequest::GetComponentDecl { .. } => "get_component_decl",
RealmRequest::ReplaceComponentDecl { .. } => "replace_component_decl",
RealmRequest::GetRealmDecl { .. } => "get_realm_decl",
RealmRequest::ReplaceRealmDecl { .. } => "replace_realm_decl",
RealmRequest::AddRoute { .. } => "add_route",
RealmRequest::ReadOnlyDirectory { .. } => "read_only_directory",
RealmRequest::InitMutableConfigFromPackage { .. } => "init_mutable_config_from_package",
RealmRequest::InitMutableConfigToEmpty { .. } => "init_mutable_config_to_empty",
RealmRequest::AddCapability { .. } => "add_capability",
RealmRequest::SetConfigValue { .. } => "set_config_value",
}
}
}
#[derive(Debug, Clone)]
pub struct RealmControlHandle {
inner: std::sync::Arc<fidl::ServeInner>,
}
impl fidl::endpoints::ControlHandle for RealmControlHandle {
fn shutdown(&self) {
self.inner.shutdown()
}
fn shutdown_with_epitaph(&self, status: zx_status::Status) {
self.inner.shutdown_with_epitaph(status)
}
fn is_closed(&self) -> bool {
self.inner.channel().is_closed()
}
fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
}
impl RealmControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct RealmAddChildResponder {
control_handle: std::mem::ManuallyDrop<RealmControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for RealmAddChildResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for RealmAddChildResponder {
type ControlHandle = RealmControlHandle;
fn control_handle(&self) -> &RealmControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl RealmAddChildResponder {
pub fn send(self, mut result: Result<(), RealmBuilderError>) -> 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<(), RealmBuilderError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), RealmBuilderError>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
RealmBuilderError,
>>(
result,
self.tx_id,
0x3f6c07627303d801,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct RealmAddChildFromDeclResponder {
control_handle: std::mem::ManuallyDrop<RealmControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for RealmAddChildFromDeclResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for RealmAddChildFromDeclResponder {
type ControlHandle = RealmControlHandle;
fn control_handle(&self) -> &RealmControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl RealmAddChildFromDeclResponder {
pub fn send(self, mut result: Result<(), RealmBuilderError>) -> 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<(), RealmBuilderError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), RealmBuilderError>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
RealmBuilderError,
>>(
result,
self.tx_id,
0x3950ad500258156d,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct RealmAddLocalChildResponder {
control_handle: std::mem::ManuallyDrop<RealmControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for RealmAddLocalChildResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for RealmAddLocalChildResponder {
type ControlHandle = RealmControlHandle;
fn control_handle(&self) -> &RealmControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl RealmAddLocalChildResponder {
pub fn send(self, mut result: Result<(), RealmBuilderError>) -> 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<(), RealmBuilderError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), RealmBuilderError>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
RealmBuilderError,
>>(
result,
self.tx_id,
0x3249817bae10abbb,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct RealmAddChildRealmResponder {
control_handle: std::mem::ManuallyDrop<RealmControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for RealmAddChildRealmResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for RealmAddChildRealmResponder {
type ControlHandle = RealmControlHandle;
fn control_handle(&self) -> &RealmControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl RealmAddChildRealmResponder {
pub fn send(self, mut result: Result<(), RealmBuilderError>) -> 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<(), RealmBuilderError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), RealmBuilderError>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
RealmBuilderError,
>>(
result,
self.tx_id,
0x3fdf98db373b9458,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct RealmGetComponentDeclResponder {
control_handle: std::mem::ManuallyDrop<RealmControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for RealmGetComponentDeclResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for RealmGetComponentDeclResponder {
type ControlHandle = RealmControlHandle;
fn control_handle(&self) -> &RealmControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl RealmGetComponentDeclResponder {
pub fn send(
self,
mut result: Result<&fidl_fuchsia_component_decl::Component, RealmBuilderError>,
) -> 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<&fidl_fuchsia_component_decl::Component, RealmBuilderError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut result: Result<&fidl_fuchsia_component_decl::Component, RealmBuilderError>,
) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
RealmGetComponentDeclResponse,
RealmBuilderError,
>>(
result.map(|component_decl| (component_decl,)),
self.tx_id,
0x320832af6a4cbac6,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct RealmReplaceComponentDeclResponder {
control_handle: std::mem::ManuallyDrop<RealmControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for RealmReplaceComponentDeclResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for RealmReplaceComponentDeclResponder {
type ControlHandle = RealmControlHandle;
fn control_handle(&self) -> &RealmControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl RealmReplaceComponentDeclResponder {
pub fn send(self, mut result: Result<(), RealmBuilderError>) -> 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<(), RealmBuilderError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), RealmBuilderError>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
RealmBuilderError,
>>(
result,
self.tx_id,
0x59cecf31b314cd5f,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct RealmGetRealmDeclResponder {
control_handle: std::mem::ManuallyDrop<RealmControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for RealmGetRealmDeclResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for RealmGetRealmDeclResponder {
type ControlHandle = RealmControlHandle;
fn control_handle(&self) -> &RealmControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl RealmGetRealmDeclResponder {
pub fn send(
self,
mut result: Result<&fidl_fuchsia_component_decl::Component, RealmBuilderError>,
) -> 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<&fidl_fuchsia_component_decl::Component, RealmBuilderError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut result: Result<&fidl_fuchsia_component_decl::Component, RealmBuilderError>,
) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
RealmGetRealmDeclResponse,
RealmBuilderError,
>>(
result.map(|component_decl| (component_decl,)),
self.tx_id,
0x46fa05b17bd64269,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct RealmReplaceRealmDeclResponder {
control_handle: std::mem::ManuallyDrop<RealmControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for RealmReplaceRealmDeclResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for RealmReplaceRealmDeclResponder {
type ControlHandle = RealmControlHandle;
fn control_handle(&self) -> &RealmControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl RealmReplaceRealmDeclResponder {
pub fn send(self, mut result: Result<(), RealmBuilderError>) -> 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<(), RealmBuilderError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), RealmBuilderError>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
RealmBuilderError,
>>(
result,
self.tx_id,
0x48fcba4ac1338da9,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct RealmAddRouteResponder {
control_handle: std::mem::ManuallyDrop<RealmControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for RealmAddRouteResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for RealmAddRouteResponder {
type ControlHandle = RealmControlHandle;
fn control_handle(&self) -> &RealmControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl RealmAddRouteResponder {
pub fn send(self, mut result: Result<(), RealmBuilderError>) -> 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<(), RealmBuilderError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), RealmBuilderError>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
RealmBuilderError,
>>(
result,
self.tx_id,
0x9d523295be53a0a,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct RealmReadOnlyDirectoryResponder {
control_handle: std::mem::ManuallyDrop<RealmControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for RealmReadOnlyDirectoryResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for RealmReadOnlyDirectoryResponder {
type ControlHandle = RealmControlHandle;
fn control_handle(&self) -> &RealmControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl RealmReadOnlyDirectoryResponder {
pub fn send(self, mut result: Result<(), RealmBuilderError>) -> 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<(), RealmBuilderError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), RealmBuilderError>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
RealmBuilderError,
>>(
result,
self.tx_id,
0x78a6d150a66e00dc,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct RealmInitMutableConfigFromPackageResponder {
control_handle: std::mem::ManuallyDrop<RealmControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for RealmInitMutableConfigFromPackageResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for RealmInitMutableConfigFromPackageResponder {
type ControlHandle = RealmControlHandle;
fn control_handle(&self) -> &RealmControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl RealmInitMutableConfigFromPackageResponder {
pub fn send(self, mut result: Result<(), RealmBuilderError>) -> 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<(), RealmBuilderError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), RealmBuilderError>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
RealmBuilderError,
>>(
result,
self.tx_id,
0x36a30c9837c64216,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct RealmInitMutableConfigToEmptyResponder {
control_handle: std::mem::ManuallyDrop<RealmControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for RealmInitMutableConfigToEmptyResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for RealmInitMutableConfigToEmptyResponder {
type ControlHandle = RealmControlHandle;
fn control_handle(&self) -> &RealmControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl RealmInitMutableConfigToEmptyResponder {
pub fn send(self, mut result: Result<(), RealmBuilderError>) -> 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<(), RealmBuilderError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), RealmBuilderError>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
RealmBuilderError,
>>(
result,
self.tx_id,
0x772cb99e2e0dccc5,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct RealmAddCapabilityResponder {
control_handle: std::mem::ManuallyDrop<RealmControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for RealmAddCapabilityResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for RealmAddCapabilityResponder {
type ControlHandle = RealmControlHandle;
fn control_handle(&self) -> &RealmControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl RealmAddCapabilityResponder {
pub fn send(self, mut result: Result<(), RealmBuilderError>) -> 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<(), RealmBuilderError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), RealmBuilderError>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
RealmBuilderError,
>>(
result,
self.tx_id,
0x23a6499eb6080249,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct RealmSetConfigValueResponder {
control_handle: std::mem::ManuallyDrop<RealmControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for RealmSetConfigValueResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for RealmSetConfigValueResponder {
type ControlHandle = RealmControlHandle;
fn control_handle(&self) -> &RealmControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl RealmSetConfigValueResponder {
pub fn send(self, mut result: Result<(), RealmBuilderError>) -> 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<(), RealmBuilderError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), RealmBuilderError>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
RealmBuilderError,
>>(
result,
self.tx_id,
0x886450d291217f2,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct RealmBuilderFactoryMarker;
impl fidl::endpoints::ProtocolMarker for RealmBuilderFactoryMarker {
type Proxy = RealmBuilderFactoryProxy;
type RequestStream = RealmBuilderFactoryRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = RealmBuilderFactorySynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.component.test.RealmBuilderFactory";
}
impl fidl::endpoints::DiscoverableProtocolMarker for RealmBuilderFactoryMarker {}
pub type RealmBuilderFactoryCreateResult = Result<(), RealmBuilderError>;
pub type RealmBuilderFactoryCreateFromRelativeUrlResult = Result<(), RealmBuilderError>;
pub trait RealmBuilderFactoryProxyInterface: Send + Sync {
type CreateResponseFut: std::future::Future<Output = Result<RealmBuilderFactoryCreateResult, fidl::Error>>
+ Send;
fn r#create(
&self,
pkg_dir_handle: fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
realm_server_end: fidl::endpoints::ServerEnd<RealmMarker>,
builder_server_end: fidl::endpoints::ServerEnd<BuilderMarker>,
) -> Self::CreateResponseFut;
type CreateFromRelativeUrlResponseFut: std::future::Future<
Output = Result<RealmBuilderFactoryCreateFromRelativeUrlResult, fidl::Error>,
> + Send;
fn r#create_from_relative_url(
&self,
pkg_dir_handle: fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
relative_url: &str,
realm_server_end: fidl::endpoints::ServerEnd<RealmMarker>,
builder_server_end: fidl::endpoints::ServerEnd<BuilderMarker>,
) -> Self::CreateFromRelativeUrlResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct RealmBuilderFactorySynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for RealmBuilderFactorySynchronousProxy {
type Proxy = RealmBuilderFactoryProxy;
type Protocol = RealmBuilderFactoryMarker;
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 RealmBuilderFactorySynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name =
<RealmBuilderFactoryMarker 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::Time,
) -> Result<RealmBuilderFactoryEvent, fidl::Error> {
RealmBuilderFactoryEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#create(
&self,
mut pkg_dir_handle: fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
mut realm_server_end: fidl::endpoints::ServerEnd<RealmMarker>,
mut builder_server_end: fidl::endpoints::ServerEnd<BuilderMarker>,
___deadline: zx::Time,
) -> Result<RealmBuilderFactoryCreateResult, fidl::Error> {
let _response =
self.client.send_query::<RealmBuilderFactoryCreateRequest, fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
RealmBuilderError,
>>(
(pkg_dir_handle, realm_server_end, builder_server_end),
0x73528b1135cb01be,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#create_from_relative_url(
&self,
mut pkg_dir_handle: fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
mut relative_url: &str,
mut realm_server_end: fidl::endpoints::ServerEnd<RealmMarker>,
mut builder_server_end: fidl::endpoints::ServerEnd<BuilderMarker>,
___deadline: zx::Time,
) -> Result<RealmBuilderFactoryCreateFromRelativeUrlResult, fidl::Error> {
let _response = self.client.send_query::<
RealmBuilderFactoryCreateFromRelativeUrlRequest,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RealmBuilderError>,
>(
(pkg_dir_handle, relative_url, realm_server_end, builder_server_end,),
0x1cafd9042c54a86b,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
}
#[derive(Debug, Clone)]
pub struct RealmBuilderFactoryProxy {
client: fidl::client::Client,
}
impl fidl::endpoints::Proxy for RealmBuilderFactoryProxy {
type Protocol = RealmBuilderFactoryMarker;
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 RealmBuilderFactoryProxy {
pub fn new(channel: fidl::AsyncChannel) -> Self {
let protocol_name =
<RealmBuilderFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> RealmBuilderFactoryEventStream {
RealmBuilderFactoryEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#create(
&self,
mut pkg_dir_handle: fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
mut realm_server_end: fidl::endpoints::ServerEnd<RealmMarker>,
mut builder_server_end: fidl::endpoints::ServerEnd<BuilderMarker>,
) -> fidl::client::QueryResponseFut<RealmBuilderFactoryCreateResult> {
RealmBuilderFactoryProxyInterface::r#create(
self,
pkg_dir_handle,
realm_server_end,
builder_server_end,
)
}
pub fn r#create_from_relative_url(
&self,
mut pkg_dir_handle: fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
mut relative_url: &str,
mut realm_server_end: fidl::endpoints::ServerEnd<RealmMarker>,
mut builder_server_end: fidl::endpoints::ServerEnd<BuilderMarker>,
) -> fidl::client::QueryResponseFut<RealmBuilderFactoryCreateFromRelativeUrlResult> {
RealmBuilderFactoryProxyInterface::r#create_from_relative_url(
self,
pkg_dir_handle,
relative_url,
realm_server_end,
builder_server_end,
)
}
}
impl RealmBuilderFactoryProxyInterface for RealmBuilderFactoryProxy {
type CreateResponseFut = fidl::client::QueryResponseFut<RealmBuilderFactoryCreateResult>;
fn r#create(
&self,
mut pkg_dir_handle: fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
mut realm_server_end: fidl::endpoints::ServerEnd<RealmMarker>,
mut builder_server_end: fidl::endpoints::ServerEnd<BuilderMarker>,
) -> Self::CreateResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<RealmBuilderFactoryCreateResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RealmBuilderError>,
0x73528b1135cb01be,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
RealmBuilderFactoryCreateRequest,
RealmBuilderFactoryCreateResult,
>(
(pkg_dir_handle, realm_server_end, builder_server_end,),
0x73528b1135cb01be,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type CreateFromRelativeUrlResponseFut =
fidl::client::QueryResponseFut<RealmBuilderFactoryCreateFromRelativeUrlResult>;
fn r#create_from_relative_url(
&self,
mut pkg_dir_handle: fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
mut relative_url: &str,
mut realm_server_end: fidl::endpoints::ServerEnd<RealmMarker>,
mut builder_server_end: fidl::endpoints::ServerEnd<BuilderMarker>,
) -> Self::CreateFromRelativeUrlResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<RealmBuilderFactoryCreateFromRelativeUrlResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RealmBuilderError>,
0x1cafd9042c54a86b,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
RealmBuilderFactoryCreateFromRelativeUrlRequest,
RealmBuilderFactoryCreateFromRelativeUrlResult,
>(
(pkg_dir_handle, relative_url, realm_server_end, builder_server_end,),
0x1cafd9042c54a86b,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct RealmBuilderFactoryEventStream {
event_receiver: fidl::client::EventReceiver,
}
impl std::marker::Unpin for RealmBuilderFactoryEventStream {}
impl futures::stream::FusedStream for RealmBuilderFactoryEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for RealmBuilderFactoryEventStream {
type Item = Result<RealmBuilderFactoryEvent, 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(RealmBuilderFactoryEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum RealmBuilderFactoryEvent {}
impl RealmBuilderFactoryEvent {
fn decode(mut buf: fidl::MessageBufEtc) -> Result<RealmBuilderFactoryEvent, 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:
<RealmBuilderFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct RealmBuilderFactoryRequestStream {
inner: std::sync::Arc<fidl::ServeInner>,
is_terminated: bool,
}
impl std::marker::Unpin for RealmBuilderFactoryRequestStream {}
impl futures::stream::FusedStream for RealmBuilderFactoryRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for RealmBuilderFactoryRequestStream {
type Protocol = RealmBuilderFactoryMarker;
type ControlHandle = RealmBuilderFactoryControlHandle;
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 {
RealmBuilderFactoryControlHandle { inner: self.inner.clone() }
}
fn into_inner(self) -> (::std::sync::Arc<fidl::ServeInner>, bool) {
(self.inner, self.is_terminated)
}
fn from_inner(inner: std::sync::Arc<fidl::ServeInner>, is_terminated: bool) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for RealmBuilderFactoryRequestStream {
type Item = Result<RealmBuilderFactoryRequest, 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 RealmBuilderFactoryRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf(|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(e))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x73528b1135cb01be => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(RealmBuilderFactoryCreateRequest);
fidl::encoding::Decoder::decode_into::<RealmBuilderFactoryCreateRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle =
RealmBuilderFactoryControlHandle { inner: this.inner.clone() };
Ok(RealmBuilderFactoryRequest::Create {
pkg_dir_handle: req.pkg_dir_handle,
realm_server_end: req.realm_server_end,
builder_server_end: req.builder_server_end,
responder: RealmBuilderFactoryCreateResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x1cafd9042c54a86b => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(RealmBuilderFactoryCreateFromRelativeUrlRequest);
fidl::encoding::Decoder::decode_into::<
RealmBuilderFactoryCreateFromRelativeUrlRequest,
>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
RealmBuilderFactoryControlHandle { inner: this.inner.clone() };
Ok(RealmBuilderFactoryRequest::CreateFromRelativeUrl {
pkg_dir_handle: req.pkg_dir_handle,
relative_url: req.relative_url,
realm_server_end: req.realm_server_end,
builder_server_end: req.builder_server_end,
responder: RealmBuilderFactoryCreateFromRelativeUrlResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<RealmBuilderFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
})
}
}
#[derive(Debug)]
pub enum RealmBuilderFactoryRequest {
Create {
pkg_dir_handle: fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
realm_server_end: fidl::endpoints::ServerEnd<RealmMarker>,
builder_server_end: fidl::endpoints::ServerEnd<BuilderMarker>,
responder: RealmBuilderFactoryCreateResponder,
},
CreateFromRelativeUrl {
pkg_dir_handle: fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
relative_url: String,
realm_server_end: fidl::endpoints::ServerEnd<RealmMarker>,
builder_server_end: fidl::endpoints::ServerEnd<BuilderMarker>,
responder: RealmBuilderFactoryCreateFromRelativeUrlResponder,
},
}
impl RealmBuilderFactoryRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_create(
self,
) -> Option<(
fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
fidl::endpoints::ServerEnd<RealmMarker>,
fidl::endpoints::ServerEnd<BuilderMarker>,
RealmBuilderFactoryCreateResponder,
)> {
if let RealmBuilderFactoryRequest::Create {
pkg_dir_handle,
realm_server_end,
builder_server_end,
responder,
} = self
{
Some((pkg_dir_handle, realm_server_end, builder_server_end, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_create_from_relative_url(
self,
) -> Option<(
fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
String,
fidl::endpoints::ServerEnd<RealmMarker>,
fidl::endpoints::ServerEnd<BuilderMarker>,
RealmBuilderFactoryCreateFromRelativeUrlResponder,
)> {
if let RealmBuilderFactoryRequest::CreateFromRelativeUrl {
pkg_dir_handle,
relative_url,
realm_server_end,
builder_server_end,
responder,
} = self
{
Some((pkg_dir_handle, relative_url, realm_server_end, builder_server_end, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
RealmBuilderFactoryRequest::Create { .. } => "create",
RealmBuilderFactoryRequest::CreateFromRelativeUrl { .. } => "create_from_relative_url",
}
}
}
#[derive(Debug, Clone)]
pub struct RealmBuilderFactoryControlHandle {
inner: std::sync::Arc<fidl::ServeInner>,
}
impl fidl::endpoints::ControlHandle for RealmBuilderFactoryControlHandle {
fn shutdown(&self) {
self.inner.shutdown()
}
fn shutdown_with_epitaph(&self, status: zx_status::Status) {
self.inner.shutdown_with_epitaph(status)
}
fn is_closed(&self) -> bool {
self.inner.channel().is_closed()
}
fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
}
impl RealmBuilderFactoryControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct RealmBuilderFactoryCreateResponder {
control_handle: std::mem::ManuallyDrop<RealmBuilderFactoryControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for RealmBuilderFactoryCreateResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for RealmBuilderFactoryCreateResponder {
type ControlHandle = RealmBuilderFactoryControlHandle;
fn control_handle(&self) -> &RealmBuilderFactoryControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl RealmBuilderFactoryCreateResponder {
pub fn send(self, mut result: Result<(), RealmBuilderError>) -> 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<(), RealmBuilderError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), RealmBuilderError>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
RealmBuilderError,
>>(
result,
self.tx_id,
0x73528b1135cb01be,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct RealmBuilderFactoryCreateFromRelativeUrlResponder {
control_handle: std::mem::ManuallyDrop<RealmBuilderFactoryControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for RealmBuilderFactoryCreateFromRelativeUrlResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for RealmBuilderFactoryCreateFromRelativeUrlResponder {
type ControlHandle = RealmBuilderFactoryControlHandle;
fn control_handle(&self) -> &RealmBuilderFactoryControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl RealmBuilderFactoryCreateFromRelativeUrlResponder {
pub fn send(self, mut result: Result<(), RealmBuilderError>) -> 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<(), RealmBuilderError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), RealmBuilderError>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
RealmBuilderError,
>>(
result,
self.tx_id,
0x1cafd9042c54a86b,
fidl::encoding::DynamicFlags::empty(),
)
}
}
mod internal {
use super::*;
unsafe impl fidl::encoding::TypeMarker for RealmBuilderError {
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 RealmBuilderError {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
*value
}
}
unsafe impl fidl::encoding::Encode<Self> for RealmBuilderError {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl fidl::encoding::Decode<Self> for RealmBuilderError {
#[inline(always)]
fn new_empty() -> Self {
Self::ChildAlreadyExists
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u32>(offset);
*self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for BuilderBuildRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
}
impl fidl::encoding::ResourceTypeMarker for BuilderBuildRequest {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<BuilderBuildRequest> for &mut BuilderBuildRequest {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<BuilderBuildRequest>(offset);
fidl::encoding::Encode::<BuilderBuildRequest>::encode(
(<fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<
fidl_fuchsia_component_runner::ComponentRunnerMarker,
>,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.runner
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<
fidl_fuchsia_component_runner::ComponentRunnerMarker,
>,
>,
>,
> fidl::encoding::Encode<BuilderBuildRequest> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<BuilderBuildRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for BuilderBuildRequest {
#[inline(always)]
fn new_empty() -> Self {
Self {
runner: fidl::new_empty!(
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<
fidl_fuchsia_component_runner::ComponentRunnerMarker,
>,
>
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<
fidl_fuchsia_component_runner::ComponentRunnerMarker,
>,
>,
&mut self.runner,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for BuilderBuildResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
impl fidl::encoding::ValueTypeMarker for BuilderBuildResponse {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<BuilderBuildResponse> for &BuilderBuildResponse {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<BuilderBuildResponse>(offset);
fidl::encoding::Encode::<BuilderBuildResponse>::encode(
(<fidl::encoding::BoundedString<4096> as fidl::encoding::ValueTypeMarker>::borrow(
&self.root_component_url,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<T0: fidl::encoding::Encode<fidl::encoding::BoundedString<4096>>>
fidl::encoding::Encode<BuilderBuildResponse> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<BuilderBuildResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for BuilderBuildResponse {
#[inline(always)]
fn new_empty() -> Self {
Self { root_component_url: fidl::new_empty!(fidl::encoding::BoundedString<4096>) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::BoundedString<4096>,
&mut self.root_component_url,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for DirectoryContents {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
impl fidl::encoding::ResourceTypeMarker for DirectoryContents {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<DirectoryContents> for &mut DirectoryContents {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DirectoryContents>(offset);
fidl::encoding::Encode::<DirectoryContents>::encode(
(
<fidl::encoding::Vector<DirectoryEntry, 1024> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.entries),
),
encoder, offset, _depth
)
}
}
unsafe impl<T0: fidl::encoding::Encode<fidl::encoding::Vector<DirectoryEntry, 1024>>>
fidl::encoding::Encode<DirectoryContents> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DirectoryContents>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for DirectoryContents {
#[inline(always)]
fn new_empty() -> Self {
Self { entries: fidl::new_empty!(fidl::encoding::Vector<DirectoryEntry, 1024>) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(fidl::encoding::Vector<DirectoryEntry, 1024>, &mut self.entries, decoder, offset + 0, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for DirectoryEntry {
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
}
}
impl fidl::encoding::ResourceTypeMarker for DirectoryEntry {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<DirectoryEntry> for &mut DirectoryEntry {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DirectoryEntry>(offset);
fidl::encoding::Encode::<DirectoryEntry>::encode(
(
<fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(&self.file_path),
<fidl_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.file_contents),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<fidl::encoding::BoundedString<255>>,
T1: fidl::encoding::Encode<fidl_fuchsia_mem::Buffer>,
> fidl::encoding::Encode<DirectoryEntry> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DirectoryEntry>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for DirectoryEntry {
#[inline(always)]
fn new_empty() -> Self {
Self {
file_path: fidl::new_empty!(fidl::encoding::BoundedString<255>),
file_contents: fidl::new_empty!(fidl_fuchsia_mem::Buffer),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::BoundedString<255>,
&mut self.file_path,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl_fuchsia_mem::Buffer,
&mut self.file_contents,
decoder,
offset + 16,
_depth
)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for RealmAddCapabilityRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
impl fidl::encoding::ValueTypeMarker for RealmAddCapabilityRequest {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<RealmAddCapabilityRequest> for &RealmAddCapabilityRequest {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RealmAddCapabilityRequest>(offset);
fidl::encoding::Encode::<RealmAddCapabilityRequest>::encode(
(
<fidl_fuchsia_component_decl::Capability as fidl::encoding::ValueTypeMarker>::borrow(&self.capability),
),
encoder, offset, _depth
)
}
}
unsafe impl<T0: fidl::encoding::Encode<fidl_fuchsia_component_decl::Capability>>
fidl::encoding::Encode<RealmAddCapabilityRequest> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RealmAddCapabilityRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for RealmAddCapabilityRequest {
#[inline(always)]
fn new_empty() -> Self {
Self { capability: fidl::new_empty!(fidl_fuchsia_component_decl::Capability) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl_fuchsia_component_decl::Capability,
&mut self.capability,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for RealmAddChildFromDeclRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
48
}
}
impl fidl::encoding::ValueTypeMarker for RealmAddChildFromDeclRequest {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<RealmAddChildFromDeclRequest> for &RealmAddChildFromDeclRequest {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RealmAddChildFromDeclRequest>(offset);
fidl::encoding::Encode::<RealmAddChildFromDeclRequest>::encode(
(
<fidl::encoding::BoundedString<1024> as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
<fidl_fuchsia_component_decl::Component as fidl::encoding::ValueTypeMarker>::borrow(&self.decl),
<ChildOptions as fidl::encoding::ValueTypeMarker>::borrow(&self.options),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<fidl::encoding::BoundedString<1024>>,
T1: fidl::encoding::Encode<fidl_fuchsia_component_decl::Component>,
T2: fidl::encoding::Encode<ChildOptions>,
> fidl::encoding::Encode<RealmAddChildFromDeclRequest> for (T0, T1, T2)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RealmAddChildFromDeclRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
self.2.encode(encoder, offset + 32, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for RealmAddChildFromDeclRequest {
#[inline(always)]
fn new_empty() -> Self {
Self {
name: fidl::new_empty!(fidl::encoding::BoundedString<1024>),
decl: fidl::new_empty!(fidl_fuchsia_component_decl::Component),
options: fidl::new_empty!(ChildOptions),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::BoundedString<1024>,
&mut self.name,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl_fuchsia_component_decl::Component,
&mut self.decl,
decoder,
offset + 16,
_depth
)?;
fidl::decode!(ChildOptions, &mut self.options, decoder, offset + 32, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for RealmAddChildRealmRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
40
}
}
impl fidl::encoding::ResourceTypeMarker for RealmAddChildRealmRequest {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<RealmAddChildRealmRequest> for &mut RealmAddChildRealmRequest {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RealmAddChildRealmRequest>(offset);
fidl::encoding::Encode::<RealmAddChildRealmRequest>::encode(
(
<fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
<ChildOptions as fidl::encoding::ValueTypeMarker>::borrow(&self.options),
<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RealmMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.child_realm),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<fidl::encoding::BoundedString<255>>,
T1: fidl::encoding::Encode<ChildOptions>,
T2: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RealmMarker>>,
>,
> fidl::encoding::Encode<RealmAddChildRealmRequest> for (T0, T1, T2)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RealmAddChildRealmRequest>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
self.2.encode(encoder, offset + 32, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for RealmAddChildRealmRequest {
#[inline(always)]
fn new_empty() -> Self {
Self {
name: fidl::new_empty!(fidl::encoding::BoundedString<255>),
options: fidl::new_empty!(ChildOptions),
child_realm: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RealmMarker>>
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffff00000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(
fidl::encoding::BoundedString<255>,
&mut self.name,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(ChildOptions, &mut self.options, decoder, offset + 16, _depth)?;
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RealmMarker>>,
&mut self.child_realm,
decoder,
offset + 32,
_depth
)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for RealmAddChildRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
48
}
}
impl fidl::encoding::ValueTypeMarker for RealmAddChildRequest {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<RealmAddChildRequest> for &RealmAddChildRequest {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RealmAddChildRequest>(offset);
fidl::encoding::Encode::<RealmAddChildRequest>::encode(
(
<fidl::encoding::BoundedString<1024> as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
<fidl::encoding::BoundedString<4096> as fidl::encoding::ValueTypeMarker>::borrow(&self.url),
<ChildOptions as fidl::encoding::ValueTypeMarker>::borrow(&self.options),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<fidl::encoding::BoundedString<1024>>,
T1: fidl::encoding::Encode<fidl::encoding::BoundedString<4096>>,
T2: fidl::encoding::Encode<ChildOptions>,
> fidl::encoding::Encode<RealmAddChildRequest> for (T0, T1, T2)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RealmAddChildRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
self.2.encode(encoder, offset + 32, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for RealmAddChildRequest {
#[inline(always)]
fn new_empty() -> Self {
Self {
name: fidl::new_empty!(fidl::encoding::BoundedString<1024>),
url: fidl::new_empty!(fidl::encoding::BoundedString<4096>),
options: fidl::new_empty!(ChildOptions),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::BoundedString<1024>,
&mut self.name,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::BoundedString<4096>,
&mut self.url,
decoder,
offset + 16,
_depth
)?;
fidl::decode!(ChildOptions, &mut self.options, decoder, offset + 32, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for RealmAddLocalChildRequest {
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
}
}
impl fidl::encoding::ValueTypeMarker for RealmAddLocalChildRequest {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<RealmAddLocalChildRequest> for &RealmAddLocalChildRequest {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RealmAddLocalChildRequest>(offset);
fidl::encoding::Encode::<RealmAddLocalChildRequest>::encode(
(
<fidl::encoding::BoundedString<1024> as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
<ChildOptions as fidl::encoding::ValueTypeMarker>::borrow(&self.options),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<fidl::encoding::BoundedString<1024>>,
T1: fidl::encoding::Encode<ChildOptions>,
> fidl::encoding::Encode<RealmAddLocalChildRequest> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RealmAddLocalChildRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for RealmAddLocalChildRequest {
#[inline(always)]
fn new_empty() -> Self {
Self {
name: fidl::new_empty!(fidl::encoding::BoundedString<1024>),
options: fidl::new_empty!(ChildOptions),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::BoundedString<1024>,
&mut self.name,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(ChildOptions, &mut self.options, decoder, offset + 16, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for RealmAddRouteRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
48
}
}
impl fidl::encoding::ValueTypeMarker for RealmAddRouteRequest {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<RealmAddRouteRequest> for &RealmAddRouteRequest {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RealmAddRouteRequest>(offset);
fidl::encoding::Encode::<RealmAddRouteRequest>::encode(
(
<fidl::encoding::UnboundedVector<Capability> as fidl::encoding::ValueTypeMarker>::borrow(&self.capabilities),
<fidl_fuchsia_component_decl::Ref as fidl::encoding::ValueTypeMarker>::borrow(&self.from),
<fidl::encoding::UnboundedVector<fidl_fuchsia_component_decl::Ref> as fidl::encoding::ValueTypeMarker>::borrow(&self.to),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<Capability>>,
T1: fidl::encoding::Encode<fidl_fuchsia_component_decl::Ref>,
T2: fidl::encoding::Encode<
fidl::encoding::UnboundedVector<fidl_fuchsia_component_decl::Ref>,
>,
> fidl::encoding::Encode<RealmAddRouteRequest> for (T0, T1, T2)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RealmAddRouteRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
self.2.encode(encoder, offset + 32, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for RealmAddRouteRequest {
#[inline(always)]
fn new_empty() -> Self {
Self {
capabilities: fidl::new_empty!(fidl::encoding::UnboundedVector<Capability>),
from: fidl::new_empty!(fidl_fuchsia_component_decl::Ref),
to: fidl::new_empty!(
fidl::encoding::UnboundedVector<fidl_fuchsia_component_decl::Ref>
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::UnboundedVector<Capability>,
&mut self.capabilities,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl_fuchsia_component_decl::Ref,
&mut self.from,
decoder,
offset + 16,
_depth
)?;
fidl::decode!(
fidl::encoding::UnboundedVector<fidl_fuchsia_component_decl::Ref>,
&mut self.to,
decoder,
offset + 32,
_depth
)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for RealmBuilderFactoryCreateFromRelativeUrlRequest {
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
}
}
impl fidl::encoding::ResourceTypeMarker for RealmBuilderFactoryCreateFromRelativeUrlRequest {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<RealmBuilderFactoryCreateFromRelativeUrlRequest>
for &mut RealmBuilderFactoryCreateFromRelativeUrlRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RealmBuilderFactoryCreateFromRelativeUrlRequest>(offset);
fidl::encoding::Encode::<RealmBuilderFactoryCreateFromRelativeUrlRequest>::encode(
(
<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.pkg_dir_handle),
<fidl::encoding::BoundedString<4096> as fidl::encoding::ValueTypeMarker>::borrow(&self.relative_url),
<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RealmMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.realm_server_end),
<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<BuilderMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.builder_server_end),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
>,
>,
T1: fidl::encoding::Encode<fidl::encoding::BoundedString<4096>>,
T2: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RealmMarker>>,
>,
T3: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<BuilderMarker>>,
>,
> fidl::encoding::Encode<RealmBuilderFactoryCreateFromRelativeUrlRequest>
for (T0, T1, T2, T3)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RealmBuilderFactoryCreateFromRelativeUrlRequest>(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)?;
self.2.encode(encoder, offset + 24, depth)?;
self.3.encode(encoder, offset + 28, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for RealmBuilderFactoryCreateFromRelativeUrlRequest {
#[inline(always)]
fn new_empty() -> Self {
Self {
pkg_dir_handle: fidl::new_empty!(
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
>
),
relative_url: fidl::new_empty!(fidl::encoding::BoundedString<4096>),
realm_server_end: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RealmMarker>>
),
builder_server_end: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<BuilderMarker>>
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffff00000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
>,
&mut self.pkg_dir_handle,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::BoundedString<4096>,
&mut self.relative_url,
decoder,
offset + 8,
_depth
)?;
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RealmMarker>>,
&mut self.realm_server_end,
decoder,
offset + 24,
_depth
)?;
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<BuilderMarker>>,
&mut self.builder_server_end,
decoder,
offset + 28,
_depth
)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for RealmBuilderFactoryCreateRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
12
}
}
impl fidl::encoding::ResourceTypeMarker for RealmBuilderFactoryCreateRequest {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<RealmBuilderFactoryCreateRequest>
for &mut RealmBuilderFactoryCreateRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RealmBuilderFactoryCreateRequest>(offset);
fidl::encoding::Encode::<RealmBuilderFactoryCreateRequest>::encode(
(
<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.pkg_dir_handle),
<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RealmMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.realm_server_end),
<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<BuilderMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.builder_server_end),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
>,
>,
T1: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RealmMarker>>,
>,
T2: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<BuilderMarker>>,
>,
> fidl::encoding::Encode<RealmBuilderFactoryCreateRequest> for (T0, T1, T2)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RealmBuilderFactoryCreateRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 4, depth)?;
self.2.encode(encoder, offset + 8, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for RealmBuilderFactoryCreateRequest {
#[inline(always)]
fn new_empty() -> Self {
Self {
pkg_dir_handle: fidl::new_empty!(
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
>
),
realm_server_end: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RealmMarker>>
),
builder_server_end: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<BuilderMarker>>
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
>,
&mut self.pkg_dir_handle,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RealmMarker>>,
&mut self.realm_server_end,
decoder,
offset + 4,
_depth
)?;
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<BuilderMarker>>,
&mut self.builder_server_end,
decoder,
offset + 8,
_depth
)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for RealmGetComponentDeclRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
impl fidl::encoding::ValueTypeMarker for RealmGetComponentDeclRequest {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<RealmGetComponentDeclRequest> for &RealmGetComponentDeclRequest {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RealmGetComponentDeclRequest>(offset);
fidl::encoding::Encode::<RealmGetComponentDeclRequest>::encode(
(<fidl::encoding::BoundedString<1024> as fidl::encoding::ValueTypeMarker>::borrow(
&self.name,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<T0: fidl::encoding::Encode<fidl::encoding::BoundedString<1024>>>
fidl::encoding::Encode<RealmGetComponentDeclRequest> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RealmGetComponentDeclRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for RealmGetComponentDeclRequest {
#[inline(always)]
fn new_empty() -> Self {
Self { name: fidl::new_empty!(fidl::encoding::BoundedString<1024>) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::BoundedString<1024>,
&mut self.name,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for RealmInitMutableConfigFromPackageRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
impl fidl::encoding::ValueTypeMarker for RealmInitMutableConfigFromPackageRequest {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<RealmInitMutableConfigFromPackageRequest>
for &RealmInitMutableConfigFromPackageRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RealmInitMutableConfigFromPackageRequest>(offset);
fidl::encoding::Encode::<RealmInitMutableConfigFromPackageRequest>::encode(
(<fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(
&self.name,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<T0: fidl::encoding::Encode<fidl::encoding::BoundedString<255>>>
fidl::encoding::Encode<RealmInitMutableConfigFromPackageRequest> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RealmInitMutableConfigFromPackageRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for RealmInitMutableConfigFromPackageRequest {
#[inline(always)]
fn new_empty() -> Self {
Self { name: fidl::new_empty!(fidl::encoding::BoundedString<255>) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::BoundedString<255>,
&mut self.name,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for RealmInitMutableConfigToEmptyRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
impl fidl::encoding::ValueTypeMarker for RealmInitMutableConfigToEmptyRequest {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<RealmInitMutableConfigToEmptyRequest>
for &RealmInitMutableConfigToEmptyRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RealmInitMutableConfigToEmptyRequest>(offset);
fidl::encoding::Encode::<RealmInitMutableConfigToEmptyRequest>::encode(
(<fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(
&self.name,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<T0: fidl::encoding::Encode<fidl::encoding::BoundedString<255>>>
fidl::encoding::Encode<RealmInitMutableConfigToEmptyRequest> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RealmInitMutableConfigToEmptyRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for RealmInitMutableConfigToEmptyRequest {
#[inline(always)]
fn new_empty() -> Self {
Self { name: fidl::new_empty!(fidl::encoding::BoundedString<255>) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::BoundedString<255>,
&mut self.name,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for RealmReadOnlyDirectoryRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
48
}
}
impl fidl::encoding::ResourceTypeMarker for RealmReadOnlyDirectoryRequest {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<RealmReadOnlyDirectoryRequest>
for &mut RealmReadOnlyDirectoryRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RealmReadOnlyDirectoryRequest>(offset);
fidl::encoding::Encode::<RealmReadOnlyDirectoryRequest>::encode(
(
<fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
<fidl::encoding::UnboundedVector<fidl_fuchsia_component_decl::Ref> as fidl::encoding::ValueTypeMarker>::borrow(&self.to),
<DirectoryContents as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.directory_contents),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<fidl::encoding::BoundedString<255>>,
T1: fidl::encoding::Encode<
fidl::encoding::UnboundedVector<fidl_fuchsia_component_decl::Ref>,
>,
T2: fidl::encoding::Encode<DirectoryContents>,
> fidl::encoding::Encode<RealmReadOnlyDirectoryRequest> for (T0, T1, T2)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RealmReadOnlyDirectoryRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
self.2.encode(encoder, offset + 32, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for RealmReadOnlyDirectoryRequest {
#[inline(always)]
fn new_empty() -> Self {
Self {
name: fidl::new_empty!(fidl::encoding::BoundedString<255>),
to: fidl::new_empty!(
fidl::encoding::UnboundedVector<fidl_fuchsia_component_decl::Ref>
),
directory_contents: fidl::new_empty!(DirectoryContents),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::BoundedString<255>,
&mut self.name,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::UnboundedVector<fidl_fuchsia_component_decl::Ref>,
&mut self.to,
decoder,
offset + 16,
_depth
)?;
fidl::decode!(
DirectoryContents,
&mut self.directory_contents,
decoder,
offset + 32,
_depth
)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for RealmReplaceComponentDeclRequest {
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
}
}
impl fidl::encoding::ValueTypeMarker for RealmReplaceComponentDeclRequest {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<RealmReplaceComponentDeclRequest>
for &RealmReplaceComponentDeclRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RealmReplaceComponentDeclRequest>(offset);
fidl::encoding::Encode::<RealmReplaceComponentDeclRequest>::encode(
(
<fidl::encoding::BoundedString<1024> as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
<fidl_fuchsia_component_decl::Component as fidl::encoding::ValueTypeMarker>::borrow(&self.component_decl),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<fidl::encoding::BoundedString<1024>>,
T1: fidl::encoding::Encode<fidl_fuchsia_component_decl::Component>,
> fidl::encoding::Encode<RealmReplaceComponentDeclRequest> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RealmReplaceComponentDeclRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for RealmReplaceComponentDeclRequest {
#[inline(always)]
fn new_empty() -> Self {
Self {
name: fidl::new_empty!(fidl::encoding::BoundedString<1024>),
component_decl: fidl::new_empty!(fidl_fuchsia_component_decl::Component),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::BoundedString<1024>,
&mut self.name,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl_fuchsia_component_decl::Component,
&mut self.component_decl,
decoder,
offset + 16,
_depth
)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for RealmReplaceRealmDeclRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
impl fidl::encoding::ValueTypeMarker for RealmReplaceRealmDeclRequest {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<RealmReplaceRealmDeclRequest> for &RealmReplaceRealmDeclRequest {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RealmReplaceRealmDeclRequest>(offset);
fidl::encoding::Encode::<RealmReplaceRealmDeclRequest>::encode(
(
<fidl_fuchsia_component_decl::Component as fidl::encoding::ValueTypeMarker>::borrow(&self.component_decl),
),
encoder, offset, _depth
)
}
}
unsafe impl<T0: fidl::encoding::Encode<fidl_fuchsia_component_decl::Component>>
fidl::encoding::Encode<RealmReplaceRealmDeclRequest> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RealmReplaceRealmDeclRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for RealmReplaceRealmDeclRequest {
#[inline(always)]
fn new_empty() -> Self {
Self { component_decl: fidl::new_empty!(fidl_fuchsia_component_decl::Component) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl_fuchsia_component_decl::Component,
&mut self.component_decl,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for RealmSetConfigValueRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
48
}
}
impl fidl::encoding::ValueTypeMarker for RealmSetConfigValueRequest {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<RealmSetConfigValueRequest> for &RealmSetConfigValueRequest {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RealmSetConfigValueRequest>(offset);
fidl::encoding::Encode::<RealmSetConfigValueRequest>::encode(
(
<fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
<fidl::encoding::BoundedString<64> as fidl::encoding::ValueTypeMarker>::borrow(&self.key),
<fidl_fuchsia_component_decl::ConfigValueSpec as fidl::encoding::ValueTypeMarker>::borrow(&self.value),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<fidl::encoding::BoundedString<255>>,
T1: fidl::encoding::Encode<fidl::encoding::BoundedString<64>>,
T2: fidl::encoding::Encode<fidl_fuchsia_component_decl::ConfigValueSpec>,
> fidl::encoding::Encode<RealmSetConfigValueRequest> for (T0, T1, T2)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RealmSetConfigValueRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
self.2.encode(encoder, offset + 32, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for RealmSetConfigValueRequest {
#[inline(always)]
fn new_empty() -> Self {
Self {
name: fidl::new_empty!(fidl::encoding::BoundedString<255>),
key: fidl::new_empty!(fidl::encoding::BoundedString<64>),
value: fidl::new_empty!(fidl_fuchsia_component_decl::ConfigValueSpec),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::BoundedString<255>,
&mut self.name,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::BoundedString<64>,
&mut self.key,
decoder,
offset + 16,
_depth
)?;
fidl::decode!(
fidl_fuchsia_component_decl::ConfigValueSpec,
&mut self.value,
decoder,
offset + 32,
_depth
)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for RealmGetComponentDeclResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
impl fidl::encoding::ValueTypeMarker for RealmGetComponentDeclResponse {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<RealmGetComponentDeclResponse>
for &RealmGetComponentDeclResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RealmGetComponentDeclResponse>(offset);
fidl::encoding::Encode::<RealmGetComponentDeclResponse>::encode(
(
<fidl_fuchsia_component_decl::Component as fidl::encoding::ValueTypeMarker>::borrow(&self.component_decl),
),
encoder, offset, _depth
)
}
}
unsafe impl<T0: fidl::encoding::Encode<fidl_fuchsia_component_decl::Component>>
fidl::encoding::Encode<RealmGetComponentDeclResponse> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RealmGetComponentDeclResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for RealmGetComponentDeclResponse {
#[inline(always)]
fn new_empty() -> Self {
Self { component_decl: fidl::new_empty!(fidl_fuchsia_component_decl::Component) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl_fuchsia_component_decl::Component,
&mut self.component_decl,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for RealmGetRealmDeclResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
impl fidl::encoding::ValueTypeMarker for RealmGetRealmDeclResponse {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<RealmGetRealmDeclResponse> for &RealmGetRealmDeclResponse {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RealmGetRealmDeclResponse>(offset);
fidl::encoding::Encode::<RealmGetRealmDeclResponse>::encode(
(
<fidl_fuchsia_component_decl::Component as fidl::encoding::ValueTypeMarker>::borrow(&self.component_decl),
),
encoder, offset, _depth
)
}
}
unsafe impl<T0: fidl::encoding::Encode<fidl_fuchsia_component_decl::Component>>
fidl::encoding::Encode<RealmGetRealmDeclResponse> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RealmGetRealmDeclResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for RealmGetRealmDeclResponse {
#[inline(always)]
fn new_empty() -> Self {
Self { component_decl: fidl::new_empty!(fidl_fuchsia_component_decl::Component) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl_fuchsia_component_decl::Component,
&mut self.component_decl,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl ChildOptions {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.config_overrides {
return 4;
}
if let Some(_) = self.on_terminate {
return 3;
}
if let Some(_) = self.environment {
return 2;
}
if let Some(_) = self.startup {
return 1;
}
0
}
}
unsafe impl fidl::encoding::TypeMarker for ChildOptions {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
impl fidl::encoding::ValueTypeMarker for ChildOptions {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<ChildOptions> for &ChildOptions {
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ChildOptions>(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_fuchsia_component_decl::StartupMode>(
self.startup.as_ref().map(<fidl_fuchsia_component_decl::StartupMode 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<255>>(
self.environment.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_fuchsia_component_decl::OnTerminate>(
self.on_terminate.as_ref().map(<fidl_fuchsia_component_decl::OnTerminate 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_component_decl::ConfigOverride>>(
self.config_overrides.as_ref().map(<fidl::encoding::UnboundedVector<fidl_fuchsia_component_decl::ConfigOverride> as fidl::encoding::ValueTypeMarker>::borrow),
encoder, offset + cur_offset, depth
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for ChildOptions {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
if len == 0 {
return Ok(());
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 1 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size = <fidl_fuchsia_component_decl::StartupMode 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.startup.get_or_insert_with(|| {
fidl::new_empty!(fidl_fuchsia_component_decl::StartupMode)
});
fidl::decode!(
fidl_fuchsia_component_decl::StartupMode,
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
.environment
.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<255>));
fidl::decode!(
fidl::encoding::BoundedString<255>,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 3 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size = <fidl_fuchsia_component_decl::OnTerminate 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.on_terminate.get_or_insert_with(|| {
fidl::new_empty!(fidl_fuchsia_component_decl::OnTerminate)
});
fidl::decode!(
fidl_fuchsia_component_decl::OnTerminate,
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_component_decl::ConfigOverride,
> 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_overrides.get_or_insert_with(|| {
fidl::new_empty!(
fidl::encoding::UnboundedVector<
fidl_fuchsia_component_decl::ConfigOverride,
>
)
});
fidl::decode!(
fidl::encoding::UnboundedVector<fidl_fuchsia_component_decl::ConfigOverride>,
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 Config {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.availability {
return 3;
}
if let Some(_) = self.as_ {
return 2;
}
if let Some(_) = self.name {
return 1;
}
0
}
}
unsafe impl fidl::encoding::TypeMarker for Config {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
impl fidl::encoding::ValueTypeMarker for Config {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<Config> for &Config {
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Config>(offset);
let max_ordinal: u64 = self.max_ordinal_present();
encoder.write_num(max_ordinal, offset);
encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
if max_ordinal == 0 {
return Ok(());
}
depth.increment()?;
let envelope_size = 8;
let bytes_len = max_ordinal as usize * envelope_size;
#[allow(unused_variables)]
let offset = encoder.out_of_line_offset(bytes_len);
let mut _prev_end_offset: usize = 0;
if 1 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (1 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<255>>(
self.name.as_ref().map(
<fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow,
),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 2 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (2 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<255>>(
self.as_.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_fuchsia_component_decl::Availability>(
self.availability.as_ref().map(<fidl_fuchsia_component_decl::Availability as fidl::encoding::ValueTypeMarker>::borrow),
encoder, offset + cur_offset, depth
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for Config {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
if len == 0 {
return Ok(());
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 1 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<fidl::encoding::BoundedString<255> as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self
.name
.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<255>));
fidl::decode!(
fidl::encoding::BoundedString<255>,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 2 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<fidl::encoding::BoundedString<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
.as_
.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<255>));
fidl::decode!(
fidl::encoding::BoundedString<255>,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 3 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size = <fidl_fuchsia_component_decl::Availability 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.availability.get_or_insert_with(|| {
fidl::new_empty!(fidl_fuchsia_component_decl::Availability)
});
fidl::decode!(
fidl_fuchsia_component_decl::Availability,
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 Directory {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.availability {
return 7;
}
if let Some(_) = self.path {
return 6;
}
if let Some(_) = self.rights {
return 5;
}
if let Some(_) = self.subdir {
return 4;
}
if let Some(_) = self.type_ {
return 3;
}
if let Some(_) = self.as_ {
return 2;
}
if let Some(_) = self.name {
return 1;
}
0
}
}
unsafe impl fidl::encoding::TypeMarker for Directory {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
impl fidl::encoding::ValueTypeMarker for Directory {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<Directory> for &Directory {
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Directory>(offset);
let max_ordinal: u64 = self.max_ordinal_present();
encoder.write_num(max_ordinal, offset);
encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
if max_ordinal == 0 {
return Ok(());
}
depth.increment()?;
let envelope_size = 8;
let bytes_len = max_ordinal as usize * envelope_size;
#[allow(unused_variables)]
let offset = encoder.out_of_line_offset(bytes_len);
let mut _prev_end_offset: usize = 0;
if 1 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (1 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<255>>(
self.name.as_ref().map(
<fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow,
),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 2 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (2 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<255>>(
self.as_.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_fuchsia_component_decl::DependencyType>(
self.type_.as_ref().map(<fidl_fuchsia_component_decl::DependencyType 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::BoundedString<4095>>(
self.subdir.as_ref().map(<fidl::encoding::BoundedString<4095> as fidl::encoding::ValueTypeMarker>::borrow),
encoder, offset + cur_offset, depth
)?;
_prev_end_offset = cur_offset + envelope_size;
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_io::Operations>(
self.rights
.as_ref()
.map(<fidl_fuchsia_io::Operations 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::<fidl::encoding::BoundedString<4095>>(
self.path.as_ref().map(<fidl::encoding::BoundedString<4095> as fidl::encoding::ValueTypeMarker>::borrow),
encoder, offset + cur_offset, depth
)?;
_prev_end_offset = cur_offset + envelope_size;
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_fuchsia_component_decl::Availability>(
self.availability.as_ref().map(<fidl_fuchsia_component_decl::Availability as fidl::encoding::ValueTypeMarker>::borrow),
encoder, offset + cur_offset, depth
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for Directory {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
if len == 0 {
return Ok(());
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 1 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<fidl::encoding::BoundedString<255> as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self
.name
.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<255>));
fidl::decode!(
fidl::encoding::BoundedString<255>,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 2 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<fidl::encoding::BoundedString<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
.as_
.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<255>));
fidl::decode!(
fidl::encoding::BoundedString<255>,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 3 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size = <fidl_fuchsia_component_decl::DependencyType 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.type_.get_or_insert_with(|| {
fidl::new_empty!(fidl_fuchsia_component_decl::DependencyType)
});
fidl::decode!(
fidl_fuchsia_component_decl::DependencyType,
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::BoundedString<4095> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self
.subdir
.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<4095>));
fidl::decode!(
fidl::encoding::BoundedString<4095>,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_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_io::Operations 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
.rights
.get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_io::Operations));
fidl::decode!(
fidl_fuchsia_io::Operations,
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 = <fidl::encoding::BoundedString<4095> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self
.path
.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<4095>));
fidl::decode!(
fidl::encoding::BoundedString<4095>,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_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_fuchsia_component_decl::Availability 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.availability.get_or_insert_with(|| {
fidl::new_empty!(fidl_fuchsia_component_decl::Availability)
});
fidl::decode!(
fidl_fuchsia_component_decl::Availability,
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 Event {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.availability {
return 4;
}
if let Some(_) = self.filter {
return 3;
}
if let Some(_) = self.as_ {
return 2;
}
if let Some(_) = self.name {
return 1;
}
0
}
}
unsafe impl fidl::encoding::TypeMarker for Event {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
impl fidl::encoding::ValueTypeMarker for Event {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<Event> for &Event {
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Event>(offset);
let max_ordinal: u64 = self.max_ordinal_present();
encoder.write_num(max_ordinal, offset);
encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
if max_ordinal == 0 {
return Ok(());
}
depth.increment()?;
let envelope_size = 8;
let bytes_len = max_ordinal as usize * envelope_size;
#[allow(unused_variables)]
let offset = encoder.out_of_line_offset(bytes_len);
let mut _prev_end_offset: usize = 0;
if 1 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (1 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<255>>(
self.name.as_ref().map(
<fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow,
),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 2 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (2 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<255>>(
self.as_.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_fuchsia_data::Dictionary>(
self.filter.as_ref().map(
<fidl_fuchsia_data::Dictionary 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_fuchsia_component_decl::Availability>(
self.availability.as_ref().map(<fidl_fuchsia_component_decl::Availability as fidl::encoding::ValueTypeMarker>::borrow),
encoder, offset + cur_offset, depth
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for Event {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
if len == 0 {
return Ok(());
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 1 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<fidl::encoding::BoundedString<255> as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self
.name
.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<255>));
fidl::decode!(
fidl::encoding::BoundedString<255>,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 2 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<fidl::encoding::BoundedString<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
.as_
.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<255>));
fidl::decode!(
fidl::encoding::BoundedString<255>,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 3 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<fidl_fuchsia_data::Dictionary 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
.filter
.get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_data::Dictionary));
fidl::decode!(
fidl_fuchsia_data::Dictionary,
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_fuchsia_component_decl::Availability 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.availability.get_or_insert_with(|| {
fidl::new_empty!(fidl_fuchsia_component_decl::Availability)
});
fidl::decode!(
fidl_fuchsia_component_decl::Availability,
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 EventStream {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.scope {
return 5;
}
if let Some(_) = self.filter {
return 4;
}
if let Some(_) = self.path {
return 3;
}
if let Some(_) = self.as_ {
return 2;
}
if let Some(_) = self.name {
return 1;
}
0
}
}
unsafe impl fidl::encoding::TypeMarker for EventStream {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
impl fidl::encoding::ValueTypeMarker for EventStream {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<EventStream> for &EventStream {
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<EventStream>(offset);
let max_ordinal: u64 = self.max_ordinal_present();
encoder.write_num(max_ordinal, offset);
encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
if max_ordinal == 0 {
return Ok(());
}
depth.increment()?;
let envelope_size = 8;
let bytes_len = max_ordinal as usize * envelope_size;
#[allow(unused_variables)]
let offset = encoder.out_of_line_offset(bytes_len);
let mut _prev_end_offset: usize = 0;
if 1 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (1 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<255>>(
self.name.as_ref().map(
<fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow,
),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 2 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (2 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<255>>(
self.as_.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::BoundedString<4095>>(
self.path.as_ref().map(<fidl::encoding::BoundedString<4095> as fidl::encoding::ValueTypeMarker>::borrow),
encoder, offset + cur_offset, depth
)?;
_prev_end_offset = cur_offset + envelope_size;
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_fuchsia_data::Dictionary>(
self.filter.as_ref().map(
<fidl_fuchsia_data::Dictionary 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_fuchsia_component_decl::Ref>>(
self.scope.as_ref().map(<fidl::encoding::UnboundedVector<fidl_fuchsia_component_decl::Ref> as fidl::encoding::ValueTypeMarker>::borrow),
encoder, offset + cur_offset, depth
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for EventStream {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
if len == 0 {
return Ok(());
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 1 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<fidl::encoding::BoundedString<255> as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self
.name
.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<255>));
fidl::decode!(
fidl::encoding::BoundedString<255>,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 2 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<fidl::encoding::BoundedString<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
.as_
.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<255>));
fidl::decode!(
fidl::encoding::BoundedString<255>,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 3 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size = <fidl::encoding::BoundedString<4095> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self
.path
.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<4095>));
fidl::decode!(
fidl::encoding::BoundedString<4095>,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_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_fuchsia_data::Dictionary 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
.filter
.get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_data::Dictionary));
fidl::decode!(
fidl_fuchsia_data::Dictionary,
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_fuchsia_component_decl::Ref,
> 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.scope.get_or_insert_with(|| {
fidl::new_empty!(
fidl::encoding::UnboundedVector<fidl_fuchsia_component_decl::Ref>
)
});
fidl::decode!(
fidl::encoding::UnboundedVector<fidl_fuchsia_component_decl::Ref>,
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 Protocol {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.availability {
return 5;
}
if let Some(_) = self.path {
return 4;
}
if let Some(_) = self.type_ {
return 3;
}
if let Some(_) = self.as_ {
return 2;
}
if let Some(_) = self.name {
return 1;
}
0
}
}
unsafe impl fidl::encoding::TypeMarker for Protocol {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
impl fidl::encoding::ValueTypeMarker for Protocol {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<Protocol> for &Protocol {
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Protocol>(offset);
let max_ordinal: u64 = self.max_ordinal_present();
encoder.write_num(max_ordinal, offset);
encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
if max_ordinal == 0 {
return Ok(());
}
depth.increment()?;
let envelope_size = 8;
let bytes_len = max_ordinal as usize * envelope_size;
#[allow(unused_variables)]
let offset = encoder.out_of_line_offset(bytes_len);
let mut _prev_end_offset: usize = 0;
if 1 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (1 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<255>>(
self.name.as_ref().map(
<fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow,
),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 2 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (2 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<255>>(
self.as_.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_fuchsia_component_decl::DependencyType>(
self.type_.as_ref().map(<fidl_fuchsia_component_decl::DependencyType 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::BoundedString<4095>>(
self.path.as_ref().map(<fidl::encoding::BoundedString<4095> as fidl::encoding::ValueTypeMarker>::borrow),
encoder, offset + cur_offset, depth
)?;
_prev_end_offset = cur_offset + envelope_size;
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_component_decl::Availability>(
self.availability.as_ref().map(<fidl_fuchsia_component_decl::Availability as fidl::encoding::ValueTypeMarker>::borrow),
encoder, offset + cur_offset, depth
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for Protocol {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
if len == 0 {
return Ok(());
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 1 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<fidl::encoding::BoundedString<255> as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self
.name
.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<255>));
fidl::decode!(
fidl::encoding::BoundedString<255>,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 2 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<fidl::encoding::BoundedString<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
.as_
.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<255>));
fidl::decode!(
fidl::encoding::BoundedString<255>,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 3 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size = <fidl_fuchsia_component_decl::DependencyType 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.type_.get_or_insert_with(|| {
fidl::new_empty!(fidl_fuchsia_component_decl::DependencyType)
});
fidl::decode!(
fidl_fuchsia_component_decl::DependencyType,
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::BoundedString<4095> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self
.path
.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<4095>));
fidl::decode!(
fidl::encoding::BoundedString<4095>,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_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_component_decl::Availability 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.availability.get_or_insert_with(|| {
fidl::new_empty!(fidl_fuchsia_component_decl::Availability)
});
fidl::decode!(
fidl_fuchsia_component_decl::Availability,
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 Service {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.availability {
return 4;
}
if let Some(_) = self.path {
return 3;
}
if let Some(_) = self.as_ {
return 2;
}
if let Some(_) = self.name {
return 1;
}
0
}
}
unsafe impl fidl::encoding::TypeMarker for Service {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
impl fidl::encoding::ValueTypeMarker for Service {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<Service> for &Service {
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Service>(offset);
let max_ordinal: u64 = self.max_ordinal_present();
encoder.write_num(max_ordinal, offset);
encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
if max_ordinal == 0 {
return Ok(());
}
depth.increment()?;
let envelope_size = 8;
let bytes_len = max_ordinal as usize * envelope_size;
#[allow(unused_variables)]
let offset = encoder.out_of_line_offset(bytes_len);
let mut _prev_end_offset: usize = 0;
if 1 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (1 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<255>>(
self.name.as_ref().map(
<fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow,
),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 2 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (2 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<255>>(
self.as_.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::BoundedString<4095>>(
self.path.as_ref().map(<fidl::encoding::BoundedString<4095> as fidl::encoding::ValueTypeMarker>::borrow),
encoder, offset + cur_offset, depth
)?;
_prev_end_offset = cur_offset + envelope_size;
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_fuchsia_component_decl::Availability>(
self.availability.as_ref().map(<fidl_fuchsia_component_decl::Availability as fidl::encoding::ValueTypeMarker>::borrow),
encoder, offset + cur_offset, depth
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for Service {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
if len == 0 {
return Ok(());
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 1 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<fidl::encoding::BoundedString<255> as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self
.name
.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<255>));
fidl::decode!(
fidl::encoding::BoundedString<255>,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 2 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<fidl::encoding::BoundedString<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
.as_
.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<255>));
fidl::decode!(
fidl::encoding::BoundedString<255>,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 3 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size = <fidl::encoding::BoundedString<4095> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self
.path
.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<4095>));
fidl::decode!(
fidl::encoding::BoundedString<4095>,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_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_fuchsia_component_decl::Availability 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.availability.get_or_insert_with(|| {
fidl::new_empty!(fidl_fuchsia_component_decl::Availability)
});
fidl::decode!(
fidl_fuchsia_component_decl::Availability,
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 Storage {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.availability {
return 4;
}
if let Some(_) = self.path {
return 3;
}
if let Some(_) = self.as_ {
return 2;
}
if let Some(_) = self.name {
return 1;
}
0
}
}
unsafe impl fidl::encoding::TypeMarker for Storage {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
impl fidl::encoding::ValueTypeMarker for Storage {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<Storage> for &Storage {
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Storage>(offset);
let max_ordinal: u64 = self.max_ordinal_present();
encoder.write_num(max_ordinal, offset);
encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
if max_ordinal == 0 {
return Ok(());
}
depth.increment()?;
let envelope_size = 8;
let bytes_len = max_ordinal as usize * envelope_size;
#[allow(unused_variables)]
let offset = encoder.out_of_line_offset(bytes_len);
let mut _prev_end_offset: usize = 0;
if 1 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (1 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<255>>(
self.name.as_ref().map(
<fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow,
),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 2 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (2 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<255>>(
self.as_.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::BoundedString<255>>(
self.path.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 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_fuchsia_component_decl::Availability>(
self.availability.as_ref().map(<fidl_fuchsia_component_decl::Availability as fidl::encoding::ValueTypeMarker>::borrow),
encoder, offset + cur_offset, depth
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for Storage {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
if len == 0 {
return Ok(());
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 1 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<fidl::encoding::BoundedString<255> as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self
.name
.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<255>));
fidl::decode!(
fidl::encoding::BoundedString<255>,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 2 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<fidl::encoding::BoundedString<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
.as_
.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<255>));
fidl::decode!(
fidl::encoding::BoundedString<255>,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 3 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<fidl::encoding::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
.path
.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<255>));
fidl::decode!(
fidl::encoding::BoundedString<255>,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 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_fuchsia_component_decl::Availability 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.availability.get_or_insert_with(|| {
fidl::new_empty!(fidl_fuchsia_component_decl::Availability)
});
fidl::decode!(
fidl_fuchsia_component_decl::Availability,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
while next_offset < end_offset {
_next_ordinal_to_read += 1;
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
next_offset += envelope_size;
}
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for Capability {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
impl fidl::encoding::ValueTypeMarker for Capability {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<Capability> for &Capability {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Capability>(offset);
encoder.write_num::<u64>(self.ordinal(), offset);
match self {
Capability::Protocol(ref val) => fidl::encoding::encode_in_envelope::<Protocol>(
<Protocol as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
),
Capability::Directory(ref val) => fidl::encoding::encode_in_envelope::<Directory>(
<Directory as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
),
Capability::Storage(ref val) => fidl::encoding::encode_in_envelope::<Storage>(
<Storage as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
),
Capability::Service(ref val) => fidl::encoding::encode_in_envelope::<Service>(
<Service as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
),
Capability::EventStream(ref val) => {
fidl::encoding::encode_in_envelope::<EventStream>(
<EventStream as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
Capability::Config(ref val) => fidl::encoding::encode_in_envelope::<Config>(
<Config as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
),
Capability::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
}
}
}
impl fidl::encoding::Decode<Self> for Capability {
#[inline(always)]
fn new_empty() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0 }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
#[allow(unused_variables)]
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
let (ordinal, inlined, num_bytes, num_handles) =
fidl::encoding::decode_union_inline_portion(decoder, offset)?;
let member_inline_size = match ordinal {
1 => <Protocol as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2 => <Directory as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3 => <Storage as fidl::encoding::TypeMarker>::inline_size(decoder.context),
4 => <Service as fidl::encoding::TypeMarker>::inline_size(decoder.context),
6 => <EventStream as fidl::encoding::TypeMarker>::inline_size(decoder.context),
7 => <Config as fidl::encoding::TypeMarker>::inline_size(decoder.context),
0 => return Err(fidl::Error::UnknownUnionTag),
_ => num_bytes as usize,
};
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::Protocol(_) = self {
} else {
*self = Capability::Protocol(fidl::new_empty!(Protocol));
}
#[allow(irrefutable_let_patterns)]
if let Capability::Protocol(ref mut val) = self {
fidl::decode!(Protocol, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
2 => {
#[allow(irrefutable_let_patterns)]
if let Capability::Directory(_) = self {
} else {
*self = Capability::Directory(fidl::new_empty!(Directory));
}
#[allow(irrefutable_let_patterns)]
if let Capability::Directory(ref mut val) = self {
fidl::decode!(Directory, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
3 => {
#[allow(irrefutable_let_patterns)]
if let Capability::Storage(_) = self {
} else {
*self = Capability::Storage(fidl::new_empty!(Storage));
}
#[allow(irrefutable_let_patterns)]
if let Capability::Storage(ref mut val) = self {
fidl::decode!(Storage, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
4 => {
#[allow(irrefutable_let_patterns)]
if let Capability::Service(_) = self {
} else {
*self = Capability::Service(fidl::new_empty!(Service));
}
#[allow(irrefutable_let_patterns)]
if let Capability::Service(ref mut val) = self {
fidl::decode!(Service, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
6 => {
#[allow(irrefutable_let_patterns)]
if let Capability::EventStream(_) = self {
} else {
*self = Capability::EventStream(fidl::new_empty!(EventStream));
}
#[allow(irrefutable_let_patterns)]
if let Capability::EventStream(ref mut val) = self {
fidl::decode!(EventStream, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
7 => {
#[allow(irrefutable_let_patterns)]
if let Capability::Config(_) = self {
} else {
*self = Capability::Config(fidl::new_empty!(Config));
}
#[allow(irrefutable_let_patterns)]
if let Capability::Config(ref mut val) = self {
fidl::decode!(Config, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
#[allow(deprecated)]
ordinal => {
for _ in 0..num_handles {
decoder.drop_next_handle()?;
}
*self = Capability::__SourceBreaking { unknown_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(())
}
}
}