#![warn(clippy::all)]
#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
use bitflags::bitflags;
use fidl::client::QueryResponseFut;
use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
use fidl::endpoints::{ControlHandle as _, Responder as _};
use futures::future::{self, MaybeDone, TryFutureExt};
use zx_status;
pub const DEFAULT_GUEST_CID: u32 = 3;
pub const HOST_CID: u32 = 2;
pub const MAX_BLOCK_DEVICES: u8 = 32;
pub const MAX_BLOCK_DEVICE_ID: u8 = 20;
pub const MAX_MEMORY: u8 = 32;
pub const MAX_NET_DEVICES: u8 = 32;
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(u32)]
pub enum BlockMode {
ReadWrite = 0,
ReadOnly = 1,
VolatileWrite = 2,
}
impl BlockMode {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
0 => Some(Self::ReadWrite),
1 => Some(Self::ReadOnly),
2 => Some(Self::VolatileWrite),
_ => None,
}
}
#[inline]
pub const fn into_primitive(self) -> u32 {
self as u32
}
#[deprecated = "Strict enums should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(u32)]
pub enum ContainerStatus {
Transient = 1,
LaunchingGuest = 2,
StartingVm = 3,
Downloading = 4,
Extracting = 5,
Starting = 6,
Ready = 7,
Failed = 8,
}
impl ContainerStatus {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::Transient),
2 => Some(Self::LaunchingGuest),
3 => Some(Self::StartingVm),
4 => Some(Self::Downloading),
5 => Some(Self::Extracting),
6 => Some(Self::Starting),
7 => Some(Self::Ready),
8 => Some(Self::Failed),
_ => None,
}
}
#[inline]
pub const fn into_primitive(self) -> u32 {
self as u32
}
#[deprecated = "Strict enums should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(u32)]
pub enum GuestError {
InternalError = 1,
DeviceNotPresent = 2,
BadConfig = 3,
GuestInitializationFailure = 4,
DeviceInitializationFailure = 5,
DeviceStartFailure = 6,
DeviceMemoryOverlap = 7,
FailedServiceConnect = 8,
DuplicatePublicServices = 9,
KernelLoadFailure = 10,
VcpuStartFailure = 11,
VcpuRuntimeFailure = 12,
NotCreated = 13,
AlreadyRunning = 14,
ControllerForcedHalt = 15,
}
impl GuestError {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::InternalError),
2 => Some(Self::DeviceNotPresent),
3 => Some(Self::BadConfig),
4 => Some(Self::GuestInitializationFailure),
5 => Some(Self::DeviceInitializationFailure),
6 => Some(Self::DeviceStartFailure),
7 => Some(Self::DeviceMemoryOverlap),
8 => Some(Self::FailedServiceConnect),
9 => Some(Self::DuplicatePublicServices),
10 => Some(Self::KernelLoadFailure),
11 => Some(Self::VcpuStartFailure),
12 => Some(Self::VcpuRuntimeFailure),
13 => Some(Self::NotCreated),
14 => Some(Self::AlreadyRunning),
15 => Some(Self::ControllerForcedHalt),
_ => None,
}
}
#[inline]
pub const fn into_primitive(self) -> u32 {
self as u32
}
#[deprecated = "Strict enums should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(u32)]
pub enum GuestManagerError {
BadConfig = 1,
AlreadyRunning = 2,
NotRunning = 3,
StartFailure = 4,
NoStorage = 5,
}
impl GuestManagerError {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::BadConfig),
2 => Some(Self::AlreadyRunning),
3 => Some(Self::NotRunning),
4 => Some(Self::StartFailure),
5 => Some(Self::NoStorage),
_ => None,
}
}
#[inline]
pub const fn into_primitive(self) -> u32 {
self as u32
}
#[deprecated = "Strict enums should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(u32)]
pub enum GuestStatus {
NotStarted = 1,
Starting = 2,
Running = 3,
Stopping = 4,
Stopped = 5,
VmmUnexpectedTermination = 6,
}
impl GuestStatus {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::NotStarted),
2 => Some(Self::Starting),
3 => Some(Self::Running),
4 => Some(Self::Stopping),
5 => Some(Self::Stopped),
6 => Some(Self::VmmUnexpectedTermination),
_ => None,
}
}
#[inline]
pub const fn into_primitive(self) -> u32 {
self as u32
}
#[deprecated = "Strict enums should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(u32)]
pub enum KernelType {
Zircon = 0,
Linux = 1,
}
impl KernelType {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
0 => Some(Self::Zircon),
1 => Some(Self::Linux),
_ => 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(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct BalloonControllerGetBalloonSizeResponse {
pub current_num_pages: u32,
pub requested_num_pages: u32,
}
impl fidl::Persistable for BalloonControllerGetBalloonSizeResponse {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct BalloonControllerGetMemStatsResponse {
pub status: i32,
pub mem_stats: Option<Vec<MemStat>>,
}
impl fidl::Persistable for BalloonControllerGetMemStatsResponse {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct BalloonControllerRequestNumPagesRequest {
pub requested_num_pages: u32,
}
impl fidl::Persistable for BalloonControllerRequestNumPagesRequest {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct BlockSpec {
pub id: String,
pub mode: BlockMode,
pub format: BlockFormat,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for BlockSpec {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct GuestGetBalloonControllerRequest {
pub controller: fidl::endpoints::ServerEnd<BalloonControllerMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for GuestGetBalloonControllerRequest
{
}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct GuestGetHostVsockEndpointRequest {
pub endpoint: fidl::endpoints::ServerEnd<HostVsockEndpointMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for GuestGetHostVsockEndpointRequest
{
}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct GuestGetMemControllerRequest {
pub controller: fidl::endpoints::ServerEnd<MemControllerMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for GuestGetMemControllerRequest
{
}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct GuestGetSerialResponse {
pub socket: fidl::Socket,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for GuestGetSerialResponse {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct GuestLifecycleBindRequest {
pub guest: fidl::endpoints::ServerEnd<GuestMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for GuestLifecycleBindRequest {}
#[derive(Debug, PartialEq)]
pub struct GuestLifecycleCreateRequest {
pub guest_config: GuestConfig,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for GuestLifecycleCreateRequest
{
}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct GuestManagerConnectRequest {
pub controller: fidl::endpoints::ServerEnd<GuestMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for GuestManagerConnectRequest
{
}
#[derive(Debug, PartialEq)]
pub struct GuestManagerGetInfoResponse {
pub guest_info: GuestInfo,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for GuestManagerGetInfoResponse
{
}
#[derive(Debug, PartialEq)]
pub struct GuestManagerLaunchRequest {
pub guest_config: GuestConfig,
pub controller: fidl::endpoints::ServerEnd<GuestMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for GuestManagerLaunchRequest {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct GuestGetConsoleResponse {
pub socket: fidl::Socket,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for GuestGetConsoleResponse {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct HostVsockAcceptorAcceptRequest {
pub src_cid: u32,
pub src_port: u32,
pub port: u32,
}
impl fidl::Persistable for HostVsockAcceptorAcceptRequest {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct HostVsockAcceptorAcceptResponse {
pub socket: fidl::Socket,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for HostVsockAcceptorAcceptResponse
{
}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct HostVsockEndpointConnectRequest {
pub guest_port: u32,
}
impl fidl::Persistable for HostVsockEndpointConnectRequest {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct HostVsockEndpointConnectResponse {
pub socket: fidl::Socket,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for HostVsockEndpointConnectResponse
{
}
#[derive(Clone, Debug, PartialEq)]
pub struct LinuxManagerOnGuestInfoChangedRequest {
pub label: String,
pub info: LinuxGuestInfo,
}
impl fidl::Persistable for LinuxManagerOnGuestInfoChangedRequest {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct LinuxManagerStartAndGetLinuxGuestInfoRequest {
pub label: String,
}
impl fidl::Persistable for LinuxManagerStartAndGetLinuxGuestInfoRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct LinuxManagerStartAndGetLinuxGuestInfoResponse {
pub info: LinuxGuestInfo,
}
impl fidl::Persistable for LinuxManagerStartAndGetLinuxGuestInfoResponse {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct Listener {
pub port: u32,
pub acceptor: fidl::endpoints::ClientEnd<HostVsockAcceptorMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for Listener {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct MagmaDevice {
pub memory: u64,
}
impl fidl::Persistable for MagmaDevice {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct MemControllerGetMemSizeResponse {
pub block_size: u64,
pub region_size: u64,
pub usable_region_size: u64,
pub plugged_size: u64,
pub requested_size: u64,
}
impl fidl::Persistable for MemControllerGetMemSizeResponse {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct MemControllerRequestSizeRequest {
pub requested_size: u64,
}
impl fidl::Persistable for MemControllerRequestSizeRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct MemStat {
pub tag: u16,
pub val: u64,
}
impl fidl::Persistable for MemStat {}
#[derive(Clone, Debug, PartialEq)]
pub struct NetSpec {
pub mac_address: fidl_fuchsia_net::MacAddress,
pub enable_bridge: bool,
}
impl fidl::Persistable for NetSpec {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct WaylandDevice {
pub memory: u64,
pub server: Option<fidl::endpoints::ClientEnd<fidl_fuchsia_wayland::Server_Marker>>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for WaylandDevice {}
#[derive(Debug, Default, PartialEq)]
pub struct GuestConfig {
pub kernel_type: Option<KernelType>,
pub kernel: Option<fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>>,
pub ramdisk: Option<fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>>,
pub dtb_overlay: Option<fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>>,
pub cmdline: Option<String>,
pub cmdline_add: Option<Vec<String>>,
pub cpus: Option<u8>,
pub guest_memory: Option<u64>,
pub block_devices: Option<Vec<BlockSpec>>,
pub net_devices: Option<Vec<NetSpec>>,
pub wayland_device: Option<WaylandDevice>,
pub magma_device: Option<MagmaDevice>,
pub default_net: Option<bool>,
pub virtio_balloon: Option<bool>,
pub virtio_console: Option<bool>,
pub virtio_gpu: Option<bool>,
pub virtio_rng: Option<bool>,
pub virtio_vsock: Option<bool>,
pub virtio_sound: Option<bool>,
pub virtio_sound_input: Option<bool>,
pub vsock_listeners: Option<Vec<Listener>>,
pub virtio_mem: Option<bool>,
pub virtio_mem_block_size: Option<u64>,
pub virtio_mem_region_size: Option<u64>,
pub virtio_mem_region_alignment: Option<u64>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for GuestConfig {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct GuestDescriptor {
pub num_cpus: Option<u8>,
pub guest_memory: Option<u64>,
pub wayland: Option<bool>,
pub magma: Option<bool>,
pub balloon: Option<bool>,
pub console: Option<bool>,
pub gpu: Option<bool>,
pub rng: Option<bool>,
pub vsock: Option<bool>,
pub sound: Option<bool>,
pub networks: Option<Vec<NetSpec>>,
pub mem: Option<bool>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for GuestDescriptor {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct GuestInfo {
pub guest_status: Option<GuestStatus>,
pub uptime: Option<i64>,
pub guest_descriptor: Option<GuestDescriptor>,
pub stop_error: Option<GuestError>,
pub detected_problems: Option<Vec<String>>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for GuestInfo {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct LinuxGuestInfo {
pub cid: Option<u32>,
pub container_status: Option<ContainerStatus>,
pub download_percent: Option<i32>,
pub failure_reason: Option<String>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for LinuxGuestInfo {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub enum BlockFormat {
File(fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>),
Qcow(fidl::Channel),
Block(fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_block::BlockMarker>),
}
impl BlockFormat {
#[inline]
pub fn ordinal(&self) -> u64 {
match *self {
Self::File(_) => 1,
Self::Qcow(_) => 2,
Self::Block(_) => 3,
}
}
#[deprecated = "Strict unions should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for BlockFormat {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct BalloonControllerMarker;
impl fidl::endpoints::ProtocolMarker for BalloonControllerMarker {
type Proxy = BalloonControllerProxy;
type RequestStream = BalloonControllerRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = BalloonControllerSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.virtualization.BalloonController";
}
impl fidl::endpoints::DiscoverableProtocolMarker for BalloonControllerMarker {}
pub trait BalloonControllerProxyInterface: Send + Sync {
type GetBalloonSizeResponseFut: std::future::Future<Output = Result<(u32, u32), fidl::Error>>
+ Send;
fn r#get_balloon_size(&self) -> Self::GetBalloonSizeResponseFut;
fn r#request_num_pages(&self, requested_num_pages: u32) -> Result<(), fidl::Error>;
type GetMemStatsResponseFut: std::future::Future<Output = Result<(i32, Option<Vec<MemStat>>), fidl::Error>>
+ Send;
fn r#get_mem_stats(&self) -> Self::GetMemStatsResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct BalloonControllerSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for BalloonControllerSynchronousProxy {
type Proxy = BalloonControllerProxy;
type Protocol = BalloonControllerMarker;
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 BalloonControllerSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name =
<BalloonControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
}
pub fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
pub fn wait_for_event(
&self,
deadline: zx::MonotonicInstant,
) -> Result<BalloonControllerEvent, fidl::Error> {
BalloonControllerEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#get_balloon_size(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<(u32, u32), fidl::Error> {
let _response = self
.client
.send_query::<fidl::encoding::EmptyPayload, BalloonControllerGetBalloonSizeResponse>(
(),
0x2bb2ebaa6ff64d0b,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok((_response.current_num_pages, _response.requested_num_pages))
}
pub fn r#request_num_pages(&self, mut requested_num_pages: u32) -> Result<(), fidl::Error> {
self.client.send::<BalloonControllerRequestNumPagesRequest>(
(requested_num_pages,),
0x55c444d65e1df1e8,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#get_mem_stats(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<(i32, Option<Vec<MemStat>>), fidl::Error> {
let _response = self
.client
.send_query::<fidl::encoding::EmptyPayload, BalloonControllerGetMemStatsResponse>(
(),
0x676199795cc01142,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok((_response.status, _response.mem_stats))
}
}
#[derive(Debug, Clone)]
pub struct BalloonControllerProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for BalloonControllerProxy {
type Protocol = BalloonControllerMarker;
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 BalloonControllerProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name =
<BalloonControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> BalloonControllerEventStream {
BalloonControllerEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#get_balloon_size(
&self,
) -> fidl::client::QueryResponseFut<(u32, u32), fidl::encoding::DefaultFuchsiaResourceDialect>
{
BalloonControllerProxyInterface::r#get_balloon_size(self)
}
pub fn r#request_num_pages(&self, mut requested_num_pages: u32) -> Result<(), fidl::Error> {
BalloonControllerProxyInterface::r#request_num_pages(self, requested_num_pages)
}
pub fn r#get_mem_stats(
&self,
) -> fidl::client::QueryResponseFut<
(i32, Option<Vec<MemStat>>),
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
BalloonControllerProxyInterface::r#get_mem_stats(self)
}
}
impl BalloonControllerProxyInterface for BalloonControllerProxy {
type GetBalloonSizeResponseFut =
fidl::client::QueryResponseFut<(u32, u32), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#get_balloon_size(&self) -> Self::GetBalloonSizeResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<(u32, u32), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
BalloonControllerGetBalloonSizeResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x2bb2ebaa6ff64d0b,
>(_buf?)?;
Ok((_response.current_num_pages, _response.requested_num_pages))
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, (u32, u32)>(
(),
0x2bb2ebaa6ff64d0b,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
fn r#request_num_pages(&self, mut requested_num_pages: u32) -> Result<(), fidl::Error> {
self.client.send::<BalloonControllerRequestNumPagesRequest>(
(requested_num_pages,),
0x55c444d65e1df1e8,
fidl::encoding::DynamicFlags::empty(),
)
}
type GetMemStatsResponseFut = fidl::client::QueryResponseFut<
(i32, Option<Vec<MemStat>>),
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#get_mem_stats(&self) -> Self::GetMemStatsResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<(i32, Option<Vec<MemStat>>), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
BalloonControllerGetMemStatsResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x676199795cc01142,
>(_buf?)?;
Ok((_response.status, _response.mem_stats))
}
self.client
.send_query_and_decode::<fidl::encoding::EmptyPayload, (i32, Option<Vec<MemStat>>)>(
(),
0x676199795cc01142,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct BalloonControllerEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for BalloonControllerEventStream {}
impl futures::stream::FusedStream for BalloonControllerEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for BalloonControllerEventStream {
type Item = Result<BalloonControllerEvent, 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(BalloonControllerEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum BalloonControllerEvent {}
impl BalloonControllerEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<BalloonControllerEvent, 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:
<BalloonControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct BalloonControllerRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for BalloonControllerRequestStream {}
impl futures::stream::FusedStream for BalloonControllerRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for BalloonControllerRequestStream {
type Protocol = BalloonControllerMarker;
type ControlHandle = BalloonControllerControlHandle;
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 {
BalloonControllerControlHandle { inner: self.inner.clone() }
}
fn into_inner(
self,
) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
{
(self.inner, self.is_terminated)
}
fn from_inner(
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for BalloonControllerRequestStream {
type Item = Result<BalloonControllerRequest, 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 BalloonControllerRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
e.into(),
))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x2bb2ebaa6ff64d0b => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
BalloonControllerControlHandle { inner: this.inner.clone() };
Ok(BalloonControllerRequest::GetBalloonSize {
responder: BalloonControllerGetBalloonSizeResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x55c444d65e1df1e8 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
BalloonControllerRequestNumPagesRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<BalloonControllerRequestNumPagesRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
BalloonControllerControlHandle { inner: this.inner.clone() };
Ok(BalloonControllerRequest::RequestNumPages {
requested_num_pages: req.requested_num_pages,
control_handle,
})
}
0x676199795cc01142 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
BalloonControllerControlHandle { inner: this.inner.clone() };
Ok(BalloonControllerRequest::GetMemStats {
responder: BalloonControllerGetMemStatsResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<BalloonControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum BalloonControllerRequest {
GetBalloonSize { responder: BalloonControllerGetBalloonSizeResponder },
RequestNumPages { requested_num_pages: u32, control_handle: BalloonControllerControlHandle },
GetMemStats { responder: BalloonControllerGetMemStatsResponder },
}
impl BalloonControllerRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_get_balloon_size(self) -> Option<(BalloonControllerGetBalloonSizeResponder)> {
if let BalloonControllerRequest::GetBalloonSize { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_request_num_pages(self) -> Option<(u32, BalloonControllerControlHandle)> {
if let BalloonControllerRequest::RequestNumPages { requested_num_pages, control_handle } =
self
{
Some((requested_num_pages, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_get_mem_stats(self) -> Option<(BalloonControllerGetMemStatsResponder)> {
if let BalloonControllerRequest::GetMemStats { responder } = self {
Some((responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
BalloonControllerRequest::GetBalloonSize { .. } => "get_balloon_size",
BalloonControllerRequest::RequestNumPages { .. } => "request_num_pages",
BalloonControllerRequest::GetMemStats { .. } => "get_mem_stats",
}
}
}
#[derive(Debug, Clone)]
pub struct BalloonControllerControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for BalloonControllerControlHandle {
fn shutdown(&self) {
self.inner.shutdown()
}
fn shutdown_with_epitaph(&self, status: zx_status::Status) {
self.inner.shutdown_with_epitaph(status)
}
fn is_closed(&self) -> bool {
self.inner.channel().is_closed()
}
fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
#[cfg(target_os = "fuchsia")]
fn signal_peer(
&self,
clear_mask: zx::Signals,
set_mask: zx::Signals,
) -> Result<(), zx_status::Status> {
use fidl::Peered;
self.inner.channel().signal_peer(clear_mask, set_mask)
}
}
impl BalloonControllerControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct BalloonControllerGetBalloonSizeResponder {
control_handle: std::mem::ManuallyDrop<BalloonControllerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for BalloonControllerGetBalloonSizeResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for BalloonControllerGetBalloonSizeResponder {
type ControlHandle = BalloonControllerControlHandle;
fn control_handle(&self) -> &BalloonControllerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl BalloonControllerGetBalloonSizeResponder {
pub fn send(
self,
mut current_num_pages: u32,
mut requested_num_pages: u32,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(current_num_pages, requested_num_pages);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut current_num_pages: u32,
mut requested_num_pages: u32,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(current_num_pages, requested_num_pages);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut current_num_pages: u32,
mut requested_num_pages: u32,
) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<BalloonControllerGetBalloonSizeResponse>(
(current_num_pages, requested_num_pages),
self.tx_id,
0x2bb2ebaa6ff64d0b,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct BalloonControllerGetMemStatsResponder {
control_handle: std::mem::ManuallyDrop<BalloonControllerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for BalloonControllerGetMemStatsResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for BalloonControllerGetMemStatsResponder {
type ControlHandle = BalloonControllerControlHandle;
fn control_handle(&self) -> &BalloonControllerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl BalloonControllerGetMemStatsResponder {
pub fn send(
self,
mut status: i32,
mut mem_stats: Option<&[MemStat]>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(status, mem_stats);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut status: i32,
mut mem_stats: Option<&[MemStat]>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(status, mem_stats);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut status: i32,
mut mem_stats: Option<&[MemStat]>,
) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<BalloonControllerGetMemStatsResponse>(
(status, mem_stats),
self.tx_id,
0x676199795cc01142,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct DebianGuestManagerMarker;
impl fidl::endpoints::ProtocolMarker for DebianGuestManagerMarker {
type Proxy = DebianGuestManagerProxy;
type RequestStream = DebianGuestManagerRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = DebianGuestManagerSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.virtualization.DebianGuestManager";
}
impl fidl::endpoints::DiscoverableProtocolMarker for DebianGuestManagerMarker {}
pub trait DebianGuestManagerProxyInterface: Send + Sync {
type LaunchResponseFut: std::future::Future<Output = Result<GuestManagerLaunchResult, fidl::Error>>
+ Send;
fn r#launch(
&self,
guest_config: GuestConfig,
controller: fidl::endpoints::ServerEnd<GuestMarker>,
) -> Self::LaunchResponseFut;
type ForceShutdownResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#force_shutdown(&self) -> Self::ForceShutdownResponseFut;
type ConnectResponseFut: std::future::Future<Output = Result<GuestManagerConnectResult, fidl::Error>>
+ Send;
fn r#connect(
&self,
controller: fidl::endpoints::ServerEnd<GuestMarker>,
) -> Self::ConnectResponseFut;
type GetInfoResponseFut: std::future::Future<Output = Result<GuestInfo, fidl::Error>> + Send;
fn r#get_info(&self) -> Self::GetInfoResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct DebianGuestManagerSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for DebianGuestManagerSynchronousProxy {
type Proxy = DebianGuestManagerProxy;
type Protocol = DebianGuestManagerMarker;
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 DebianGuestManagerSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name =
<DebianGuestManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
}
pub fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
pub fn wait_for_event(
&self,
deadline: zx::MonotonicInstant,
) -> Result<DebianGuestManagerEvent, fidl::Error> {
DebianGuestManagerEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#launch(
&self,
mut guest_config: GuestConfig,
mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
___deadline: zx::MonotonicInstant,
) -> Result<GuestManagerLaunchResult, fidl::Error> {
let _response =
self.client.send_query::<GuestManagerLaunchRequest, fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
GuestManagerError,
>>(
(&mut guest_config, controller),
0x394a2e29f750323e,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#force_shutdown(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
let _response =
self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::EmptyPayload>(
(),
0x3ad9a012982f872d,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
pub fn r#connect(
&self,
mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
___deadline: zx::MonotonicInstant,
) -> Result<GuestManagerConnectResult, fidl::Error> {
let _response =
self.client.send_query::<GuestManagerConnectRequest, fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
GuestManagerError,
>>(
(controller,),
0x4e489076e3bb15b4,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#get_info(&self, ___deadline: zx::MonotonicInstant) -> Result<GuestInfo, fidl::Error> {
let _response =
self.client.send_query::<fidl::encoding::EmptyPayload, GuestManagerGetInfoResponse>(
(),
0x76892614aea695dc,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.guest_info)
}
}
#[derive(Debug, Clone)]
pub struct DebianGuestManagerProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for DebianGuestManagerProxy {
type Protocol = DebianGuestManagerMarker;
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 DebianGuestManagerProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name =
<DebianGuestManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> DebianGuestManagerEventStream {
DebianGuestManagerEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#launch(
&self,
mut guest_config: GuestConfig,
mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
) -> fidl::client::QueryResponseFut<
GuestManagerLaunchResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
DebianGuestManagerProxyInterface::r#launch(self, guest_config, controller)
}
pub fn r#force_shutdown(
&self,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
DebianGuestManagerProxyInterface::r#force_shutdown(self)
}
pub fn r#connect(
&self,
mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
) -> fidl::client::QueryResponseFut<
GuestManagerConnectResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
DebianGuestManagerProxyInterface::r#connect(self, controller)
}
pub fn r#get_info(
&self,
) -> fidl::client::QueryResponseFut<GuestInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
{
DebianGuestManagerProxyInterface::r#get_info(self)
}
}
impl DebianGuestManagerProxyInterface for DebianGuestManagerProxy {
type LaunchResponseFut = fidl::client::QueryResponseFut<
GuestManagerLaunchResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#launch(
&self,
mut guest_config: GuestConfig,
mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
) -> Self::LaunchResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<GuestManagerLaunchResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GuestManagerError>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x394a2e29f750323e,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<GuestManagerLaunchRequest, GuestManagerLaunchResult>(
(&mut guest_config, controller),
0x394a2e29f750323e,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type ForceShutdownResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#force_shutdown(&self) -> Self::ForceShutdownResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<(), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x3ad9a012982f872d,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
(),
0x3ad9a012982f872d,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type ConnectResponseFut = fidl::client::QueryResponseFut<
GuestManagerConnectResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#connect(
&self,
mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
) -> Self::ConnectResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<GuestManagerConnectResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GuestManagerError>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x4e489076e3bb15b4,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<GuestManagerConnectRequest, GuestManagerConnectResult>(
(controller,),
0x4e489076e3bb15b4,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type GetInfoResponseFut =
fidl::client::QueryResponseFut<GuestInfo, fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#get_info(&self) -> Self::GetInfoResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<GuestInfo, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
GuestManagerGetInfoResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x76892614aea695dc,
>(_buf?)?;
Ok(_response.guest_info)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, GuestInfo>(
(),
0x76892614aea695dc,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct DebianGuestManagerEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for DebianGuestManagerEventStream {}
impl futures::stream::FusedStream for DebianGuestManagerEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for DebianGuestManagerEventStream {
type Item = Result<DebianGuestManagerEvent, 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(DebianGuestManagerEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum DebianGuestManagerEvent {}
impl DebianGuestManagerEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<DebianGuestManagerEvent, 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:
<DebianGuestManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct DebianGuestManagerRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for DebianGuestManagerRequestStream {}
impl futures::stream::FusedStream for DebianGuestManagerRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for DebianGuestManagerRequestStream {
type Protocol = DebianGuestManagerMarker;
type ControlHandle = DebianGuestManagerControlHandle;
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 {
DebianGuestManagerControlHandle { inner: self.inner.clone() }
}
fn into_inner(
self,
) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
{
(self.inner, self.is_terminated)
}
fn from_inner(
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for DebianGuestManagerRequestStream {
type Item = Result<DebianGuestManagerRequest, 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 DebianGuestManagerRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
e.into(),
))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x394a2e29f750323e => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(GuestManagerLaunchRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<GuestManagerLaunchRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = DebianGuestManagerControlHandle {
inner: this.inner.clone(),
};
Ok(DebianGuestManagerRequest::Launch {guest_config: req.guest_config,
controller: req.controller,
responder: DebianGuestManagerLaunchResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x3ad9a012982f872d => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle = DebianGuestManagerControlHandle {
inner: this.inner.clone(),
};
Ok(DebianGuestManagerRequest::ForceShutdown {
responder: DebianGuestManagerForceShutdownResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x4e489076e3bb15b4 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(GuestManagerConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<GuestManagerConnectRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = DebianGuestManagerControlHandle {
inner: this.inner.clone(),
};
Ok(DebianGuestManagerRequest::Connect {controller: req.controller,
responder: DebianGuestManagerConnectResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x76892614aea695dc => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle = DebianGuestManagerControlHandle {
inner: this.inner.clone(),
};
Ok(DebianGuestManagerRequest::GetInfo {
responder: DebianGuestManagerGetInfoResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <DebianGuestManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum DebianGuestManagerRequest {
Launch {
guest_config: GuestConfig,
controller: fidl::endpoints::ServerEnd<GuestMarker>,
responder: DebianGuestManagerLaunchResponder,
},
ForceShutdown { responder: DebianGuestManagerForceShutdownResponder },
Connect {
controller: fidl::endpoints::ServerEnd<GuestMarker>,
responder: DebianGuestManagerConnectResponder,
},
GetInfo { responder: DebianGuestManagerGetInfoResponder },
}
impl DebianGuestManagerRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_launch(
self,
) -> Option<(
GuestConfig,
fidl::endpoints::ServerEnd<GuestMarker>,
DebianGuestManagerLaunchResponder,
)> {
if let DebianGuestManagerRequest::Launch { guest_config, controller, responder } = self {
Some((guest_config, controller, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_force_shutdown(self) -> Option<(DebianGuestManagerForceShutdownResponder)> {
if let DebianGuestManagerRequest::ForceShutdown { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_connect(
self,
) -> Option<(fidl::endpoints::ServerEnd<GuestMarker>, DebianGuestManagerConnectResponder)> {
if let DebianGuestManagerRequest::Connect { controller, responder } = self {
Some((controller, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_get_info(self) -> Option<(DebianGuestManagerGetInfoResponder)> {
if let DebianGuestManagerRequest::GetInfo { responder } = self {
Some((responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
DebianGuestManagerRequest::Launch { .. } => "launch",
DebianGuestManagerRequest::ForceShutdown { .. } => "force_shutdown",
DebianGuestManagerRequest::Connect { .. } => "connect",
DebianGuestManagerRequest::GetInfo { .. } => "get_info",
}
}
}
#[derive(Debug, Clone)]
pub struct DebianGuestManagerControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for DebianGuestManagerControlHandle {
fn shutdown(&self) {
self.inner.shutdown()
}
fn shutdown_with_epitaph(&self, status: zx_status::Status) {
self.inner.shutdown_with_epitaph(status)
}
fn is_closed(&self) -> bool {
self.inner.channel().is_closed()
}
fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
#[cfg(target_os = "fuchsia")]
fn signal_peer(
&self,
clear_mask: zx::Signals,
set_mask: zx::Signals,
) -> Result<(), zx_status::Status> {
use fidl::Peered;
self.inner.channel().signal_peer(clear_mask, set_mask)
}
}
impl DebianGuestManagerControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct DebianGuestManagerLaunchResponder {
control_handle: std::mem::ManuallyDrop<DebianGuestManagerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for DebianGuestManagerLaunchResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for DebianGuestManagerLaunchResponder {
type ControlHandle = DebianGuestManagerControlHandle;
fn control_handle(&self) -> &DebianGuestManagerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl DebianGuestManagerLaunchResponder {
pub fn send(self, mut result: Result<(), GuestManagerError>) -> 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<(), GuestManagerError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), GuestManagerError>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
GuestManagerError,
>>(
result,
self.tx_id,
0x394a2e29f750323e,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct DebianGuestManagerForceShutdownResponder {
control_handle: std::mem::ManuallyDrop<DebianGuestManagerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for DebianGuestManagerForceShutdownResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for DebianGuestManagerForceShutdownResponder {
type ControlHandle = DebianGuestManagerControlHandle;
fn control_handle(&self) -> &DebianGuestManagerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl DebianGuestManagerForceShutdownResponder {
pub fn send(self) -> Result<(), fidl::Error> {
let _result = self.send_raw();
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
let _result = self.send_raw();
self.drop_without_shutdown();
_result
}
fn send_raw(&self) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
(),
self.tx_id,
0x3ad9a012982f872d,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct DebianGuestManagerConnectResponder {
control_handle: std::mem::ManuallyDrop<DebianGuestManagerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for DebianGuestManagerConnectResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for DebianGuestManagerConnectResponder {
type ControlHandle = DebianGuestManagerControlHandle;
fn control_handle(&self) -> &DebianGuestManagerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl DebianGuestManagerConnectResponder {
pub fn send(self, mut result: Result<(), GuestManagerError>) -> 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<(), GuestManagerError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), GuestManagerError>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
GuestManagerError,
>>(
result,
self.tx_id,
0x4e489076e3bb15b4,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct DebianGuestManagerGetInfoResponder {
control_handle: std::mem::ManuallyDrop<DebianGuestManagerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for DebianGuestManagerGetInfoResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for DebianGuestManagerGetInfoResponder {
type ControlHandle = DebianGuestManagerControlHandle;
fn control_handle(&self) -> &DebianGuestManagerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl DebianGuestManagerGetInfoResponder {
pub fn send(self, mut guest_info: &GuestInfo) -> Result<(), fidl::Error> {
let _result = self.send_raw(guest_info);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut guest_info: &GuestInfo) -> Result<(), fidl::Error> {
let _result = self.send_raw(guest_info);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut guest_info: &GuestInfo) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<GuestManagerGetInfoResponse>(
(guest_info,),
self.tx_id,
0x76892614aea695dc,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct GuestMarker;
impl fidl::endpoints::ProtocolMarker for GuestMarker {
type Proxy = GuestProxy;
type RequestStream = GuestRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = GuestSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.virtualization.Guest";
}
impl fidl::endpoints::DiscoverableProtocolMarker for GuestMarker {}
pub type GuestGetConsoleResult = Result<fidl::Socket, GuestError>;
pub type GuestGetHostVsockEndpointResult = Result<(), GuestError>;
pub type GuestGetBalloonControllerResult = Result<(), GuestError>;
pub type GuestGetMemControllerResult = Result<(), GuestError>;
pub trait GuestProxyInterface: Send + Sync {
type GetConsoleResponseFut: std::future::Future<Output = Result<GuestGetConsoleResult, fidl::Error>>
+ Send;
fn r#get_console(&self) -> Self::GetConsoleResponseFut;
type GetSerialResponseFut: std::future::Future<Output = Result<fidl::Socket, fidl::Error>>
+ Send;
fn r#get_serial(&self) -> Self::GetSerialResponseFut;
type GetHostVsockEndpointResponseFut: std::future::Future<Output = Result<GuestGetHostVsockEndpointResult, fidl::Error>>
+ Send;
fn r#get_host_vsock_endpoint(
&self,
endpoint: fidl::endpoints::ServerEnd<HostVsockEndpointMarker>,
) -> Self::GetHostVsockEndpointResponseFut;
type GetBalloonControllerResponseFut: std::future::Future<Output = Result<GuestGetBalloonControllerResult, fidl::Error>>
+ Send;
fn r#get_balloon_controller(
&self,
controller: fidl::endpoints::ServerEnd<BalloonControllerMarker>,
) -> Self::GetBalloonControllerResponseFut;
type GetMemControllerResponseFut: std::future::Future<Output = Result<GuestGetMemControllerResult, fidl::Error>>
+ Send;
fn r#get_mem_controller(
&self,
controller: fidl::endpoints::ServerEnd<MemControllerMarker>,
) -> Self::GetMemControllerResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct GuestSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for GuestSynchronousProxy {
type Proxy = GuestProxy;
type Protocol = GuestMarker;
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 GuestSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <GuestMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
}
pub fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
pub fn wait_for_event(
&self,
deadline: zx::MonotonicInstant,
) -> Result<GuestEvent, fidl::Error> {
GuestEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#get_console(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<GuestGetConsoleResult, fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
fidl::encoding::ResultType<GuestGetConsoleResponse, GuestError>,
>(
(),
0x48cbcecb7793806e,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x.socket))
}
pub fn r#get_serial(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<fidl::Socket, fidl::Error> {
let _response =
self.client.send_query::<fidl::encoding::EmptyPayload, GuestGetSerialResponse>(
(),
0xcdd541a160d7044,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.socket)
}
pub fn r#get_host_vsock_endpoint(
&self,
mut endpoint: fidl::endpoints::ServerEnd<HostVsockEndpointMarker>,
___deadline: zx::MonotonicInstant,
) -> Result<GuestGetHostVsockEndpointResult, fidl::Error> {
let _response = self.client.send_query::<
GuestGetHostVsockEndpointRequest,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GuestError>,
>(
(endpoint,),
0x766e96aeb9c28ed1,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#get_balloon_controller(
&self,
mut controller: fidl::endpoints::ServerEnd<BalloonControllerMarker>,
___deadline: zx::MonotonicInstant,
) -> Result<GuestGetBalloonControllerResult, fidl::Error> {
let _response = self.client.send_query::<
GuestGetBalloonControllerRequest,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GuestError>,
>(
(controller,),
0x7b210bff219ac84e,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#get_mem_controller(
&self,
mut controller: fidl::endpoints::ServerEnd<MemControllerMarker>,
___deadline: zx::MonotonicInstant,
) -> Result<GuestGetMemControllerResult, fidl::Error> {
let _response = self.client.send_query::<
GuestGetMemControllerRequest,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GuestError>,
>(
(controller,),
0x170b19f4b867a01c,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
}
#[derive(Debug, Clone)]
pub struct GuestProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for GuestProxy {
type Protocol = GuestMarker;
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 GuestProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <GuestMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> GuestEventStream {
GuestEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#get_console(
&self,
) -> fidl::client::QueryResponseFut<
GuestGetConsoleResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
GuestProxyInterface::r#get_console(self)
}
pub fn r#get_serial(
&self,
) -> fidl::client::QueryResponseFut<fidl::Socket, fidl::encoding::DefaultFuchsiaResourceDialect>
{
GuestProxyInterface::r#get_serial(self)
}
pub fn r#get_host_vsock_endpoint(
&self,
mut endpoint: fidl::endpoints::ServerEnd<HostVsockEndpointMarker>,
) -> fidl::client::QueryResponseFut<
GuestGetHostVsockEndpointResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
GuestProxyInterface::r#get_host_vsock_endpoint(self, endpoint)
}
pub fn r#get_balloon_controller(
&self,
mut controller: fidl::endpoints::ServerEnd<BalloonControllerMarker>,
) -> fidl::client::QueryResponseFut<
GuestGetBalloonControllerResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
GuestProxyInterface::r#get_balloon_controller(self, controller)
}
pub fn r#get_mem_controller(
&self,
mut controller: fidl::endpoints::ServerEnd<MemControllerMarker>,
) -> fidl::client::QueryResponseFut<
GuestGetMemControllerResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
GuestProxyInterface::r#get_mem_controller(self, controller)
}
}
impl GuestProxyInterface for GuestProxy {
type GetConsoleResponseFut = fidl::client::QueryResponseFut<
GuestGetConsoleResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#get_console(&self) -> Self::GetConsoleResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<GuestGetConsoleResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<GuestGetConsoleResponse, GuestError>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x48cbcecb7793806e,
>(_buf?)?;
Ok(_response.map(|x| x.socket))
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, GuestGetConsoleResult>(
(),
0x48cbcecb7793806e,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type GetSerialResponseFut =
fidl::client::QueryResponseFut<fidl::Socket, fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#get_serial(&self) -> Self::GetSerialResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<fidl::Socket, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
GuestGetSerialResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0xcdd541a160d7044,
>(_buf?)?;
Ok(_response.socket)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Socket>(
(),
0xcdd541a160d7044,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type GetHostVsockEndpointResponseFut = fidl::client::QueryResponseFut<
GuestGetHostVsockEndpointResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#get_host_vsock_endpoint(
&self,
mut endpoint: fidl::endpoints::ServerEnd<HostVsockEndpointMarker>,
) -> Self::GetHostVsockEndpointResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<GuestGetHostVsockEndpointResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GuestError>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x766e96aeb9c28ed1,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
GuestGetHostVsockEndpointRequest,
GuestGetHostVsockEndpointResult,
>(
(endpoint,),
0x766e96aeb9c28ed1,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type GetBalloonControllerResponseFut = fidl::client::QueryResponseFut<
GuestGetBalloonControllerResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#get_balloon_controller(
&self,
mut controller: fidl::endpoints::ServerEnd<BalloonControllerMarker>,
) -> Self::GetBalloonControllerResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<GuestGetBalloonControllerResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GuestError>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x7b210bff219ac84e,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
GuestGetBalloonControllerRequest,
GuestGetBalloonControllerResult,
>(
(controller,),
0x7b210bff219ac84e,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type GetMemControllerResponseFut = fidl::client::QueryResponseFut<
GuestGetMemControllerResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#get_mem_controller(
&self,
mut controller: fidl::endpoints::ServerEnd<MemControllerMarker>,
) -> Self::GetMemControllerResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<GuestGetMemControllerResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GuestError>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x170b19f4b867a01c,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client
.send_query_and_decode::<GuestGetMemControllerRequest, GuestGetMemControllerResult>(
(controller,),
0x170b19f4b867a01c,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct GuestEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for GuestEventStream {}
impl futures::stream::FusedStream for GuestEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for GuestEventStream {
type Item = Result<GuestEvent, 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(GuestEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum GuestEvent {}
impl GuestEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<GuestEvent, 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: <GuestMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct GuestRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for GuestRequestStream {}
impl futures::stream::FusedStream for GuestRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for GuestRequestStream {
type Protocol = GuestMarker;
type ControlHandle = GuestControlHandle;
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 {
GuestControlHandle { inner: self.inner.clone() }
}
fn into_inner(
self,
) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
{
(self.inner, self.is_terminated)
}
fn from_inner(
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for GuestRequestStream {
type Item = Result<GuestRequest, 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 GuestRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
e.into(),
))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x48cbcecb7793806e => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle = GuestControlHandle { inner: this.inner.clone() };
Ok(GuestRequest::GetConsole {
responder: GuestGetConsoleResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0xcdd541a160d7044 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle = GuestControlHandle { inner: this.inner.clone() };
Ok(GuestRequest::GetSerial {
responder: GuestGetSerialResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x766e96aeb9c28ed1 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
GuestGetHostVsockEndpointRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<GuestGetHostVsockEndpointRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = GuestControlHandle { inner: this.inner.clone() };
Ok(GuestRequest::GetHostVsockEndpoint {
endpoint: req.endpoint,
responder: GuestGetHostVsockEndpointResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x7b210bff219ac84e => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
GuestGetBalloonControllerRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<GuestGetBalloonControllerRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = GuestControlHandle { inner: this.inner.clone() };
Ok(GuestRequest::GetBalloonController {
controller: req.controller,
responder: GuestGetBalloonControllerResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x170b19f4b867a01c => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
GuestGetMemControllerRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<GuestGetMemControllerRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = GuestControlHandle { inner: this.inner.clone() };
Ok(GuestRequest::GetMemController {
controller: req.controller,
responder: GuestGetMemControllerResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <GuestMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum GuestRequest {
GetConsole { responder: GuestGetConsoleResponder },
GetSerial { responder: GuestGetSerialResponder },
GetHostVsockEndpoint {
endpoint: fidl::endpoints::ServerEnd<HostVsockEndpointMarker>,
responder: GuestGetHostVsockEndpointResponder,
},
GetBalloonController {
controller: fidl::endpoints::ServerEnd<BalloonControllerMarker>,
responder: GuestGetBalloonControllerResponder,
},
GetMemController {
controller: fidl::endpoints::ServerEnd<MemControllerMarker>,
responder: GuestGetMemControllerResponder,
},
}
impl GuestRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_get_console(self) -> Option<(GuestGetConsoleResponder)> {
if let GuestRequest::GetConsole { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_get_serial(self) -> Option<(GuestGetSerialResponder)> {
if let GuestRequest::GetSerial { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_get_host_vsock_endpoint(
self,
) -> Option<(
fidl::endpoints::ServerEnd<HostVsockEndpointMarker>,
GuestGetHostVsockEndpointResponder,
)> {
if let GuestRequest::GetHostVsockEndpoint { endpoint, responder } = self {
Some((endpoint, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_get_balloon_controller(
self,
) -> Option<(
fidl::endpoints::ServerEnd<BalloonControllerMarker>,
GuestGetBalloonControllerResponder,
)> {
if let GuestRequest::GetBalloonController { controller, responder } = self {
Some((controller, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_get_mem_controller(
self,
) -> Option<(fidl::endpoints::ServerEnd<MemControllerMarker>, GuestGetMemControllerResponder)>
{
if let GuestRequest::GetMemController { controller, responder } = self {
Some((controller, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
GuestRequest::GetConsole { .. } => "get_console",
GuestRequest::GetSerial { .. } => "get_serial",
GuestRequest::GetHostVsockEndpoint { .. } => "get_host_vsock_endpoint",
GuestRequest::GetBalloonController { .. } => "get_balloon_controller",
GuestRequest::GetMemController { .. } => "get_mem_controller",
}
}
}
#[derive(Debug, Clone)]
pub struct GuestControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for GuestControlHandle {
fn shutdown(&self) {
self.inner.shutdown()
}
fn shutdown_with_epitaph(&self, status: zx_status::Status) {
self.inner.shutdown_with_epitaph(status)
}
fn is_closed(&self) -> bool {
self.inner.channel().is_closed()
}
fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
#[cfg(target_os = "fuchsia")]
fn signal_peer(
&self,
clear_mask: zx::Signals,
set_mask: zx::Signals,
) -> Result<(), zx_status::Status> {
use fidl::Peered;
self.inner.channel().signal_peer(clear_mask, set_mask)
}
}
impl GuestControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct GuestGetConsoleResponder {
control_handle: std::mem::ManuallyDrop<GuestControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for GuestGetConsoleResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for GuestGetConsoleResponder {
type ControlHandle = GuestControlHandle;
fn control_handle(&self) -> &GuestControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl GuestGetConsoleResponder {
pub fn send(self, mut result: Result<fidl::Socket, GuestError>) -> 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::Socket, GuestError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<fidl::Socket, GuestError>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<GuestGetConsoleResponse, GuestError>>(
result.map(|socket| (socket,)),
self.tx_id,
0x48cbcecb7793806e,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct GuestGetSerialResponder {
control_handle: std::mem::ManuallyDrop<GuestControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for GuestGetSerialResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for GuestGetSerialResponder {
type ControlHandle = GuestControlHandle;
fn control_handle(&self) -> &GuestControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl GuestGetSerialResponder {
pub fn send(self, mut socket: fidl::Socket) -> Result<(), fidl::Error> {
let _result = self.send_raw(socket);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut socket: fidl::Socket) -> Result<(), fidl::Error> {
let _result = self.send_raw(socket);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut socket: fidl::Socket) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<GuestGetSerialResponse>(
(socket,),
self.tx_id,
0xcdd541a160d7044,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct GuestGetHostVsockEndpointResponder {
control_handle: std::mem::ManuallyDrop<GuestControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for GuestGetHostVsockEndpointResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for GuestGetHostVsockEndpointResponder {
type ControlHandle = GuestControlHandle;
fn control_handle(&self) -> &GuestControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl GuestGetHostVsockEndpointResponder {
pub fn send(self, mut result: Result<(), GuestError>) -> 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<(), GuestError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), GuestError>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GuestError>>(
result,
self.tx_id,
0x766e96aeb9c28ed1,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct GuestGetBalloonControllerResponder {
control_handle: std::mem::ManuallyDrop<GuestControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for GuestGetBalloonControllerResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for GuestGetBalloonControllerResponder {
type ControlHandle = GuestControlHandle;
fn control_handle(&self) -> &GuestControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl GuestGetBalloonControllerResponder {
pub fn send(self, mut result: Result<(), GuestError>) -> 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<(), GuestError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), GuestError>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GuestError>>(
result,
self.tx_id,
0x7b210bff219ac84e,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct GuestGetMemControllerResponder {
control_handle: std::mem::ManuallyDrop<GuestControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for GuestGetMemControllerResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for GuestGetMemControllerResponder {
type ControlHandle = GuestControlHandle;
fn control_handle(&self) -> &GuestControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl GuestGetMemControllerResponder {
pub fn send(self, mut result: Result<(), GuestError>) -> 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<(), GuestError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), GuestError>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GuestError>>(
result,
self.tx_id,
0x170b19f4b867a01c,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct GuestLifecycleMarker;
impl fidl::endpoints::ProtocolMarker for GuestLifecycleMarker {
type Proxy = GuestLifecycleProxy;
type RequestStream = GuestLifecycleRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = GuestLifecycleSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.virtualization.GuestLifecycle";
}
impl fidl::endpoints::DiscoverableProtocolMarker for GuestLifecycleMarker {}
pub type GuestLifecycleCreateResult = Result<(), GuestError>;
pub type GuestLifecycleRunResult = Result<(), GuestError>;
pub trait GuestLifecycleProxyInterface: Send + Sync {
type CreateResponseFut: std::future::Future<Output = Result<GuestLifecycleCreateResult, fidl::Error>>
+ Send;
fn r#create(&self, guest_config: GuestConfig) -> Self::CreateResponseFut;
fn r#bind(&self, guest: fidl::endpoints::ServerEnd<GuestMarker>) -> Result<(), fidl::Error>;
type RunResponseFut: std::future::Future<Output = Result<GuestLifecycleRunResult, fidl::Error>>
+ Send;
fn r#run(&self) -> Self::RunResponseFut;
type StopResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#stop(&self) -> Self::StopResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct GuestLifecycleSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for GuestLifecycleSynchronousProxy {
type Proxy = GuestLifecycleProxy;
type Protocol = GuestLifecycleMarker;
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 GuestLifecycleSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <GuestLifecycleMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
}
pub fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
pub fn wait_for_event(
&self,
deadline: zx::MonotonicInstant,
) -> Result<GuestLifecycleEvent, fidl::Error> {
GuestLifecycleEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#create(
&self,
mut guest_config: GuestConfig,
___deadline: zx::MonotonicInstant,
) -> Result<GuestLifecycleCreateResult, fidl::Error> {
let _response = self.client.send_query::<
GuestLifecycleCreateRequest,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GuestError>,
>(
(&mut guest_config,),
0x152719eed416ed41,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#bind(
&self,
mut guest: fidl::endpoints::ServerEnd<GuestMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<GuestLifecycleBindRequest>(
(guest,),
0x57dd3e245f9598ed,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#run(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<GuestLifecycleRunResult, fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GuestError>,
>(
(),
0x2907fef2ac775657,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#stop(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
let _response =
self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::EmptyPayload>(
(),
0x27eef9c535ac8eb4,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
}
#[derive(Debug, Clone)]
pub struct GuestLifecycleProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for GuestLifecycleProxy {
type Protocol = GuestLifecycleMarker;
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 GuestLifecycleProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <GuestLifecycleMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> GuestLifecycleEventStream {
GuestLifecycleEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#create(
&self,
mut guest_config: GuestConfig,
) -> fidl::client::QueryResponseFut<
GuestLifecycleCreateResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
GuestLifecycleProxyInterface::r#create(self, guest_config)
}
pub fn r#bind(
&self,
mut guest: fidl::endpoints::ServerEnd<GuestMarker>,
) -> Result<(), fidl::Error> {
GuestLifecycleProxyInterface::r#bind(self, guest)
}
pub fn r#run(
&self,
) -> fidl::client::QueryResponseFut<
GuestLifecycleRunResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
GuestLifecycleProxyInterface::r#run(self)
}
pub fn r#stop(
&self,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
GuestLifecycleProxyInterface::r#stop(self)
}
}
impl GuestLifecycleProxyInterface for GuestLifecycleProxy {
type CreateResponseFut = fidl::client::QueryResponseFut<
GuestLifecycleCreateResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#create(&self, mut guest_config: GuestConfig) -> Self::CreateResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<GuestLifecycleCreateResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GuestError>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x152719eed416ed41,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client
.send_query_and_decode::<GuestLifecycleCreateRequest, GuestLifecycleCreateResult>(
(&mut guest_config,),
0x152719eed416ed41,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
fn r#bind(
&self,
mut guest: fidl::endpoints::ServerEnd<GuestMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<GuestLifecycleBindRequest>(
(guest,),
0x57dd3e245f9598ed,
fidl::encoding::DynamicFlags::empty(),
)
}
type RunResponseFut = fidl::client::QueryResponseFut<
GuestLifecycleRunResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#run(&self) -> Self::RunResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<GuestLifecycleRunResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GuestError>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x2907fef2ac775657,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, GuestLifecycleRunResult>(
(),
0x2907fef2ac775657,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type StopResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#stop(&self) -> Self::StopResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<(), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x27eef9c535ac8eb4,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
(),
0x27eef9c535ac8eb4,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct GuestLifecycleEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for GuestLifecycleEventStream {}
impl futures::stream::FusedStream for GuestLifecycleEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for GuestLifecycleEventStream {
type Item = Result<GuestLifecycleEvent, 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(GuestLifecycleEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum GuestLifecycleEvent {}
impl GuestLifecycleEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<GuestLifecycleEvent, 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:
<GuestLifecycleMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct GuestLifecycleRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for GuestLifecycleRequestStream {}
impl futures::stream::FusedStream for GuestLifecycleRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for GuestLifecycleRequestStream {
type Protocol = GuestLifecycleMarker;
type ControlHandle = GuestLifecycleControlHandle;
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 {
GuestLifecycleControlHandle { inner: self.inner.clone() }
}
fn into_inner(
self,
) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
{
(self.inner, self.is_terminated)
}
fn from_inner(
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for GuestLifecycleRequestStream {
type Item = Result<GuestLifecycleRequest, 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 GuestLifecycleRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
e.into(),
))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x152719eed416ed41 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
GuestLifecycleCreateRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<GuestLifecycleCreateRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
GuestLifecycleControlHandle { inner: this.inner.clone() };
Ok(GuestLifecycleRequest::Create {
guest_config: req.guest_config,
responder: GuestLifecycleCreateResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x57dd3e245f9598ed => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
GuestLifecycleBindRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<GuestLifecycleBindRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
GuestLifecycleControlHandle { inner: this.inner.clone() };
Ok(GuestLifecycleRequest::Bind { guest: req.guest, control_handle })
}
0x2907fef2ac775657 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
GuestLifecycleControlHandle { inner: this.inner.clone() };
Ok(GuestLifecycleRequest::Run {
responder: GuestLifecycleRunResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x27eef9c535ac8eb4 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
GuestLifecycleControlHandle { inner: this.inner.clone() };
Ok(GuestLifecycleRequest::Stop {
responder: GuestLifecycleStopResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<GuestLifecycleMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum GuestLifecycleRequest {
Create { guest_config: GuestConfig, responder: GuestLifecycleCreateResponder },
Bind {
guest: fidl::endpoints::ServerEnd<GuestMarker>,
control_handle: GuestLifecycleControlHandle,
},
Run { responder: GuestLifecycleRunResponder },
Stop { responder: GuestLifecycleStopResponder },
}
impl GuestLifecycleRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_create(self) -> Option<(GuestConfig, GuestLifecycleCreateResponder)> {
if let GuestLifecycleRequest::Create { guest_config, responder } = self {
Some((guest_config, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_bind(
self,
) -> Option<(fidl::endpoints::ServerEnd<GuestMarker>, GuestLifecycleControlHandle)> {
if let GuestLifecycleRequest::Bind { guest, control_handle } = self {
Some((guest, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_run(self) -> Option<(GuestLifecycleRunResponder)> {
if let GuestLifecycleRequest::Run { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_stop(self) -> Option<(GuestLifecycleStopResponder)> {
if let GuestLifecycleRequest::Stop { responder } = self {
Some((responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
GuestLifecycleRequest::Create { .. } => "create",
GuestLifecycleRequest::Bind { .. } => "bind",
GuestLifecycleRequest::Run { .. } => "run",
GuestLifecycleRequest::Stop { .. } => "stop",
}
}
}
#[derive(Debug, Clone)]
pub struct GuestLifecycleControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for GuestLifecycleControlHandle {
fn shutdown(&self) {
self.inner.shutdown()
}
fn shutdown_with_epitaph(&self, status: zx_status::Status) {
self.inner.shutdown_with_epitaph(status)
}
fn is_closed(&self) -> bool {
self.inner.channel().is_closed()
}
fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
#[cfg(target_os = "fuchsia")]
fn signal_peer(
&self,
clear_mask: zx::Signals,
set_mask: zx::Signals,
) -> Result<(), zx_status::Status> {
use fidl::Peered;
self.inner.channel().signal_peer(clear_mask, set_mask)
}
}
impl GuestLifecycleControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct GuestLifecycleCreateResponder {
control_handle: std::mem::ManuallyDrop<GuestLifecycleControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for GuestLifecycleCreateResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for GuestLifecycleCreateResponder {
type ControlHandle = GuestLifecycleControlHandle;
fn control_handle(&self) -> &GuestLifecycleControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl GuestLifecycleCreateResponder {
pub fn send(self, mut result: Result<(), GuestError>) -> 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<(), GuestError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), GuestError>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GuestError>>(
result,
self.tx_id,
0x152719eed416ed41,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct GuestLifecycleRunResponder {
control_handle: std::mem::ManuallyDrop<GuestLifecycleControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for GuestLifecycleRunResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for GuestLifecycleRunResponder {
type ControlHandle = GuestLifecycleControlHandle;
fn control_handle(&self) -> &GuestLifecycleControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl GuestLifecycleRunResponder {
pub fn send(self, mut result: Result<(), GuestError>) -> 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<(), GuestError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), GuestError>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GuestError>>(
result,
self.tx_id,
0x2907fef2ac775657,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct GuestLifecycleStopResponder {
control_handle: std::mem::ManuallyDrop<GuestLifecycleControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for GuestLifecycleStopResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for GuestLifecycleStopResponder {
type ControlHandle = GuestLifecycleControlHandle;
fn control_handle(&self) -> &GuestLifecycleControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl GuestLifecycleStopResponder {
pub fn send(self) -> Result<(), fidl::Error> {
let _result = self.send_raw();
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
let _result = self.send_raw();
self.drop_without_shutdown();
_result
}
fn send_raw(&self) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
(),
self.tx_id,
0x27eef9c535ac8eb4,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct GuestManagerMarker;
impl fidl::endpoints::ProtocolMarker for GuestManagerMarker {
type Proxy = GuestManagerProxy;
type RequestStream = GuestManagerRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = GuestManagerSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.virtualization.GuestManager";
}
impl fidl::endpoints::DiscoverableProtocolMarker for GuestManagerMarker {}
pub type GuestManagerLaunchResult = Result<(), GuestManagerError>;
pub type GuestManagerConnectResult = Result<(), GuestManagerError>;
pub trait GuestManagerProxyInterface: Send + Sync {
type LaunchResponseFut: std::future::Future<Output = Result<GuestManagerLaunchResult, fidl::Error>>
+ Send;
fn r#launch(
&self,
guest_config: GuestConfig,
controller: fidl::endpoints::ServerEnd<GuestMarker>,
) -> Self::LaunchResponseFut;
type ForceShutdownResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#force_shutdown(&self) -> Self::ForceShutdownResponseFut;
type ConnectResponseFut: std::future::Future<Output = Result<GuestManagerConnectResult, fidl::Error>>
+ Send;
fn r#connect(
&self,
controller: fidl::endpoints::ServerEnd<GuestMarker>,
) -> Self::ConnectResponseFut;
type GetInfoResponseFut: std::future::Future<Output = Result<GuestInfo, fidl::Error>> + Send;
fn r#get_info(&self) -> Self::GetInfoResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct GuestManagerSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for GuestManagerSynchronousProxy {
type Proxy = GuestManagerProxy;
type Protocol = GuestManagerMarker;
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 GuestManagerSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <GuestManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
}
pub fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
pub fn wait_for_event(
&self,
deadline: zx::MonotonicInstant,
) -> Result<GuestManagerEvent, fidl::Error> {
GuestManagerEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#launch(
&self,
mut guest_config: GuestConfig,
mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
___deadline: zx::MonotonicInstant,
) -> Result<GuestManagerLaunchResult, fidl::Error> {
let _response =
self.client.send_query::<GuestManagerLaunchRequest, fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
GuestManagerError,
>>(
(&mut guest_config, controller),
0x394a2e29f750323e,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#force_shutdown(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
let _response =
self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::EmptyPayload>(
(),
0x3ad9a012982f872d,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
pub fn r#connect(
&self,
mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
___deadline: zx::MonotonicInstant,
) -> Result<GuestManagerConnectResult, fidl::Error> {
let _response =
self.client.send_query::<GuestManagerConnectRequest, fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
GuestManagerError,
>>(
(controller,),
0x4e489076e3bb15b4,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#get_info(&self, ___deadline: zx::MonotonicInstant) -> Result<GuestInfo, fidl::Error> {
let _response =
self.client.send_query::<fidl::encoding::EmptyPayload, GuestManagerGetInfoResponse>(
(),
0x76892614aea695dc,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.guest_info)
}
}
#[derive(Debug, Clone)]
pub struct GuestManagerProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for GuestManagerProxy {
type Protocol = GuestManagerMarker;
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 GuestManagerProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <GuestManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> GuestManagerEventStream {
GuestManagerEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#launch(
&self,
mut guest_config: GuestConfig,
mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
) -> fidl::client::QueryResponseFut<
GuestManagerLaunchResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
GuestManagerProxyInterface::r#launch(self, guest_config, controller)
}
pub fn r#force_shutdown(
&self,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
GuestManagerProxyInterface::r#force_shutdown(self)
}
pub fn r#connect(
&self,
mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
) -> fidl::client::QueryResponseFut<
GuestManagerConnectResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
GuestManagerProxyInterface::r#connect(self, controller)
}
pub fn r#get_info(
&self,
) -> fidl::client::QueryResponseFut<GuestInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
{
GuestManagerProxyInterface::r#get_info(self)
}
}
impl GuestManagerProxyInterface for GuestManagerProxy {
type LaunchResponseFut = fidl::client::QueryResponseFut<
GuestManagerLaunchResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#launch(
&self,
mut guest_config: GuestConfig,
mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
) -> Self::LaunchResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<GuestManagerLaunchResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GuestManagerError>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x394a2e29f750323e,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<GuestManagerLaunchRequest, GuestManagerLaunchResult>(
(&mut guest_config, controller),
0x394a2e29f750323e,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type ForceShutdownResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#force_shutdown(&self) -> Self::ForceShutdownResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<(), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x3ad9a012982f872d,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
(),
0x3ad9a012982f872d,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type ConnectResponseFut = fidl::client::QueryResponseFut<
GuestManagerConnectResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#connect(
&self,
mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
) -> Self::ConnectResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<GuestManagerConnectResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GuestManagerError>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x4e489076e3bb15b4,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<GuestManagerConnectRequest, GuestManagerConnectResult>(
(controller,),
0x4e489076e3bb15b4,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type GetInfoResponseFut =
fidl::client::QueryResponseFut<GuestInfo, fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#get_info(&self) -> Self::GetInfoResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<GuestInfo, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
GuestManagerGetInfoResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x76892614aea695dc,
>(_buf?)?;
Ok(_response.guest_info)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, GuestInfo>(
(),
0x76892614aea695dc,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct GuestManagerEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for GuestManagerEventStream {}
impl futures::stream::FusedStream for GuestManagerEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for GuestManagerEventStream {
type Item = Result<GuestManagerEvent, 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(GuestManagerEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum GuestManagerEvent {}
impl GuestManagerEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<GuestManagerEvent, 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: <GuestManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct GuestManagerRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for GuestManagerRequestStream {}
impl futures::stream::FusedStream for GuestManagerRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for GuestManagerRequestStream {
type Protocol = GuestManagerMarker;
type ControlHandle = GuestManagerControlHandle;
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 {
GuestManagerControlHandle { inner: self.inner.clone() }
}
fn into_inner(
self,
) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
{
(self.inner, self.is_terminated)
}
fn from_inner(
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for GuestManagerRequestStream {
type Item = Result<GuestManagerRequest, 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 GuestManagerRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
e.into(),
))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x394a2e29f750323e => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
GuestManagerLaunchRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<GuestManagerLaunchRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
GuestManagerControlHandle { inner: this.inner.clone() };
Ok(GuestManagerRequest::Launch {
guest_config: req.guest_config,
controller: req.controller,
responder: GuestManagerLaunchResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x3ad9a012982f872d => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
GuestManagerControlHandle { inner: this.inner.clone() };
Ok(GuestManagerRequest::ForceShutdown {
responder: GuestManagerForceShutdownResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x4e489076e3bb15b4 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
GuestManagerConnectRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<GuestManagerConnectRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
GuestManagerControlHandle { inner: this.inner.clone() };
Ok(GuestManagerRequest::Connect {
controller: req.controller,
responder: GuestManagerConnectResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x76892614aea695dc => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
GuestManagerControlHandle { inner: this.inner.clone() };
Ok(GuestManagerRequest::GetInfo {
responder: GuestManagerGetInfoResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<GuestManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum GuestManagerRequest {
Launch {
guest_config: GuestConfig,
controller: fidl::endpoints::ServerEnd<GuestMarker>,
responder: GuestManagerLaunchResponder,
},
ForceShutdown { responder: GuestManagerForceShutdownResponder },
Connect {
controller: fidl::endpoints::ServerEnd<GuestMarker>,
responder: GuestManagerConnectResponder,
},
GetInfo { responder: GuestManagerGetInfoResponder },
}
impl GuestManagerRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_launch(
self,
) -> Option<(GuestConfig, fidl::endpoints::ServerEnd<GuestMarker>, GuestManagerLaunchResponder)>
{
if let GuestManagerRequest::Launch { guest_config, controller, responder } = self {
Some((guest_config, controller, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_force_shutdown(self) -> Option<(GuestManagerForceShutdownResponder)> {
if let GuestManagerRequest::ForceShutdown { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_connect(
self,
) -> Option<(fidl::endpoints::ServerEnd<GuestMarker>, GuestManagerConnectResponder)> {
if let GuestManagerRequest::Connect { controller, responder } = self {
Some((controller, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_get_info(self) -> Option<(GuestManagerGetInfoResponder)> {
if let GuestManagerRequest::GetInfo { responder } = self {
Some((responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
GuestManagerRequest::Launch { .. } => "launch",
GuestManagerRequest::ForceShutdown { .. } => "force_shutdown",
GuestManagerRequest::Connect { .. } => "connect",
GuestManagerRequest::GetInfo { .. } => "get_info",
}
}
}
#[derive(Debug, Clone)]
pub struct GuestManagerControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for GuestManagerControlHandle {
fn shutdown(&self) {
self.inner.shutdown()
}
fn shutdown_with_epitaph(&self, status: zx_status::Status) {
self.inner.shutdown_with_epitaph(status)
}
fn is_closed(&self) -> bool {
self.inner.channel().is_closed()
}
fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
#[cfg(target_os = "fuchsia")]
fn signal_peer(
&self,
clear_mask: zx::Signals,
set_mask: zx::Signals,
) -> Result<(), zx_status::Status> {
use fidl::Peered;
self.inner.channel().signal_peer(clear_mask, set_mask)
}
}
impl GuestManagerControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct GuestManagerLaunchResponder {
control_handle: std::mem::ManuallyDrop<GuestManagerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for GuestManagerLaunchResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for GuestManagerLaunchResponder {
type ControlHandle = GuestManagerControlHandle;
fn control_handle(&self) -> &GuestManagerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl GuestManagerLaunchResponder {
pub fn send(self, mut result: Result<(), GuestManagerError>) -> 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<(), GuestManagerError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), GuestManagerError>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
GuestManagerError,
>>(
result,
self.tx_id,
0x394a2e29f750323e,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct GuestManagerForceShutdownResponder {
control_handle: std::mem::ManuallyDrop<GuestManagerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for GuestManagerForceShutdownResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for GuestManagerForceShutdownResponder {
type ControlHandle = GuestManagerControlHandle;
fn control_handle(&self) -> &GuestManagerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl GuestManagerForceShutdownResponder {
pub fn send(self) -> Result<(), fidl::Error> {
let _result = self.send_raw();
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
let _result = self.send_raw();
self.drop_without_shutdown();
_result
}
fn send_raw(&self) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
(),
self.tx_id,
0x3ad9a012982f872d,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct GuestManagerConnectResponder {
control_handle: std::mem::ManuallyDrop<GuestManagerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for GuestManagerConnectResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for GuestManagerConnectResponder {
type ControlHandle = GuestManagerControlHandle;
fn control_handle(&self) -> &GuestManagerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl GuestManagerConnectResponder {
pub fn send(self, mut result: Result<(), GuestManagerError>) -> 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<(), GuestManagerError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), GuestManagerError>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
GuestManagerError,
>>(
result,
self.tx_id,
0x4e489076e3bb15b4,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct GuestManagerGetInfoResponder {
control_handle: std::mem::ManuallyDrop<GuestManagerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for GuestManagerGetInfoResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for GuestManagerGetInfoResponder {
type ControlHandle = GuestManagerControlHandle;
fn control_handle(&self) -> &GuestManagerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl GuestManagerGetInfoResponder {
pub fn send(self, mut guest_info: &GuestInfo) -> Result<(), fidl::Error> {
let _result = self.send_raw(guest_info);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut guest_info: &GuestInfo) -> Result<(), fidl::Error> {
let _result = self.send_raw(guest_info);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut guest_info: &GuestInfo) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<GuestManagerGetInfoResponse>(
(guest_info,),
self.tx_id,
0x76892614aea695dc,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct HostVsockAcceptorMarker;
impl fidl::endpoints::ProtocolMarker for HostVsockAcceptorMarker {
type Proxy = HostVsockAcceptorProxy;
type RequestStream = HostVsockAcceptorRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = HostVsockAcceptorSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) HostVsockAcceptor";
}
pub type HostVsockAcceptorAcceptResult = Result<fidl::Socket, i32>;
pub trait HostVsockAcceptorProxyInterface: Send + Sync {
type AcceptResponseFut: std::future::Future<Output = Result<HostVsockAcceptorAcceptResult, fidl::Error>>
+ Send;
fn r#accept(&self, src_cid: u32, src_port: u32, port: u32) -> Self::AcceptResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct HostVsockAcceptorSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for HostVsockAcceptorSynchronousProxy {
type Proxy = HostVsockAcceptorProxy;
type Protocol = HostVsockAcceptorMarker;
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 HostVsockAcceptorSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name =
<HostVsockAcceptorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
}
pub fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
pub fn wait_for_event(
&self,
deadline: zx::MonotonicInstant,
) -> Result<HostVsockAcceptorEvent, fidl::Error> {
HostVsockAcceptorEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#accept(
&self,
mut src_cid: u32,
mut src_port: u32,
mut port: u32,
___deadline: zx::MonotonicInstant,
) -> Result<HostVsockAcceptorAcceptResult, fidl::Error> {
let _response = self.client.send_query::<
HostVsockAcceptorAcceptRequest,
fidl::encoding::ResultType<HostVsockAcceptorAcceptResponse, i32>,
>(
(src_cid, src_port, port,),
0x6996ed935beaa2d7,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x.socket))
}
}
#[derive(Debug, Clone)]
pub struct HostVsockAcceptorProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for HostVsockAcceptorProxy {
type Protocol = HostVsockAcceptorMarker;
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 HostVsockAcceptorProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name =
<HostVsockAcceptorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> HostVsockAcceptorEventStream {
HostVsockAcceptorEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#accept(
&self,
mut src_cid: u32,
mut src_port: u32,
mut port: u32,
) -> fidl::client::QueryResponseFut<
HostVsockAcceptorAcceptResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
HostVsockAcceptorProxyInterface::r#accept(self, src_cid, src_port, port)
}
}
impl HostVsockAcceptorProxyInterface for HostVsockAcceptorProxy {
type AcceptResponseFut = fidl::client::QueryResponseFut<
HostVsockAcceptorAcceptResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#accept(
&self,
mut src_cid: u32,
mut src_port: u32,
mut port: u32,
) -> Self::AcceptResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<HostVsockAcceptorAcceptResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<HostVsockAcceptorAcceptResponse, i32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x6996ed935beaa2d7,
>(_buf?)?;
Ok(_response.map(|x| x.socket))
}
self.client
.send_query_and_decode::<HostVsockAcceptorAcceptRequest, HostVsockAcceptorAcceptResult>(
(src_cid, src_port, port),
0x6996ed935beaa2d7,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct HostVsockAcceptorEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for HostVsockAcceptorEventStream {}
impl futures::stream::FusedStream for HostVsockAcceptorEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for HostVsockAcceptorEventStream {
type Item = Result<HostVsockAcceptorEvent, 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(HostVsockAcceptorEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum HostVsockAcceptorEvent {}
impl HostVsockAcceptorEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<HostVsockAcceptorEvent, 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:
<HostVsockAcceptorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct HostVsockAcceptorRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for HostVsockAcceptorRequestStream {}
impl futures::stream::FusedStream for HostVsockAcceptorRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for HostVsockAcceptorRequestStream {
type Protocol = HostVsockAcceptorMarker;
type ControlHandle = HostVsockAcceptorControlHandle;
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 {
HostVsockAcceptorControlHandle { inner: self.inner.clone() }
}
fn into_inner(
self,
) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
{
(self.inner, self.is_terminated)
}
fn from_inner(
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for HostVsockAcceptorRequestStream {
type Item = Result<HostVsockAcceptorRequest, 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 HostVsockAcceptorRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
e.into(),
))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x6996ed935beaa2d7 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
HostVsockAcceptorAcceptRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HostVsockAcceptorAcceptRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
HostVsockAcceptorControlHandle { inner: this.inner.clone() };
Ok(HostVsockAcceptorRequest::Accept {
src_cid: req.src_cid,
src_port: req.src_port,
port: req.port,
responder: HostVsockAcceptorAcceptResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<HostVsockAcceptorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum HostVsockAcceptorRequest {
Accept { src_cid: u32, src_port: u32, port: u32, responder: HostVsockAcceptorAcceptResponder },
}
impl HostVsockAcceptorRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_accept(self) -> Option<(u32, u32, u32, HostVsockAcceptorAcceptResponder)> {
if let HostVsockAcceptorRequest::Accept { src_cid, src_port, port, responder } = self {
Some((src_cid, src_port, port, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
HostVsockAcceptorRequest::Accept { .. } => "accept",
}
}
}
#[derive(Debug, Clone)]
pub struct HostVsockAcceptorControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for HostVsockAcceptorControlHandle {
fn shutdown(&self) {
self.inner.shutdown()
}
fn shutdown_with_epitaph(&self, status: zx_status::Status) {
self.inner.shutdown_with_epitaph(status)
}
fn is_closed(&self) -> bool {
self.inner.channel().is_closed()
}
fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
#[cfg(target_os = "fuchsia")]
fn signal_peer(
&self,
clear_mask: zx::Signals,
set_mask: zx::Signals,
) -> Result<(), zx_status::Status> {
use fidl::Peered;
self.inner.channel().signal_peer(clear_mask, set_mask)
}
}
impl HostVsockAcceptorControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct HostVsockAcceptorAcceptResponder {
control_handle: std::mem::ManuallyDrop<HostVsockAcceptorControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for HostVsockAcceptorAcceptResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for HostVsockAcceptorAcceptResponder {
type ControlHandle = HostVsockAcceptorControlHandle;
fn control_handle(&self) -> &HostVsockAcceptorControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl HostVsockAcceptorAcceptResponder {
pub fn send(self, mut result: Result<fidl::Socket, i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut result: Result<fidl::Socket, i32>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<fidl::Socket, i32>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<HostVsockAcceptorAcceptResponse, i32>>(
result.map(|socket| (socket,)),
self.tx_id,
0x6996ed935beaa2d7,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct HostVsockEndpointMarker;
impl fidl::endpoints::ProtocolMarker for HostVsockEndpointMarker {
type Proxy = HostVsockEndpointProxy;
type RequestStream = HostVsockEndpointRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = HostVsockEndpointSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.virtualization.HostVsockEndpoint";
}
impl fidl::endpoints::DiscoverableProtocolMarker for HostVsockEndpointMarker {}
pub type HostVsockEndpointListenResult = Result<(), i32>;
pub type HostVsockEndpointConnectResult = Result<fidl::Socket, i32>;
pub trait HostVsockEndpointProxyInterface: Send + Sync {
type ListenResponseFut: std::future::Future<Output = Result<HostVsockEndpointListenResult, fidl::Error>>
+ Send;
fn r#listen(
&self,
port: u32,
acceptor: fidl::endpoints::ClientEnd<HostVsockAcceptorMarker>,
) -> Self::ListenResponseFut;
type ConnectResponseFut: std::future::Future<Output = Result<HostVsockEndpointConnectResult, fidl::Error>>
+ Send;
fn r#connect(&self, guest_port: u32) -> Self::ConnectResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct HostVsockEndpointSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for HostVsockEndpointSynchronousProxy {
type Proxy = HostVsockEndpointProxy;
type Protocol = HostVsockEndpointMarker;
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 HostVsockEndpointSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name =
<HostVsockEndpointMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
}
pub fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
pub fn wait_for_event(
&self,
deadline: zx::MonotonicInstant,
) -> Result<HostVsockEndpointEvent, fidl::Error> {
HostVsockEndpointEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#listen(
&self,
mut port: u32,
mut acceptor: fidl::endpoints::ClientEnd<HostVsockAcceptorMarker>,
___deadline: zx::MonotonicInstant,
) -> Result<HostVsockEndpointListenResult, fidl::Error> {
let _response = self
.client
.send_query::<Listener, fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
(port, acceptor),
0xfd88f3b4767f2c7,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#connect(
&self,
mut guest_port: u32,
___deadline: zx::MonotonicInstant,
) -> Result<HostVsockEndpointConnectResult, fidl::Error> {
let _response = self.client.send_query::<
HostVsockEndpointConnectRequest,
fidl::encoding::ResultType<HostVsockEndpointConnectResponse, i32>,
>(
(guest_port,),
0x4d12e10e946b43e4,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x.socket))
}
}
#[derive(Debug, Clone)]
pub struct HostVsockEndpointProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for HostVsockEndpointProxy {
type Protocol = HostVsockEndpointMarker;
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 HostVsockEndpointProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name =
<HostVsockEndpointMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> HostVsockEndpointEventStream {
HostVsockEndpointEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#listen(
&self,
mut port: u32,
mut acceptor: fidl::endpoints::ClientEnd<HostVsockAcceptorMarker>,
) -> fidl::client::QueryResponseFut<
HostVsockEndpointListenResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
HostVsockEndpointProxyInterface::r#listen(self, port, acceptor)
}
pub fn r#connect(
&self,
mut guest_port: u32,
) -> fidl::client::QueryResponseFut<
HostVsockEndpointConnectResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
HostVsockEndpointProxyInterface::r#connect(self, guest_port)
}
}
impl HostVsockEndpointProxyInterface for HostVsockEndpointProxy {
type ListenResponseFut = fidl::client::QueryResponseFut<
HostVsockEndpointListenResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#listen(
&self,
mut port: u32,
mut acceptor: fidl::endpoints::ClientEnd<HostVsockAcceptorMarker>,
) -> Self::ListenResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<HostVsockEndpointListenResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0xfd88f3b4767f2c7,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<Listener, HostVsockEndpointListenResult>(
(port, acceptor),
0xfd88f3b4767f2c7,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type ConnectResponseFut = fidl::client::QueryResponseFut<
HostVsockEndpointConnectResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#connect(&self, mut guest_port: u32) -> Self::ConnectResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<HostVsockEndpointConnectResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<HostVsockEndpointConnectResponse, i32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x4d12e10e946b43e4,
>(_buf?)?;
Ok(_response.map(|x| x.socket))
}
self.client.send_query_and_decode::<
HostVsockEndpointConnectRequest,
HostVsockEndpointConnectResult,
>(
(guest_port,),
0x4d12e10e946b43e4,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct HostVsockEndpointEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for HostVsockEndpointEventStream {}
impl futures::stream::FusedStream for HostVsockEndpointEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for HostVsockEndpointEventStream {
type Item = Result<HostVsockEndpointEvent, 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(HostVsockEndpointEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum HostVsockEndpointEvent {}
impl HostVsockEndpointEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<HostVsockEndpointEvent, 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:
<HostVsockEndpointMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct HostVsockEndpointRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for HostVsockEndpointRequestStream {}
impl futures::stream::FusedStream for HostVsockEndpointRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for HostVsockEndpointRequestStream {
type Protocol = HostVsockEndpointMarker;
type ControlHandle = HostVsockEndpointControlHandle;
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 {
HostVsockEndpointControlHandle { inner: self.inner.clone() }
}
fn into_inner(
self,
) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
{
(self.inner, self.is_terminated)
}
fn from_inner(
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for HostVsockEndpointRequestStream {
type Item = Result<HostVsockEndpointRequest, 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 HostVsockEndpointRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
e.into(),
))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0xfd88f3b4767f2c7 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
Listener,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Listener>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
HostVsockEndpointControlHandle { inner: this.inner.clone() };
Ok(HostVsockEndpointRequest::Listen {
port: req.port,
acceptor: req.acceptor,
responder: HostVsockEndpointListenResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x4d12e10e946b43e4 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
HostVsockEndpointConnectRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HostVsockEndpointConnectRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
HostVsockEndpointControlHandle { inner: this.inner.clone() };
Ok(HostVsockEndpointRequest::Connect {
guest_port: req.guest_port,
responder: HostVsockEndpointConnectResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<HostVsockEndpointMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum HostVsockEndpointRequest {
Listen {
port: u32,
acceptor: fidl::endpoints::ClientEnd<HostVsockAcceptorMarker>,
responder: HostVsockEndpointListenResponder,
},
Connect { guest_port: u32, responder: HostVsockEndpointConnectResponder },
}
impl HostVsockEndpointRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_listen(
self,
) -> Option<(
u32,
fidl::endpoints::ClientEnd<HostVsockAcceptorMarker>,
HostVsockEndpointListenResponder,
)> {
if let HostVsockEndpointRequest::Listen { port, acceptor, responder } = self {
Some((port, acceptor, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_connect(self) -> Option<(u32, HostVsockEndpointConnectResponder)> {
if let HostVsockEndpointRequest::Connect { guest_port, responder } = self {
Some((guest_port, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
HostVsockEndpointRequest::Listen { .. } => "listen",
HostVsockEndpointRequest::Connect { .. } => "connect",
}
}
}
#[derive(Debug, Clone)]
pub struct HostVsockEndpointControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for HostVsockEndpointControlHandle {
fn shutdown(&self) {
self.inner.shutdown()
}
fn shutdown_with_epitaph(&self, status: zx_status::Status) {
self.inner.shutdown_with_epitaph(status)
}
fn is_closed(&self) -> bool {
self.inner.channel().is_closed()
}
fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
#[cfg(target_os = "fuchsia")]
fn signal_peer(
&self,
clear_mask: zx::Signals,
set_mask: zx::Signals,
) -> Result<(), zx_status::Status> {
use fidl::Peered;
self.inner.channel().signal_peer(clear_mask, set_mask)
}
}
impl HostVsockEndpointControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct HostVsockEndpointListenResponder {
control_handle: std::mem::ManuallyDrop<HostVsockEndpointControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for HostVsockEndpointListenResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for HostVsockEndpointListenResponder {
type ControlHandle = HostVsockEndpointControlHandle;
fn control_handle(&self) -> &HostVsockEndpointControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl HostVsockEndpointListenResponder {
pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
result,
self.tx_id,
0xfd88f3b4767f2c7,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct HostVsockEndpointConnectResponder {
control_handle: std::mem::ManuallyDrop<HostVsockEndpointControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for HostVsockEndpointConnectResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for HostVsockEndpointConnectResponder {
type ControlHandle = HostVsockEndpointControlHandle;
fn control_handle(&self) -> &HostVsockEndpointControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl HostVsockEndpointConnectResponder {
pub fn send(self, mut result: Result<fidl::Socket, i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut result: Result<fidl::Socket, i32>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<fidl::Socket, i32>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<HostVsockEndpointConnectResponse, i32>>(
result.map(|socket| (socket,)),
self.tx_id,
0x4d12e10e946b43e4,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct LinuxManagerMarker;
impl fidl::endpoints::ProtocolMarker for LinuxManagerMarker {
type Proxy = LinuxManagerProxy;
type RequestStream = LinuxManagerRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = LinuxManagerSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.virtualization.LinuxManager";
}
impl fidl::endpoints::DiscoverableProtocolMarker for LinuxManagerMarker {}
pub type LinuxManagerStartAndGetLinuxGuestInfoResult = Result<LinuxGuestInfo, i32>;
pub type LinuxManagerWipeDataResult = Result<(), i32>;
pub trait LinuxManagerProxyInterface: Send + Sync {
type StartAndGetLinuxGuestInfoResponseFut: std::future::Future<
Output = Result<LinuxManagerStartAndGetLinuxGuestInfoResult, fidl::Error>,
> + Send;
fn r#start_and_get_linux_guest_info(
&self,
label: &str,
) -> Self::StartAndGetLinuxGuestInfoResponseFut;
type WipeDataResponseFut: std::future::Future<Output = Result<LinuxManagerWipeDataResult, fidl::Error>>
+ Send;
fn r#wipe_data(&self) -> Self::WipeDataResponseFut;
fn r#graceful_shutdown(&self) -> Result<(), fidl::Error>;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct LinuxManagerSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for LinuxManagerSynchronousProxy {
type Proxy = LinuxManagerProxy;
type Protocol = LinuxManagerMarker;
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 LinuxManagerSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <LinuxManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
}
pub fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
pub fn wait_for_event(
&self,
deadline: zx::MonotonicInstant,
) -> Result<LinuxManagerEvent, fidl::Error> {
LinuxManagerEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#start_and_get_linux_guest_info(
&self,
mut label: &str,
___deadline: zx::MonotonicInstant,
) -> Result<LinuxManagerStartAndGetLinuxGuestInfoResult, fidl::Error> {
let _response = self.client.send_query::<
LinuxManagerStartAndGetLinuxGuestInfoRequest,
fidl::encoding::ResultType<LinuxManagerStartAndGetLinuxGuestInfoResponse, i32>,
>(
(label,),
0x11809ced100a2bea,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x.info))
}
pub fn r#wipe_data(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<LinuxManagerWipeDataResult, fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
>(
(),
0x732c69394548a76a,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#graceful_shutdown(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x5dab12b50bc9909d,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Clone)]
pub struct LinuxManagerProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for LinuxManagerProxy {
type Protocol = LinuxManagerMarker;
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 LinuxManagerProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <LinuxManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> LinuxManagerEventStream {
LinuxManagerEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#start_and_get_linux_guest_info(
&self,
mut label: &str,
) -> fidl::client::QueryResponseFut<
LinuxManagerStartAndGetLinuxGuestInfoResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
LinuxManagerProxyInterface::r#start_and_get_linux_guest_info(self, label)
}
pub fn r#wipe_data(
&self,
) -> fidl::client::QueryResponseFut<
LinuxManagerWipeDataResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
LinuxManagerProxyInterface::r#wipe_data(self)
}
pub fn r#graceful_shutdown(&self) -> Result<(), fidl::Error> {
LinuxManagerProxyInterface::r#graceful_shutdown(self)
}
}
impl LinuxManagerProxyInterface for LinuxManagerProxy {
type StartAndGetLinuxGuestInfoResponseFut = fidl::client::QueryResponseFut<
LinuxManagerStartAndGetLinuxGuestInfoResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#start_and_get_linux_guest_info(
&self,
mut label: &str,
) -> Self::StartAndGetLinuxGuestInfoResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<LinuxManagerStartAndGetLinuxGuestInfoResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<LinuxManagerStartAndGetLinuxGuestInfoResponse, i32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x11809ced100a2bea,
>(_buf?)?;
Ok(_response.map(|x| x.info))
}
self.client.send_query_and_decode::<
LinuxManagerStartAndGetLinuxGuestInfoRequest,
LinuxManagerStartAndGetLinuxGuestInfoResult,
>(
(label,),
0x11809ced100a2bea,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type WipeDataResponseFut = fidl::client::QueryResponseFut<
LinuxManagerWipeDataResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#wipe_data(&self) -> Self::WipeDataResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<LinuxManagerWipeDataResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x732c69394548a76a,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client
.send_query_and_decode::<fidl::encoding::EmptyPayload, LinuxManagerWipeDataResult>(
(),
0x732c69394548a76a,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
fn r#graceful_shutdown(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x5dab12b50bc9909d,
fidl::encoding::DynamicFlags::empty(),
)
}
}
pub struct LinuxManagerEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for LinuxManagerEventStream {}
impl futures::stream::FusedStream for LinuxManagerEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for LinuxManagerEventStream {
type Item = Result<LinuxManagerEvent, 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(LinuxManagerEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum LinuxManagerEvent {
OnGuestInfoChanged { label: String, info: LinuxGuestInfo },
}
impl LinuxManagerEvent {
#[allow(irrefutable_let_patterns)]
pub fn into_on_guest_info_changed(self) -> Option<(String, LinuxGuestInfo)> {
if let LinuxManagerEvent::OnGuestInfoChanged { label, info } = self {
Some((label, info))
} else {
None
}
}
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<LinuxManagerEvent, 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 {
0x30a9be4c43d6a2d6 => {
let mut out = fidl::new_empty!(
LinuxManagerOnGuestInfoChangedRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LinuxManagerOnGuestInfoChangedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
Ok((LinuxManagerEvent::OnGuestInfoChanged { label: out.label, info: out.info }))
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name: <LinuxManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct LinuxManagerRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for LinuxManagerRequestStream {}
impl futures::stream::FusedStream for LinuxManagerRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for LinuxManagerRequestStream {
type Protocol = LinuxManagerMarker;
type ControlHandle = LinuxManagerControlHandle;
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 {
LinuxManagerControlHandle { inner: self.inner.clone() }
}
fn into_inner(
self,
) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
{
(self.inner, self.is_terminated)
}
fn from_inner(
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for LinuxManagerRequestStream {
type Item = Result<LinuxManagerRequest, 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 LinuxManagerRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
e.into(),
))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x11809ced100a2bea => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
LinuxManagerStartAndGetLinuxGuestInfoRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LinuxManagerStartAndGetLinuxGuestInfoRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
LinuxManagerControlHandle { inner: this.inner.clone() };
Ok(LinuxManagerRequest::StartAndGetLinuxGuestInfo {
label: req.label,
responder: LinuxManagerStartAndGetLinuxGuestInfoResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x732c69394548a76a => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
LinuxManagerControlHandle { inner: this.inner.clone() };
Ok(LinuxManagerRequest::WipeData {
responder: LinuxManagerWipeDataResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x5dab12b50bc9909d => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
LinuxManagerControlHandle { inner: this.inner.clone() };
Ok(LinuxManagerRequest::GracefulShutdown { control_handle })
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<LinuxManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum LinuxManagerRequest {
StartAndGetLinuxGuestInfo {
label: String,
responder: LinuxManagerStartAndGetLinuxGuestInfoResponder,
},
WipeData { responder: LinuxManagerWipeDataResponder },
GracefulShutdown { control_handle: LinuxManagerControlHandle },
}
impl LinuxManagerRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_start_and_get_linux_guest_info(
self,
) -> Option<(String, LinuxManagerStartAndGetLinuxGuestInfoResponder)> {
if let LinuxManagerRequest::StartAndGetLinuxGuestInfo { label, responder } = self {
Some((label, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_wipe_data(self) -> Option<(LinuxManagerWipeDataResponder)> {
if let LinuxManagerRequest::WipeData { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_graceful_shutdown(self) -> Option<(LinuxManagerControlHandle)> {
if let LinuxManagerRequest::GracefulShutdown { control_handle } = self {
Some((control_handle))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
LinuxManagerRequest::StartAndGetLinuxGuestInfo { .. } => {
"start_and_get_linux_guest_info"
}
LinuxManagerRequest::WipeData { .. } => "wipe_data",
LinuxManagerRequest::GracefulShutdown { .. } => "graceful_shutdown",
}
}
}
#[derive(Debug, Clone)]
pub struct LinuxManagerControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for LinuxManagerControlHandle {
fn shutdown(&self) {
self.inner.shutdown()
}
fn shutdown_with_epitaph(&self, status: zx_status::Status) {
self.inner.shutdown_with_epitaph(status)
}
fn is_closed(&self) -> bool {
self.inner.channel().is_closed()
}
fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
#[cfg(target_os = "fuchsia")]
fn signal_peer(
&self,
clear_mask: zx::Signals,
set_mask: zx::Signals,
) -> Result<(), zx_status::Status> {
use fidl::Peered;
self.inner.channel().signal_peer(clear_mask, set_mask)
}
}
impl LinuxManagerControlHandle {
pub fn send_on_guest_info_changed(
&self,
mut label: &str,
mut info: &LinuxGuestInfo,
) -> Result<(), fidl::Error> {
self.inner.send::<LinuxManagerOnGuestInfoChangedRequest>(
(label, info),
0,
0x30a9be4c43d6a2d6,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct LinuxManagerStartAndGetLinuxGuestInfoResponder {
control_handle: std::mem::ManuallyDrop<LinuxManagerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for LinuxManagerStartAndGetLinuxGuestInfoResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for LinuxManagerStartAndGetLinuxGuestInfoResponder {
type ControlHandle = LinuxManagerControlHandle;
fn control_handle(&self) -> &LinuxManagerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl LinuxManagerStartAndGetLinuxGuestInfoResponder {
pub fn send(self, mut result: Result<&LinuxGuestInfo, i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut result: Result<&LinuxGuestInfo, i32>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<&LinuxGuestInfo, i32>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
LinuxManagerStartAndGetLinuxGuestInfoResponse,
i32,
>>(
result.map(|info| (info,)),
self.tx_id,
0x11809ced100a2bea,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct LinuxManagerWipeDataResponder {
control_handle: std::mem::ManuallyDrop<LinuxManagerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for LinuxManagerWipeDataResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for LinuxManagerWipeDataResponder {
type ControlHandle = LinuxManagerControlHandle;
fn control_handle(&self) -> &LinuxManagerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl LinuxManagerWipeDataResponder {
pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
result,
self.tx_id,
0x732c69394548a76a,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct MemControllerMarker;
impl fidl::endpoints::ProtocolMarker for MemControllerMarker {
type Proxy = MemControllerProxy;
type RequestStream = MemControllerRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = MemControllerSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.virtualization.MemController";
}
impl fidl::endpoints::DiscoverableProtocolMarker for MemControllerMarker {}
pub trait MemControllerProxyInterface: Send + Sync {
type GetMemSizeResponseFut: std::future::Future<Output = Result<(u64, u64, u64, u64, u64), fidl::Error>>
+ Send;
fn r#get_mem_size(&self) -> Self::GetMemSizeResponseFut;
fn r#request_size(&self, requested_size: u64) -> Result<(), fidl::Error>;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct MemControllerSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for MemControllerSynchronousProxy {
type Proxy = MemControllerProxy;
type Protocol = MemControllerMarker;
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 MemControllerSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <MemControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
}
pub fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
pub fn wait_for_event(
&self,
deadline: zx::MonotonicInstant,
) -> Result<MemControllerEvent, fidl::Error> {
MemControllerEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#get_mem_size(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<(u64, u64, u64, u64, u64), fidl::Error> {
let _response = self
.client
.send_query::<fidl::encoding::EmptyPayload, MemControllerGetMemSizeResponse>(
(),
0x6e9d496f9b66ea56,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok((
_response.block_size,
_response.region_size,
_response.usable_region_size,
_response.plugged_size,
_response.requested_size,
))
}
pub fn r#request_size(&self, mut requested_size: u64) -> Result<(), fidl::Error> {
self.client.send::<MemControllerRequestSizeRequest>(
(requested_size,),
0x12f8e2cc21ee8102,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Clone)]
pub struct MemControllerProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for MemControllerProxy {
type Protocol = MemControllerMarker;
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 MemControllerProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <MemControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> MemControllerEventStream {
MemControllerEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#get_mem_size(
&self,
) -> fidl::client::QueryResponseFut<
(u64, u64, u64, u64, u64),
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
MemControllerProxyInterface::r#get_mem_size(self)
}
pub fn r#request_size(&self, mut requested_size: u64) -> Result<(), fidl::Error> {
MemControllerProxyInterface::r#request_size(self, requested_size)
}
}
impl MemControllerProxyInterface for MemControllerProxy {
type GetMemSizeResponseFut = fidl::client::QueryResponseFut<
(u64, u64, u64, u64, u64),
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#get_mem_size(&self) -> Self::GetMemSizeResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<(u64, u64, u64, u64, u64), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
MemControllerGetMemSizeResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x6e9d496f9b66ea56,
>(_buf?)?;
Ok((
_response.block_size,
_response.region_size,
_response.usable_region_size,
_response.plugged_size,
_response.requested_size,
))
}
self.client
.send_query_and_decode::<fidl::encoding::EmptyPayload, (u64, u64, u64, u64, u64)>(
(),
0x6e9d496f9b66ea56,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
fn r#request_size(&self, mut requested_size: u64) -> Result<(), fidl::Error> {
self.client.send::<MemControllerRequestSizeRequest>(
(requested_size,),
0x12f8e2cc21ee8102,
fidl::encoding::DynamicFlags::empty(),
)
}
}
pub struct MemControllerEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for MemControllerEventStream {}
impl futures::stream::FusedStream for MemControllerEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for MemControllerEventStream {
type Item = Result<MemControllerEvent, 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(MemControllerEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum MemControllerEvent {}
impl MemControllerEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<MemControllerEvent, 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: <MemControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct MemControllerRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for MemControllerRequestStream {}
impl futures::stream::FusedStream for MemControllerRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for MemControllerRequestStream {
type Protocol = MemControllerMarker;
type ControlHandle = MemControllerControlHandle;
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 {
MemControllerControlHandle { inner: self.inner.clone() }
}
fn into_inner(
self,
) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
{
(self.inner, self.is_terminated)
}
fn from_inner(
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for MemControllerRequestStream {
type Item = Result<MemControllerRequest, 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 MemControllerRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
e.into(),
))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x6e9d496f9b66ea56 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
MemControllerControlHandle { inner: this.inner.clone() };
Ok(MemControllerRequest::GetMemSize {
responder: MemControllerGetMemSizeResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x12f8e2cc21ee8102 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
MemControllerRequestSizeRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<MemControllerRequestSizeRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
MemControllerControlHandle { inner: this.inner.clone() };
Ok(MemControllerRequest::RequestSize {
requested_size: req.requested_size,
control_handle,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<MemControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum MemControllerRequest {
GetMemSize { responder: MemControllerGetMemSizeResponder },
RequestSize { requested_size: u64, control_handle: MemControllerControlHandle },
}
impl MemControllerRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_get_mem_size(self) -> Option<(MemControllerGetMemSizeResponder)> {
if let MemControllerRequest::GetMemSize { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_request_size(self) -> Option<(u64, MemControllerControlHandle)> {
if let MemControllerRequest::RequestSize { requested_size, control_handle } = self {
Some((requested_size, control_handle))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
MemControllerRequest::GetMemSize { .. } => "get_mem_size",
MemControllerRequest::RequestSize { .. } => "request_size",
}
}
}
#[derive(Debug, Clone)]
pub struct MemControllerControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for MemControllerControlHandle {
fn shutdown(&self) {
self.inner.shutdown()
}
fn shutdown_with_epitaph(&self, status: zx_status::Status) {
self.inner.shutdown_with_epitaph(status)
}
fn is_closed(&self) -> bool {
self.inner.channel().is_closed()
}
fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
#[cfg(target_os = "fuchsia")]
fn signal_peer(
&self,
clear_mask: zx::Signals,
set_mask: zx::Signals,
) -> Result<(), zx_status::Status> {
use fidl::Peered;
self.inner.channel().signal_peer(clear_mask, set_mask)
}
}
impl MemControllerControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct MemControllerGetMemSizeResponder {
control_handle: std::mem::ManuallyDrop<MemControllerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for MemControllerGetMemSizeResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for MemControllerGetMemSizeResponder {
type ControlHandle = MemControllerControlHandle;
fn control_handle(&self) -> &MemControllerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl MemControllerGetMemSizeResponder {
pub fn send(
self,
mut block_size: u64,
mut region_size: u64,
mut usable_region_size: u64,
mut plugged_size: u64,
mut requested_size: u64,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(
block_size,
region_size,
usable_region_size,
plugged_size,
requested_size,
);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut block_size: u64,
mut region_size: u64,
mut usable_region_size: u64,
mut plugged_size: u64,
mut requested_size: u64,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(
block_size,
region_size,
usable_region_size,
plugged_size,
requested_size,
);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut block_size: u64,
mut region_size: u64,
mut usable_region_size: u64,
mut plugged_size: u64,
mut requested_size: u64,
) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<MemControllerGetMemSizeResponse>(
(block_size, region_size, usable_region_size, plugged_size, requested_size),
self.tx_id,
0x6e9d496f9b66ea56,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct TerminaGuestManagerMarker;
impl fidl::endpoints::ProtocolMarker for TerminaGuestManagerMarker {
type Proxy = TerminaGuestManagerProxy;
type RequestStream = TerminaGuestManagerRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = TerminaGuestManagerSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.virtualization.TerminaGuestManager";
}
impl fidl::endpoints::DiscoverableProtocolMarker for TerminaGuestManagerMarker {}
pub trait TerminaGuestManagerProxyInterface: Send + Sync {
type LaunchResponseFut: std::future::Future<Output = Result<GuestManagerLaunchResult, fidl::Error>>
+ Send;
fn r#launch(
&self,
guest_config: GuestConfig,
controller: fidl::endpoints::ServerEnd<GuestMarker>,
) -> Self::LaunchResponseFut;
type ForceShutdownResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#force_shutdown(&self) -> Self::ForceShutdownResponseFut;
type ConnectResponseFut: std::future::Future<Output = Result<GuestManagerConnectResult, fidl::Error>>
+ Send;
fn r#connect(
&self,
controller: fidl::endpoints::ServerEnd<GuestMarker>,
) -> Self::ConnectResponseFut;
type GetInfoResponseFut: std::future::Future<Output = Result<GuestInfo, fidl::Error>> + Send;
fn r#get_info(&self) -> Self::GetInfoResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct TerminaGuestManagerSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for TerminaGuestManagerSynchronousProxy {
type Proxy = TerminaGuestManagerProxy;
type Protocol = TerminaGuestManagerMarker;
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 TerminaGuestManagerSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name =
<TerminaGuestManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
}
pub fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
pub fn wait_for_event(
&self,
deadline: zx::MonotonicInstant,
) -> Result<TerminaGuestManagerEvent, fidl::Error> {
TerminaGuestManagerEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#launch(
&self,
mut guest_config: GuestConfig,
mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
___deadline: zx::MonotonicInstant,
) -> Result<GuestManagerLaunchResult, fidl::Error> {
let _response =
self.client.send_query::<GuestManagerLaunchRequest, fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
GuestManagerError,
>>(
(&mut guest_config, controller),
0x394a2e29f750323e,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#force_shutdown(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
let _response =
self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::EmptyPayload>(
(),
0x3ad9a012982f872d,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
pub fn r#connect(
&self,
mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
___deadline: zx::MonotonicInstant,
) -> Result<GuestManagerConnectResult, fidl::Error> {
let _response =
self.client.send_query::<GuestManagerConnectRequest, fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
GuestManagerError,
>>(
(controller,),
0x4e489076e3bb15b4,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#get_info(&self, ___deadline: zx::MonotonicInstant) -> Result<GuestInfo, fidl::Error> {
let _response =
self.client.send_query::<fidl::encoding::EmptyPayload, GuestManagerGetInfoResponse>(
(),
0x76892614aea695dc,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.guest_info)
}
}
#[derive(Debug, Clone)]
pub struct TerminaGuestManagerProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for TerminaGuestManagerProxy {
type Protocol = TerminaGuestManagerMarker;
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 TerminaGuestManagerProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name =
<TerminaGuestManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> TerminaGuestManagerEventStream {
TerminaGuestManagerEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#launch(
&self,
mut guest_config: GuestConfig,
mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
) -> fidl::client::QueryResponseFut<
GuestManagerLaunchResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
TerminaGuestManagerProxyInterface::r#launch(self, guest_config, controller)
}
pub fn r#force_shutdown(
&self,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
TerminaGuestManagerProxyInterface::r#force_shutdown(self)
}
pub fn r#connect(
&self,
mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
) -> fidl::client::QueryResponseFut<
GuestManagerConnectResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
TerminaGuestManagerProxyInterface::r#connect(self, controller)
}
pub fn r#get_info(
&self,
) -> fidl::client::QueryResponseFut<GuestInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
{
TerminaGuestManagerProxyInterface::r#get_info(self)
}
}
impl TerminaGuestManagerProxyInterface for TerminaGuestManagerProxy {
type LaunchResponseFut = fidl::client::QueryResponseFut<
GuestManagerLaunchResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#launch(
&self,
mut guest_config: GuestConfig,
mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
) -> Self::LaunchResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<GuestManagerLaunchResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GuestManagerError>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x394a2e29f750323e,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<GuestManagerLaunchRequest, GuestManagerLaunchResult>(
(&mut guest_config, controller),
0x394a2e29f750323e,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type ForceShutdownResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#force_shutdown(&self) -> Self::ForceShutdownResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<(), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x3ad9a012982f872d,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
(),
0x3ad9a012982f872d,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type ConnectResponseFut = fidl::client::QueryResponseFut<
GuestManagerConnectResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#connect(
&self,
mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
) -> Self::ConnectResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<GuestManagerConnectResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GuestManagerError>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x4e489076e3bb15b4,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<GuestManagerConnectRequest, GuestManagerConnectResult>(
(controller,),
0x4e489076e3bb15b4,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type GetInfoResponseFut =
fidl::client::QueryResponseFut<GuestInfo, fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#get_info(&self) -> Self::GetInfoResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<GuestInfo, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
GuestManagerGetInfoResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x76892614aea695dc,
>(_buf?)?;
Ok(_response.guest_info)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, GuestInfo>(
(),
0x76892614aea695dc,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct TerminaGuestManagerEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for TerminaGuestManagerEventStream {}
impl futures::stream::FusedStream for TerminaGuestManagerEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for TerminaGuestManagerEventStream {
type Item = Result<TerminaGuestManagerEvent, 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(TerminaGuestManagerEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum TerminaGuestManagerEvent {}
impl TerminaGuestManagerEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<TerminaGuestManagerEvent, 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:
<TerminaGuestManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct TerminaGuestManagerRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for TerminaGuestManagerRequestStream {}
impl futures::stream::FusedStream for TerminaGuestManagerRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for TerminaGuestManagerRequestStream {
type Protocol = TerminaGuestManagerMarker;
type ControlHandle = TerminaGuestManagerControlHandle;
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 {
TerminaGuestManagerControlHandle { inner: self.inner.clone() }
}
fn into_inner(
self,
) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
{
(self.inner, self.is_terminated)
}
fn from_inner(
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for TerminaGuestManagerRequestStream {
type Item = Result<TerminaGuestManagerRequest, 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 TerminaGuestManagerRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
e.into(),
))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x394a2e29f750323e => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(GuestManagerLaunchRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<GuestManagerLaunchRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = TerminaGuestManagerControlHandle {
inner: this.inner.clone(),
};
Ok(TerminaGuestManagerRequest::Launch {guest_config: req.guest_config,
controller: req.controller,
responder: TerminaGuestManagerLaunchResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x3ad9a012982f872d => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle = TerminaGuestManagerControlHandle {
inner: this.inner.clone(),
};
Ok(TerminaGuestManagerRequest::ForceShutdown {
responder: TerminaGuestManagerForceShutdownResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x4e489076e3bb15b4 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(GuestManagerConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<GuestManagerConnectRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = TerminaGuestManagerControlHandle {
inner: this.inner.clone(),
};
Ok(TerminaGuestManagerRequest::Connect {controller: req.controller,
responder: TerminaGuestManagerConnectResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x76892614aea695dc => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle = TerminaGuestManagerControlHandle {
inner: this.inner.clone(),
};
Ok(TerminaGuestManagerRequest::GetInfo {
responder: TerminaGuestManagerGetInfoResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <TerminaGuestManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum TerminaGuestManagerRequest {
Launch {
guest_config: GuestConfig,
controller: fidl::endpoints::ServerEnd<GuestMarker>,
responder: TerminaGuestManagerLaunchResponder,
},
ForceShutdown { responder: TerminaGuestManagerForceShutdownResponder },
Connect {
controller: fidl::endpoints::ServerEnd<GuestMarker>,
responder: TerminaGuestManagerConnectResponder,
},
GetInfo { responder: TerminaGuestManagerGetInfoResponder },
}
impl TerminaGuestManagerRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_launch(
self,
) -> Option<(
GuestConfig,
fidl::endpoints::ServerEnd<GuestMarker>,
TerminaGuestManagerLaunchResponder,
)> {
if let TerminaGuestManagerRequest::Launch { guest_config, controller, responder } = self {
Some((guest_config, controller, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_force_shutdown(self) -> Option<(TerminaGuestManagerForceShutdownResponder)> {
if let TerminaGuestManagerRequest::ForceShutdown { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_connect(
self,
) -> Option<(fidl::endpoints::ServerEnd<GuestMarker>, TerminaGuestManagerConnectResponder)>
{
if let TerminaGuestManagerRequest::Connect { controller, responder } = self {
Some((controller, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_get_info(self) -> Option<(TerminaGuestManagerGetInfoResponder)> {
if let TerminaGuestManagerRequest::GetInfo { responder } = self {
Some((responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
TerminaGuestManagerRequest::Launch { .. } => "launch",
TerminaGuestManagerRequest::ForceShutdown { .. } => "force_shutdown",
TerminaGuestManagerRequest::Connect { .. } => "connect",
TerminaGuestManagerRequest::GetInfo { .. } => "get_info",
}
}
}
#[derive(Debug, Clone)]
pub struct TerminaGuestManagerControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for TerminaGuestManagerControlHandle {
fn shutdown(&self) {
self.inner.shutdown()
}
fn shutdown_with_epitaph(&self, status: zx_status::Status) {
self.inner.shutdown_with_epitaph(status)
}
fn is_closed(&self) -> bool {
self.inner.channel().is_closed()
}
fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
#[cfg(target_os = "fuchsia")]
fn signal_peer(
&self,
clear_mask: zx::Signals,
set_mask: zx::Signals,
) -> Result<(), zx_status::Status> {
use fidl::Peered;
self.inner.channel().signal_peer(clear_mask, set_mask)
}
}
impl TerminaGuestManagerControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct TerminaGuestManagerLaunchResponder {
control_handle: std::mem::ManuallyDrop<TerminaGuestManagerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for TerminaGuestManagerLaunchResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for TerminaGuestManagerLaunchResponder {
type ControlHandle = TerminaGuestManagerControlHandle;
fn control_handle(&self) -> &TerminaGuestManagerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl TerminaGuestManagerLaunchResponder {
pub fn send(self, mut result: Result<(), GuestManagerError>) -> 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<(), GuestManagerError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), GuestManagerError>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
GuestManagerError,
>>(
result,
self.tx_id,
0x394a2e29f750323e,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct TerminaGuestManagerForceShutdownResponder {
control_handle: std::mem::ManuallyDrop<TerminaGuestManagerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for TerminaGuestManagerForceShutdownResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for TerminaGuestManagerForceShutdownResponder {
type ControlHandle = TerminaGuestManagerControlHandle;
fn control_handle(&self) -> &TerminaGuestManagerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl TerminaGuestManagerForceShutdownResponder {
pub fn send(self) -> Result<(), fidl::Error> {
let _result = self.send_raw();
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
let _result = self.send_raw();
self.drop_without_shutdown();
_result
}
fn send_raw(&self) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
(),
self.tx_id,
0x3ad9a012982f872d,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct TerminaGuestManagerConnectResponder {
control_handle: std::mem::ManuallyDrop<TerminaGuestManagerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for TerminaGuestManagerConnectResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for TerminaGuestManagerConnectResponder {
type ControlHandle = TerminaGuestManagerControlHandle;
fn control_handle(&self) -> &TerminaGuestManagerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl TerminaGuestManagerConnectResponder {
pub fn send(self, mut result: Result<(), GuestManagerError>) -> 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<(), GuestManagerError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), GuestManagerError>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
GuestManagerError,
>>(
result,
self.tx_id,
0x4e489076e3bb15b4,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct TerminaGuestManagerGetInfoResponder {
control_handle: std::mem::ManuallyDrop<TerminaGuestManagerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for TerminaGuestManagerGetInfoResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for TerminaGuestManagerGetInfoResponder {
type ControlHandle = TerminaGuestManagerControlHandle;
fn control_handle(&self) -> &TerminaGuestManagerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl TerminaGuestManagerGetInfoResponder {
pub fn send(self, mut guest_info: &GuestInfo) -> Result<(), fidl::Error> {
let _result = self.send_raw(guest_info);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut guest_info: &GuestInfo) -> Result<(), fidl::Error> {
let _result = self.send_raw(guest_info);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut guest_info: &GuestInfo) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<GuestManagerGetInfoResponse>(
(guest_info,),
self.tx_id,
0x76892614aea695dc,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct ZirconGuestManagerMarker;
impl fidl::endpoints::ProtocolMarker for ZirconGuestManagerMarker {
type Proxy = ZirconGuestManagerProxy;
type RequestStream = ZirconGuestManagerRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = ZirconGuestManagerSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.virtualization.ZirconGuestManager";
}
impl fidl::endpoints::DiscoverableProtocolMarker for ZirconGuestManagerMarker {}
pub trait ZirconGuestManagerProxyInterface: Send + Sync {
type LaunchResponseFut: std::future::Future<Output = Result<GuestManagerLaunchResult, fidl::Error>>
+ Send;
fn r#launch(
&self,
guest_config: GuestConfig,
controller: fidl::endpoints::ServerEnd<GuestMarker>,
) -> Self::LaunchResponseFut;
type ForceShutdownResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#force_shutdown(&self) -> Self::ForceShutdownResponseFut;
type ConnectResponseFut: std::future::Future<Output = Result<GuestManagerConnectResult, fidl::Error>>
+ Send;
fn r#connect(
&self,
controller: fidl::endpoints::ServerEnd<GuestMarker>,
) -> Self::ConnectResponseFut;
type GetInfoResponseFut: std::future::Future<Output = Result<GuestInfo, fidl::Error>> + Send;
fn r#get_info(&self) -> Self::GetInfoResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct ZirconGuestManagerSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for ZirconGuestManagerSynchronousProxy {
type Proxy = ZirconGuestManagerProxy;
type Protocol = ZirconGuestManagerMarker;
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 ZirconGuestManagerSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name =
<ZirconGuestManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
}
pub fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
pub fn wait_for_event(
&self,
deadline: zx::MonotonicInstant,
) -> Result<ZirconGuestManagerEvent, fidl::Error> {
ZirconGuestManagerEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#launch(
&self,
mut guest_config: GuestConfig,
mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
___deadline: zx::MonotonicInstant,
) -> Result<GuestManagerLaunchResult, fidl::Error> {
let _response =
self.client.send_query::<GuestManagerLaunchRequest, fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
GuestManagerError,
>>(
(&mut guest_config, controller),
0x394a2e29f750323e,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#force_shutdown(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
let _response =
self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::EmptyPayload>(
(),
0x3ad9a012982f872d,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
pub fn r#connect(
&self,
mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
___deadline: zx::MonotonicInstant,
) -> Result<GuestManagerConnectResult, fidl::Error> {
let _response =
self.client.send_query::<GuestManagerConnectRequest, fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
GuestManagerError,
>>(
(controller,),
0x4e489076e3bb15b4,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#get_info(&self, ___deadline: zx::MonotonicInstant) -> Result<GuestInfo, fidl::Error> {
let _response =
self.client.send_query::<fidl::encoding::EmptyPayload, GuestManagerGetInfoResponse>(
(),
0x76892614aea695dc,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.guest_info)
}
}
#[derive(Debug, Clone)]
pub struct ZirconGuestManagerProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for ZirconGuestManagerProxy {
type Protocol = ZirconGuestManagerMarker;
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 ZirconGuestManagerProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name =
<ZirconGuestManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> ZirconGuestManagerEventStream {
ZirconGuestManagerEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#launch(
&self,
mut guest_config: GuestConfig,
mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
) -> fidl::client::QueryResponseFut<
GuestManagerLaunchResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
ZirconGuestManagerProxyInterface::r#launch(self, guest_config, controller)
}
pub fn r#force_shutdown(
&self,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
ZirconGuestManagerProxyInterface::r#force_shutdown(self)
}
pub fn r#connect(
&self,
mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
) -> fidl::client::QueryResponseFut<
GuestManagerConnectResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
ZirconGuestManagerProxyInterface::r#connect(self, controller)
}
pub fn r#get_info(
&self,
) -> fidl::client::QueryResponseFut<GuestInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
{
ZirconGuestManagerProxyInterface::r#get_info(self)
}
}
impl ZirconGuestManagerProxyInterface for ZirconGuestManagerProxy {
type LaunchResponseFut = fidl::client::QueryResponseFut<
GuestManagerLaunchResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#launch(
&self,
mut guest_config: GuestConfig,
mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
) -> Self::LaunchResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<GuestManagerLaunchResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GuestManagerError>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x394a2e29f750323e,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<GuestManagerLaunchRequest, GuestManagerLaunchResult>(
(&mut guest_config, controller),
0x394a2e29f750323e,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type ForceShutdownResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#force_shutdown(&self) -> Self::ForceShutdownResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<(), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x3ad9a012982f872d,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
(),
0x3ad9a012982f872d,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type ConnectResponseFut = fidl::client::QueryResponseFut<
GuestManagerConnectResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#connect(
&self,
mut controller: fidl::endpoints::ServerEnd<GuestMarker>,
) -> Self::ConnectResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<GuestManagerConnectResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, GuestManagerError>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x4e489076e3bb15b4,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<GuestManagerConnectRequest, GuestManagerConnectResult>(
(controller,),
0x4e489076e3bb15b4,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type GetInfoResponseFut =
fidl::client::QueryResponseFut<GuestInfo, fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#get_info(&self) -> Self::GetInfoResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<GuestInfo, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
GuestManagerGetInfoResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x76892614aea695dc,
>(_buf?)?;
Ok(_response.guest_info)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, GuestInfo>(
(),
0x76892614aea695dc,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct ZirconGuestManagerEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for ZirconGuestManagerEventStream {}
impl futures::stream::FusedStream for ZirconGuestManagerEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for ZirconGuestManagerEventStream {
type Item = Result<ZirconGuestManagerEvent, 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(ZirconGuestManagerEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum ZirconGuestManagerEvent {}
impl ZirconGuestManagerEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<ZirconGuestManagerEvent, 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:
<ZirconGuestManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct ZirconGuestManagerRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for ZirconGuestManagerRequestStream {}
impl futures::stream::FusedStream for ZirconGuestManagerRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for ZirconGuestManagerRequestStream {
type Protocol = ZirconGuestManagerMarker;
type ControlHandle = ZirconGuestManagerControlHandle;
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 {
ZirconGuestManagerControlHandle { inner: self.inner.clone() }
}
fn into_inner(
self,
) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
{
(self.inner, self.is_terminated)
}
fn from_inner(
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for ZirconGuestManagerRequestStream {
type Item = Result<ZirconGuestManagerRequest, 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 ZirconGuestManagerRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
e.into(),
))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x394a2e29f750323e => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(GuestManagerLaunchRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<GuestManagerLaunchRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = ZirconGuestManagerControlHandle {
inner: this.inner.clone(),
};
Ok(ZirconGuestManagerRequest::Launch {guest_config: req.guest_config,
controller: req.controller,
responder: ZirconGuestManagerLaunchResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x3ad9a012982f872d => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle = ZirconGuestManagerControlHandle {
inner: this.inner.clone(),
};
Ok(ZirconGuestManagerRequest::ForceShutdown {
responder: ZirconGuestManagerForceShutdownResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x4e489076e3bb15b4 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(GuestManagerConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<GuestManagerConnectRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = ZirconGuestManagerControlHandle {
inner: this.inner.clone(),
};
Ok(ZirconGuestManagerRequest::Connect {controller: req.controller,
responder: ZirconGuestManagerConnectResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x76892614aea695dc => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle = ZirconGuestManagerControlHandle {
inner: this.inner.clone(),
};
Ok(ZirconGuestManagerRequest::GetInfo {
responder: ZirconGuestManagerGetInfoResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <ZirconGuestManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum ZirconGuestManagerRequest {
Launch {
guest_config: GuestConfig,
controller: fidl::endpoints::ServerEnd<GuestMarker>,
responder: ZirconGuestManagerLaunchResponder,
},
ForceShutdown { responder: ZirconGuestManagerForceShutdownResponder },
Connect {
controller: fidl::endpoints::ServerEnd<GuestMarker>,
responder: ZirconGuestManagerConnectResponder,
},
GetInfo { responder: ZirconGuestManagerGetInfoResponder },
}
impl ZirconGuestManagerRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_launch(
self,
) -> Option<(
GuestConfig,
fidl::endpoints::ServerEnd<GuestMarker>,
ZirconGuestManagerLaunchResponder,
)> {
if let ZirconGuestManagerRequest::Launch { guest_config, controller, responder } = self {
Some((guest_config, controller, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_force_shutdown(self) -> Option<(ZirconGuestManagerForceShutdownResponder)> {
if let ZirconGuestManagerRequest::ForceShutdown { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_connect(
self,
) -> Option<(fidl::endpoints::ServerEnd<GuestMarker>, ZirconGuestManagerConnectResponder)> {
if let ZirconGuestManagerRequest::Connect { controller, responder } = self {
Some((controller, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_get_info(self) -> Option<(ZirconGuestManagerGetInfoResponder)> {
if let ZirconGuestManagerRequest::GetInfo { responder } = self {
Some((responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
ZirconGuestManagerRequest::Launch { .. } => "launch",
ZirconGuestManagerRequest::ForceShutdown { .. } => "force_shutdown",
ZirconGuestManagerRequest::Connect { .. } => "connect",
ZirconGuestManagerRequest::GetInfo { .. } => "get_info",
}
}
}
#[derive(Debug, Clone)]
pub struct ZirconGuestManagerControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for ZirconGuestManagerControlHandle {
fn shutdown(&self) {
self.inner.shutdown()
}
fn shutdown_with_epitaph(&self, status: zx_status::Status) {
self.inner.shutdown_with_epitaph(status)
}
fn is_closed(&self) -> bool {
self.inner.channel().is_closed()
}
fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
#[cfg(target_os = "fuchsia")]
fn signal_peer(
&self,
clear_mask: zx::Signals,
set_mask: zx::Signals,
) -> Result<(), zx_status::Status> {
use fidl::Peered;
self.inner.channel().signal_peer(clear_mask, set_mask)
}
}
impl ZirconGuestManagerControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct ZirconGuestManagerLaunchResponder {
control_handle: std::mem::ManuallyDrop<ZirconGuestManagerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for ZirconGuestManagerLaunchResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for ZirconGuestManagerLaunchResponder {
type ControlHandle = ZirconGuestManagerControlHandle;
fn control_handle(&self) -> &ZirconGuestManagerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl ZirconGuestManagerLaunchResponder {
pub fn send(self, mut result: Result<(), GuestManagerError>) -> 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<(), GuestManagerError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), GuestManagerError>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
GuestManagerError,
>>(
result,
self.tx_id,
0x394a2e29f750323e,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct ZirconGuestManagerForceShutdownResponder {
control_handle: std::mem::ManuallyDrop<ZirconGuestManagerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for ZirconGuestManagerForceShutdownResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for ZirconGuestManagerForceShutdownResponder {
type ControlHandle = ZirconGuestManagerControlHandle;
fn control_handle(&self) -> &ZirconGuestManagerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl ZirconGuestManagerForceShutdownResponder {
pub fn send(self) -> Result<(), fidl::Error> {
let _result = self.send_raw();
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
let _result = self.send_raw();
self.drop_without_shutdown();
_result
}
fn send_raw(&self) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
(),
self.tx_id,
0x3ad9a012982f872d,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct ZirconGuestManagerConnectResponder {
control_handle: std::mem::ManuallyDrop<ZirconGuestManagerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for ZirconGuestManagerConnectResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for ZirconGuestManagerConnectResponder {
type ControlHandle = ZirconGuestManagerControlHandle;
fn control_handle(&self) -> &ZirconGuestManagerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl ZirconGuestManagerConnectResponder {
pub fn send(self, mut result: Result<(), GuestManagerError>) -> 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<(), GuestManagerError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), GuestManagerError>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
GuestManagerError,
>>(
result,
self.tx_id,
0x4e489076e3bb15b4,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct ZirconGuestManagerGetInfoResponder {
control_handle: std::mem::ManuallyDrop<ZirconGuestManagerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for ZirconGuestManagerGetInfoResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for ZirconGuestManagerGetInfoResponder {
type ControlHandle = ZirconGuestManagerControlHandle;
fn control_handle(&self) -> &ZirconGuestManagerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl ZirconGuestManagerGetInfoResponder {
pub fn send(self, mut guest_info: &GuestInfo) -> Result<(), fidl::Error> {
let _result = self.send_raw(guest_info);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut guest_info: &GuestInfo) -> Result<(), fidl::Error> {
let _result = self.send_raw(guest_info);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut guest_info: &GuestInfo) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<GuestManagerGetInfoResponse>(
(guest_info,),
self.tx_id,
0x76892614aea695dc,
fidl::encoding::DynamicFlags::empty(),
)
}
}
mod internal {
use super::*;
unsafe impl fidl::encoding::TypeMarker for BlockMode {
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 BlockMode {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
*value
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for BlockMode {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BlockMode {
#[inline(always)]
fn new_empty() -> Self {
Self::ReadWrite
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u32>(offset);
*self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for ContainerStatus {
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 ContainerStatus {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
*value
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
for ContainerStatus
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ContainerStatus {
#[inline(always)]
fn new_empty() -> Self {
Self::Transient
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u32>(offset);
*self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for GuestError {
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 GuestError {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
*value
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for GuestError {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for GuestError {
#[inline(always)]
fn new_empty() -> Self {
Self::InternalError
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u32>(offset);
*self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for GuestManagerError {
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 GuestManagerError {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
*value
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
for GuestManagerError
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for GuestManagerError {
#[inline(always)]
fn new_empty() -> Self {
Self::BadConfig
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u32>(offset);
*self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for GuestStatus {
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 GuestStatus {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
*value
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for GuestStatus {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for GuestStatus {
#[inline(always)]
fn new_empty() -> Self {
Self::NotStarted
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u32>(offset);
*self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for KernelType {
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 KernelType {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
*value
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for KernelType {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for KernelType {
#[inline(always)]
fn new_empty() -> Self {
Self::Zircon
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u32>(offset);
*self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for BalloonControllerGetBalloonSizeResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for BalloonControllerGetBalloonSizeResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<BalloonControllerGetBalloonSizeResponse, D>
for &BalloonControllerGetBalloonSizeResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<BalloonControllerGetBalloonSizeResponse>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut BalloonControllerGetBalloonSizeResponse).write_unaligned(
(self as *const BalloonControllerGetBalloonSizeResponse).read(),
);
}
Ok(())
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<u32, D>,
T1: fidl::encoding::Encode<u32, D>,
> fidl::encoding::Encode<BalloonControllerGetBalloonSizeResponse, D> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<BalloonControllerGetBalloonSizeResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 4, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for BalloonControllerGetBalloonSizeResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self {
current_num_pages: fidl::new_empty!(u32, D),
requested_num_pages: fidl::new_empty!(u32, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for BalloonControllerGetMemStatsResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for BalloonControllerGetMemStatsResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
24
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<BalloonControllerGetMemStatsResponse, D>
for &BalloonControllerGetMemStatsResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<BalloonControllerGetMemStatsResponse>(offset);
fidl::encoding::Encode::<BalloonControllerGetMemStatsResponse, D>::encode(
(
<i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.status),
<fidl::encoding::Optional<fidl::encoding::UnboundedVector<MemStat>> as fidl::encoding::ValueTypeMarker>::borrow(&self.mem_stats),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<i32, D>,
T1: fidl::encoding::Encode<
fidl::encoding::Optional<fidl::encoding::UnboundedVector<MemStat>>,
D,
>,
> fidl::encoding::Encode<BalloonControllerGetMemStatsResponse, D> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<BalloonControllerGetMemStatsResponse>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for BalloonControllerGetMemStatsResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self {
status: fidl::new_empty!(i32, D),
mem_stats: fidl::new_empty!(
fidl::encoding::Optional<fidl::encoding::UnboundedVector<MemStat>>,
D
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
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!(i32, D, &mut self.status, decoder, offset + 0, _depth)?;
fidl::decode!(
fidl::encoding::Optional<fidl::encoding::UnboundedVector<MemStat>>,
D,
&mut self.mem_stats,
decoder,
offset + 8,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for BalloonControllerRequestNumPagesRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for BalloonControllerRequestNumPagesRequest {
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
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<BalloonControllerRequestNumPagesRequest, D>
for &BalloonControllerRequestNumPagesRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<BalloonControllerRequestNumPagesRequest>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut BalloonControllerRequestNumPagesRequest).write_unaligned(
(self as *const BalloonControllerRequestNumPagesRequest).read(),
);
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
fidl::encoding::Encode<BalloonControllerRequestNumPagesRequest, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<BalloonControllerRequestNumPagesRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for BalloonControllerRequestNumPagesRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { requested_num_pages: fidl::new_empty!(u32, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
}
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for BlockSpec {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for BlockSpec {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
40
}
}
unsafe impl fidl::encoding::Encode<BlockSpec, fidl::encoding::DefaultFuchsiaResourceDialect>
for &mut BlockSpec
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<BlockSpec>(offset);
fidl::encoding::Encode::<BlockSpec, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<fidl::encoding::BoundedString<20> as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
<BlockMode as fidl::encoding::ValueTypeMarker>::borrow(&self.mode),
<BlockFormat as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.format),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::BoundedString<20>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T1: fidl::encoding::Encode<BlockMode, fidl::encoding::DefaultFuchsiaResourceDialect>,
T2: fidl::encoding::Encode<BlockFormat, fidl::encoding::DefaultFuchsiaResourceDialect>,
> fidl::encoding::Encode<BlockSpec, fidl::encoding::DefaultFuchsiaResourceDialect>
for (T0, T1, T2)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<BlockSpec>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
self.2.encode(encoder, offset + 24, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for BlockSpec {
#[inline(always)]
fn new_empty() -> Self {
Self {
id: fidl::new_empty!(
fidl::encoding::BoundedString<20>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
mode: fidl::new_empty!(BlockMode, fidl::encoding::DefaultFuchsiaResourceDialect),
format: fidl::new_empty!(
BlockFormat,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffff00000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(
fidl::encoding::BoundedString<20>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.id,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
BlockMode,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.mode,
decoder,
offset + 16,
_depth
)?;
fidl::decode!(
BlockFormat,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.format,
decoder,
offset + 24,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for GuestGetBalloonControllerRequest {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for GuestGetBalloonControllerRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
}
unsafe impl
fidl::encoding::Encode<
GuestGetBalloonControllerRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut GuestGetBalloonControllerRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<GuestGetBalloonControllerRequest>(offset);
fidl::encoding::Encode::<GuestGetBalloonControllerRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<BalloonControllerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.controller),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<BalloonControllerMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
GuestGetBalloonControllerRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<GuestGetBalloonControllerRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for GuestGetBalloonControllerRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
controller: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<BalloonControllerMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<BalloonControllerMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.controller,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for GuestGetHostVsockEndpointRequest {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for GuestGetHostVsockEndpointRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
}
unsafe impl
fidl::encoding::Encode<
GuestGetHostVsockEndpointRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut GuestGetHostVsockEndpointRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<GuestGetHostVsockEndpointRequest>(offset);
fidl::encoding::Encode::<GuestGetHostVsockEndpointRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<HostVsockEndpointMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.endpoint),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<HostVsockEndpointMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
GuestGetHostVsockEndpointRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<GuestGetHostVsockEndpointRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for GuestGetHostVsockEndpointRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
endpoint: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<HostVsockEndpointMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<HostVsockEndpointMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.endpoint,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for GuestGetMemControllerRequest {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for GuestGetMemControllerRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
}
unsafe impl
fidl::encoding::Encode<
GuestGetMemControllerRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut GuestGetMemControllerRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<GuestGetMemControllerRequest>(offset);
fidl::encoding::Encode::<GuestGetMemControllerRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MemControllerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.controller),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MemControllerMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
GuestGetMemControllerRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<GuestGetMemControllerRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for GuestGetMemControllerRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
controller: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MemControllerMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MemControllerMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.controller,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for GuestGetSerialResponse {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for GuestGetSerialResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
}
unsafe impl
fidl::encoding::Encode<
GuestGetSerialResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut GuestGetSerialResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<GuestGetSerialResponse>(offset);
fidl::encoding::Encode::<
GuestGetSerialResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(<fidl::encoding::HandleType<
fidl::Socket,
{ fidl::ObjectType::SOCKET.into_raw() },
2147483648,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.socket
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::HandleType<
fidl::Socket,
{ fidl::ObjectType::SOCKET.into_raw() },
2147483648,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
GuestGetSerialResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<GuestGetSerialResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for GuestGetSerialResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self {
socket: fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.socket, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for GuestLifecycleBindRequest {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for GuestLifecycleBindRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
}
unsafe impl
fidl::encoding::Encode<
GuestLifecycleBindRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut GuestLifecycleBindRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<GuestLifecycleBindRequest>(offset);
fidl::encoding::Encode::<GuestLifecycleBindRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<GuestMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.guest),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<GuestMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
GuestLifecycleBindRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<GuestLifecycleBindRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for GuestLifecycleBindRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
guest: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<GuestMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<GuestMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.guest,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for GuestLifecycleCreateRequest {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for GuestLifecycleCreateRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl
fidl::encoding::Encode<
GuestLifecycleCreateRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut GuestLifecycleCreateRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<GuestLifecycleCreateRequest>(offset);
fidl::encoding::Encode::<
GuestLifecycleCreateRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(<GuestConfig as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.guest_config,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<GuestConfig, fidl::encoding::DefaultFuchsiaResourceDialect>,
>
fidl::encoding::Encode<
GuestLifecycleCreateRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<GuestLifecycleCreateRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for GuestLifecycleCreateRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
guest_config: fidl::new_empty!(
GuestConfig,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
GuestConfig,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.guest_config,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for GuestManagerConnectRequest {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for GuestManagerConnectRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
}
unsafe impl
fidl::encoding::Encode<
GuestManagerConnectRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut GuestManagerConnectRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<GuestManagerConnectRequest>(offset);
fidl::encoding::Encode::<GuestManagerConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<GuestMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.controller),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<GuestMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
GuestManagerConnectRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<GuestManagerConnectRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for GuestManagerConnectRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
controller: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<GuestMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<GuestMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.controller,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for GuestManagerGetInfoResponse {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for GuestManagerGetInfoResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl
fidl::encoding::Encode<
GuestManagerGetInfoResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut GuestManagerGetInfoResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<GuestManagerGetInfoResponse>(offset);
fidl::encoding::Encode::<
GuestManagerGetInfoResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(<GuestInfo as fidl::encoding::ValueTypeMarker>::borrow(&self.guest_info),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<T0: fidl::encoding::Encode<GuestInfo, fidl::encoding::DefaultFuchsiaResourceDialect>>
fidl::encoding::Encode<
GuestManagerGetInfoResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<GuestManagerGetInfoResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for GuestManagerGetInfoResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self {
guest_info: fidl::new_empty!(
GuestInfo,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
GuestInfo,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.guest_info,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for GuestManagerLaunchRequest {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for GuestManagerLaunchRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
24
}
}
unsafe impl
fidl::encoding::Encode<
GuestManagerLaunchRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut GuestManagerLaunchRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<GuestManagerLaunchRequest>(offset);
fidl::encoding::Encode::<GuestManagerLaunchRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<GuestConfig as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.guest_config),
<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<GuestMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.controller),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<GuestConfig, fidl::encoding::DefaultFuchsiaResourceDialect>,
T1: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<GuestMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
GuestManagerLaunchRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<GuestManagerLaunchRequest>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for GuestManagerLaunchRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
guest_config: fidl::new_empty!(
GuestConfig,
fidl::encoding::DefaultFuchsiaResourceDialect
),
controller: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<GuestMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffff00000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(
GuestConfig,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.guest_config,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<GuestMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.controller,
decoder,
offset + 16,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for GuestGetConsoleResponse {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for GuestGetConsoleResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
}
unsafe impl
fidl::encoding::Encode<
GuestGetConsoleResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut GuestGetConsoleResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<GuestGetConsoleResponse>(offset);
fidl::encoding::Encode::<
GuestGetConsoleResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(<fidl::encoding::HandleType<
fidl::Socket,
{ fidl::ObjectType::SOCKET.into_raw() },
2147483648,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.socket
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::HandleType<
fidl::Socket,
{ fidl::ObjectType::SOCKET.into_raw() },
2147483648,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
GuestGetConsoleResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<GuestGetConsoleResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for GuestGetConsoleResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self {
socket: fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.socket, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for HostVsockAcceptorAcceptRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for HostVsockAcceptorAcceptRequest {
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
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<HostVsockAcceptorAcceptRequest, D>
for &HostVsockAcceptorAcceptRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HostVsockAcceptorAcceptRequest>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut HostVsockAcceptorAcceptRequest)
.write_unaligned((self as *const HostVsockAcceptorAcceptRequest).read());
}
Ok(())
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<u32, D>,
T1: fidl::encoding::Encode<u32, D>,
T2: fidl::encoding::Encode<u32, D>,
> fidl::encoding::Encode<HostVsockAcceptorAcceptRequest, D> for (T0, T1, T2)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HostVsockAcceptorAcceptRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 4, depth)?;
self.2.encode(encoder, offset + 8, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for HostVsockAcceptorAcceptRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
src_cid: fidl::new_empty!(u32, D),
src_port: fidl::new_empty!(u32, D),
port: fidl::new_empty!(u32, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 12);
}
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for HostVsockAcceptorAcceptResponse {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for HostVsockAcceptorAcceptResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
}
unsafe impl
fidl::encoding::Encode<
HostVsockAcceptorAcceptResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut HostVsockAcceptorAcceptResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HostVsockAcceptorAcceptResponse>(offset);
fidl::encoding::Encode::<
HostVsockAcceptorAcceptResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(<fidl::encoding::HandleType<
fidl::Socket,
{ fidl::ObjectType::SOCKET.into_raw() },
2147483648,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.socket
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::HandleType<
fidl::Socket,
{ fidl::ObjectType::SOCKET.into_raw() },
2147483648,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
HostVsockAcceptorAcceptResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HostVsockAcceptorAcceptResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for HostVsockAcceptorAcceptResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self {
socket: fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.socket, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for HostVsockEndpointConnectRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for HostVsockEndpointConnectRequest {
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
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<HostVsockEndpointConnectRequest, D>
for &HostVsockEndpointConnectRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HostVsockEndpointConnectRequest>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut HostVsockEndpointConnectRequest)
.write_unaligned((self as *const HostVsockEndpointConnectRequest).read());
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
fidl::encoding::Encode<HostVsockEndpointConnectRequest, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HostVsockEndpointConnectRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for HostVsockEndpointConnectRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { guest_port: fidl::new_empty!(u32, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
}
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for HostVsockEndpointConnectResponse {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for HostVsockEndpointConnectResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
}
unsafe impl
fidl::encoding::Encode<
HostVsockEndpointConnectResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut HostVsockEndpointConnectResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HostVsockEndpointConnectResponse>(offset);
fidl::encoding::Encode::<
HostVsockEndpointConnectResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(<fidl::encoding::HandleType<
fidl::Socket,
{ fidl::ObjectType::SOCKET.into_raw() },
2147483648,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.socket
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::HandleType<
fidl::Socket,
{ fidl::ObjectType::SOCKET.into_raw() },
2147483648,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
HostVsockEndpointConnectResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HostVsockEndpointConnectResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for HostVsockEndpointConnectResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self {
socket: fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.socket, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for LinuxManagerOnGuestInfoChangedRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for LinuxManagerOnGuestInfoChangedRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
32
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<LinuxManagerOnGuestInfoChangedRequest, D>
for &LinuxManagerOnGuestInfoChangedRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<LinuxManagerOnGuestInfoChangedRequest>(offset);
fidl::encoding::Encode::<LinuxManagerOnGuestInfoChangedRequest, D>::encode(
(
<fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
&self.label,
),
<LinuxGuestInfo as fidl::encoding::ValueTypeMarker>::borrow(&self.info),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
T1: fidl::encoding::Encode<LinuxGuestInfo, D>,
> fidl::encoding::Encode<LinuxManagerOnGuestInfoChangedRequest, D> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<LinuxManagerOnGuestInfoChangedRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for LinuxManagerOnGuestInfoChangedRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
label: fidl::new_empty!(fidl::encoding::UnboundedString, D),
info: fidl::new_empty!(LinuxGuestInfo, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::UnboundedString,
D,
&mut self.label,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(LinuxGuestInfo, D, &mut self.info, decoder, offset + 16, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for LinuxManagerStartAndGetLinuxGuestInfoRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for LinuxManagerStartAndGetLinuxGuestInfoRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<LinuxManagerStartAndGetLinuxGuestInfoRequest, D>
for &LinuxManagerStartAndGetLinuxGuestInfoRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<LinuxManagerStartAndGetLinuxGuestInfoRequest>(offset);
fidl::encoding::Encode::<LinuxManagerStartAndGetLinuxGuestInfoRequest, D>::encode(
(<fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
&self.label,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
> fidl::encoding::Encode<LinuxManagerStartAndGetLinuxGuestInfoRequest, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<LinuxManagerStartAndGetLinuxGuestInfoRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for LinuxManagerStartAndGetLinuxGuestInfoRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { label: fidl::new_empty!(fidl::encoding::UnboundedString, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::UnboundedString,
D,
&mut self.label,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for LinuxManagerStartAndGetLinuxGuestInfoResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for LinuxManagerStartAndGetLinuxGuestInfoResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<LinuxManagerStartAndGetLinuxGuestInfoResponse, D>
for &LinuxManagerStartAndGetLinuxGuestInfoResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<LinuxManagerStartAndGetLinuxGuestInfoResponse>(offset);
fidl::encoding::Encode::<LinuxManagerStartAndGetLinuxGuestInfoResponse, D>::encode(
(<LinuxGuestInfo as fidl::encoding::ValueTypeMarker>::borrow(&self.info),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<LinuxGuestInfo, D>>
fidl::encoding::Encode<LinuxManagerStartAndGetLinuxGuestInfoResponse, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<LinuxManagerStartAndGetLinuxGuestInfoResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for LinuxManagerStartAndGetLinuxGuestInfoResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { info: fidl::new_empty!(LinuxGuestInfo, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(LinuxGuestInfo, D, &mut self.info, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for Listener {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for Listener {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
8
}
}
unsafe impl fidl::encoding::Encode<Listener, fidl::encoding::DefaultFuchsiaResourceDialect>
for &mut Listener
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Listener>(offset);
fidl::encoding::Encode::<Listener, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.port),
<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<HostVsockAcceptorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.acceptor),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<u32, fidl::encoding::DefaultFuchsiaResourceDialect>,
T1: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<HostVsockAcceptorMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
> fidl::encoding::Encode<Listener, fidl::encoding::DefaultFuchsiaResourceDialect>
for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Listener>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 4, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for Listener {
#[inline(always)]
fn new_empty() -> Self {
Self {
port: fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect),
acceptor: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<HostVsockAcceptorMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
u32,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.port,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<HostVsockAcceptorMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.acceptor,
decoder,
offset + 4,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for MagmaDevice {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for MagmaDevice {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<MagmaDevice, D>
for &MagmaDevice
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<MagmaDevice>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut MagmaDevice).write_unaligned((self as *const MagmaDevice).read());
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
fidl::encoding::Encode<MagmaDevice, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<MagmaDevice>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for MagmaDevice {
#[inline(always)]
fn new_empty() -> Self {
Self { memory: fidl::new_empty!(u64, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for MemControllerGetMemSizeResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for MemControllerGetMemSizeResponse {
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
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<MemControllerGetMemSizeResponse, D>
for &MemControllerGetMemSizeResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<MemControllerGetMemSizeResponse>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut MemControllerGetMemSizeResponse)
.write_unaligned((self as *const MemControllerGetMemSizeResponse).read());
}
Ok(())
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<u64, D>,
T1: fidl::encoding::Encode<u64, D>,
T2: fidl::encoding::Encode<u64, D>,
T3: fidl::encoding::Encode<u64, D>,
T4: fidl::encoding::Encode<u64, D>,
> fidl::encoding::Encode<MemControllerGetMemSizeResponse, D> for (T0, T1, T2, T3, T4)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<MemControllerGetMemSizeResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
self.2.encode(encoder, offset + 16, depth)?;
self.3.encode(encoder, offset + 24, depth)?;
self.4.encode(encoder, offset + 32, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for MemControllerGetMemSizeResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self {
block_size: fidl::new_empty!(u64, D),
region_size: fidl::new_empty!(u64, D),
usable_region_size: fidl::new_empty!(u64, D),
plugged_size: fidl::new_empty!(u64, D),
requested_size: fidl::new_empty!(u64, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 40);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for MemControllerRequestSizeRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for MemControllerRequestSizeRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<MemControllerRequestSizeRequest, D>
for &MemControllerRequestSizeRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<MemControllerRequestSizeRequest>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut MemControllerRequestSizeRequest)
.write_unaligned((self as *const MemControllerRequestSizeRequest).read());
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
fidl::encoding::Encode<MemControllerRequestSizeRequest, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<MemControllerRequestSizeRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for MemControllerRequestSizeRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { requested_size: fidl::new_empty!(u64, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for MemStat {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for MemStat {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<MemStat, D> for &MemStat {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<MemStat>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut MemStat).write_unaligned((self as *const MemStat).read());
let padding_ptr = buf_ptr.offset(0) as *mut u64;
let padding_mask = 0xffffffffffff0000u64;
padding_ptr.write_unaligned(padding_ptr.read_unaligned() & !padding_mask);
}
Ok(())
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<u16, D>,
T1: fidl::encoding::Encode<u64, D>,
> fidl::encoding::Encode<MemStat, D> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<MemStat>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for MemStat {
#[inline(always)]
fn new_empty() -> Self {
Self { tag: fidl::new_empty!(u16, D), val: fidl::new_empty!(u64, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
let ptr = unsafe { buf_ptr.offset(0) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffffffff0000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for NetSpec {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for NetSpec {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
1
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
7
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<NetSpec, D> for &NetSpec {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<NetSpec>(offset);
fidl::encoding::Encode::<NetSpec, D>::encode(
(
<fidl_fuchsia_net::MacAddress as fidl::encoding::ValueTypeMarker>::borrow(
&self.mac_address,
),
<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.enable_bridge),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl_fuchsia_net::MacAddress, D>,
T1: fidl::encoding::Encode<bool, D>,
> fidl::encoding::Encode<NetSpec, D> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<NetSpec>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 6, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for NetSpec {
#[inline(always)]
fn new_empty() -> Self {
Self {
mac_address: fidl::new_empty!(fidl_fuchsia_net::MacAddress, D),
enable_bridge: fidl::new_empty!(bool, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl_fuchsia_net::MacAddress,
D,
&mut self.mac_address,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(bool, D, &mut self.enable_bridge, decoder, offset + 6, _depth)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for WaylandDevice {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for WaylandDevice {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl fidl::encoding::Encode<WaylandDevice, fidl::encoding::DefaultFuchsiaResourceDialect>
for &mut WaylandDevice
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<WaylandDevice>(offset);
fidl::encoding::Encode::<WaylandDevice, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.memory),
<fidl::encoding::Optional<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<fidl_fuchsia_wayland::Server_Marker>>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.server),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
T1: fidl::encoding::Encode<
fidl::encoding::Optional<
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_wayland::Server_Marker>,
>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
> fidl::encoding::Encode<WaylandDevice, fidl::encoding::DefaultFuchsiaResourceDialect>
for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<WaylandDevice>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for WaylandDevice {
#[inline(always)]
fn new_empty() -> Self {
Self {
memory: fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect),
server: fidl::new_empty!(
fidl::encoding::Optional<
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_wayland::Server_Marker>,
>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
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 + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(
u64,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.memory,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::Optional<
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_wayland::Server_Marker>,
>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.server,
decoder,
offset + 8,
_depth
)?;
Ok(())
}
}
impl GuestConfig {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.virtio_mem_region_alignment {
return 25;
}
if let Some(_) = self.virtio_mem_region_size {
return 24;
}
if let Some(_) = self.virtio_mem_block_size {
return 23;
}
if let Some(_) = self.virtio_mem {
return 22;
}
if let Some(_) = self.vsock_listeners {
return 21;
}
if let Some(_) = self.virtio_sound_input {
return 20;
}
if let Some(_) = self.virtio_sound {
return 19;
}
if let Some(_) = self.virtio_vsock {
return 18;
}
if let Some(_) = self.virtio_rng {
return 17;
}
if let Some(_) = self.virtio_gpu {
return 16;
}
if let Some(_) = self.virtio_console {
return 15;
}
if let Some(_) = self.virtio_balloon {
return 14;
}
if let Some(_) = self.default_net {
return 13;
}
if let Some(_) = self.magma_device {
return 12;
}
if let Some(_) = self.wayland_device {
return 11;
}
if let Some(_) = self.net_devices {
return 10;
}
if let Some(_) = self.block_devices {
return 9;
}
if let Some(_) = self.guest_memory {
return 8;
}
if let Some(_) = self.cpus {
return 7;
}
if let Some(_) = self.cmdline_add {
return 6;
}
if let Some(_) = self.cmdline {
return 5;
}
if let Some(_) = self.dtb_overlay {
return 4;
}
if let Some(_) = self.ramdisk {
return 3;
}
if let Some(_) = self.kernel {
return 2;
}
if let Some(_) = self.kernel_type {
return 1;
}
0
}
}
impl fidl::encoding::ResourceTypeMarker for GuestConfig {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for GuestConfig {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl fidl::encoding::Encode<GuestConfig, fidl::encoding::DefaultFuchsiaResourceDialect>
for &mut GuestConfig
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<GuestConfig>(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::<
KernelType,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
self.kernel_type
.as_ref()
.map(<KernelType as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 2 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (2 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
self.kernel.as_mut().map(
<fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 3 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (3 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
self.ramdisk.as_mut().map(
<fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
> as fidl::encoding::ResourceTypeMarker>::take_or_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::Endpoint<fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
self.dtb_overlay.as_mut().map(
<fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
> as fidl::encoding::ResourceTypeMarker>::take_or_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::UnboundedString,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
self.cmdline.as_ref().map(
<fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow,
),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 6 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (6 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>, fidl::encoding::DefaultFuchsiaResourceDialect>(
self.cmdline_add.as_ref().map(<fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString> as fidl::encoding::ValueTypeMarker>::borrow),
encoder, offset + cur_offset, depth
)?;
_prev_end_offset = cur_offset + envelope_size;
if 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::<
u8,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
self.cpus.as_ref().map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 8 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (8 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<
u64,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
self.guest_memory.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 9 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (9 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<BlockSpec, 32>, fidl::encoding::DefaultFuchsiaResourceDialect>(
self.block_devices.as_mut().map(<fidl::encoding::Vector<BlockSpec, 32> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
encoder, offset + cur_offset, depth
)?;
_prev_end_offset = cur_offset + envelope_size;
if 10 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (10 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<NetSpec, 32>, fidl::encoding::DefaultFuchsiaResourceDialect>(
self.net_devices.as_ref().map(<fidl::encoding::Vector<NetSpec, 32> as fidl::encoding::ValueTypeMarker>::borrow),
encoder, offset + cur_offset, depth
)?;
_prev_end_offset = cur_offset + envelope_size;
if 11 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (11 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<
WaylandDevice,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
self.wayland_device
.as_mut()
.map(<WaylandDevice as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 12 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (12 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<
MagmaDevice,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
self.magma_device
.as_ref()
.map(<MagmaDevice as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 13 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (13 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<
bool,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
self.default_net.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 14 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (14 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<
bool,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
self.virtio_balloon.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 15 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (15 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<
bool,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
self.virtio_console.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 16 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (16 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<
bool,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
self.virtio_gpu.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 17 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (17 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<
bool,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
self.virtio_rng.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 18 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (18 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<
bool,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
self.virtio_vsock.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 19 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (19 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<
bool,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
self.virtio_sound.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 20 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (20 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<
bool,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
self.virtio_sound_input
.as_ref()
.map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 21 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (21 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<Listener>, fidl::encoding::DefaultFuchsiaResourceDialect>(
self.vsock_listeners.as_mut().map(<fidl::encoding::UnboundedVector<Listener> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
encoder, offset + cur_offset, depth
)?;
_prev_end_offset = cur_offset + envelope_size;
if 22 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (22 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<
bool,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
self.virtio_mem.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 23 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (23 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<
u64,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
self.virtio_mem_block_size
.as_ref()
.map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 24 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (24 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<
u64,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
self.virtio_mem_region_size
.as_ref()
.map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 25 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (25 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<
u64,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
self.virtio_mem_region_alignment
.as_ref()
.map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for GuestConfig {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
if len == 0 {
return Ok(());
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 1 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<KernelType 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.kernel_type.get_or_insert_with(|| {
fidl::new_empty!(KernelType, fidl::encoding::DefaultFuchsiaResourceDialect)
});
fidl::decode!(
KernelType,
fidl::encoding::DefaultFuchsiaResourceDialect,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 2 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size = <fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
> 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.kernel.get_or_insert_with(|| {
fidl::new_empty!(
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect
)
});
fidl::decode!(
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 3 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size = <fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
> 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.ramdisk.get_or_insert_with(|| {
fidl::new_empty!(
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect
)
});
fidl::decode!(
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 4 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size = <fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
> 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.dtb_overlay.get_or_insert_with(|| {
fidl::new_empty!(
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect
)
});
fidl::decode!(
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 5 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<fidl::encoding::UnboundedString as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.cmdline.get_or_insert_with(|| {
fidl::new_empty!(
fidl::encoding::UnboundedString,
fidl::encoding::DefaultFuchsiaResourceDialect
)
});
fidl::decode!(
fidl::encoding::UnboundedString,
fidl::encoding::DefaultFuchsiaResourceDialect,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 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::UnboundedVector<
fidl::encoding::UnboundedString,
> as fidl::encoding::TypeMarker>::inline_size(
decoder.context
);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.cmdline_add.get_or_insert_with(|| {
fidl::new_empty!(
fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>,
fidl::encoding::DefaultFuchsiaResourceDialect
)
});
fidl::decode!(
fidl::encoding::UnboundedVector<fidl::encoding::UnboundedString>,
fidl::encoding::DefaultFuchsiaResourceDialect,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 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 =
<u8 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.cpus.get_or_insert_with(|| {
fidl::new_empty!(u8, fidl::encoding::DefaultFuchsiaResourceDialect)
});
fidl::decode!(
u8,
fidl::encoding::DefaultFuchsiaResourceDialect,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 8 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<u64 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.guest_memory.get_or_insert_with(|| {
fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
});
fidl::decode!(
u64,
fidl::encoding::DefaultFuchsiaResourceDialect,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 9 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size = <fidl::encoding::Vector<BlockSpec, 32> 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.block_devices.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<BlockSpec, 32>, fidl::encoding::DefaultFuchsiaResourceDialect));
fidl::decode!(fidl::encoding::Vector<BlockSpec, 32>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 10 {
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::Vector<NetSpec, 32> 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.net_devices.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<NetSpec, 32>, fidl::encoding::DefaultFuchsiaResourceDialect));
fidl::decode!(fidl::encoding::Vector<NetSpec, 32>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 11 {
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 =
<WaylandDevice 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.wayland_device.get_or_insert_with(|| {
fidl::new_empty!(WaylandDevice, fidl::encoding::DefaultFuchsiaResourceDialect)
});
fidl::decode!(
WaylandDevice,
fidl::encoding::DefaultFuchsiaResourceDialect,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 12 {
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 =
<MagmaDevice 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.magma_device.get_or_insert_with(|| {
fidl::new_empty!(MagmaDevice, fidl::encoding::DefaultFuchsiaResourceDialect)
});
fidl::decode!(
MagmaDevice,
fidl::encoding::DefaultFuchsiaResourceDialect,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 13 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.default_net.get_or_insert_with(|| {
fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
});
fidl::decode!(
bool,
fidl::encoding::DefaultFuchsiaResourceDialect,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 14 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.virtio_balloon.get_or_insert_with(|| {
fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
});
fidl::decode!(
bool,
fidl::encoding::DefaultFuchsiaResourceDialect,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 15 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.virtio_console.get_or_insert_with(|| {
fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
});
fidl::decode!(
bool,
fidl::encoding::DefaultFuchsiaResourceDialect,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 16 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.virtio_gpu.get_or_insert_with(|| {
fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
});
fidl::decode!(
bool,
fidl::encoding::DefaultFuchsiaResourceDialect,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 17 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.virtio_rng.get_or_insert_with(|| {
fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
});
fidl::decode!(
bool,
fidl::encoding::DefaultFuchsiaResourceDialect,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 18 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.virtio_vsock.get_or_insert_with(|| {
fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
});
fidl::decode!(
bool,
fidl::encoding::DefaultFuchsiaResourceDialect,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 19 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.virtio_sound.get_or_insert_with(|| {
fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
});
fidl::decode!(
bool,
fidl::encoding::DefaultFuchsiaResourceDialect,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 20 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.virtio_sound_input.get_or_insert_with(|| {
fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
});
fidl::decode!(
bool,
fidl::encoding::DefaultFuchsiaResourceDialect,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 21 {
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<Listener> 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.vsock_listeners.get_or_insert_with(|| {
fidl::new_empty!(
fidl::encoding::UnboundedVector<Listener>,
fidl::encoding::DefaultFuchsiaResourceDialect
)
});
fidl::decode!(
fidl::encoding::UnboundedVector<Listener>,
fidl::encoding::DefaultFuchsiaResourceDialect,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 22 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.virtio_mem.get_or_insert_with(|| {
fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
});
fidl::decode!(
bool,
fidl::encoding::DefaultFuchsiaResourceDialect,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 23 {
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 =
<u64 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.virtio_mem_block_size.get_or_insert_with(|| {
fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
});
fidl::decode!(
u64,
fidl::encoding::DefaultFuchsiaResourceDialect,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 24 {
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 =
<u64 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.virtio_mem_region_size.get_or_insert_with(|| {
fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
});
fidl::decode!(
u64,
fidl::encoding::DefaultFuchsiaResourceDialect,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 25 {
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 =
<u64 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.virtio_mem_region_alignment.get_or_insert_with(|| {
fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
});
fidl::decode!(
u64,
fidl::encoding::DefaultFuchsiaResourceDialect,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
while next_offset < end_offset {
_next_ordinal_to_read += 1;
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
next_offset += envelope_size;
}
Ok(())
}
}
impl GuestDescriptor {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.mem {
return 12;
}
if let Some(_) = self.networks {
return 11;
}
if let Some(_) = self.sound {
return 10;
}
if let Some(_) = self.vsock {
return 9;
}
if let Some(_) = self.rng {
return 8;
}
if let Some(_) = self.gpu {
return 7;
}
if let Some(_) = self.console {
return 6;
}
if let Some(_) = self.balloon {
return 5;
}
if let Some(_) = self.magma {
return 4;
}
if let Some(_) = self.wayland {
return 3;
}
if let Some(_) = self.guest_memory {
return 2;
}
if let Some(_) = self.num_cpus {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for GuestDescriptor {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for GuestDescriptor {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<GuestDescriptor, D>
for &GuestDescriptor
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<GuestDescriptor>(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::<u8, D>(
self.num_cpus.as_ref().map(<u8 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::<u64, D>(
self.guest_memory.as_ref().map(<u64 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::<bool, D>(
self.wayland.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 4 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (4 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<bool, D>(
self.magma.as_ref().map(<bool 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::<bool, D>(
self.balloon.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 6 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (6 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<bool, D>(
self.console.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 7 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (7 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<bool, D>(
self.gpu.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 8 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (8 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<bool, D>(
self.rng.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 9 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (9 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<bool, D>(
self.vsock.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 10 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (10 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<bool, D>(
self.sound.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 11 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (11 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<NetSpec, 32>, D>(
self.networks.as_ref().map(<fidl::encoding::Vector<NetSpec, 32> as fidl::encoding::ValueTypeMarker>::borrow),
encoder, offset + cur_offset, depth
)?;
_prev_end_offset = cur_offset + envelope_size;
if 12 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (12 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<bool, D>(
self.mem.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for GuestDescriptor {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
if len == 0 {
return Ok(());
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 1 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<u8 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.num_cpus.get_or_insert_with(|| fidl::new_empty!(u8, D));
fidl::decode!(u8, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 2 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<u64 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.guest_memory.get_or_insert_with(|| fidl::new_empty!(u64, D));
fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 3 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.wayland.get_or_insert_with(|| fidl::new_empty!(bool, D));
fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 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 =
<bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.magma.get_or_insert_with(|| fidl::new_empty!(bool, D));
fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 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 =
<bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.balloon.get_or_insert_with(|| fidl::new_empty!(bool, D));
fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 6 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.console.get_or_insert_with(|| fidl::new_empty!(bool, D));
fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 7 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.gpu.get_or_insert_with(|| fidl::new_empty!(bool, D));
fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 8 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.rng.get_or_insert_with(|| fidl::new_empty!(bool, D));
fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 9 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.vsock.get_or_insert_with(|| fidl::new_empty!(bool, D));
fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 10 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.sound.get_or_insert_with(|| fidl::new_empty!(bool, D));
fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 11 {
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::Vector<NetSpec, 32> 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.networks.get_or_insert_with(
|| fidl::new_empty!(fidl::encoding::Vector<NetSpec, 32>, D),
);
fidl::decode!(fidl::encoding::Vector<NetSpec, 32>, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 12 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.mem.get_or_insert_with(|| fidl::new_empty!(bool, D));
fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
while next_offset < end_offset {
_next_ordinal_to_read += 1;
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
next_offset += envelope_size;
}
Ok(())
}
}
impl GuestInfo {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.detected_problems {
return 5;
}
if let Some(_) = self.stop_error {
return 4;
}
if let Some(_) = self.guest_descriptor {
return 3;
}
if let Some(_) = self.uptime {
return 2;
}
if let Some(_) = self.guest_status {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for GuestInfo {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for GuestInfo {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<GuestInfo, D>
for &GuestInfo
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<GuestInfo>(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::<GuestStatus, D>(
self.guest_status
.as_ref()
.map(<GuestStatus 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::<i64, D>(
self.uptime.as_ref().map(<i64 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::<GuestDescriptor, D>(
self.guest_descriptor
.as_ref()
.map(<GuestDescriptor 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::<GuestError, D>(
self.stop_error
.as_ref()
.map(<GuestError 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::Vector<fidl::encoding::UnboundedString, 8>, D>(
self.detected_problems.as_ref().map(<fidl::encoding::Vector<fidl::encoding::UnboundedString, 8> as fidl::encoding::ValueTypeMarker>::borrow),
encoder, offset + cur_offset, depth
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for GuestInfo {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
if len == 0 {
return Ok(());
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 1 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<GuestStatus 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.guest_status.get_or_insert_with(|| fidl::new_empty!(GuestStatus, D));
fidl::decode!(GuestStatus, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 2 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<i64 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.uptime.get_or_insert_with(|| fidl::new_empty!(i64, D));
fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 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 =
<GuestDescriptor 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
.guest_descriptor
.get_or_insert_with(|| fidl::new_empty!(GuestDescriptor, D));
fidl::decode!(GuestDescriptor, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 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 =
<GuestError 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.stop_error.get_or_insert_with(|| fidl::new_empty!(GuestError, D));
fidl::decode!(GuestError, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 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::Vector<fidl::encoding::UnboundedString, 8> 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.detected_problems.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<fidl::encoding::UnboundedString, 8>, D));
fidl::decode!(fidl::encoding::Vector<fidl::encoding::UnboundedString, 8>, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
while next_offset < end_offset {
_next_ordinal_to_read += 1;
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
next_offset += envelope_size;
}
Ok(())
}
}
impl LinuxGuestInfo {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.failure_reason {
return 4;
}
if let Some(_) = self.download_percent {
return 3;
}
if let Some(_) = self.container_status {
return 2;
}
if let Some(_) = self.cid {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for LinuxGuestInfo {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for LinuxGuestInfo {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<LinuxGuestInfo, D>
for &LinuxGuestInfo
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<LinuxGuestInfo>(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::<u32, D>(
self.cid.as_ref().map(<u32 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::<ContainerStatus, D>(
self.container_status
.as_ref()
.map(<ContainerStatus 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::<i32, D>(
self.download_percent
.as_ref()
.map(<i32 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::UnboundedString, D>(
self.failure_reason.as_ref().map(
<fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow,
),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for LinuxGuestInfo {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
if len == 0 {
return Ok(());
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 1 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<u32 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.cid.get_or_insert_with(|| fidl::new_empty!(u32, D));
fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 2 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<ContainerStatus 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
.container_status
.get_or_insert_with(|| fidl::new_empty!(ContainerStatus, D));
fidl::decode!(ContainerStatus, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 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 =
<i32 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.download_percent.get_or_insert_with(|| fidl::new_empty!(i32, D));
fidl::decode!(i32, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 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::UnboundedString as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self
.failure_reason
.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::UnboundedString, D));
fidl::decode!(
fidl::encoding::UnboundedString,
D,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
while next_offset < end_offset {
_next_ordinal_to_read += 1;
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
next_offset += envelope_size;
}
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for BlockFormat {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for BlockFormat {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl fidl::encoding::Encode<BlockFormat, fidl::encoding::DefaultFuchsiaResourceDialect>
for &mut BlockFormat
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<BlockFormat>(offset);
encoder.write_num::<u64>(self.ordinal(), offset);
match self {
BlockFormat::File(ref mut val) => fidl::encoding::encode_in_envelope::<
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
<fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
val
),
encoder,
offset + 8,
_depth,
),
BlockFormat::Qcow(ref mut val) => fidl::encoding::encode_in_envelope::<
fidl::encoding::HandleType<
fidl::Channel,
{ fidl::ObjectType::CHANNEL.into_raw() },
2147483648,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
<fidl::encoding::HandleType<
fidl::Channel,
{ fidl::ObjectType::CHANNEL.into_raw() },
2147483648,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
val
),
encoder,
offset + 8,
_depth,
),
BlockFormat::Block(ref mut val) => fidl::encoding::encode_in_envelope::<
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_block::BlockMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
<fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_block::BlockMarker>,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
val
),
encoder,
offset + 8,
_depth,
),
}
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for BlockFormat {
#[inline(always)]
fn new_empty() -> Self {
Self::File(fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect
))
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
#[allow(unused_variables)]
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
let (ordinal, inlined, num_bytes, num_handles) =
fidl::encoding::decode_union_inline_portion(decoder, offset)?;
let member_inline_size = match ordinal {
1 => <fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
> as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2 => <fidl::encoding::HandleType<
fidl::Channel,
{ fidl::ObjectType::CHANNEL.into_raw() },
2147483648,
> as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3 => <fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_block::BlockMarker>,
> as fidl::encoding::TypeMarker>::inline_size(decoder.context),
_ => return Err(fidl::Error::UnknownUnionTag),
};
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let _inner_offset;
if inlined {
decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
_inner_offset = offset + 8;
} else {
depth.increment()?;
_inner_offset = decoder.out_of_line_offset(member_inline_size)?;
}
match ordinal {
1 => {
#[allow(irrefutable_let_patterns)]
if let BlockFormat::File(_) = self {
} else {
*self = BlockFormat::File(fidl::new_empty!(
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect
));
}
#[allow(irrefutable_let_patterns)]
if let BlockFormat::File(ref mut val) = self {
fidl::decode!(
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
val,
decoder,
_inner_offset,
depth
)?;
} else {
unreachable!()
}
}
2 => {
#[allow(irrefutable_let_patterns)]
if let BlockFormat::Qcow(_) = self {
} else {
*self = BlockFormat::Qcow(
fidl::new_empty!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
);
}
#[allow(irrefutable_let_patterns)]
if let BlockFormat::Qcow(ref mut val) = self {
fidl::decode!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
3 => {
#[allow(irrefutable_let_patterns)]
if let BlockFormat::Block(_) = self {
} else {
*self = BlockFormat::Block(fidl::new_empty!(
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<
fidl_fuchsia_hardware_block::BlockMarker,
>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect
));
}
#[allow(irrefutable_let_patterns)]
if let BlockFormat::Block(ref mut val) = self {
fidl::decode!(
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<
fidl_fuchsia_hardware_block::BlockMarker,
>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
val,
decoder,
_inner_offset,
depth
)?;
} else {
unreachable!()
}
}
ordinal => panic!("unexpected ordinal {:?}", ordinal),
}
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
Ok(())
}
}
}