#![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 EVENT_SET_CONFIG: u32 = 1;
pub const EVENT_SET_INTERRUPT: u32 = 2;
pub const EVENT_SET_QUEUE: u32 = 0;
pub const VIRTIO_WAYLAND_INVALID_VFD_ID: u32 = 0;
pub const VIRTIO_WAYLAND_MAX_IMAGE_INFO_SIZE: u32 = 128;
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct StartInfo {
pub trap: Trap,
pub guest: Option<fidl::Guest>,
pub event: fidl::Event,
pub vmo: fidl::Vmo,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for StartInfo {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct Trap {
pub addr: u64,
pub size: u64,
}
impl fidl::Persistable for Trap {}
#[derive(Clone, Debug, PartialEq)]
pub struct VirtioBalloonGetMemStatsResponse {
pub status: i32,
pub mem_stats: Option<Vec<fidl_fuchsia_virtualization::MemStat>>,
}
impl fidl::Persistable for VirtioBalloonGetMemStatsResponse {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct VirtioBalloonStartRequest {
pub start_info: StartInfo,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for VirtioBalloonStartRequest {}
#[derive(Debug, PartialEq)]
pub struct VirtioBlockStartRequest {
pub start_info: StartInfo,
pub spec: fidl_fuchsia_virtualization::BlockSpec,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for VirtioBlockStartRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct VirtioBlockStartResponse {
pub capacity: u64,
pub block_size: u32,
}
impl fidl::Persistable for VirtioBlockStartResponse {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct VirtioConsoleStartRequest {
pub start_info: StartInfo,
pub socket: fidl::Socket,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for VirtioConsoleStartRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct VirtioDeviceConfigureQueueRequest {
pub queue: u16,
pub size: u16,
pub desc: u64,
pub avail: u64,
pub used: u64,
}
impl fidl::Persistable for VirtioDeviceConfigureQueueRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct VirtioDeviceNotifyQueueRequest {
pub queue: u16,
}
impl fidl::Persistable for VirtioDeviceNotifyQueueRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct VirtioDeviceReadyRequest {
pub negotiated_features: u32,
}
impl fidl::Persistable for VirtioDeviceReadyRequest {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct VirtioGpuStartRequest {
pub start_info: StartInfo,
pub keyboard_listener:
Option<fidl::endpoints::ClientEnd<fidl_fuchsia_ui_input3::KeyboardListenerMarker>>,
pub mouse_source:
Option<fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for VirtioGpuStartRequest {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct VirtioImage {
pub vmo: fidl::Vmo,
pub token: Option<fidl::EventPair>,
pub info: Vec<u8>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for VirtioImage {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct VirtioInputStartRequest {
pub start_info: StartInfo,
pub input_type: InputType,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for VirtioInputStartRequest {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct VirtioMagmaStartRequest {
pub start_info: StartInfo,
pub vmar: fidl::Vmar,
pub wayland_importer: Option<fidl::endpoints::ClientEnd<VirtioWaylandImporterMarker>>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for VirtioMagmaStartRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct VirtioMagmaStartResponse {
pub status: i32,
}
impl fidl::Persistable for VirtioMagmaStartResponse {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct VirtioMemOnConfigChangedRequest {
pub plugged_size: u64,
}
impl fidl::Persistable for VirtioMemOnConfigChangedRequest {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct VirtioMemStartRequest {
pub start_info: StartInfo,
pub region_addr: u64,
pub plugged_block_size: u64,
pub region_size: u64,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for VirtioMemStartRequest {}
#[derive(Debug, PartialEq)]
pub struct VirtioNetStartRequest {
pub start_info: StartInfo,
pub mac_address: fidl_fuchsia_net::MacAddress,
pub enable_bridge: bool,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for VirtioNetStartRequest {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct VirtioRngStartRequest {
pub start_info: StartInfo,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for VirtioRngStartRequest {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct VirtioSoundStartRequest {
pub start_info: StartInfo,
pub enable_input: bool,
pub enable_verbose_logging: bool,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for VirtioSoundStartRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct VirtioSoundStartResponse {
pub features: u32,
pub jacks: u32,
pub streams: u32,
pub chmaps: u32,
}
impl fidl::Persistable for VirtioSoundStartResponse {}
#[derive(Debug, PartialEq)]
pub struct VirtioVsockStartRequest {
pub start_info: StartInfo,
pub guest_cid: u32,
pub listeners: Vec<fidl_fuchsia_virtualization::Listener>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for VirtioVsockStartRequest {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct VirtioWaylandGetImporterRequest {
pub importer: fidl::endpoints::ServerEnd<VirtioWaylandImporterMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for VirtioWaylandGetImporterRequest
{
}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct VirtioWaylandImporterExportImageRequest {
pub vfd_id: u32,
}
impl fidl::Persistable for VirtioWaylandImporterExportImageRequest {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct VirtioWaylandImporterExportImageResponse {
pub status: i32,
pub image: Option<Box<VirtioImage>>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for VirtioWaylandImporterExportImageResponse
{
}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct VirtioWaylandImporterImportImageRequest {
pub image: VirtioImage,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for VirtioWaylandImporterImportImageRequest
{
}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct VirtioWaylandImporterImportImageResponse {
pub vfd_id: u32,
}
impl fidl::Persistable for VirtioWaylandImporterImportImageResponse {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct VirtioWaylandStartRequest {
pub start_info: StartInfo,
pub vmar: fidl::Vmar,
pub sysmem_allocator: fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::AllocatorMarker>,
pub scenic_allocator: fidl::endpoints::ClientEnd<fidl_fuchsia_ui_composition::AllocatorMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for VirtioWaylandStartRequest {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct VirtioWaylandStartWithWaylandServerRequest {
pub start_info: StartInfo,
pub vmar: fidl::Vmar,
pub wayland_server: Option<fidl::endpoints::ClientEnd<fidl_fuchsia_wayland::Server_Marker>>,
pub sysmem_allocator: fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::AllocatorMarker>,
pub scenic_allocator: fidl::endpoints::ClientEnd<fidl_fuchsia_ui_composition::AllocatorMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for VirtioWaylandStartWithWaylandServerRequest
{
}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub enum InputType {
Keyboard(fidl::endpoints::ServerEnd<fidl_fuchsia_ui_input3::KeyboardListenerMarker>),
Mouse(fidl::endpoints::ClientEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>),
}
impl InputType {
#[inline]
pub fn ordinal(&self) -> u64 {
match *self {
Self::Keyboard(_) => 1,
Self::Mouse(_) => 2,
}
}
#[deprecated = "Strict unions should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for InputType {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct VirtioBalloonMarker;
impl fidl::endpoints::ProtocolMarker for VirtioBalloonMarker {
type Proxy = VirtioBalloonProxy;
type RequestStream = VirtioBalloonRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = VirtioBalloonSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.virtualization.hardware.VirtioBalloon";
}
impl fidl::endpoints::DiscoverableProtocolMarker for VirtioBalloonMarker {}
pub trait VirtioBalloonProxyInterface: Send + Sync {
type ConfigureQueueResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#configure_queue(
&self,
queue: u16,
size: u16,
desc: u64,
avail: u64,
used: u64,
) -> Self::ConfigureQueueResponseFut;
fn r#notify_queue(&self, queue: u16) -> Result<(), fidl::Error>;
type ReadyResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#ready(&self, negotiated_features: u32) -> Self::ReadyResponseFut;
type StartResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#start(&self, start_info: StartInfo) -> Self::StartResponseFut;
type GetMemStatsResponseFut: std::future::Future<
Output = Result<(i32, Option<Vec<fidl_fuchsia_virtualization::MemStat>>), fidl::Error>,
> + Send;
fn r#get_mem_stats(&self) -> Self::GetMemStatsResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct VirtioBalloonSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for VirtioBalloonSynchronousProxy {
type Proxy = VirtioBalloonProxy;
type Protocol = VirtioBalloonMarker;
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 VirtioBalloonSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <VirtioBalloonMarker 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<VirtioBalloonEvent, fidl::Error> {
VirtioBalloonEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#configure_queue(
&self,
mut queue: u16,
mut size: u16,
mut desc: u64,
mut avail: u64,
mut used: u64,
___deadline: zx::MonotonicInstant,
) -> Result<(), fidl::Error> {
let _response = self
.client
.send_query::<VirtioDeviceConfigureQueueRequest, fidl::encoding::EmptyPayload>(
(queue, size, desc, avail, used),
0x72b44fb963480b11,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
pub fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
self.client.send::<VirtioDeviceNotifyQueueRequest>(
(queue,),
0x6e3a61d652499244,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#ready(
&self,
mut negotiated_features: u32,
___deadline: zx::MonotonicInstant,
) -> Result<(), fidl::Error> {
let _response =
self.client.send_query::<VirtioDeviceReadyRequest, fidl::encoding::EmptyPayload>(
(negotiated_features,),
0x45707654f5d23c3f,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
pub fn r#start(
&self,
mut start_info: StartInfo,
___deadline: zx::MonotonicInstant,
) -> Result<(), fidl::Error> {
let _response =
self.client.send_query::<VirtioBalloonStartRequest, fidl::encoding::EmptyPayload>(
(&mut start_info,),
0x26645282fddf6f46,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
pub fn r#get_mem_stats(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<(i32, Option<Vec<fidl_fuchsia_virtualization::MemStat>>), fidl::Error> {
let _response = self
.client
.send_query::<fidl::encoding::EmptyPayload, VirtioBalloonGetMemStatsResponse>(
(),
0x6641f4c296607e24,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok((_response.status, _response.mem_stats))
}
}
#[derive(Debug, Clone)]
pub struct VirtioBalloonProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for VirtioBalloonProxy {
type Protocol = VirtioBalloonMarker;
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 VirtioBalloonProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <VirtioBalloonMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> VirtioBalloonEventStream {
VirtioBalloonEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#configure_queue(
&self,
mut queue: u16,
mut size: u16,
mut desc: u64,
mut avail: u64,
mut used: u64,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
VirtioBalloonProxyInterface::r#configure_queue(self, queue, size, desc, avail, used)
}
pub fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
VirtioBalloonProxyInterface::r#notify_queue(self, queue)
}
pub fn r#ready(
&self,
mut negotiated_features: u32,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
VirtioBalloonProxyInterface::r#ready(self, negotiated_features)
}
pub fn r#start(
&self,
mut start_info: StartInfo,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
VirtioBalloonProxyInterface::r#start(self, start_info)
}
pub fn r#get_mem_stats(
&self,
) -> fidl::client::QueryResponseFut<
(i32, Option<Vec<fidl_fuchsia_virtualization::MemStat>>),
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
VirtioBalloonProxyInterface::r#get_mem_stats(self)
}
}
impl VirtioBalloonProxyInterface for VirtioBalloonProxy {
type ConfigureQueueResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#configure_queue(
&self,
mut queue: u16,
mut size: u16,
mut desc: u64,
mut avail: u64,
mut used: u64,
) -> Self::ConfigureQueueResponseFut {
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,
0x72b44fb963480b11,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<VirtioDeviceConfigureQueueRequest, ()>(
(queue, size, desc, avail, used),
0x72b44fb963480b11,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
self.client.send::<VirtioDeviceNotifyQueueRequest>(
(queue,),
0x6e3a61d652499244,
fidl::encoding::DynamicFlags::empty(),
)
}
type ReadyResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#ready(&self, mut negotiated_features: u32) -> Self::ReadyResponseFut {
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,
0x45707654f5d23c3f,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<VirtioDeviceReadyRequest, ()>(
(negotiated_features,),
0x45707654f5d23c3f,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type StartResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#start(&self, mut start_info: StartInfo) -> Self::StartResponseFut {
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,
0x26645282fddf6f46,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<VirtioBalloonStartRequest, ()>(
(&mut start_info,),
0x26645282fddf6f46,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type GetMemStatsResponseFut = fidl::client::QueryResponseFut<
(i32, Option<Vec<fidl_fuchsia_virtualization::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<fidl_fuchsia_virtualization::MemStat>>), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
VirtioBalloonGetMemStatsResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x6641f4c296607e24,
>(_buf?)?;
Ok((_response.status, _response.mem_stats))
}
self.client.send_query_and_decode::<
fidl::encoding::EmptyPayload,
(i32, Option<Vec<fidl_fuchsia_virtualization::MemStat>>),
>(
(),
0x6641f4c296607e24,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct VirtioBalloonEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for VirtioBalloonEventStream {}
impl futures::stream::FusedStream for VirtioBalloonEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for VirtioBalloonEventStream {
type Item = Result<VirtioBalloonEvent, 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(VirtioBalloonEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum VirtioBalloonEvent {}
impl VirtioBalloonEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<VirtioBalloonEvent, 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: <VirtioBalloonMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct VirtioBalloonRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for VirtioBalloonRequestStream {}
impl futures::stream::FusedStream for VirtioBalloonRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for VirtioBalloonRequestStream {
type Protocol = VirtioBalloonMarker;
type ControlHandle = VirtioBalloonControlHandle;
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 {
VirtioBalloonControlHandle { 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 VirtioBalloonRequestStream {
type Item = Result<VirtioBalloonRequest, 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 VirtioBalloonRequestStream 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 {
0x72b44fb963480b11 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
VirtioDeviceConfigureQueueRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceConfigureQueueRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
VirtioBalloonControlHandle { inner: this.inner.clone() };
Ok(VirtioBalloonRequest::ConfigureQueue {
queue: req.queue,
size: req.size,
desc: req.desc,
avail: req.avail,
used: req.used,
responder: VirtioBalloonConfigureQueueResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x6e3a61d652499244 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
VirtioDeviceNotifyQueueRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceNotifyQueueRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
VirtioBalloonControlHandle { inner: this.inner.clone() };
Ok(VirtioBalloonRequest::NotifyQueue { queue: req.queue, control_handle })
}
0x45707654f5d23c3f => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
VirtioDeviceReadyRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceReadyRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
VirtioBalloonControlHandle { inner: this.inner.clone() };
Ok(VirtioBalloonRequest::Ready {
negotiated_features: req.negotiated_features,
responder: VirtioBalloonReadyResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x26645282fddf6f46 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
VirtioBalloonStartRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioBalloonStartRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
VirtioBalloonControlHandle { inner: this.inner.clone() };
Ok(VirtioBalloonRequest::Start {
start_info: req.start_info,
responder: VirtioBalloonStartResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x6641f4c296607e24 => {
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 =
VirtioBalloonControlHandle { inner: this.inner.clone() };
Ok(VirtioBalloonRequest::GetMemStats {
responder: VirtioBalloonGetMemStatsResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<VirtioBalloonMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum VirtioBalloonRequest {
ConfigureQueue {
queue: u16,
size: u16,
desc: u64,
avail: u64,
used: u64,
responder: VirtioBalloonConfigureQueueResponder,
},
NotifyQueue { queue: u16, control_handle: VirtioBalloonControlHandle },
Ready { negotiated_features: u32, responder: VirtioBalloonReadyResponder },
Start { start_info: StartInfo, responder: VirtioBalloonStartResponder },
GetMemStats { responder: VirtioBalloonGetMemStatsResponder },
}
impl VirtioBalloonRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_configure_queue(
self,
) -> Option<(u16, u16, u64, u64, u64, VirtioBalloonConfigureQueueResponder)> {
if let VirtioBalloonRequest::ConfigureQueue { queue, size, desc, avail, used, responder } =
self
{
Some((queue, size, desc, avail, used, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_notify_queue(self) -> Option<(u16, VirtioBalloonControlHandle)> {
if let VirtioBalloonRequest::NotifyQueue { queue, control_handle } = self {
Some((queue, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_ready(self) -> Option<(u32, VirtioBalloonReadyResponder)> {
if let VirtioBalloonRequest::Ready { negotiated_features, responder } = self {
Some((negotiated_features, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_start(self) -> Option<(StartInfo, VirtioBalloonStartResponder)> {
if let VirtioBalloonRequest::Start { start_info, responder } = self {
Some((start_info, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_get_mem_stats(self) -> Option<(VirtioBalloonGetMemStatsResponder)> {
if let VirtioBalloonRequest::GetMemStats { responder } = self {
Some((responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
VirtioBalloonRequest::ConfigureQueue { .. } => "configure_queue",
VirtioBalloonRequest::NotifyQueue { .. } => "notify_queue",
VirtioBalloonRequest::Ready { .. } => "ready",
VirtioBalloonRequest::Start { .. } => "start",
VirtioBalloonRequest::GetMemStats { .. } => "get_mem_stats",
}
}
}
#[derive(Debug, Clone)]
pub struct VirtioBalloonControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for VirtioBalloonControlHandle {
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 VirtioBalloonControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct VirtioBalloonConfigureQueueResponder {
control_handle: std::mem::ManuallyDrop<VirtioBalloonControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for VirtioBalloonConfigureQueueResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for VirtioBalloonConfigureQueueResponder {
type ControlHandle = VirtioBalloonControlHandle;
fn control_handle(&self) -> &VirtioBalloonControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl VirtioBalloonConfigureQueueResponder {
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,
0x72b44fb963480b11,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct VirtioBalloonReadyResponder {
control_handle: std::mem::ManuallyDrop<VirtioBalloonControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for VirtioBalloonReadyResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for VirtioBalloonReadyResponder {
type ControlHandle = VirtioBalloonControlHandle;
fn control_handle(&self) -> &VirtioBalloonControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl VirtioBalloonReadyResponder {
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,
0x45707654f5d23c3f,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct VirtioBalloonStartResponder {
control_handle: std::mem::ManuallyDrop<VirtioBalloonControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for VirtioBalloonStartResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for VirtioBalloonStartResponder {
type ControlHandle = VirtioBalloonControlHandle;
fn control_handle(&self) -> &VirtioBalloonControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl VirtioBalloonStartResponder {
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,
0x26645282fddf6f46,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct VirtioBalloonGetMemStatsResponder {
control_handle: std::mem::ManuallyDrop<VirtioBalloonControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for VirtioBalloonGetMemStatsResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for VirtioBalloonGetMemStatsResponder {
type ControlHandle = VirtioBalloonControlHandle;
fn control_handle(&self) -> &VirtioBalloonControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl VirtioBalloonGetMemStatsResponder {
pub fn send(
self,
mut status: i32,
mut mem_stats: Option<&[fidl_fuchsia_virtualization::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<&[fidl_fuchsia_virtualization::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<&[fidl_fuchsia_virtualization::MemStat]>,
) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<VirtioBalloonGetMemStatsResponse>(
(status, mem_stats),
self.tx_id,
0x6641f4c296607e24,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct VirtioBlockMarker;
impl fidl::endpoints::ProtocolMarker for VirtioBlockMarker {
type Proxy = VirtioBlockProxy;
type RequestStream = VirtioBlockRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = VirtioBlockSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.virtualization.hardware.VirtioBlock";
}
impl fidl::endpoints::DiscoverableProtocolMarker for VirtioBlockMarker {}
pub trait VirtioBlockProxyInterface: Send + Sync {
type ConfigureQueueResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#configure_queue(
&self,
queue: u16,
size: u16,
desc: u64,
avail: u64,
used: u64,
) -> Self::ConfigureQueueResponseFut;
fn r#notify_queue(&self, queue: u16) -> Result<(), fidl::Error>;
type ReadyResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#ready(&self, negotiated_features: u32) -> Self::ReadyResponseFut;
type StartResponseFut: std::future::Future<Output = Result<(u64, u32), fidl::Error>> + Send;
fn r#start(
&self,
start_info: StartInfo,
spec: fidl_fuchsia_virtualization::BlockSpec,
) -> Self::StartResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct VirtioBlockSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for VirtioBlockSynchronousProxy {
type Proxy = VirtioBlockProxy;
type Protocol = VirtioBlockMarker;
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 VirtioBlockSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <VirtioBlockMarker 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<VirtioBlockEvent, fidl::Error> {
VirtioBlockEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#configure_queue(
&self,
mut queue: u16,
mut size: u16,
mut desc: u64,
mut avail: u64,
mut used: u64,
___deadline: zx::MonotonicInstant,
) -> Result<(), fidl::Error> {
let _response = self
.client
.send_query::<VirtioDeviceConfigureQueueRequest, fidl::encoding::EmptyPayload>(
(queue, size, desc, avail, used),
0x72b44fb963480b11,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
pub fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
self.client.send::<VirtioDeviceNotifyQueueRequest>(
(queue,),
0x6e3a61d652499244,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#ready(
&self,
mut negotiated_features: u32,
___deadline: zx::MonotonicInstant,
) -> Result<(), fidl::Error> {
let _response =
self.client.send_query::<VirtioDeviceReadyRequest, fidl::encoding::EmptyPayload>(
(negotiated_features,),
0x45707654f5d23c3f,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
pub fn r#start(
&self,
mut start_info: StartInfo,
mut spec: fidl_fuchsia_virtualization::BlockSpec,
___deadline: zx::MonotonicInstant,
) -> Result<(u64, u32), fidl::Error> {
let _response =
self.client.send_query::<VirtioBlockStartRequest, VirtioBlockStartResponse>(
(&mut start_info, &mut spec),
0x5ef6a4b9ce9adcb2,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok((_response.capacity, _response.block_size))
}
}
#[derive(Debug, Clone)]
pub struct VirtioBlockProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for VirtioBlockProxy {
type Protocol = VirtioBlockMarker;
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 VirtioBlockProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <VirtioBlockMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> VirtioBlockEventStream {
VirtioBlockEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#configure_queue(
&self,
mut queue: u16,
mut size: u16,
mut desc: u64,
mut avail: u64,
mut used: u64,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
VirtioBlockProxyInterface::r#configure_queue(self, queue, size, desc, avail, used)
}
pub fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
VirtioBlockProxyInterface::r#notify_queue(self, queue)
}
pub fn r#ready(
&self,
mut negotiated_features: u32,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
VirtioBlockProxyInterface::r#ready(self, negotiated_features)
}
pub fn r#start(
&self,
mut start_info: StartInfo,
mut spec: fidl_fuchsia_virtualization::BlockSpec,
) -> fidl::client::QueryResponseFut<(u64, u32), fidl::encoding::DefaultFuchsiaResourceDialect>
{
VirtioBlockProxyInterface::r#start(self, start_info, spec)
}
}
impl VirtioBlockProxyInterface for VirtioBlockProxy {
type ConfigureQueueResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#configure_queue(
&self,
mut queue: u16,
mut size: u16,
mut desc: u64,
mut avail: u64,
mut used: u64,
) -> Self::ConfigureQueueResponseFut {
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,
0x72b44fb963480b11,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<VirtioDeviceConfigureQueueRequest, ()>(
(queue, size, desc, avail, used),
0x72b44fb963480b11,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
self.client.send::<VirtioDeviceNotifyQueueRequest>(
(queue,),
0x6e3a61d652499244,
fidl::encoding::DynamicFlags::empty(),
)
}
type ReadyResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#ready(&self, mut negotiated_features: u32) -> Self::ReadyResponseFut {
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,
0x45707654f5d23c3f,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<VirtioDeviceReadyRequest, ()>(
(negotiated_features,),
0x45707654f5d23c3f,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type StartResponseFut =
fidl::client::QueryResponseFut<(u64, u32), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#start(
&self,
mut start_info: StartInfo,
mut spec: fidl_fuchsia_virtualization::BlockSpec,
) -> Self::StartResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<(u64, u32), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
VirtioBlockStartResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x5ef6a4b9ce9adcb2,
>(_buf?)?;
Ok((_response.capacity, _response.block_size))
}
self.client.send_query_and_decode::<VirtioBlockStartRequest, (u64, u32)>(
(&mut start_info, &mut spec),
0x5ef6a4b9ce9adcb2,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct VirtioBlockEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for VirtioBlockEventStream {}
impl futures::stream::FusedStream for VirtioBlockEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for VirtioBlockEventStream {
type Item = Result<VirtioBlockEvent, 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(VirtioBlockEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum VirtioBlockEvent {}
impl VirtioBlockEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<VirtioBlockEvent, 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: <VirtioBlockMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct VirtioBlockRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for VirtioBlockRequestStream {}
impl futures::stream::FusedStream for VirtioBlockRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for VirtioBlockRequestStream {
type Protocol = VirtioBlockMarker;
type ControlHandle = VirtioBlockControlHandle;
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 {
VirtioBlockControlHandle { 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 VirtioBlockRequestStream {
type Item = Result<VirtioBlockRequest, 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 VirtioBlockRequestStream 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 {
0x72b44fb963480b11 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
VirtioDeviceConfigureQueueRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceConfigureQueueRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = VirtioBlockControlHandle { inner: this.inner.clone() };
Ok(VirtioBlockRequest::ConfigureQueue {
queue: req.queue,
size: req.size,
desc: req.desc,
avail: req.avail,
used: req.used,
responder: VirtioBlockConfigureQueueResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x6e3a61d652499244 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
VirtioDeviceNotifyQueueRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceNotifyQueueRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = VirtioBlockControlHandle { inner: this.inner.clone() };
Ok(VirtioBlockRequest::NotifyQueue { queue: req.queue, control_handle })
}
0x45707654f5d23c3f => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
VirtioDeviceReadyRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceReadyRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = VirtioBlockControlHandle { inner: this.inner.clone() };
Ok(VirtioBlockRequest::Ready {
negotiated_features: req.negotiated_features,
responder: VirtioBlockReadyResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x5ef6a4b9ce9adcb2 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
VirtioBlockStartRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioBlockStartRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = VirtioBlockControlHandle { inner: this.inner.clone() };
Ok(VirtioBlockRequest::Start {
start_info: req.start_info,
spec: req.spec,
responder: VirtioBlockStartResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<VirtioBlockMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum VirtioBlockRequest {
ConfigureQueue {
queue: u16,
size: u16,
desc: u64,
avail: u64,
used: u64,
responder: VirtioBlockConfigureQueueResponder,
},
NotifyQueue { queue: u16, control_handle: VirtioBlockControlHandle },
Ready { negotiated_features: u32, responder: VirtioBlockReadyResponder },
Start {
start_info: StartInfo,
spec: fidl_fuchsia_virtualization::BlockSpec,
responder: VirtioBlockStartResponder,
},
}
impl VirtioBlockRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_configure_queue(
self,
) -> Option<(u16, u16, u64, u64, u64, VirtioBlockConfigureQueueResponder)> {
if let VirtioBlockRequest::ConfigureQueue { queue, size, desc, avail, used, responder } =
self
{
Some((queue, size, desc, avail, used, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_notify_queue(self) -> Option<(u16, VirtioBlockControlHandle)> {
if let VirtioBlockRequest::NotifyQueue { queue, control_handle } = self {
Some((queue, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_ready(self) -> Option<(u32, VirtioBlockReadyResponder)> {
if let VirtioBlockRequest::Ready { negotiated_features, responder } = self {
Some((negotiated_features, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_start(
self,
) -> Option<(StartInfo, fidl_fuchsia_virtualization::BlockSpec, VirtioBlockStartResponder)>
{
if let VirtioBlockRequest::Start { start_info, spec, responder } = self {
Some((start_info, spec, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
VirtioBlockRequest::ConfigureQueue { .. } => "configure_queue",
VirtioBlockRequest::NotifyQueue { .. } => "notify_queue",
VirtioBlockRequest::Ready { .. } => "ready",
VirtioBlockRequest::Start { .. } => "start",
}
}
}
#[derive(Debug, Clone)]
pub struct VirtioBlockControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for VirtioBlockControlHandle {
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 VirtioBlockControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct VirtioBlockConfigureQueueResponder {
control_handle: std::mem::ManuallyDrop<VirtioBlockControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for VirtioBlockConfigureQueueResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for VirtioBlockConfigureQueueResponder {
type ControlHandle = VirtioBlockControlHandle;
fn control_handle(&self) -> &VirtioBlockControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl VirtioBlockConfigureQueueResponder {
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,
0x72b44fb963480b11,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct VirtioBlockReadyResponder {
control_handle: std::mem::ManuallyDrop<VirtioBlockControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for VirtioBlockReadyResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for VirtioBlockReadyResponder {
type ControlHandle = VirtioBlockControlHandle;
fn control_handle(&self) -> &VirtioBlockControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl VirtioBlockReadyResponder {
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,
0x45707654f5d23c3f,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct VirtioBlockStartResponder {
control_handle: std::mem::ManuallyDrop<VirtioBlockControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for VirtioBlockStartResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for VirtioBlockStartResponder {
type ControlHandle = VirtioBlockControlHandle;
fn control_handle(&self) -> &VirtioBlockControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl VirtioBlockStartResponder {
pub fn send(self, mut capacity: u64, mut block_size: u32) -> Result<(), fidl::Error> {
let _result = self.send_raw(capacity, block_size);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut capacity: u64,
mut block_size: u32,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(capacity, block_size);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut capacity: u64, mut block_size: u32) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<VirtioBlockStartResponse>(
(capacity, block_size),
self.tx_id,
0x5ef6a4b9ce9adcb2,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct VirtioConsoleMarker;
impl fidl::endpoints::ProtocolMarker for VirtioConsoleMarker {
type Proxy = VirtioConsoleProxy;
type RequestStream = VirtioConsoleRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = VirtioConsoleSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.virtualization.hardware.VirtioConsole";
}
impl fidl::endpoints::DiscoverableProtocolMarker for VirtioConsoleMarker {}
pub trait VirtioConsoleProxyInterface: Send + Sync {
type ConfigureQueueResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#configure_queue(
&self,
queue: u16,
size: u16,
desc: u64,
avail: u64,
used: u64,
) -> Self::ConfigureQueueResponseFut;
fn r#notify_queue(&self, queue: u16) -> Result<(), fidl::Error>;
type ReadyResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#ready(&self, negotiated_features: u32) -> Self::ReadyResponseFut;
type StartResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#start(&self, start_info: StartInfo, socket: fidl::Socket) -> Self::StartResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct VirtioConsoleSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for VirtioConsoleSynchronousProxy {
type Proxy = VirtioConsoleProxy;
type Protocol = VirtioConsoleMarker;
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 VirtioConsoleSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <VirtioConsoleMarker 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<VirtioConsoleEvent, fidl::Error> {
VirtioConsoleEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#configure_queue(
&self,
mut queue: u16,
mut size: u16,
mut desc: u64,
mut avail: u64,
mut used: u64,
___deadline: zx::MonotonicInstant,
) -> Result<(), fidl::Error> {
let _response = self
.client
.send_query::<VirtioDeviceConfigureQueueRequest, fidl::encoding::EmptyPayload>(
(queue, size, desc, avail, used),
0x72b44fb963480b11,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
pub fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
self.client.send::<VirtioDeviceNotifyQueueRequest>(
(queue,),
0x6e3a61d652499244,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#ready(
&self,
mut negotiated_features: u32,
___deadline: zx::MonotonicInstant,
) -> Result<(), fidl::Error> {
let _response =
self.client.send_query::<VirtioDeviceReadyRequest, fidl::encoding::EmptyPayload>(
(negotiated_features,),
0x45707654f5d23c3f,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
pub fn r#start(
&self,
mut start_info: StartInfo,
mut socket: fidl::Socket,
___deadline: zx::MonotonicInstant,
) -> Result<(), fidl::Error> {
let _response =
self.client.send_query::<VirtioConsoleStartRequest, fidl::encoding::EmptyPayload>(
(&mut start_info, socket),
0x10a6267f2ab7e24c,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
}
#[derive(Debug, Clone)]
pub struct VirtioConsoleProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for VirtioConsoleProxy {
type Protocol = VirtioConsoleMarker;
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 VirtioConsoleProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <VirtioConsoleMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> VirtioConsoleEventStream {
VirtioConsoleEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#configure_queue(
&self,
mut queue: u16,
mut size: u16,
mut desc: u64,
mut avail: u64,
mut used: u64,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
VirtioConsoleProxyInterface::r#configure_queue(self, queue, size, desc, avail, used)
}
pub fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
VirtioConsoleProxyInterface::r#notify_queue(self, queue)
}
pub fn r#ready(
&self,
mut negotiated_features: u32,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
VirtioConsoleProxyInterface::r#ready(self, negotiated_features)
}
pub fn r#start(
&self,
mut start_info: StartInfo,
mut socket: fidl::Socket,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
VirtioConsoleProxyInterface::r#start(self, start_info, socket)
}
}
impl VirtioConsoleProxyInterface for VirtioConsoleProxy {
type ConfigureQueueResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#configure_queue(
&self,
mut queue: u16,
mut size: u16,
mut desc: u64,
mut avail: u64,
mut used: u64,
) -> Self::ConfigureQueueResponseFut {
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,
0x72b44fb963480b11,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<VirtioDeviceConfigureQueueRequest, ()>(
(queue, size, desc, avail, used),
0x72b44fb963480b11,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
self.client.send::<VirtioDeviceNotifyQueueRequest>(
(queue,),
0x6e3a61d652499244,
fidl::encoding::DynamicFlags::empty(),
)
}
type ReadyResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#ready(&self, mut negotiated_features: u32) -> Self::ReadyResponseFut {
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,
0x45707654f5d23c3f,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<VirtioDeviceReadyRequest, ()>(
(negotiated_features,),
0x45707654f5d23c3f,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type StartResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#start(
&self,
mut start_info: StartInfo,
mut socket: fidl::Socket,
) -> Self::StartResponseFut {
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,
0x10a6267f2ab7e24c,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<VirtioConsoleStartRequest, ()>(
(&mut start_info, socket),
0x10a6267f2ab7e24c,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct VirtioConsoleEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for VirtioConsoleEventStream {}
impl futures::stream::FusedStream for VirtioConsoleEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for VirtioConsoleEventStream {
type Item = Result<VirtioConsoleEvent, 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(VirtioConsoleEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum VirtioConsoleEvent {}
impl VirtioConsoleEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<VirtioConsoleEvent, 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: <VirtioConsoleMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct VirtioConsoleRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for VirtioConsoleRequestStream {}
impl futures::stream::FusedStream for VirtioConsoleRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for VirtioConsoleRequestStream {
type Protocol = VirtioConsoleMarker;
type ControlHandle = VirtioConsoleControlHandle;
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 {
VirtioConsoleControlHandle { 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 VirtioConsoleRequestStream {
type Item = Result<VirtioConsoleRequest, 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 VirtioConsoleRequestStream 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 {
0x72b44fb963480b11 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
VirtioDeviceConfigureQueueRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceConfigureQueueRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
VirtioConsoleControlHandle { inner: this.inner.clone() };
Ok(VirtioConsoleRequest::ConfigureQueue {
queue: req.queue,
size: req.size,
desc: req.desc,
avail: req.avail,
used: req.used,
responder: VirtioConsoleConfigureQueueResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x6e3a61d652499244 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
VirtioDeviceNotifyQueueRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceNotifyQueueRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
VirtioConsoleControlHandle { inner: this.inner.clone() };
Ok(VirtioConsoleRequest::NotifyQueue { queue: req.queue, control_handle })
}
0x45707654f5d23c3f => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
VirtioDeviceReadyRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceReadyRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
VirtioConsoleControlHandle { inner: this.inner.clone() };
Ok(VirtioConsoleRequest::Ready {
negotiated_features: req.negotiated_features,
responder: VirtioConsoleReadyResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x10a6267f2ab7e24c => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
VirtioConsoleStartRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioConsoleStartRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
VirtioConsoleControlHandle { inner: this.inner.clone() };
Ok(VirtioConsoleRequest::Start {
start_info: req.start_info,
socket: req.socket,
responder: VirtioConsoleStartResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<VirtioConsoleMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum VirtioConsoleRequest {
ConfigureQueue {
queue: u16,
size: u16,
desc: u64,
avail: u64,
used: u64,
responder: VirtioConsoleConfigureQueueResponder,
},
NotifyQueue { queue: u16, control_handle: VirtioConsoleControlHandle },
Ready { negotiated_features: u32, responder: VirtioConsoleReadyResponder },
Start { start_info: StartInfo, socket: fidl::Socket, responder: VirtioConsoleStartResponder },
}
impl VirtioConsoleRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_configure_queue(
self,
) -> Option<(u16, u16, u64, u64, u64, VirtioConsoleConfigureQueueResponder)> {
if let VirtioConsoleRequest::ConfigureQueue { queue, size, desc, avail, used, responder } =
self
{
Some((queue, size, desc, avail, used, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_notify_queue(self) -> Option<(u16, VirtioConsoleControlHandle)> {
if let VirtioConsoleRequest::NotifyQueue { queue, control_handle } = self {
Some((queue, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_ready(self) -> Option<(u32, VirtioConsoleReadyResponder)> {
if let VirtioConsoleRequest::Ready { negotiated_features, responder } = self {
Some((negotiated_features, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_start(self) -> Option<(StartInfo, fidl::Socket, VirtioConsoleStartResponder)> {
if let VirtioConsoleRequest::Start { start_info, socket, responder } = self {
Some((start_info, socket, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
VirtioConsoleRequest::ConfigureQueue { .. } => "configure_queue",
VirtioConsoleRequest::NotifyQueue { .. } => "notify_queue",
VirtioConsoleRequest::Ready { .. } => "ready",
VirtioConsoleRequest::Start { .. } => "start",
}
}
}
#[derive(Debug, Clone)]
pub struct VirtioConsoleControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for VirtioConsoleControlHandle {
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 VirtioConsoleControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct VirtioConsoleConfigureQueueResponder {
control_handle: std::mem::ManuallyDrop<VirtioConsoleControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for VirtioConsoleConfigureQueueResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for VirtioConsoleConfigureQueueResponder {
type ControlHandle = VirtioConsoleControlHandle;
fn control_handle(&self) -> &VirtioConsoleControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl VirtioConsoleConfigureQueueResponder {
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,
0x72b44fb963480b11,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct VirtioConsoleReadyResponder {
control_handle: std::mem::ManuallyDrop<VirtioConsoleControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for VirtioConsoleReadyResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for VirtioConsoleReadyResponder {
type ControlHandle = VirtioConsoleControlHandle;
fn control_handle(&self) -> &VirtioConsoleControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl VirtioConsoleReadyResponder {
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,
0x45707654f5d23c3f,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct VirtioConsoleStartResponder {
control_handle: std::mem::ManuallyDrop<VirtioConsoleControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for VirtioConsoleStartResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for VirtioConsoleStartResponder {
type ControlHandle = VirtioConsoleControlHandle;
fn control_handle(&self) -> &VirtioConsoleControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl VirtioConsoleStartResponder {
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,
0x10a6267f2ab7e24c,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct VirtioDeviceMarker;
impl fidl::endpoints::ProtocolMarker for VirtioDeviceMarker {
type Proxy = VirtioDeviceProxy;
type RequestStream = VirtioDeviceRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = VirtioDeviceSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) VirtioDevice";
}
pub trait VirtioDeviceProxyInterface: Send + Sync {
type ConfigureQueueResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#configure_queue(
&self,
queue: u16,
size: u16,
desc: u64,
avail: u64,
used: u64,
) -> Self::ConfigureQueueResponseFut;
fn r#notify_queue(&self, queue: u16) -> Result<(), fidl::Error>;
type ReadyResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#ready(&self, negotiated_features: u32) -> Self::ReadyResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct VirtioDeviceSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for VirtioDeviceSynchronousProxy {
type Proxy = VirtioDeviceProxy;
type Protocol = VirtioDeviceMarker;
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 VirtioDeviceSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <VirtioDeviceMarker 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<VirtioDeviceEvent, fidl::Error> {
VirtioDeviceEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#configure_queue(
&self,
mut queue: u16,
mut size: u16,
mut desc: u64,
mut avail: u64,
mut used: u64,
___deadline: zx::MonotonicInstant,
) -> Result<(), fidl::Error> {
let _response = self
.client
.send_query::<VirtioDeviceConfigureQueueRequest, fidl::encoding::EmptyPayload>(
(queue, size, desc, avail, used),
0x72b44fb963480b11,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
pub fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
self.client.send::<VirtioDeviceNotifyQueueRequest>(
(queue,),
0x6e3a61d652499244,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#ready(
&self,
mut negotiated_features: u32,
___deadline: zx::MonotonicInstant,
) -> Result<(), fidl::Error> {
let _response =
self.client.send_query::<VirtioDeviceReadyRequest, fidl::encoding::EmptyPayload>(
(negotiated_features,),
0x45707654f5d23c3f,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
}
#[derive(Debug, Clone)]
pub struct VirtioDeviceProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for VirtioDeviceProxy {
type Protocol = VirtioDeviceMarker;
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 VirtioDeviceProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <VirtioDeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> VirtioDeviceEventStream {
VirtioDeviceEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#configure_queue(
&self,
mut queue: u16,
mut size: u16,
mut desc: u64,
mut avail: u64,
mut used: u64,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
VirtioDeviceProxyInterface::r#configure_queue(self, queue, size, desc, avail, used)
}
pub fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
VirtioDeviceProxyInterface::r#notify_queue(self, queue)
}
pub fn r#ready(
&self,
mut negotiated_features: u32,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
VirtioDeviceProxyInterface::r#ready(self, negotiated_features)
}
}
impl VirtioDeviceProxyInterface for VirtioDeviceProxy {
type ConfigureQueueResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#configure_queue(
&self,
mut queue: u16,
mut size: u16,
mut desc: u64,
mut avail: u64,
mut used: u64,
) -> Self::ConfigureQueueResponseFut {
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,
0x72b44fb963480b11,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<VirtioDeviceConfigureQueueRequest, ()>(
(queue, size, desc, avail, used),
0x72b44fb963480b11,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
self.client.send::<VirtioDeviceNotifyQueueRequest>(
(queue,),
0x6e3a61d652499244,
fidl::encoding::DynamicFlags::empty(),
)
}
type ReadyResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#ready(&self, mut negotiated_features: u32) -> Self::ReadyResponseFut {
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,
0x45707654f5d23c3f,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<VirtioDeviceReadyRequest, ()>(
(negotiated_features,),
0x45707654f5d23c3f,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct VirtioDeviceEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for VirtioDeviceEventStream {}
impl futures::stream::FusedStream for VirtioDeviceEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for VirtioDeviceEventStream {
type Item = Result<VirtioDeviceEvent, 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(VirtioDeviceEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum VirtioDeviceEvent {}
impl VirtioDeviceEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<VirtioDeviceEvent, 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: <VirtioDeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct VirtioDeviceRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for VirtioDeviceRequestStream {}
impl futures::stream::FusedStream for VirtioDeviceRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for VirtioDeviceRequestStream {
type Protocol = VirtioDeviceMarker;
type ControlHandle = VirtioDeviceControlHandle;
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 {
VirtioDeviceControlHandle { 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 VirtioDeviceRequestStream {
type Item = Result<VirtioDeviceRequest, 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 VirtioDeviceRequestStream 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 {
0x72b44fb963480b11 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
VirtioDeviceConfigureQueueRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceConfigureQueueRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
VirtioDeviceControlHandle { inner: this.inner.clone() };
Ok(VirtioDeviceRequest::ConfigureQueue {
queue: req.queue,
size: req.size,
desc: req.desc,
avail: req.avail,
used: req.used,
responder: VirtioDeviceConfigureQueueResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x6e3a61d652499244 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
VirtioDeviceNotifyQueueRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceNotifyQueueRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
VirtioDeviceControlHandle { inner: this.inner.clone() };
Ok(VirtioDeviceRequest::NotifyQueue { queue: req.queue, control_handle })
}
0x45707654f5d23c3f => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
VirtioDeviceReadyRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceReadyRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
VirtioDeviceControlHandle { inner: this.inner.clone() };
Ok(VirtioDeviceRequest::Ready {
negotiated_features: req.negotiated_features,
responder: VirtioDeviceReadyResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<VirtioDeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum VirtioDeviceRequest {
ConfigureQueue {
queue: u16,
size: u16,
desc: u64,
avail: u64,
used: u64,
responder: VirtioDeviceConfigureQueueResponder,
},
NotifyQueue { queue: u16, control_handle: VirtioDeviceControlHandle },
Ready { negotiated_features: u32, responder: VirtioDeviceReadyResponder },
}
impl VirtioDeviceRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_configure_queue(
self,
) -> Option<(u16, u16, u64, u64, u64, VirtioDeviceConfigureQueueResponder)> {
if let VirtioDeviceRequest::ConfigureQueue { queue, size, desc, avail, used, responder } =
self
{
Some((queue, size, desc, avail, used, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_notify_queue(self) -> Option<(u16, VirtioDeviceControlHandle)> {
if let VirtioDeviceRequest::NotifyQueue { queue, control_handle } = self {
Some((queue, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_ready(self) -> Option<(u32, VirtioDeviceReadyResponder)> {
if let VirtioDeviceRequest::Ready { negotiated_features, responder } = self {
Some((negotiated_features, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
VirtioDeviceRequest::ConfigureQueue { .. } => "configure_queue",
VirtioDeviceRequest::NotifyQueue { .. } => "notify_queue",
VirtioDeviceRequest::Ready { .. } => "ready",
}
}
}
#[derive(Debug, Clone)]
pub struct VirtioDeviceControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for VirtioDeviceControlHandle {
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 VirtioDeviceControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct VirtioDeviceConfigureQueueResponder {
control_handle: std::mem::ManuallyDrop<VirtioDeviceControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for VirtioDeviceConfigureQueueResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for VirtioDeviceConfigureQueueResponder {
type ControlHandle = VirtioDeviceControlHandle;
fn control_handle(&self) -> &VirtioDeviceControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl VirtioDeviceConfigureQueueResponder {
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,
0x72b44fb963480b11,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct VirtioDeviceReadyResponder {
control_handle: std::mem::ManuallyDrop<VirtioDeviceControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for VirtioDeviceReadyResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for VirtioDeviceReadyResponder {
type ControlHandle = VirtioDeviceControlHandle;
fn control_handle(&self) -> &VirtioDeviceControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl VirtioDeviceReadyResponder {
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,
0x45707654f5d23c3f,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct VirtioGpuMarker;
impl fidl::endpoints::ProtocolMarker for VirtioGpuMarker {
type Proxy = VirtioGpuProxy;
type RequestStream = VirtioGpuRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = VirtioGpuSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.virtualization.hardware.VirtioGpu";
}
impl fidl::endpoints::DiscoverableProtocolMarker for VirtioGpuMarker {}
pub trait VirtioGpuProxyInterface: Send + Sync {
type ConfigureQueueResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#configure_queue(
&self,
queue: u16,
size: u16,
desc: u64,
avail: u64,
used: u64,
) -> Self::ConfigureQueueResponseFut;
fn r#notify_queue(&self, queue: u16) -> Result<(), fidl::Error>;
type ReadyResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#ready(&self, negotiated_features: u32) -> Self::ReadyResponseFut;
type StartResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#start(
&self,
start_info: StartInfo,
keyboard_listener: Option<
fidl::endpoints::ClientEnd<fidl_fuchsia_ui_input3::KeyboardListenerMarker>,
>,
mouse_source: Option<
fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>,
>,
) -> Self::StartResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct VirtioGpuSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for VirtioGpuSynchronousProxy {
type Proxy = VirtioGpuProxy;
type Protocol = VirtioGpuMarker;
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 VirtioGpuSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <VirtioGpuMarker 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<VirtioGpuEvent, fidl::Error> {
VirtioGpuEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#configure_queue(
&self,
mut queue: u16,
mut size: u16,
mut desc: u64,
mut avail: u64,
mut used: u64,
___deadline: zx::MonotonicInstant,
) -> Result<(), fidl::Error> {
let _response = self
.client
.send_query::<VirtioDeviceConfigureQueueRequest, fidl::encoding::EmptyPayload>(
(queue, size, desc, avail, used),
0x72b44fb963480b11,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
pub fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
self.client.send::<VirtioDeviceNotifyQueueRequest>(
(queue,),
0x6e3a61d652499244,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#ready(
&self,
mut negotiated_features: u32,
___deadline: zx::MonotonicInstant,
) -> Result<(), fidl::Error> {
let _response =
self.client.send_query::<VirtioDeviceReadyRequest, fidl::encoding::EmptyPayload>(
(negotiated_features,),
0x45707654f5d23c3f,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
pub fn r#start(
&self,
mut start_info: StartInfo,
mut keyboard_listener: Option<
fidl::endpoints::ClientEnd<fidl_fuchsia_ui_input3::KeyboardListenerMarker>,
>,
mut mouse_source: Option<
fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>,
>,
___deadline: zx::MonotonicInstant,
) -> Result<(), fidl::Error> {
let _response =
self.client.send_query::<VirtioGpuStartRequest, fidl::encoding::EmptyPayload>(
(&mut start_info, keyboard_listener, mouse_source),
0x7e81ed410f770c14,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
}
#[derive(Debug, Clone)]
pub struct VirtioGpuProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for VirtioGpuProxy {
type Protocol = VirtioGpuMarker;
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 VirtioGpuProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <VirtioGpuMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> VirtioGpuEventStream {
VirtioGpuEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#configure_queue(
&self,
mut queue: u16,
mut size: u16,
mut desc: u64,
mut avail: u64,
mut used: u64,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
VirtioGpuProxyInterface::r#configure_queue(self, queue, size, desc, avail, used)
}
pub fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
VirtioGpuProxyInterface::r#notify_queue(self, queue)
}
pub fn r#ready(
&self,
mut negotiated_features: u32,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
VirtioGpuProxyInterface::r#ready(self, negotiated_features)
}
pub fn r#start(
&self,
mut start_info: StartInfo,
mut keyboard_listener: Option<
fidl::endpoints::ClientEnd<fidl_fuchsia_ui_input3::KeyboardListenerMarker>,
>,
mut mouse_source: Option<
fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>,
>,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
VirtioGpuProxyInterface::r#start(self, start_info, keyboard_listener, mouse_source)
}
}
impl VirtioGpuProxyInterface for VirtioGpuProxy {
type ConfigureQueueResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#configure_queue(
&self,
mut queue: u16,
mut size: u16,
mut desc: u64,
mut avail: u64,
mut used: u64,
) -> Self::ConfigureQueueResponseFut {
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,
0x72b44fb963480b11,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<VirtioDeviceConfigureQueueRequest, ()>(
(queue, size, desc, avail, used),
0x72b44fb963480b11,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
self.client.send::<VirtioDeviceNotifyQueueRequest>(
(queue,),
0x6e3a61d652499244,
fidl::encoding::DynamicFlags::empty(),
)
}
type ReadyResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#ready(&self, mut negotiated_features: u32) -> Self::ReadyResponseFut {
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,
0x45707654f5d23c3f,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<VirtioDeviceReadyRequest, ()>(
(negotiated_features,),
0x45707654f5d23c3f,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type StartResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#start(
&self,
mut start_info: StartInfo,
mut keyboard_listener: Option<
fidl::endpoints::ClientEnd<fidl_fuchsia_ui_input3::KeyboardListenerMarker>,
>,
mut mouse_source: Option<
fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>,
>,
) -> Self::StartResponseFut {
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,
0x7e81ed410f770c14,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<VirtioGpuStartRequest, ()>(
(&mut start_info, keyboard_listener, mouse_source),
0x7e81ed410f770c14,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct VirtioGpuEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for VirtioGpuEventStream {}
impl futures::stream::FusedStream for VirtioGpuEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for VirtioGpuEventStream {
type Item = Result<VirtioGpuEvent, 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(VirtioGpuEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum VirtioGpuEvent {
OnConfigChanged {},
}
impl VirtioGpuEvent {
#[allow(irrefutable_let_patterns)]
pub fn into_on_config_changed(self) -> Option<()> {
if let VirtioGpuEvent::OnConfigChanged {} = self {
Some(())
} else {
None
}
}
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<VirtioGpuEvent, 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 {
0x1555f5b7c8444aa0 => {
let mut out = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&tx_header, _body_bytes, _handles, &mut out)?;
Ok((VirtioGpuEvent::OnConfigChanged {}))
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name: <VirtioGpuMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct VirtioGpuRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for VirtioGpuRequestStream {}
impl futures::stream::FusedStream for VirtioGpuRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for VirtioGpuRequestStream {
type Protocol = VirtioGpuMarker;
type ControlHandle = VirtioGpuControlHandle;
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 {
VirtioGpuControlHandle { 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 VirtioGpuRequestStream {
type Item = Result<VirtioGpuRequest, 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 VirtioGpuRequestStream 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 {
0x72b44fb963480b11 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
VirtioDeviceConfigureQueueRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceConfigureQueueRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = VirtioGpuControlHandle { inner: this.inner.clone() };
Ok(VirtioGpuRequest::ConfigureQueue {
queue: req.queue,
size: req.size,
desc: req.desc,
avail: req.avail,
used: req.used,
responder: VirtioGpuConfigureQueueResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x6e3a61d652499244 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
VirtioDeviceNotifyQueueRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceNotifyQueueRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = VirtioGpuControlHandle { inner: this.inner.clone() };
Ok(VirtioGpuRequest::NotifyQueue { queue: req.queue, control_handle })
}
0x45707654f5d23c3f => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
VirtioDeviceReadyRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceReadyRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = VirtioGpuControlHandle { inner: this.inner.clone() };
Ok(VirtioGpuRequest::Ready {
negotiated_features: req.negotiated_features,
responder: VirtioGpuReadyResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x7e81ed410f770c14 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
VirtioGpuStartRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioGpuStartRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = VirtioGpuControlHandle { inner: this.inner.clone() };
Ok(VirtioGpuRequest::Start {
start_info: req.start_info,
keyboard_listener: req.keyboard_listener,
mouse_source: req.mouse_source,
responder: VirtioGpuStartResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<VirtioGpuMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum VirtioGpuRequest {
ConfigureQueue {
queue: u16,
size: u16,
desc: u64,
avail: u64,
used: u64,
responder: VirtioGpuConfigureQueueResponder,
},
NotifyQueue { queue: u16, control_handle: VirtioGpuControlHandle },
Ready { negotiated_features: u32, responder: VirtioGpuReadyResponder },
Start {
start_info: StartInfo,
keyboard_listener:
Option<fidl::endpoints::ClientEnd<fidl_fuchsia_ui_input3::KeyboardListenerMarker>>,
mouse_source:
Option<fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>>,
responder: VirtioGpuStartResponder,
},
}
impl VirtioGpuRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_configure_queue(
self,
) -> Option<(u16, u16, u64, u64, u64, VirtioGpuConfigureQueueResponder)> {
if let VirtioGpuRequest::ConfigureQueue { queue, size, desc, avail, used, responder } = self
{
Some((queue, size, desc, avail, used, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_notify_queue(self) -> Option<(u16, VirtioGpuControlHandle)> {
if let VirtioGpuRequest::NotifyQueue { queue, control_handle } = self {
Some((queue, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_ready(self) -> Option<(u32, VirtioGpuReadyResponder)> {
if let VirtioGpuRequest::Ready { negotiated_features, responder } = self {
Some((negotiated_features, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_start(
self,
) -> Option<(
StartInfo,
Option<fidl::endpoints::ClientEnd<fidl_fuchsia_ui_input3::KeyboardListenerMarker>>,
Option<fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>>,
VirtioGpuStartResponder,
)> {
if let VirtioGpuRequest::Start { start_info, keyboard_listener, mouse_source, responder } =
self
{
Some((start_info, keyboard_listener, mouse_source, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
VirtioGpuRequest::ConfigureQueue { .. } => "configure_queue",
VirtioGpuRequest::NotifyQueue { .. } => "notify_queue",
VirtioGpuRequest::Ready { .. } => "ready",
VirtioGpuRequest::Start { .. } => "start",
}
}
}
#[derive(Debug, Clone)]
pub struct VirtioGpuControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for VirtioGpuControlHandle {
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 VirtioGpuControlHandle {
pub fn send_on_config_changed(&self) -> Result<(), fidl::Error> {
self.inner.send::<fidl::encoding::EmptyPayload>(
(),
0,
0x1555f5b7c8444aa0,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct VirtioGpuConfigureQueueResponder {
control_handle: std::mem::ManuallyDrop<VirtioGpuControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for VirtioGpuConfigureQueueResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for VirtioGpuConfigureQueueResponder {
type ControlHandle = VirtioGpuControlHandle;
fn control_handle(&self) -> &VirtioGpuControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl VirtioGpuConfigureQueueResponder {
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,
0x72b44fb963480b11,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct VirtioGpuReadyResponder {
control_handle: std::mem::ManuallyDrop<VirtioGpuControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for VirtioGpuReadyResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for VirtioGpuReadyResponder {
type ControlHandle = VirtioGpuControlHandle;
fn control_handle(&self) -> &VirtioGpuControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl VirtioGpuReadyResponder {
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,
0x45707654f5d23c3f,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct VirtioGpuStartResponder {
control_handle: std::mem::ManuallyDrop<VirtioGpuControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for VirtioGpuStartResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for VirtioGpuStartResponder {
type ControlHandle = VirtioGpuControlHandle;
fn control_handle(&self) -> &VirtioGpuControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl VirtioGpuStartResponder {
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,
0x7e81ed410f770c14,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct VirtioInputMarker;
impl fidl::endpoints::ProtocolMarker for VirtioInputMarker {
type Proxy = VirtioInputProxy;
type RequestStream = VirtioInputRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = VirtioInputSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.virtualization.hardware.VirtioInput";
}
impl fidl::endpoints::DiscoverableProtocolMarker for VirtioInputMarker {}
pub trait VirtioInputProxyInterface: Send + Sync {
type ConfigureQueueResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#configure_queue(
&self,
queue: u16,
size: u16,
desc: u64,
avail: u64,
used: u64,
) -> Self::ConfigureQueueResponseFut;
fn r#notify_queue(&self, queue: u16) -> Result<(), fidl::Error>;
type ReadyResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#ready(&self, negotiated_features: u32) -> Self::ReadyResponseFut;
type StartResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#start(&self, start_info: StartInfo, input_type: InputType) -> Self::StartResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct VirtioInputSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for VirtioInputSynchronousProxy {
type Proxy = VirtioInputProxy;
type Protocol = VirtioInputMarker;
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 VirtioInputSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <VirtioInputMarker 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<VirtioInputEvent, fidl::Error> {
VirtioInputEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#configure_queue(
&self,
mut queue: u16,
mut size: u16,
mut desc: u64,
mut avail: u64,
mut used: u64,
___deadline: zx::MonotonicInstant,
) -> Result<(), fidl::Error> {
let _response = self
.client
.send_query::<VirtioDeviceConfigureQueueRequest, fidl::encoding::EmptyPayload>(
(queue, size, desc, avail, used),
0x72b44fb963480b11,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
pub fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
self.client.send::<VirtioDeviceNotifyQueueRequest>(
(queue,),
0x6e3a61d652499244,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#ready(
&self,
mut negotiated_features: u32,
___deadline: zx::MonotonicInstant,
) -> Result<(), fidl::Error> {
let _response =
self.client.send_query::<VirtioDeviceReadyRequest, fidl::encoding::EmptyPayload>(
(negotiated_features,),
0x45707654f5d23c3f,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
pub fn r#start(
&self,
mut start_info: StartInfo,
mut input_type: InputType,
___deadline: zx::MonotonicInstant,
) -> Result<(), fidl::Error> {
let _response =
self.client.send_query::<VirtioInputStartRequest, fidl::encoding::EmptyPayload>(
(&mut start_info, &mut input_type),
0x612743931f7f9249,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
}
#[derive(Debug, Clone)]
pub struct VirtioInputProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for VirtioInputProxy {
type Protocol = VirtioInputMarker;
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 VirtioInputProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <VirtioInputMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> VirtioInputEventStream {
VirtioInputEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#configure_queue(
&self,
mut queue: u16,
mut size: u16,
mut desc: u64,
mut avail: u64,
mut used: u64,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
VirtioInputProxyInterface::r#configure_queue(self, queue, size, desc, avail, used)
}
pub fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
VirtioInputProxyInterface::r#notify_queue(self, queue)
}
pub fn r#ready(
&self,
mut negotiated_features: u32,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
VirtioInputProxyInterface::r#ready(self, negotiated_features)
}
pub fn r#start(
&self,
mut start_info: StartInfo,
mut input_type: InputType,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
VirtioInputProxyInterface::r#start(self, start_info, input_type)
}
}
impl VirtioInputProxyInterface for VirtioInputProxy {
type ConfigureQueueResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#configure_queue(
&self,
mut queue: u16,
mut size: u16,
mut desc: u64,
mut avail: u64,
mut used: u64,
) -> Self::ConfigureQueueResponseFut {
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,
0x72b44fb963480b11,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<VirtioDeviceConfigureQueueRequest, ()>(
(queue, size, desc, avail, used),
0x72b44fb963480b11,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
self.client.send::<VirtioDeviceNotifyQueueRequest>(
(queue,),
0x6e3a61d652499244,
fidl::encoding::DynamicFlags::empty(),
)
}
type ReadyResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#ready(&self, mut negotiated_features: u32) -> Self::ReadyResponseFut {
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,
0x45707654f5d23c3f,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<VirtioDeviceReadyRequest, ()>(
(negotiated_features,),
0x45707654f5d23c3f,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type StartResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#start(
&self,
mut start_info: StartInfo,
mut input_type: InputType,
) -> Self::StartResponseFut {
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,
0x612743931f7f9249,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<VirtioInputStartRequest, ()>(
(&mut start_info, &mut input_type),
0x612743931f7f9249,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct VirtioInputEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for VirtioInputEventStream {}
impl futures::stream::FusedStream for VirtioInputEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for VirtioInputEventStream {
type Item = Result<VirtioInputEvent, 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(VirtioInputEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum VirtioInputEvent {}
impl VirtioInputEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<VirtioInputEvent, 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: <VirtioInputMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct VirtioInputRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for VirtioInputRequestStream {}
impl futures::stream::FusedStream for VirtioInputRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for VirtioInputRequestStream {
type Protocol = VirtioInputMarker;
type ControlHandle = VirtioInputControlHandle;
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 {
VirtioInputControlHandle { 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 VirtioInputRequestStream {
type Item = Result<VirtioInputRequest, 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 VirtioInputRequestStream 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 {
0x72b44fb963480b11 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
VirtioDeviceConfigureQueueRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceConfigureQueueRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = VirtioInputControlHandle { inner: this.inner.clone() };
Ok(VirtioInputRequest::ConfigureQueue {
queue: req.queue,
size: req.size,
desc: req.desc,
avail: req.avail,
used: req.used,
responder: VirtioInputConfigureQueueResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x6e3a61d652499244 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
VirtioDeviceNotifyQueueRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceNotifyQueueRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = VirtioInputControlHandle { inner: this.inner.clone() };
Ok(VirtioInputRequest::NotifyQueue { queue: req.queue, control_handle })
}
0x45707654f5d23c3f => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
VirtioDeviceReadyRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceReadyRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = VirtioInputControlHandle { inner: this.inner.clone() };
Ok(VirtioInputRequest::Ready {
negotiated_features: req.negotiated_features,
responder: VirtioInputReadyResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x612743931f7f9249 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
VirtioInputStartRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioInputStartRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = VirtioInputControlHandle { inner: this.inner.clone() };
Ok(VirtioInputRequest::Start {
start_info: req.start_info,
input_type: req.input_type,
responder: VirtioInputStartResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<VirtioInputMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum VirtioInputRequest {
ConfigureQueue {
queue: u16,
size: u16,
desc: u64,
avail: u64,
used: u64,
responder: VirtioInputConfigureQueueResponder,
},
NotifyQueue { queue: u16, control_handle: VirtioInputControlHandle },
Ready { negotiated_features: u32, responder: VirtioInputReadyResponder },
Start { start_info: StartInfo, input_type: InputType, responder: VirtioInputStartResponder },
}
impl VirtioInputRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_configure_queue(
self,
) -> Option<(u16, u16, u64, u64, u64, VirtioInputConfigureQueueResponder)> {
if let VirtioInputRequest::ConfigureQueue { queue, size, desc, avail, used, responder } =
self
{
Some((queue, size, desc, avail, used, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_notify_queue(self) -> Option<(u16, VirtioInputControlHandle)> {
if let VirtioInputRequest::NotifyQueue { queue, control_handle } = self {
Some((queue, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_ready(self) -> Option<(u32, VirtioInputReadyResponder)> {
if let VirtioInputRequest::Ready { negotiated_features, responder } = self {
Some((negotiated_features, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_start(self) -> Option<(StartInfo, InputType, VirtioInputStartResponder)> {
if let VirtioInputRequest::Start { start_info, input_type, responder } = self {
Some((start_info, input_type, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
VirtioInputRequest::ConfigureQueue { .. } => "configure_queue",
VirtioInputRequest::NotifyQueue { .. } => "notify_queue",
VirtioInputRequest::Ready { .. } => "ready",
VirtioInputRequest::Start { .. } => "start",
}
}
}
#[derive(Debug, Clone)]
pub struct VirtioInputControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for VirtioInputControlHandle {
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 VirtioInputControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct VirtioInputConfigureQueueResponder {
control_handle: std::mem::ManuallyDrop<VirtioInputControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for VirtioInputConfigureQueueResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for VirtioInputConfigureQueueResponder {
type ControlHandle = VirtioInputControlHandle;
fn control_handle(&self) -> &VirtioInputControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl VirtioInputConfigureQueueResponder {
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,
0x72b44fb963480b11,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct VirtioInputReadyResponder {
control_handle: std::mem::ManuallyDrop<VirtioInputControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for VirtioInputReadyResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for VirtioInputReadyResponder {
type ControlHandle = VirtioInputControlHandle;
fn control_handle(&self) -> &VirtioInputControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl VirtioInputReadyResponder {
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,
0x45707654f5d23c3f,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct VirtioInputStartResponder {
control_handle: std::mem::ManuallyDrop<VirtioInputControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for VirtioInputStartResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for VirtioInputStartResponder {
type ControlHandle = VirtioInputControlHandle;
fn control_handle(&self) -> &VirtioInputControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl VirtioInputStartResponder {
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,
0x612743931f7f9249,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct VirtioMagmaMarker;
impl fidl::endpoints::ProtocolMarker for VirtioMagmaMarker {
type Proxy = VirtioMagmaProxy;
type RequestStream = VirtioMagmaRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = VirtioMagmaSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.virtualization.hardware.VirtioMagma";
}
impl fidl::endpoints::DiscoverableProtocolMarker for VirtioMagmaMarker {}
pub trait VirtioMagmaProxyInterface: Send + Sync {
type ConfigureQueueResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#configure_queue(
&self,
queue: u16,
size: u16,
desc: u64,
avail: u64,
used: u64,
) -> Self::ConfigureQueueResponseFut;
fn r#notify_queue(&self, queue: u16) -> Result<(), fidl::Error>;
type ReadyResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#ready(&self, negotiated_features: u32) -> Self::ReadyResponseFut;
type StartResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
fn r#start(
&self,
start_info: StartInfo,
vmar: fidl::Vmar,
wayland_importer: Option<fidl::endpoints::ClientEnd<VirtioWaylandImporterMarker>>,
) -> Self::StartResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct VirtioMagmaSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for VirtioMagmaSynchronousProxy {
type Proxy = VirtioMagmaProxy;
type Protocol = VirtioMagmaMarker;
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 VirtioMagmaSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <VirtioMagmaMarker 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<VirtioMagmaEvent, fidl::Error> {
VirtioMagmaEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#configure_queue(
&self,
mut queue: u16,
mut size: u16,
mut desc: u64,
mut avail: u64,
mut used: u64,
___deadline: zx::MonotonicInstant,
) -> Result<(), fidl::Error> {
let _response = self
.client
.send_query::<VirtioDeviceConfigureQueueRequest, fidl::encoding::EmptyPayload>(
(queue, size, desc, avail, used),
0x72b44fb963480b11,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
pub fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
self.client.send::<VirtioDeviceNotifyQueueRequest>(
(queue,),
0x6e3a61d652499244,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#ready(
&self,
mut negotiated_features: u32,
___deadline: zx::MonotonicInstant,
) -> Result<(), fidl::Error> {
let _response =
self.client.send_query::<VirtioDeviceReadyRequest, fidl::encoding::EmptyPayload>(
(negotiated_features,),
0x45707654f5d23c3f,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
pub fn r#start(
&self,
mut start_info: StartInfo,
mut vmar: fidl::Vmar,
mut wayland_importer: Option<fidl::endpoints::ClientEnd<VirtioWaylandImporterMarker>>,
___deadline: zx::MonotonicInstant,
) -> Result<i32, fidl::Error> {
let _response =
self.client.send_query::<VirtioMagmaStartRequest, VirtioMagmaStartResponse>(
(&mut start_info, vmar, wayland_importer),
0x6b94e28f73d201e2,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.status)
}
}
#[derive(Debug, Clone)]
pub struct VirtioMagmaProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for VirtioMagmaProxy {
type Protocol = VirtioMagmaMarker;
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 VirtioMagmaProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <VirtioMagmaMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> VirtioMagmaEventStream {
VirtioMagmaEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#configure_queue(
&self,
mut queue: u16,
mut size: u16,
mut desc: u64,
mut avail: u64,
mut used: u64,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
VirtioMagmaProxyInterface::r#configure_queue(self, queue, size, desc, avail, used)
}
pub fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
VirtioMagmaProxyInterface::r#notify_queue(self, queue)
}
pub fn r#ready(
&self,
mut negotiated_features: u32,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
VirtioMagmaProxyInterface::r#ready(self, negotiated_features)
}
pub fn r#start(
&self,
mut start_info: StartInfo,
mut vmar: fidl::Vmar,
mut wayland_importer: Option<fidl::endpoints::ClientEnd<VirtioWaylandImporterMarker>>,
) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
VirtioMagmaProxyInterface::r#start(self, start_info, vmar, wayland_importer)
}
}
impl VirtioMagmaProxyInterface for VirtioMagmaProxy {
type ConfigureQueueResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#configure_queue(
&self,
mut queue: u16,
mut size: u16,
mut desc: u64,
mut avail: u64,
mut used: u64,
) -> Self::ConfigureQueueResponseFut {
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,
0x72b44fb963480b11,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<VirtioDeviceConfigureQueueRequest, ()>(
(queue, size, desc, avail, used),
0x72b44fb963480b11,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
self.client.send::<VirtioDeviceNotifyQueueRequest>(
(queue,),
0x6e3a61d652499244,
fidl::encoding::DynamicFlags::empty(),
)
}
type ReadyResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#ready(&self, mut negotiated_features: u32) -> Self::ReadyResponseFut {
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,
0x45707654f5d23c3f,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<VirtioDeviceReadyRequest, ()>(
(negotiated_features,),
0x45707654f5d23c3f,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type StartResponseFut =
fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#start(
&self,
mut start_info: StartInfo,
mut vmar: fidl::Vmar,
mut wayland_importer: Option<fidl::endpoints::ClientEnd<VirtioWaylandImporterMarker>>,
) -> Self::StartResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<i32, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
VirtioMagmaStartResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x6b94e28f73d201e2,
>(_buf?)?;
Ok(_response.status)
}
self.client.send_query_and_decode::<VirtioMagmaStartRequest, i32>(
(&mut start_info, vmar, wayland_importer),
0x6b94e28f73d201e2,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct VirtioMagmaEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for VirtioMagmaEventStream {}
impl futures::stream::FusedStream for VirtioMagmaEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for VirtioMagmaEventStream {
type Item = Result<VirtioMagmaEvent, 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(VirtioMagmaEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum VirtioMagmaEvent {}
impl VirtioMagmaEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<VirtioMagmaEvent, 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: <VirtioMagmaMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct VirtioMagmaRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for VirtioMagmaRequestStream {}
impl futures::stream::FusedStream for VirtioMagmaRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for VirtioMagmaRequestStream {
type Protocol = VirtioMagmaMarker;
type ControlHandle = VirtioMagmaControlHandle;
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 {
VirtioMagmaControlHandle { 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 VirtioMagmaRequestStream {
type Item = Result<VirtioMagmaRequest, 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 VirtioMagmaRequestStream 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 {
0x72b44fb963480b11 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
VirtioDeviceConfigureQueueRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceConfigureQueueRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = VirtioMagmaControlHandle { inner: this.inner.clone() };
Ok(VirtioMagmaRequest::ConfigureQueue {
queue: req.queue,
size: req.size,
desc: req.desc,
avail: req.avail,
used: req.used,
responder: VirtioMagmaConfigureQueueResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x6e3a61d652499244 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
VirtioDeviceNotifyQueueRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceNotifyQueueRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = VirtioMagmaControlHandle { inner: this.inner.clone() };
Ok(VirtioMagmaRequest::NotifyQueue { queue: req.queue, control_handle })
}
0x45707654f5d23c3f => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
VirtioDeviceReadyRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceReadyRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = VirtioMagmaControlHandle { inner: this.inner.clone() };
Ok(VirtioMagmaRequest::Ready {
negotiated_features: req.negotiated_features,
responder: VirtioMagmaReadyResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x6b94e28f73d201e2 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
VirtioMagmaStartRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioMagmaStartRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = VirtioMagmaControlHandle { inner: this.inner.clone() };
Ok(VirtioMagmaRequest::Start {
start_info: req.start_info,
vmar: req.vmar,
wayland_importer: req.wayland_importer,
responder: VirtioMagmaStartResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<VirtioMagmaMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum VirtioMagmaRequest {
ConfigureQueue {
queue: u16,
size: u16,
desc: u64,
avail: u64,
used: u64,
responder: VirtioMagmaConfigureQueueResponder,
},
NotifyQueue { queue: u16, control_handle: VirtioMagmaControlHandle },
Ready { negotiated_features: u32, responder: VirtioMagmaReadyResponder },
Start {
start_info: StartInfo,
vmar: fidl::Vmar,
wayland_importer: Option<fidl::endpoints::ClientEnd<VirtioWaylandImporterMarker>>,
responder: VirtioMagmaStartResponder,
},
}
impl VirtioMagmaRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_configure_queue(
self,
) -> Option<(u16, u16, u64, u64, u64, VirtioMagmaConfigureQueueResponder)> {
if let VirtioMagmaRequest::ConfigureQueue { queue, size, desc, avail, used, responder } =
self
{
Some((queue, size, desc, avail, used, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_notify_queue(self) -> Option<(u16, VirtioMagmaControlHandle)> {
if let VirtioMagmaRequest::NotifyQueue { queue, control_handle } = self {
Some((queue, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_ready(self) -> Option<(u32, VirtioMagmaReadyResponder)> {
if let VirtioMagmaRequest::Ready { negotiated_features, responder } = self {
Some((negotiated_features, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_start(
self,
) -> Option<(
StartInfo,
fidl::Vmar,
Option<fidl::endpoints::ClientEnd<VirtioWaylandImporterMarker>>,
VirtioMagmaStartResponder,
)> {
if let VirtioMagmaRequest::Start { start_info, vmar, wayland_importer, responder } = self {
Some((start_info, vmar, wayland_importer, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
VirtioMagmaRequest::ConfigureQueue { .. } => "configure_queue",
VirtioMagmaRequest::NotifyQueue { .. } => "notify_queue",
VirtioMagmaRequest::Ready { .. } => "ready",
VirtioMagmaRequest::Start { .. } => "start",
}
}
}
#[derive(Debug, Clone)]
pub struct VirtioMagmaControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for VirtioMagmaControlHandle {
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 VirtioMagmaControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct VirtioMagmaConfigureQueueResponder {
control_handle: std::mem::ManuallyDrop<VirtioMagmaControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for VirtioMagmaConfigureQueueResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for VirtioMagmaConfigureQueueResponder {
type ControlHandle = VirtioMagmaControlHandle;
fn control_handle(&self) -> &VirtioMagmaControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl VirtioMagmaConfigureQueueResponder {
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,
0x72b44fb963480b11,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct VirtioMagmaReadyResponder {
control_handle: std::mem::ManuallyDrop<VirtioMagmaControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for VirtioMagmaReadyResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for VirtioMagmaReadyResponder {
type ControlHandle = VirtioMagmaControlHandle;
fn control_handle(&self) -> &VirtioMagmaControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl VirtioMagmaReadyResponder {
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,
0x45707654f5d23c3f,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct VirtioMagmaStartResponder {
control_handle: std::mem::ManuallyDrop<VirtioMagmaControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for VirtioMagmaStartResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for VirtioMagmaStartResponder {
type ControlHandle = VirtioMagmaControlHandle;
fn control_handle(&self) -> &VirtioMagmaControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl VirtioMagmaStartResponder {
pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
let _result = self.send_raw(status);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
let _result = self.send_raw(status);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<VirtioMagmaStartResponse>(
(status,),
self.tx_id,
0x6b94e28f73d201e2,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct VirtioMemMarker;
impl fidl::endpoints::ProtocolMarker for VirtioMemMarker {
type Proxy = VirtioMemProxy;
type RequestStream = VirtioMemRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = VirtioMemSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.virtualization.hardware.VirtioMem";
}
impl fidl::endpoints::DiscoverableProtocolMarker for VirtioMemMarker {}
pub trait VirtioMemProxyInterface: Send + Sync {
type ConfigureQueueResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#configure_queue(
&self,
queue: u16,
size: u16,
desc: u64,
avail: u64,
used: u64,
) -> Self::ConfigureQueueResponseFut;
fn r#notify_queue(&self, queue: u16) -> Result<(), fidl::Error>;
type ReadyResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#ready(&self, negotiated_features: u32) -> Self::ReadyResponseFut;
type StartResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#start(
&self,
start_info: StartInfo,
region_addr: u64,
plugged_block_size: u64,
region_size: u64,
) -> Self::StartResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct VirtioMemSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for VirtioMemSynchronousProxy {
type Proxy = VirtioMemProxy;
type Protocol = VirtioMemMarker;
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 VirtioMemSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <VirtioMemMarker 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<VirtioMemEvent, fidl::Error> {
VirtioMemEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#configure_queue(
&self,
mut queue: u16,
mut size: u16,
mut desc: u64,
mut avail: u64,
mut used: u64,
___deadline: zx::MonotonicInstant,
) -> Result<(), fidl::Error> {
let _response = self
.client
.send_query::<VirtioDeviceConfigureQueueRequest, fidl::encoding::EmptyPayload>(
(queue, size, desc, avail, used),
0x72b44fb963480b11,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
pub fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
self.client.send::<VirtioDeviceNotifyQueueRequest>(
(queue,),
0x6e3a61d652499244,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#ready(
&self,
mut negotiated_features: u32,
___deadline: zx::MonotonicInstant,
) -> Result<(), fidl::Error> {
let _response =
self.client.send_query::<VirtioDeviceReadyRequest, fidl::encoding::EmptyPayload>(
(negotiated_features,),
0x45707654f5d23c3f,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
pub fn r#start(
&self,
mut start_info: StartInfo,
mut region_addr: u64,
mut plugged_block_size: u64,
mut region_size: u64,
___deadline: zx::MonotonicInstant,
) -> Result<(), fidl::Error> {
let _response =
self.client.send_query::<VirtioMemStartRequest, fidl::encoding::EmptyPayload>(
(&mut start_info, region_addr, plugged_block_size, region_size),
0x66dd64f17fb5223c,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
}
#[derive(Debug, Clone)]
pub struct VirtioMemProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for VirtioMemProxy {
type Protocol = VirtioMemMarker;
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 VirtioMemProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <VirtioMemMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> VirtioMemEventStream {
VirtioMemEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#configure_queue(
&self,
mut queue: u16,
mut size: u16,
mut desc: u64,
mut avail: u64,
mut used: u64,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
VirtioMemProxyInterface::r#configure_queue(self, queue, size, desc, avail, used)
}
pub fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
VirtioMemProxyInterface::r#notify_queue(self, queue)
}
pub fn r#ready(
&self,
mut negotiated_features: u32,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
VirtioMemProxyInterface::r#ready(self, negotiated_features)
}
pub fn r#start(
&self,
mut start_info: StartInfo,
mut region_addr: u64,
mut plugged_block_size: u64,
mut region_size: u64,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
VirtioMemProxyInterface::r#start(
self,
start_info,
region_addr,
plugged_block_size,
region_size,
)
}
}
impl VirtioMemProxyInterface for VirtioMemProxy {
type ConfigureQueueResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#configure_queue(
&self,
mut queue: u16,
mut size: u16,
mut desc: u64,
mut avail: u64,
mut used: u64,
) -> Self::ConfigureQueueResponseFut {
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,
0x72b44fb963480b11,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<VirtioDeviceConfigureQueueRequest, ()>(
(queue, size, desc, avail, used),
0x72b44fb963480b11,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
self.client.send::<VirtioDeviceNotifyQueueRequest>(
(queue,),
0x6e3a61d652499244,
fidl::encoding::DynamicFlags::empty(),
)
}
type ReadyResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#ready(&self, mut negotiated_features: u32) -> Self::ReadyResponseFut {
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,
0x45707654f5d23c3f,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<VirtioDeviceReadyRequest, ()>(
(negotiated_features,),
0x45707654f5d23c3f,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type StartResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#start(
&self,
mut start_info: StartInfo,
mut region_addr: u64,
mut plugged_block_size: u64,
mut region_size: u64,
) -> Self::StartResponseFut {
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,
0x66dd64f17fb5223c,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<VirtioMemStartRequest, ()>(
(&mut start_info, region_addr, plugged_block_size, region_size),
0x66dd64f17fb5223c,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct VirtioMemEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for VirtioMemEventStream {}
impl futures::stream::FusedStream for VirtioMemEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for VirtioMemEventStream {
type Item = Result<VirtioMemEvent, 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(VirtioMemEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum VirtioMemEvent {
OnConfigChanged { plugged_size: u64 },
}
impl VirtioMemEvent {
#[allow(irrefutable_let_patterns)]
pub fn into_on_config_changed(self) -> Option<u64> {
if let VirtioMemEvent::OnConfigChanged { plugged_size } = self {
Some((plugged_size))
} else {
None
}
}
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<VirtioMemEvent, 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 {
0x73b86d7cc80020b9 => {
let mut out = fidl::new_empty!(
VirtioMemOnConfigChangedRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioMemOnConfigChangedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
Ok((VirtioMemEvent::OnConfigChanged { plugged_size: out.plugged_size }))
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name: <VirtioMemMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct VirtioMemRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for VirtioMemRequestStream {}
impl futures::stream::FusedStream for VirtioMemRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for VirtioMemRequestStream {
type Protocol = VirtioMemMarker;
type ControlHandle = VirtioMemControlHandle;
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 {
VirtioMemControlHandle { 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 VirtioMemRequestStream {
type Item = Result<VirtioMemRequest, 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 VirtioMemRequestStream 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 {
0x72b44fb963480b11 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
VirtioDeviceConfigureQueueRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceConfigureQueueRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = VirtioMemControlHandle { inner: this.inner.clone() };
Ok(VirtioMemRequest::ConfigureQueue {
queue: req.queue,
size: req.size,
desc: req.desc,
avail: req.avail,
used: req.used,
responder: VirtioMemConfigureQueueResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x6e3a61d652499244 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
VirtioDeviceNotifyQueueRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceNotifyQueueRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = VirtioMemControlHandle { inner: this.inner.clone() };
Ok(VirtioMemRequest::NotifyQueue { queue: req.queue, control_handle })
}
0x45707654f5d23c3f => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
VirtioDeviceReadyRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceReadyRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = VirtioMemControlHandle { inner: this.inner.clone() };
Ok(VirtioMemRequest::Ready {
negotiated_features: req.negotiated_features,
responder: VirtioMemReadyResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x66dd64f17fb5223c => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
VirtioMemStartRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioMemStartRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = VirtioMemControlHandle { inner: this.inner.clone() };
Ok(VirtioMemRequest::Start {
start_info: req.start_info,
region_addr: req.region_addr,
plugged_block_size: req.plugged_block_size,
region_size: req.region_size,
responder: VirtioMemStartResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<VirtioMemMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum VirtioMemRequest {
ConfigureQueue {
queue: u16,
size: u16,
desc: u64,
avail: u64,
used: u64,
responder: VirtioMemConfigureQueueResponder,
},
NotifyQueue { queue: u16, control_handle: VirtioMemControlHandle },
Ready { negotiated_features: u32, responder: VirtioMemReadyResponder },
Start {
start_info: StartInfo,
region_addr: u64,
plugged_block_size: u64,
region_size: u64,
responder: VirtioMemStartResponder,
},
}
impl VirtioMemRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_configure_queue(
self,
) -> Option<(u16, u16, u64, u64, u64, VirtioMemConfigureQueueResponder)> {
if let VirtioMemRequest::ConfigureQueue { queue, size, desc, avail, used, responder } = self
{
Some((queue, size, desc, avail, used, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_notify_queue(self) -> Option<(u16, VirtioMemControlHandle)> {
if let VirtioMemRequest::NotifyQueue { queue, control_handle } = self {
Some((queue, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_ready(self) -> Option<(u32, VirtioMemReadyResponder)> {
if let VirtioMemRequest::Ready { negotiated_features, responder } = self {
Some((negotiated_features, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_start(self) -> Option<(StartInfo, u64, u64, u64, VirtioMemStartResponder)> {
if let VirtioMemRequest::Start {
start_info,
region_addr,
plugged_block_size,
region_size,
responder,
} = self
{
Some((start_info, region_addr, plugged_block_size, region_size, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
VirtioMemRequest::ConfigureQueue { .. } => "configure_queue",
VirtioMemRequest::NotifyQueue { .. } => "notify_queue",
VirtioMemRequest::Ready { .. } => "ready",
VirtioMemRequest::Start { .. } => "start",
}
}
}
#[derive(Debug, Clone)]
pub struct VirtioMemControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for VirtioMemControlHandle {
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 VirtioMemControlHandle {
pub fn send_on_config_changed(&self, mut plugged_size: u64) -> Result<(), fidl::Error> {
self.inner.send::<VirtioMemOnConfigChangedRequest>(
(plugged_size,),
0,
0x73b86d7cc80020b9,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct VirtioMemConfigureQueueResponder {
control_handle: std::mem::ManuallyDrop<VirtioMemControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for VirtioMemConfigureQueueResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for VirtioMemConfigureQueueResponder {
type ControlHandle = VirtioMemControlHandle;
fn control_handle(&self) -> &VirtioMemControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl VirtioMemConfigureQueueResponder {
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,
0x72b44fb963480b11,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct VirtioMemReadyResponder {
control_handle: std::mem::ManuallyDrop<VirtioMemControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for VirtioMemReadyResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for VirtioMemReadyResponder {
type ControlHandle = VirtioMemControlHandle;
fn control_handle(&self) -> &VirtioMemControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl VirtioMemReadyResponder {
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,
0x45707654f5d23c3f,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct VirtioMemStartResponder {
control_handle: std::mem::ManuallyDrop<VirtioMemControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for VirtioMemStartResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for VirtioMemStartResponder {
type ControlHandle = VirtioMemControlHandle;
fn control_handle(&self) -> &VirtioMemControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl VirtioMemStartResponder {
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,
0x66dd64f17fb5223c,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct VirtioNetMarker;
impl fidl::endpoints::ProtocolMarker for VirtioNetMarker {
type Proxy = VirtioNetProxy;
type RequestStream = VirtioNetRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = VirtioNetSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.virtualization.hardware.VirtioNet";
}
impl fidl::endpoints::DiscoverableProtocolMarker for VirtioNetMarker {}
pub type VirtioNetStartResult = Result<(), i32>;
pub trait VirtioNetProxyInterface: Send + Sync {
type ConfigureQueueResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#configure_queue(
&self,
queue: u16,
size: u16,
desc: u64,
avail: u64,
used: u64,
) -> Self::ConfigureQueueResponseFut;
fn r#notify_queue(&self, queue: u16) -> Result<(), fidl::Error>;
type ReadyResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#ready(&self, negotiated_features: u32) -> Self::ReadyResponseFut;
type StartResponseFut: std::future::Future<Output = Result<VirtioNetStartResult, fidl::Error>>
+ Send;
fn r#start(
&self,
start_info: StartInfo,
mac_address: &fidl_fuchsia_net::MacAddress,
enable_bridge: bool,
) -> Self::StartResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct VirtioNetSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for VirtioNetSynchronousProxy {
type Proxy = VirtioNetProxy;
type Protocol = VirtioNetMarker;
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 VirtioNetSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <VirtioNetMarker 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<VirtioNetEvent, fidl::Error> {
VirtioNetEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#configure_queue(
&self,
mut queue: u16,
mut size: u16,
mut desc: u64,
mut avail: u64,
mut used: u64,
___deadline: zx::MonotonicInstant,
) -> Result<(), fidl::Error> {
let _response = self
.client
.send_query::<VirtioDeviceConfigureQueueRequest, fidl::encoding::EmptyPayload>(
(queue, size, desc, avail, used),
0x72b44fb963480b11,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
pub fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
self.client.send::<VirtioDeviceNotifyQueueRequest>(
(queue,),
0x6e3a61d652499244,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#ready(
&self,
mut negotiated_features: u32,
___deadline: zx::MonotonicInstant,
) -> Result<(), fidl::Error> {
let _response =
self.client.send_query::<VirtioDeviceReadyRequest, fidl::encoding::EmptyPayload>(
(negotiated_features,),
0x45707654f5d23c3f,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
pub fn r#start(
&self,
mut start_info: StartInfo,
mut mac_address: &fidl_fuchsia_net::MacAddress,
mut enable_bridge: bool,
___deadline: zx::MonotonicInstant,
) -> Result<VirtioNetStartResult, fidl::Error> {
let _response = self.client.send_query::<
VirtioNetStartRequest,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
>(
(&mut start_info, mac_address, enable_bridge,),
0x795c0b3a8461b3ed,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
}
#[derive(Debug, Clone)]
pub struct VirtioNetProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for VirtioNetProxy {
type Protocol = VirtioNetMarker;
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 VirtioNetProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <VirtioNetMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> VirtioNetEventStream {
VirtioNetEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#configure_queue(
&self,
mut queue: u16,
mut size: u16,
mut desc: u64,
mut avail: u64,
mut used: u64,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
VirtioNetProxyInterface::r#configure_queue(self, queue, size, desc, avail, used)
}
pub fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
VirtioNetProxyInterface::r#notify_queue(self, queue)
}
pub fn r#ready(
&self,
mut negotiated_features: u32,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
VirtioNetProxyInterface::r#ready(self, negotiated_features)
}
pub fn r#start(
&self,
mut start_info: StartInfo,
mut mac_address: &fidl_fuchsia_net::MacAddress,
mut enable_bridge: bool,
) -> fidl::client::QueryResponseFut<
VirtioNetStartResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
VirtioNetProxyInterface::r#start(self, start_info, mac_address, enable_bridge)
}
}
impl VirtioNetProxyInterface for VirtioNetProxy {
type ConfigureQueueResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#configure_queue(
&self,
mut queue: u16,
mut size: u16,
mut desc: u64,
mut avail: u64,
mut used: u64,
) -> Self::ConfigureQueueResponseFut {
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,
0x72b44fb963480b11,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<VirtioDeviceConfigureQueueRequest, ()>(
(queue, size, desc, avail, used),
0x72b44fb963480b11,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
self.client.send::<VirtioDeviceNotifyQueueRequest>(
(queue,),
0x6e3a61d652499244,
fidl::encoding::DynamicFlags::empty(),
)
}
type ReadyResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#ready(&self, mut negotiated_features: u32) -> Self::ReadyResponseFut {
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,
0x45707654f5d23c3f,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<VirtioDeviceReadyRequest, ()>(
(negotiated_features,),
0x45707654f5d23c3f,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type StartResponseFut = fidl::client::QueryResponseFut<
VirtioNetStartResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#start(
&self,
mut start_info: StartInfo,
mut mac_address: &fidl_fuchsia_net::MacAddress,
mut enable_bridge: bool,
) -> Self::StartResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<VirtioNetStartResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x795c0b3a8461b3ed,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<VirtioNetStartRequest, VirtioNetStartResult>(
(&mut start_info, mac_address, enable_bridge),
0x795c0b3a8461b3ed,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct VirtioNetEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for VirtioNetEventStream {}
impl futures::stream::FusedStream for VirtioNetEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for VirtioNetEventStream {
type Item = Result<VirtioNetEvent, 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(VirtioNetEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum VirtioNetEvent {}
impl VirtioNetEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<VirtioNetEvent, 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: <VirtioNetMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct VirtioNetRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for VirtioNetRequestStream {}
impl futures::stream::FusedStream for VirtioNetRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for VirtioNetRequestStream {
type Protocol = VirtioNetMarker;
type ControlHandle = VirtioNetControlHandle;
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 {
VirtioNetControlHandle { 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 VirtioNetRequestStream {
type Item = Result<VirtioNetRequest, 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 VirtioNetRequestStream 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 {
0x72b44fb963480b11 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
VirtioDeviceConfigureQueueRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceConfigureQueueRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = VirtioNetControlHandle { inner: this.inner.clone() };
Ok(VirtioNetRequest::ConfigureQueue {
queue: req.queue,
size: req.size,
desc: req.desc,
avail: req.avail,
used: req.used,
responder: VirtioNetConfigureQueueResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x6e3a61d652499244 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
VirtioDeviceNotifyQueueRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceNotifyQueueRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = VirtioNetControlHandle { inner: this.inner.clone() };
Ok(VirtioNetRequest::NotifyQueue { queue: req.queue, control_handle })
}
0x45707654f5d23c3f => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
VirtioDeviceReadyRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceReadyRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = VirtioNetControlHandle { inner: this.inner.clone() };
Ok(VirtioNetRequest::Ready {
negotiated_features: req.negotiated_features,
responder: VirtioNetReadyResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x795c0b3a8461b3ed => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
VirtioNetStartRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioNetStartRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = VirtioNetControlHandle { inner: this.inner.clone() };
Ok(VirtioNetRequest::Start {
start_info: req.start_info,
mac_address: req.mac_address,
enable_bridge: req.enable_bridge,
responder: VirtioNetStartResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<VirtioNetMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum VirtioNetRequest {
ConfigureQueue {
queue: u16,
size: u16,
desc: u64,
avail: u64,
used: u64,
responder: VirtioNetConfigureQueueResponder,
},
NotifyQueue { queue: u16, control_handle: VirtioNetControlHandle },
Ready { negotiated_features: u32, responder: VirtioNetReadyResponder },
Start {
start_info: StartInfo,
mac_address: fidl_fuchsia_net::MacAddress,
enable_bridge: bool,
responder: VirtioNetStartResponder,
},
}
impl VirtioNetRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_configure_queue(
self,
) -> Option<(u16, u16, u64, u64, u64, VirtioNetConfigureQueueResponder)> {
if let VirtioNetRequest::ConfigureQueue { queue, size, desc, avail, used, responder } = self
{
Some((queue, size, desc, avail, used, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_notify_queue(self) -> Option<(u16, VirtioNetControlHandle)> {
if let VirtioNetRequest::NotifyQueue { queue, control_handle } = self {
Some((queue, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_ready(self) -> Option<(u32, VirtioNetReadyResponder)> {
if let VirtioNetRequest::Ready { negotiated_features, responder } = self {
Some((negotiated_features, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_start(
self,
) -> Option<(StartInfo, fidl_fuchsia_net::MacAddress, bool, VirtioNetStartResponder)> {
if let VirtioNetRequest::Start { start_info, mac_address, enable_bridge, responder } = self
{
Some((start_info, mac_address, enable_bridge, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
VirtioNetRequest::ConfigureQueue { .. } => "configure_queue",
VirtioNetRequest::NotifyQueue { .. } => "notify_queue",
VirtioNetRequest::Ready { .. } => "ready",
VirtioNetRequest::Start { .. } => "start",
}
}
}
#[derive(Debug, Clone)]
pub struct VirtioNetControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for VirtioNetControlHandle {
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 VirtioNetControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct VirtioNetConfigureQueueResponder {
control_handle: std::mem::ManuallyDrop<VirtioNetControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for VirtioNetConfigureQueueResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for VirtioNetConfigureQueueResponder {
type ControlHandle = VirtioNetControlHandle;
fn control_handle(&self) -> &VirtioNetControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl VirtioNetConfigureQueueResponder {
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,
0x72b44fb963480b11,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct VirtioNetReadyResponder {
control_handle: std::mem::ManuallyDrop<VirtioNetControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for VirtioNetReadyResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for VirtioNetReadyResponder {
type ControlHandle = VirtioNetControlHandle;
fn control_handle(&self) -> &VirtioNetControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl VirtioNetReadyResponder {
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,
0x45707654f5d23c3f,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct VirtioNetStartResponder {
control_handle: std::mem::ManuallyDrop<VirtioNetControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for VirtioNetStartResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for VirtioNetStartResponder {
type ControlHandle = VirtioNetControlHandle;
fn control_handle(&self) -> &VirtioNetControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl VirtioNetStartResponder {
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,
0x795c0b3a8461b3ed,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct VirtioRngMarker;
impl fidl::endpoints::ProtocolMarker for VirtioRngMarker {
type Proxy = VirtioRngProxy;
type RequestStream = VirtioRngRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = VirtioRngSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.virtualization.hardware.VirtioRng";
}
impl fidl::endpoints::DiscoverableProtocolMarker for VirtioRngMarker {}
pub trait VirtioRngProxyInterface: Send + Sync {
type ConfigureQueueResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#configure_queue(
&self,
queue: u16,
size: u16,
desc: u64,
avail: u64,
used: u64,
) -> Self::ConfigureQueueResponseFut;
fn r#notify_queue(&self, queue: u16) -> Result<(), fidl::Error>;
type ReadyResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#ready(&self, negotiated_features: u32) -> Self::ReadyResponseFut;
type StartResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#start(&self, start_info: StartInfo) -> Self::StartResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct VirtioRngSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for VirtioRngSynchronousProxy {
type Proxy = VirtioRngProxy;
type Protocol = VirtioRngMarker;
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 VirtioRngSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <VirtioRngMarker 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<VirtioRngEvent, fidl::Error> {
VirtioRngEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#configure_queue(
&self,
mut queue: u16,
mut size: u16,
mut desc: u64,
mut avail: u64,
mut used: u64,
___deadline: zx::MonotonicInstant,
) -> Result<(), fidl::Error> {
let _response = self
.client
.send_query::<VirtioDeviceConfigureQueueRequest, fidl::encoding::EmptyPayload>(
(queue, size, desc, avail, used),
0x72b44fb963480b11,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
pub fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
self.client.send::<VirtioDeviceNotifyQueueRequest>(
(queue,),
0x6e3a61d652499244,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#ready(
&self,
mut negotiated_features: u32,
___deadline: zx::MonotonicInstant,
) -> Result<(), fidl::Error> {
let _response =
self.client.send_query::<VirtioDeviceReadyRequest, fidl::encoding::EmptyPayload>(
(negotiated_features,),
0x45707654f5d23c3f,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
pub fn r#start(
&self,
mut start_info: StartInfo,
___deadline: zx::MonotonicInstant,
) -> Result<(), fidl::Error> {
let _response =
self.client.send_query::<VirtioRngStartRequest, fidl::encoding::EmptyPayload>(
(&mut start_info,),
0x620b3ed254febc0f,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
}
#[derive(Debug, Clone)]
pub struct VirtioRngProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for VirtioRngProxy {
type Protocol = VirtioRngMarker;
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 VirtioRngProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <VirtioRngMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> VirtioRngEventStream {
VirtioRngEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#configure_queue(
&self,
mut queue: u16,
mut size: u16,
mut desc: u64,
mut avail: u64,
mut used: u64,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
VirtioRngProxyInterface::r#configure_queue(self, queue, size, desc, avail, used)
}
pub fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
VirtioRngProxyInterface::r#notify_queue(self, queue)
}
pub fn r#ready(
&self,
mut negotiated_features: u32,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
VirtioRngProxyInterface::r#ready(self, negotiated_features)
}
pub fn r#start(
&self,
mut start_info: StartInfo,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
VirtioRngProxyInterface::r#start(self, start_info)
}
}
impl VirtioRngProxyInterface for VirtioRngProxy {
type ConfigureQueueResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#configure_queue(
&self,
mut queue: u16,
mut size: u16,
mut desc: u64,
mut avail: u64,
mut used: u64,
) -> Self::ConfigureQueueResponseFut {
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,
0x72b44fb963480b11,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<VirtioDeviceConfigureQueueRequest, ()>(
(queue, size, desc, avail, used),
0x72b44fb963480b11,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
self.client.send::<VirtioDeviceNotifyQueueRequest>(
(queue,),
0x6e3a61d652499244,
fidl::encoding::DynamicFlags::empty(),
)
}
type ReadyResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#ready(&self, mut negotiated_features: u32) -> Self::ReadyResponseFut {
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,
0x45707654f5d23c3f,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<VirtioDeviceReadyRequest, ()>(
(negotiated_features,),
0x45707654f5d23c3f,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type StartResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#start(&self, mut start_info: StartInfo) -> Self::StartResponseFut {
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,
0x620b3ed254febc0f,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<VirtioRngStartRequest, ()>(
(&mut start_info,),
0x620b3ed254febc0f,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct VirtioRngEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for VirtioRngEventStream {}
impl futures::stream::FusedStream for VirtioRngEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for VirtioRngEventStream {
type Item = Result<VirtioRngEvent, 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(VirtioRngEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum VirtioRngEvent {}
impl VirtioRngEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<VirtioRngEvent, 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: <VirtioRngMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct VirtioRngRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for VirtioRngRequestStream {}
impl futures::stream::FusedStream for VirtioRngRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for VirtioRngRequestStream {
type Protocol = VirtioRngMarker;
type ControlHandle = VirtioRngControlHandle;
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 {
VirtioRngControlHandle { 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 VirtioRngRequestStream {
type Item = Result<VirtioRngRequest, 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 VirtioRngRequestStream 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 {
0x72b44fb963480b11 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
VirtioDeviceConfigureQueueRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceConfigureQueueRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = VirtioRngControlHandle { inner: this.inner.clone() };
Ok(VirtioRngRequest::ConfigureQueue {
queue: req.queue,
size: req.size,
desc: req.desc,
avail: req.avail,
used: req.used,
responder: VirtioRngConfigureQueueResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x6e3a61d652499244 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
VirtioDeviceNotifyQueueRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceNotifyQueueRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = VirtioRngControlHandle { inner: this.inner.clone() };
Ok(VirtioRngRequest::NotifyQueue { queue: req.queue, control_handle })
}
0x45707654f5d23c3f => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
VirtioDeviceReadyRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceReadyRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = VirtioRngControlHandle { inner: this.inner.clone() };
Ok(VirtioRngRequest::Ready {
negotiated_features: req.negotiated_features,
responder: VirtioRngReadyResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x620b3ed254febc0f => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
VirtioRngStartRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioRngStartRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = VirtioRngControlHandle { inner: this.inner.clone() };
Ok(VirtioRngRequest::Start {
start_info: req.start_info,
responder: VirtioRngStartResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<VirtioRngMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum VirtioRngRequest {
ConfigureQueue {
queue: u16,
size: u16,
desc: u64,
avail: u64,
used: u64,
responder: VirtioRngConfigureQueueResponder,
},
NotifyQueue { queue: u16, control_handle: VirtioRngControlHandle },
Ready { negotiated_features: u32, responder: VirtioRngReadyResponder },
Start { start_info: StartInfo, responder: VirtioRngStartResponder },
}
impl VirtioRngRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_configure_queue(
self,
) -> Option<(u16, u16, u64, u64, u64, VirtioRngConfigureQueueResponder)> {
if let VirtioRngRequest::ConfigureQueue { queue, size, desc, avail, used, responder } = self
{
Some((queue, size, desc, avail, used, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_notify_queue(self) -> Option<(u16, VirtioRngControlHandle)> {
if let VirtioRngRequest::NotifyQueue { queue, control_handle } = self {
Some((queue, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_ready(self) -> Option<(u32, VirtioRngReadyResponder)> {
if let VirtioRngRequest::Ready { negotiated_features, responder } = self {
Some((negotiated_features, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_start(self) -> Option<(StartInfo, VirtioRngStartResponder)> {
if let VirtioRngRequest::Start { start_info, responder } = self {
Some((start_info, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
VirtioRngRequest::ConfigureQueue { .. } => "configure_queue",
VirtioRngRequest::NotifyQueue { .. } => "notify_queue",
VirtioRngRequest::Ready { .. } => "ready",
VirtioRngRequest::Start { .. } => "start",
}
}
}
#[derive(Debug, Clone)]
pub struct VirtioRngControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for VirtioRngControlHandle {
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 VirtioRngControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct VirtioRngConfigureQueueResponder {
control_handle: std::mem::ManuallyDrop<VirtioRngControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for VirtioRngConfigureQueueResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for VirtioRngConfigureQueueResponder {
type ControlHandle = VirtioRngControlHandle;
fn control_handle(&self) -> &VirtioRngControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl VirtioRngConfigureQueueResponder {
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,
0x72b44fb963480b11,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct VirtioRngReadyResponder {
control_handle: std::mem::ManuallyDrop<VirtioRngControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for VirtioRngReadyResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for VirtioRngReadyResponder {
type ControlHandle = VirtioRngControlHandle;
fn control_handle(&self) -> &VirtioRngControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl VirtioRngReadyResponder {
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,
0x45707654f5d23c3f,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct VirtioRngStartResponder {
control_handle: std::mem::ManuallyDrop<VirtioRngControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for VirtioRngStartResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for VirtioRngStartResponder {
type ControlHandle = VirtioRngControlHandle;
fn control_handle(&self) -> &VirtioRngControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl VirtioRngStartResponder {
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,
0x620b3ed254febc0f,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct VirtioSoundMarker;
impl fidl::endpoints::ProtocolMarker for VirtioSoundMarker {
type Proxy = VirtioSoundProxy;
type RequestStream = VirtioSoundRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = VirtioSoundSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.virtualization.hardware.VirtioSound";
}
impl fidl::endpoints::DiscoverableProtocolMarker for VirtioSoundMarker {}
pub trait VirtioSoundProxyInterface: Send + Sync {
type ConfigureQueueResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#configure_queue(
&self,
queue: u16,
size: u16,
desc: u64,
avail: u64,
used: u64,
) -> Self::ConfigureQueueResponseFut;
fn r#notify_queue(&self, queue: u16) -> Result<(), fidl::Error>;
type ReadyResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#ready(&self, negotiated_features: u32) -> Self::ReadyResponseFut;
type StartResponseFut: std::future::Future<Output = Result<(u32, u32, u32, u32), fidl::Error>>
+ Send;
fn r#start(
&self,
start_info: StartInfo,
enable_input: bool,
enable_verbose_logging: bool,
) -> Self::StartResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct VirtioSoundSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for VirtioSoundSynchronousProxy {
type Proxy = VirtioSoundProxy;
type Protocol = VirtioSoundMarker;
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 VirtioSoundSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <VirtioSoundMarker 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<VirtioSoundEvent, fidl::Error> {
VirtioSoundEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#configure_queue(
&self,
mut queue: u16,
mut size: u16,
mut desc: u64,
mut avail: u64,
mut used: u64,
___deadline: zx::MonotonicInstant,
) -> Result<(), fidl::Error> {
let _response = self
.client
.send_query::<VirtioDeviceConfigureQueueRequest, fidl::encoding::EmptyPayload>(
(queue, size, desc, avail, used),
0x72b44fb963480b11,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
pub fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
self.client.send::<VirtioDeviceNotifyQueueRequest>(
(queue,),
0x6e3a61d652499244,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#ready(
&self,
mut negotiated_features: u32,
___deadline: zx::MonotonicInstant,
) -> Result<(), fidl::Error> {
let _response =
self.client.send_query::<VirtioDeviceReadyRequest, fidl::encoding::EmptyPayload>(
(negotiated_features,),
0x45707654f5d23c3f,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
pub fn r#start(
&self,
mut start_info: StartInfo,
mut enable_input: bool,
mut enable_verbose_logging: bool,
___deadline: zx::MonotonicInstant,
) -> Result<(u32, u32, u32, u32), fidl::Error> {
let _response =
self.client.send_query::<VirtioSoundStartRequest, VirtioSoundStartResponse>(
(&mut start_info, enable_input, enable_verbose_logging),
0x2c3a5528c0b92e2d,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok((_response.features, _response.jacks, _response.streams, _response.chmaps))
}
}
#[derive(Debug, Clone)]
pub struct VirtioSoundProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for VirtioSoundProxy {
type Protocol = VirtioSoundMarker;
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 VirtioSoundProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <VirtioSoundMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> VirtioSoundEventStream {
VirtioSoundEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#configure_queue(
&self,
mut queue: u16,
mut size: u16,
mut desc: u64,
mut avail: u64,
mut used: u64,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
VirtioSoundProxyInterface::r#configure_queue(self, queue, size, desc, avail, used)
}
pub fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
VirtioSoundProxyInterface::r#notify_queue(self, queue)
}
pub fn r#ready(
&self,
mut negotiated_features: u32,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
VirtioSoundProxyInterface::r#ready(self, negotiated_features)
}
pub fn r#start(
&self,
mut start_info: StartInfo,
mut enable_input: bool,
mut enable_verbose_logging: bool,
) -> fidl::client::QueryResponseFut<
(u32, u32, u32, u32),
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
VirtioSoundProxyInterface::r#start(self, start_info, enable_input, enable_verbose_logging)
}
}
impl VirtioSoundProxyInterface for VirtioSoundProxy {
type ConfigureQueueResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#configure_queue(
&self,
mut queue: u16,
mut size: u16,
mut desc: u64,
mut avail: u64,
mut used: u64,
) -> Self::ConfigureQueueResponseFut {
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,
0x72b44fb963480b11,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<VirtioDeviceConfigureQueueRequest, ()>(
(queue, size, desc, avail, used),
0x72b44fb963480b11,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
self.client.send::<VirtioDeviceNotifyQueueRequest>(
(queue,),
0x6e3a61d652499244,
fidl::encoding::DynamicFlags::empty(),
)
}
type ReadyResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#ready(&self, mut negotiated_features: u32) -> Self::ReadyResponseFut {
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,
0x45707654f5d23c3f,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<VirtioDeviceReadyRequest, ()>(
(negotiated_features,),
0x45707654f5d23c3f,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type StartResponseFut = fidl::client::QueryResponseFut<
(u32, u32, u32, u32),
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#start(
&self,
mut start_info: StartInfo,
mut enable_input: bool,
mut enable_verbose_logging: bool,
) -> Self::StartResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<(u32, u32, u32, u32), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
VirtioSoundStartResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x2c3a5528c0b92e2d,
>(_buf?)?;
Ok((_response.features, _response.jacks, _response.streams, _response.chmaps))
}
self.client.send_query_and_decode::<VirtioSoundStartRequest, (u32, u32, u32, u32)>(
(&mut start_info, enable_input, enable_verbose_logging),
0x2c3a5528c0b92e2d,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct VirtioSoundEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for VirtioSoundEventStream {}
impl futures::stream::FusedStream for VirtioSoundEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for VirtioSoundEventStream {
type Item = Result<VirtioSoundEvent, 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(VirtioSoundEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum VirtioSoundEvent {}
impl VirtioSoundEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<VirtioSoundEvent, 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: <VirtioSoundMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct VirtioSoundRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for VirtioSoundRequestStream {}
impl futures::stream::FusedStream for VirtioSoundRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for VirtioSoundRequestStream {
type Protocol = VirtioSoundMarker;
type ControlHandle = VirtioSoundControlHandle;
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 {
VirtioSoundControlHandle { 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 VirtioSoundRequestStream {
type Item = Result<VirtioSoundRequest, 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 VirtioSoundRequestStream 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 {
0x72b44fb963480b11 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
VirtioDeviceConfigureQueueRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceConfigureQueueRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = VirtioSoundControlHandle { inner: this.inner.clone() };
Ok(VirtioSoundRequest::ConfigureQueue {
queue: req.queue,
size: req.size,
desc: req.desc,
avail: req.avail,
used: req.used,
responder: VirtioSoundConfigureQueueResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x6e3a61d652499244 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
VirtioDeviceNotifyQueueRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceNotifyQueueRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = VirtioSoundControlHandle { inner: this.inner.clone() };
Ok(VirtioSoundRequest::NotifyQueue { queue: req.queue, control_handle })
}
0x45707654f5d23c3f => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
VirtioDeviceReadyRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceReadyRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = VirtioSoundControlHandle { inner: this.inner.clone() };
Ok(VirtioSoundRequest::Ready {
negotiated_features: req.negotiated_features,
responder: VirtioSoundReadyResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x2c3a5528c0b92e2d => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
VirtioSoundStartRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioSoundStartRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = VirtioSoundControlHandle { inner: this.inner.clone() };
Ok(VirtioSoundRequest::Start {
start_info: req.start_info,
enable_input: req.enable_input,
enable_verbose_logging: req.enable_verbose_logging,
responder: VirtioSoundStartResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<VirtioSoundMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum VirtioSoundRequest {
ConfigureQueue {
queue: u16,
size: u16,
desc: u64,
avail: u64,
used: u64,
responder: VirtioSoundConfigureQueueResponder,
},
NotifyQueue { queue: u16, control_handle: VirtioSoundControlHandle },
Ready { negotiated_features: u32, responder: VirtioSoundReadyResponder },
Start {
start_info: StartInfo,
enable_input: bool,
enable_verbose_logging: bool,
responder: VirtioSoundStartResponder,
},
}
impl VirtioSoundRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_configure_queue(
self,
) -> Option<(u16, u16, u64, u64, u64, VirtioSoundConfigureQueueResponder)> {
if let VirtioSoundRequest::ConfigureQueue { queue, size, desc, avail, used, responder } =
self
{
Some((queue, size, desc, avail, used, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_notify_queue(self) -> Option<(u16, VirtioSoundControlHandle)> {
if let VirtioSoundRequest::NotifyQueue { queue, control_handle } = self {
Some((queue, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_ready(self) -> Option<(u32, VirtioSoundReadyResponder)> {
if let VirtioSoundRequest::Ready { negotiated_features, responder } = self {
Some((negotiated_features, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_start(self) -> Option<(StartInfo, bool, bool, VirtioSoundStartResponder)> {
if let VirtioSoundRequest::Start {
start_info,
enable_input,
enable_verbose_logging,
responder,
} = self
{
Some((start_info, enable_input, enable_verbose_logging, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
VirtioSoundRequest::ConfigureQueue { .. } => "configure_queue",
VirtioSoundRequest::NotifyQueue { .. } => "notify_queue",
VirtioSoundRequest::Ready { .. } => "ready",
VirtioSoundRequest::Start { .. } => "start",
}
}
}
#[derive(Debug, Clone)]
pub struct VirtioSoundControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for VirtioSoundControlHandle {
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 VirtioSoundControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct VirtioSoundConfigureQueueResponder {
control_handle: std::mem::ManuallyDrop<VirtioSoundControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for VirtioSoundConfigureQueueResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for VirtioSoundConfigureQueueResponder {
type ControlHandle = VirtioSoundControlHandle;
fn control_handle(&self) -> &VirtioSoundControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl VirtioSoundConfigureQueueResponder {
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,
0x72b44fb963480b11,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct VirtioSoundReadyResponder {
control_handle: std::mem::ManuallyDrop<VirtioSoundControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for VirtioSoundReadyResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for VirtioSoundReadyResponder {
type ControlHandle = VirtioSoundControlHandle;
fn control_handle(&self) -> &VirtioSoundControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl VirtioSoundReadyResponder {
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,
0x45707654f5d23c3f,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct VirtioSoundStartResponder {
control_handle: std::mem::ManuallyDrop<VirtioSoundControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for VirtioSoundStartResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for VirtioSoundStartResponder {
type ControlHandle = VirtioSoundControlHandle;
fn control_handle(&self) -> &VirtioSoundControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl VirtioSoundStartResponder {
pub fn send(
self,
mut features: u32,
mut jacks: u32,
mut streams: u32,
mut chmaps: u32,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(features, jacks, streams, chmaps);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut features: u32,
mut jacks: u32,
mut streams: u32,
mut chmaps: u32,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(features, jacks, streams, chmaps);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut features: u32,
mut jacks: u32,
mut streams: u32,
mut chmaps: u32,
) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<VirtioSoundStartResponse>(
(features, jacks, streams, chmaps),
self.tx_id,
0x2c3a5528c0b92e2d,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct VirtioVsockMarker;
impl fidl::endpoints::ProtocolMarker for VirtioVsockMarker {
type Proxy = VirtioVsockProxy;
type RequestStream = VirtioVsockRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = VirtioVsockSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.virtualization.hardware.VirtioVsock";
}
impl fidl::endpoints::DiscoverableProtocolMarker for VirtioVsockMarker {}
pub type VirtioVsockStartResult = Result<(), i32>;
pub trait VirtioVsockProxyInterface: Send + Sync {
type ConfigureQueueResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#configure_queue(
&self,
queue: u16,
size: u16,
desc: u64,
avail: u64,
used: u64,
) -> Self::ConfigureQueueResponseFut;
fn r#notify_queue(&self, queue: u16) -> Result<(), fidl::Error>;
type ReadyResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#ready(&self, negotiated_features: u32) -> Self::ReadyResponseFut;
type StartResponseFut: std::future::Future<Output = Result<VirtioVsockStartResult, fidl::Error>>
+ Send;
fn r#start(
&self,
start_info: StartInfo,
guest_cid: u32,
listeners: Vec<fidl_fuchsia_virtualization::Listener>,
) -> Self::StartResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct VirtioVsockSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for VirtioVsockSynchronousProxy {
type Proxy = VirtioVsockProxy;
type Protocol = VirtioVsockMarker;
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 VirtioVsockSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <VirtioVsockMarker 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<VirtioVsockEvent, fidl::Error> {
VirtioVsockEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#configure_queue(
&self,
mut queue: u16,
mut size: u16,
mut desc: u64,
mut avail: u64,
mut used: u64,
___deadline: zx::MonotonicInstant,
) -> Result<(), fidl::Error> {
let _response = self
.client
.send_query::<VirtioDeviceConfigureQueueRequest, fidl::encoding::EmptyPayload>(
(queue, size, desc, avail, used),
0x72b44fb963480b11,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
pub fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
self.client.send::<VirtioDeviceNotifyQueueRequest>(
(queue,),
0x6e3a61d652499244,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#ready(
&self,
mut negotiated_features: u32,
___deadline: zx::MonotonicInstant,
) -> Result<(), fidl::Error> {
let _response =
self.client.send_query::<VirtioDeviceReadyRequest, fidl::encoding::EmptyPayload>(
(negotiated_features,),
0x45707654f5d23c3f,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
pub fn r#start(
&self,
mut start_info: StartInfo,
mut guest_cid: u32,
mut listeners: Vec<fidl_fuchsia_virtualization::Listener>,
___deadline: zx::MonotonicInstant,
) -> Result<VirtioVsockStartResult, fidl::Error> {
let _response = self.client.send_query::<
VirtioVsockStartRequest,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
>(
(&mut start_info, guest_cid, listeners.as_mut(),),
0x56433562cf67ae0f,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
}
#[derive(Debug, Clone)]
pub struct VirtioVsockProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for VirtioVsockProxy {
type Protocol = VirtioVsockMarker;
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 VirtioVsockProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <VirtioVsockMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> VirtioVsockEventStream {
VirtioVsockEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#configure_queue(
&self,
mut queue: u16,
mut size: u16,
mut desc: u64,
mut avail: u64,
mut used: u64,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
VirtioVsockProxyInterface::r#configure_queue(self, queue, size, desc, avail, used)
}
pub fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
VirtioVsockProxyInterface::r#notify_queue(self, queue)
}
pub fn r#ready(
&self,
mut negotiated_features: u32,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
VirtioVsockProxyInterface::r#ready(self, negotiated_features)
}
pub fn r#start(
&self,
mut start_info: StartInfo,
mut guest_cid: u32,
mut listeners: Vec<fidl_fuchsia_virtualization::Listener>,
) -> fidl::client::QueryResponseFut<
VirtioVsockStartResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
VirtioVsockProxyInterface::r#start(self, start_info, guest_cid, listeners)
}
}
impl VirtioVsockProxyInterface for VirtioVsockProxy {
type ConfigureQueueResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#configure_queue(
&self,
mut queue: u16,
mut size: u16,
mut desc: u64,
mut avail: u64,
mut used: u64,
) -> Self::ConfigureQueueResponseFut {
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,
0x72b44fb963480b11,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<VirtioDeviceConfigureQueueRequest, ()>(
(queue, size, desc, avail, used),
0x72b44fb963480b11,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
self.client.send::<VirtioDeviceNotifyQueueRequest>(
(queue,),
0x6e3a61d652499244,
fidl::encoding::DynamicFlags::empty(),
)
}
type ReadyResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#ready(&self, mut negotiated_features: u32) -> Self::ReadyResponseFut {
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,
0x45707654f5d23c3f,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<VirtioDeviceReadyRequest, ()>(
(negotiated_features,),
0x45707654f5d23c3f,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type StartResponseFut = fidl::client::QueryResponseFut<
VirtioVsockStartResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#start(
&self,
mut start_info: StartInfo,
mut guest_cid: u32,
mut listeners: Vec<fidl_fuchsia_virtualization::Listener>,
) -> Self::StartResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<VirtioVsockStartResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x56433562cf67ae0f,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<VirtioVsockStartRequest, VirtioVsockStartResult>(
(&mut start_info, guest_cid, listeners.as_mut()),
0x56433562cf67ae0f,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct VirtioVsockEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for VirtioVsockEventStream {}
impl futures::stream::FusedStream for VirtioVsockEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for VirtioVsockEventStream {
type Item = Result<VirtioVsockEvent, 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(VirtioVsockEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum VirtioVsockEvent {}
impl VirtioVsockEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<VirtioVsockEvent, 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: <VirtioVsockMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct VirtioVsockRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for VirtioVsockRequestStream {}
impl futures::stream::FusedStream for VirtioVsockRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for VirtioVsockRequestStream {
type Protocol = VirtioVsockMarker;
type ControlHandle = VirtioVsockControlHandle;
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 {
VirtioVsockControlHandle { 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 VirtioVsockRequestStream {
type Item = Result<VirtioVsockRequest, 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 VirtioVsockRequestStream 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 {
0x72b44fb963480b11 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
VirtioDeviceConfigureQueueRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceConfigureQueueRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = VirtioVsockControlHandle { inner: this.inner.clone() };
Ok(VirtioVsockRequest::ConfigureQueue {
queue: req.queue,
size: req.size,
desc: req.desc,
avail: req.avail,
used: req.used,
responder: VirtioVsockConfigureQueueResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x6e3a61d652499244 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
VirtioDeviceNotifyQueueRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceNotifyQueueRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = VirtioVsockControlHandle { inner: this.inner.clone() };
Ok(VirtioVsockRequest::NotifyQueue { queue: req.queue, control_handle })
}
0x45707654f5d23c3f => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
VirtioDeviceReadyRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceReadyRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = VirtioVsockControlHandle { inner: this.inner.clone() };
Ok(VirtioVsockRequest::Ready {
negotiated_features: req.negotiated_features,
responder: VirtioVsockReadyResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x56433562cf67ae0f => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
VirtioVsockStartRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioVsockStartRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = VirtioVsockControlHandle { inner: this.inner.clone() };
Ok(VirtioVsockRequest::Start {
start_info: req.start_info,
guest_cid: req.guest_cid,
listeners: req.listeners,
responder: VirtioVsockStartResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<VirtioVsockMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum VirtioVsockRequest {
ConfigureQueue {
queue: u16,
size: u16,
desc: u64,
avail: u64,
used: u64,
responder: VirtioVsockConfigureQueueResponder,
},
NotifyQueue { queue: u16, control_handle: VirtioVsockControlHandle },
Ready { negotiated_features: u32, responder: VirtioVsockReadyResponder },
Start {
start_info: StartInfo,
guest_cid: u32,
listeners: Vec<fidl_fuchsia_virtualization::Listener>,
responder: VirtioVsockStartResponder,
},
}
impl VirtioVsockRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_configure_queue(
self,
) -> Option<(u16, u16, u64, u64, u64, VirtioVsockConfigureQueueResponder)> {
if let VirtioVsockRequest::ConfigureQueue { queue, size, desc, avail, used, responder } =
self
{
Some((queue, size, desc, avail, used, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_notify_queue(self) -> Option<(u16, VirtioVsockControlHandle)> {
if let VirtioVsockRequest::NotifyQueue { queue, control_handle } = self {
Some((queue, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_ready(self) -> Option<(u32, VirtioVsockReadyResponder)> {
if let VirtioVsockRequest::Ready { negotiated_features, responder } = self {
Some((negotiated_features, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_start(
self,
) -> Option<(
StartInfo,
u32,
Vec<fidl_fuchsia_virtualization::Listener>,
VirtioVsockStartResponder,
)> {
if let VirtioVsockRequest::Start { start_info, guest_cid, listeners, responder } = self {
Some((start_info, guest_cid, listeners, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
VirtioVsockRequest::ConfigureQueue { .. } => "configure_queue",
VirtioVsockRequest::NotifyQueue { .. } => "notify_queue",
VirtioVsockRequest::Ready { .. } => "ready",
VirtioVsockRequest::Start { .. } => "start",
}
}
}
#[derive(Debug, Clone)]
pub struct VirtioVsockControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for VirtioVsockControlHandle {
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 VirtioVsockControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct VirtioVsockConfigureQueueResponder {
control_handle: std::mem::ManuallyDrop<VirtioVsockControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for VirtioVsockConfigureQueueResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for VirtioVsockConfigureQueueResponder {
type ControlHandle = VirtioVsockControlHandle;
fn control_handle(&self) -> &VirtioVsockControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl VirtioVsockConfigureQueueResponder {
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,
0x72b44fb963480b11,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct VirtioVsockReadyResponder {
control_handle: std::mem::ManuallyDrop<VirtioVsockControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for VirtioVsockReadyResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for VirtioVsockReadyResponder {
type ControlHandle = VirtioVsockControlHandle;
fn control_handle(&self) -> &VirtioVsockControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl VirtioVsockReadyResponder {
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,
0x45707654f5d23c3f,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct VirtioVsockStartResponder {
control_handle: std::mem::ManuallyDrop<VirtioVsockControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for VirtioVsockStartResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for VirtioVsockStartResponder {
type ControlHandle = VirtioVsockControlHandle;
fn control_handle(&self) -> &VirtioVsockControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl VirtioVsockStartResponder {
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,
0x56433562cf67ae0f,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct VirtioWaylandMarker;
impl fidl::endpoints::ProtocolMarker for VirtioWaylandMarker {
type Proxy = VirtioWaylandProxy;
type RequestStream = VirtioWaylandRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = VirtioWaylandSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.virtualization.hardware.VirtioWayland";
}
impl fidl::endpoints::DiscoverableProtocolMarker for VirtioWaylandMarker {}
pub trait VirtioWaylandProxyInterface: Send + Sync {
type ConfigureQueueResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#configure_queue(
&self,
queue: u16,
size: u16,
desc: u64,
avail: u64,
used: u64,
) -> Self::ConfigureQueueResponseFut;
fn r#notify_queue(&self, queue: u16) -> Result<(), fidl::Error>;
type ReadyResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#ready(&self, negotiated_features: u32) -> Self::ReadyResponseFut;
type StartResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#start(
&self,
start_info: StartInfo,
vmar: fidl::Vmar,
sysmem_allocator: fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::AllocatorMarker>,
scenic_allocator: fidl::endpoints::ClientEnd<fidl_fuchsia_ui_composition::AllocatorMarker>,
) -> Self::StartResponseFut;
type StartWithWaylandServer_ResponseFut: std::future::Future<Output = Result<(), fidl::Error>>
+ Send;
fn r#start_with_wayland_server_(
&self,
start_info: StartInfo,
vmar: fidl::Vmar,
wayland_server: Option<fidl::endpoints::ClientEnd<fidl_fuchsia_wayland::Server_Marker>>,
sysmem_allocator: fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::AllocatorMarker>,
scenic_allocator: fidl::endpoints::ClientEnd<fidl_fuchsia_ui_composition::AllocatorMarker>,
) -> Self::StartWithWaylandServer_ResponseFut;
fn r#get_importer(
&self,
importer: fidl::endpoints::ServerEnd<VirtioWaylandImporterMarker>,
) -> Result<(), fidl::Error>;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct VirtioWaylandSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for VirtioWaylandSynchronousProxy {
type Proxy = VirtioWaylandProxy;
type Protocol = VirtioWaylandMarker;
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 VirtioWaylandSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <VirtioWaylandMarker 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<VirtioWaylandEvent, fidl::Error> {
VirtioWaylandEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#configure_queue(
&self,
mut queue: u16,
mut size: u16,
mut desc: u64,
mut avail: u64,
mut used: u64,
___deadline: zx::MonotonicInstant,
) -> Result<(), fidl::Error> {
let _response = self
.client
.send_query::<VirtioDeviceConfigureQueueRequest, fidl::encoding::EmptyPayload>(
(queue, size, desc, avail, used),
0x72b44fb963480b11,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
pub fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
self.client.send::<VirtioDeviceNotifyQueueRequest>(
(queue,),
0x6e3a61d652499244,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#ready(
&self,
mut negotiated_features: u32,
___deadline: zx::MonotonicInstant,
) -> Result<(), fidl::Error> {
let _response =
self.client.send_query::<VirtioDeviceReadyRequest, fidl::encoding::EmptyPayload>(
(negotiated_features,),
0x45707654f5d23c3f,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
pub fn r#start(
&self,
mut start_info: StartInfo,
mut vmar: fidl::Vmar,
mut sysmem_allocator: fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::AllocatorMarker>,
mut scenic_allocator: fidl::endpoints::ClientEnd<
fidl_fuchsia_ui_composition::AllocatorMarker,
>,
___deadline: zx::MonotonicInstant,
) -> Result<(), fidl::Error> {
let _response =
self.client.send_query::<VirtioWaylandStartRequest, fidl::encoding::EmptyPayload>(
(&mut start_info, vmar, sysmem_allocator, scenic_allocator),
0x1f60e084e30deee6,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
pub fn r#start_with_wayland_server_(
&self,
mut start_info: StartInfo,
mut vmar: fidl::Vmar,
mut wayland_server: Option<fidl::endpoints::ClientEnd<fidl_fuchsia_wayland::Server_Marker>>,
mut sysmem_allocator: fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::AllocatorMarker>,
mut scenic_allocator: fidl::endpoints::ClientEnd<
fidl_fuchsia_ui_composition::AllocatorMarker,
>,
___deadline: zx::MonotonicInstant,
) -> Result<(), fidl::Error> {
let _response = self
.client
.send_query::<VirtioWaylandStartWithWaylandServerRequest, fidl::encoding::EmptyPayload>(
(&mut start_info, vmar, wayland_server, sysmem_allocator, scenic_allocator),
0x3f2e38dfb60077e9,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
pub fn r#get_importer(
&self,
mut importer: fidl::endpoints::ServerEnd<VirtioWaylandImporterMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<VirtioWaylandGetImporterRequest>(
(importer,),
0x49d1b3c94767a541,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Clone)]
pub struct VirtioWaylandProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for VirtioWaylandProxy {
type Protocol = VirtioWaylandMarker;
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 VirtioWaylandProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <VirtioWaylandMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> VirtioWaylandEventStream {
VirtioWaylandEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#configure_queue(
&self,
mut queue: u16,
mut size: u16,
mut desc: u64,
mut avail: u64,
mut used: u64,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
VirtioWaylandProxyInterface::r#configure_queue(self, queue, size, desc, avail, used)
}
pub fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
VirtioWaylandProxyInterface::r#notify_queue(self, queue)
}
pub fn r#ready(
&self,
mut negotiated_features: u32,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
VirtioWaylandProxyInterface::r#ready(self, negotiated_features)
}
pub fn r#start(
&self,
mut start_info: StartInfo,
mut vmar: fidl::Vmar,
mut sysmem_allocator: fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::AllocatorMarker>,
mut scenic_allocator: fidl::endpoints::ClientEnd<
fidl_fuchsia_ui_composition::AllocatorMarker,
>,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
VirtioWaylandProxyInterface::r#start(
self,
start_info,
vmar,
sysmem_allocator,
scenic_allocator,
)
}
pub fn r#start_with_wayland_server_(
&self,
mut start_info: StartInfo,
mut vmar: fidl::Vmar,
mut wayland_server: Option<fidl::endpoints::ClientEnd<fidl_fuchsia_wayland::Server_Marker>>,
mut sysmem_allocator: fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::AllocatorMarker>,
mut scenic_allocator: fidl::endpoints::ClientEnd<
fidl_fuchsia_ui_composition::AllocatorMarker,
>,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
VirtioWaylandProxyInterface::r#start_with_wayland_server_(
self,
start_info,
vmar,
wayland_server,
sysmem_allocator,
scenic_allocator,
)
}
pub fn r#get_importer(
&self,
mut importer: fidl::endpoints::ServerEnd<VirtioWaylandImporterMarker>,
) -> Result<(), fidl::Error> {
VirtioWaylandProxyInterface::r#get_importer(self, importer)
}
}
impl VirtioWaylandProxyInterface for VirtioWaylandProxy {
type ConfigureQueueResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#configure_queue(
&self,
mut queue: u16,
mut size: u16,
mut desc: u64,
mut avail: u64,
mut used: u64,
) -> Self::ConfigureQueueResponseFut {
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,
0x72b44fb963480b11,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<VirtioDeviceConfigureQueueRequest, ()>(
(queue, size, desc, avail, used),
0x72b44fb963480b11,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
fn r#notify_queue(&self, mut queue: u16) -> Result<(), fidl::Error> {
self.client.send::<VirtioDeviceNotifyQueueRequest>(
(queue,),
0x6e3a61d652499244,
fidl::encoding::DynamicFlags::empty(),
)
}
type ReadyResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#ready(&self, mut negotiated_features: u32) -> Self::ReadyResponseFut {
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,
0x45707654f5d23c3f,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<VirtioDeviceReadyRequest, ()>(
(negotiated_features,),
0x45707654f5d23c3f,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type StartResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#start(
&self,
mut start_info: StartInfo,
mut vmar: fidl::Vmar,
mut sysmem_allocator: fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::AllocatorMarker>,
mut scenic_allocator: fidl::endpoints::ClientEnd<
fidl_fuchsia_ui_composition::AllocatorMarker,
>,
) -> Self::StartResponseFut {
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,
0x1f60e084e30deee6,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<VirtioWaylandStartRequest, ()>(
(&mut start_info, vmar, sysmem_allocator, scenic_allocator),
0x1f60e084e30deee6,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type StartWithWaylandServer_ResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#start_with_wayland_server_(
&self,
mut start_info: StartInfo,
mut vmar: fidl::Vmar,
mut wayland_server: Option<fidl::endpoints::ClientEnd<fidl_fuchsia_wayland::Server_Marker>>,
mut sysmem_allocator: fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::AllocatorMarker>,
mut scenic_allocator: fidl::endpoints::ClientEnd<
fidl_fuchsia_ui_composition::AllocatorMarker,
>,
) -> Self::StartWithWaylandServer_ResponseFut {
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,
0x3f2e38dfb60077e9,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<VirtioWaylandStartWithWaylandServerRequest, ()>(
(&mut start_info, vmar, wayland_server, sysmem_allocator, scenic_allocator),
0x3f2e38dfb60077e9,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
fn r#get_importer(
&self,
mut importer: fidl::endpoints::ServerEnd<VirtioWaylandImporterMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<VirtioWaylandGetImporterRequest>(
(importer,),
0x49d1b3c94767a541,
fidl::encoding::DynamicFlags::empty(),
)
}
}
pub struct VirtioWaylandEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for VirtioWaylandEventStream {}
impl futures::stream::FusedStream for VirtioWaylandEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for VirtioWaylandEventStream {
type Item = Result<VirtioWaylandEvent, 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(VirtioWaylandEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum VirtioWaylandEvent {}
impl VirtioWaylandEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<VirtioWaylandEvent, 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: <VirtioWaylandMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct VirtioWaylandRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for VirtioWaylandRequestStream {}
impl futures::stream::FusedStream for VirtioWaylandRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for VirtioWaylandRequestStream {
type Protocol = VirtioWaylandMarker;
type ControlHandle = VirtioWaylandControlHandle;
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 {
VirtioWaylandControlHandle { 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 VirtioWaylandRequestStream {
type Item = Result<VirtioWaylandRequest, 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 VirtioWaylandRequestStream 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 {
0x72b44fb963480b11 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
VirtioDeviceConfigureQueueRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceConfigureQueueRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
VirtioWaylandControlHandle { inner: this.inner.clone() };
Ok(VirtioWaylandRequest::ConfigureQueue {
queue: req.queue,
size: req.size,
desc: req.desc,
avail: req.avail,
used: req.used,
responder: VirtioWaylandConfigureQueueResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x6e3a61d652499244 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
VirtioDeviceNotifyQueueRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceNotifyQueueRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
VirtioWaylandControlHandle { inner: this.inner.clone() };
Ok(VirtioWaylandRequest::NotifyQueue { queue: req.queue, control_handle })
}
0x45707654f5d23c3f => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
VirtioDeviceReadyRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioDeviceReadyRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
VirtioWaylandControlHandle { inner: this.inner.clone() };
Ok(VirtioWaylandRequest::Ready {
negotiated_features: req.negotiated_features,
responder: VirtioWaylandReadyResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x1f60e084e30deee6 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
VirtioWaylandStartRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioWaylandStartRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
VirtioWaylandControlHandle { inner: this.inner.clone() };
Ok(VirtioWaylandRequest::Start {
start_info: req.start_info,
vmar: req.vmar,
sysmem_allocator: req.sysmem_allocator,
scenic_allocator: req.scenic_allocator,
responder: VirtioWaylandStartResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x3f2e38dfb60077e9 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
VirtioWaylandStartWithWaylandServerRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioWaylandStartWithWaylandServerRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
VirtioWaylandControlHandle { inner: this.inner.clone() };
Ok(VirtioWaylandRequest::StartWithWaylandServer_ {
start_info: req.start_info,
vmar: req.vmar,
wayland_server: req.wayland_server,
sysmem_allocator: req.sysmem_allocator,
scenic_allocator: req.scenic_allocator,
responder: VirtioWaylandStartWithWaylandServer_Responder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x49d1b3c94767a541 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
VirtioWaylandGetImporterRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioWaylandGetImporterRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
VirtioWaylandControlHandle { inner: this.inner.clone() };
Ok(VirtioWaylandRequest::GetImporter {
importer: req.importer,
control_handle,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<VirtioWaylandMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum VirtioWaylandRequest {
ConfigureQueue {
queue: u16,
size: u16,
desc: u64,
avail: u64,
used: u64,
responder: VirtioWaylandConfigureQueueResponder,
},
NotifyQueue { queue: u16, control_handle: VirtioWaylandControlHandle },
Ready { negotiated_features: u32, responder: VirtioWaylandReadyResponder },
Start {
start_info: StartInfo,
vmar: fidl::Vmar,
sysmem_allocator: fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::AllocatorMarker>,
scenic_allocator: fidl::endpoints::ClientEnd<fidl_fuchsia_ui_composition::AllocatorMarker>,
responder: VirtioWaylandStartResponder,
},
StartWithWaylandServer_ {
start_info: StartInfo,
vmar: fidl::Vmar,
wayland_server: Option<fidl::endpoints::ClientEnd<fidl_fuchsia_wayland::Server_Marker>>,
sysmem_allocator: fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::AllocatorMarker>,
scenic_allocator: fidl::endpoints::ClientEnd<fidl_fuchsia_ui_composition::AllocatorMarker>,
responder: VirtioWaylandStartWithWaylandServer_Responder,
},
GetImporter {
importer: fidl::endpoints::ServerEnd<VirtioWaylandImporterMarker>,
control_handle: VirtioWaylandControlHandle,
},
}
impl VirtioWaylandRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_configure_queue(
self,
) -> Option<(u16, u16, u64, u64, u64, VirtioWaylandConfigureQueueResponder)> {
if let VirtioWaylandRequest::ConfigureQueue { queue, size, desc, avail, used, responder } =
self
{
Some((queue, size, desc, avail, used, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_notify_queue(self) -> Option<(u16, VirtioWaylandControlHandle)> {
if let VirtioWaylandRequest::NotifyQueue { queue, control_handle } = self {
Some((queue, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_ready(self) -> Option<(u32, VirtioWaylandReadyResponder)> {
if let VirtioWaylandRequest::Ready { negotiated_features, responder } = self {
Some((negotiated_features, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_start(
self,
) -> Option<(
StartInfo,
fidl::Vmar,
fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::AllocatorMarker>,
fidl::endpoints::ClientEnd<fidl_fuchsia_ui_composition::AllocatorMarker>,
VirtioWaylandStartResponder,
)> {
if let VirtioWaylandRequest::Start {
start_info,
vmar,
sysmem_allocator,
scenic_allocator,
responder,
} = self
{
Some((start_info, vmar, sysmem_allocator, scenic_allocator, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_start_with_wayland_server_(
self,
) -> Option<(
StartInfo,
fidl::Vmar,
Option<fidl::endpoints::ClientEnd<fidl_fuchsia_wayland::Server_Marker>>,
fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::AllocatorMarker>,
fidl::endpoints::ClientEnd<fidl_fuchsia_ui_composition::AllocatorMarker>,
VirtioWaylandStartWithWaylandServer_Responder,
)> {
if let VirtioWaylandRequest::StartWithWaylandServer_ {
start_info,
vmar,
wayland_server,
sysmem_allocator,
scenic_allocator,
responder,
} = self
{
Some((start_info, vmar, wayland_server, sysmem_allocator, scenic_allocator, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_get_importer(
self,
) -> Option<(fidl::endpoints::ServerEnd<VirtioWaylandImporterMarker>, VirtioWaylandControlHandle)>
{
if let VirtioWaylandRequest::GetImporter { importer, control_handle } = self {
Some((importer, control_handle))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
VirtioWaylandRequest::ConfigureQueue { .. } => "configure_queue",
VirtioWaylandRequest::NotifyQueue { .. } => "notify_queue",
VirtioWaylandRequest::Ready { .. } => "ready",
VirtioWaylandRequest::Start { .. } => "start",
VirtioWaylandRequest::StartWithWaylandServer_ { .. } => "start_with_wayland_server_",
VirtioWaylandRequest::GetImporter { .. } => "get_importer",
}
}
}
#[derive(Debug, Clone)]
pub struct VirtioWaylandControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for VirtioWaylandControlHandle {
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 VirtioWaylandControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct VirtioWaylandConfigureQueueResponder {
control_handle: std::mem::ManuallyDrop<VirtioWaylandControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for VirtioWaylandConfigureQueueResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for VirtioWaylandConfigureQueueResponder {
type ControlHandle = VirtioWaylandControlHandle;
fn control_handle(&self) -> &VirtioWaylandControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl VirtioWaylandConfigureQueueResponder {
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,
0x72b44fb963480b11,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct VirtioWaylandReadyResponder {
control_handle: std::mem::ManuallyDrop<VirtioWaylandControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for VirtioWaylandReadyResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for VirtioWaylandReadyResponder {
type ControlHandle = VirtioWaylandControlHandle;
fn control_handle(&self) -> &VirtioWaylandControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl VirtioWaylandReadyResponder {
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,
0x45707654f5d23c3f,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct VirtioWaylandStartResponder {
control_handle: std::mem::ManuallyDrop<VirtioWaylandControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for VirtioWaylandStartResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for VirtioWaylandStartResponder {
type ControlHandle = VirtioWaylandControlHandle;
fn control_handle(&self) -> &VirtioWaylandControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl VirtioWaylandStartResponder {
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,
0x1f60e084e30deee6,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct VirtioWaylandStartWithWaylandServer_Responder {
control_handle: std::mem::ManuallyDrop<VirtioWaylandControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for VirtioWaylandStartWithWaylandServer_Responder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for VirtioWaylandStartWithWaylandServer_Responder {
type ControlHandle = VirtioWaylandControlHandle;
fn control_handle(&self) -> &VirtioWaylandControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl VirtioWaylandStartWithWaylandServer_Responder {
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,
0x3f2e38dfb60077e9,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct VirtioWaylandImporterMarker;
impl fidl::endpoints::ProtocolMarker for VirtioWaylandImporterMarker {
type Proxy = VirtioWaylandImporterProxy;
type RequestStream = VirtioWaylandImporterRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = VirtioWaylandImporterSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) VirtioWaylandImporter";
}
pub trait VirtioWaylandImporterProxyInterface: Send + Sync {
type ImportImageResponseFut: std::future::Future<Output = Result<u32, fidl::Error>> + Send;
fn r#import_image(&self, image: VirtioImage) -> Self::ImportImageResponseFut;
type ExportImageResponseFut: std::future::Future<Output = Result<(i32, Option<Box<VirtioImage>>), fidl::Error>>
+ Send;
fn r#export_image(&self, vfd_id: u32) -> Self::ExportImageResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct VirtioWaylandImporterSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for VirtioWaylandImporterSynchronousProxy {
type Proxy = VirtioWaylandImporterProxy;
type Protocol = VirtioWaylandImporterMarker;
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 VirtioWaylandImporterSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name =
<VirtioWaylandImporterMarker 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<VirtioWaylandImporterEvent, fidl::Error> {
VirtioWaylandImporterEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#import_image(
&self,
mut image: VirtioImage,
___deadline: zx::MonotonicInstant,
) -> Result<u32, fidl::Error> {
let _response = self.client.send_query::<
VirtioWaylandImporterImportImageRequest,
VirtioWaylandImporterImportImageResponse,
>(
(&mut image,),
0x3f8f3f75c34de5c,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.vfd_id)
}
pub fn r#export_image(
&self,
mut vfd_id: u32,
___deadline: zx::MonotonicInstant,
) -> Result<(i32, Option<Box<VirtioImage>>), fidl::Error> {
let _response = self.client.send_query::<
VirtioWaylandImporterExportImageRequest,
VirtioWaylandImporterExportImageResponse,
>(
(vfd_id,),
0x25a33daa7c0307c4,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok((_response.status, _response.image))
}
}
#[derive(Debug, Clone)]
pub struct VirtioWaylandImporterProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for VirtioWaylandImporterProxy {
type Protocol = VirtioWaylandImporterMarker;
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 VirtioWaylandImporterProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name =
<VirtioWaylandImporterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> VirtioWaylandImporterEventStream {
VirtioWaylandImporterEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#import_image(
&self,
mut image: VirtioImage,
) -> fidl::client::QueryResponseFut<u32, fidl::encoding::DefaultFuchsiaResourceDialect> {
VirtioWaylandImporterProxyInterface::r#import_image(self, image)
}
pub fn r#export_image(
&self,
mut vfd_id: u32,
) -> fidl::client::QueryResponseFut<
(i32, Option<Box<VirtioImage>>),
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
VirtioWaylandImporterProxyInterface::r#export_image(self, vfd_id)
}
}
impl VirtioWaylandImporterProxyInterface for VirtioWaylandImporterProxy {
type ImportImageResponseFut =
fidl::client::QueryResponseFut<u32, fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#import_image(&self, mut image: VirtioImage) -> Self::ImportImageResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<u32, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
VirtioWaylandImporterImportImageResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x3f8f3f75c34de5c,
>(_buf?)?;
Ok(_response.vfd_id)
}
self.client.send_query_and_decode::<VirtioWaylandImporterImportImageRequest, u32>(
(&mut image,),
0x3f8f3f75c34de5c,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type ExportImageResponseFut = fidl::client::QueryResponseFut<
(i32, Option<Box<VirtioImage>>),
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#export_image(&self, mut vfd_id: u32) -> Self::ExportImageResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<(i32, Option<Box<VirtioImage>>), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
VirtioWaylandImporterExportImageResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x25a33daa7c0307c4,
>(_buf?)?;
Ok((_response.status, _response.image))
}
self.client.send_query_and_decode::<
VirtioWaylandImporterExportImageRequest,
(i32, Option<Box<VirtioImage>>),
>(
(vfd_id,),
0x25a33daa7c0307c4,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct VirtioWaylandImporterEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for VirtioWaylandImporterEventStream {}
impl futures::stream::FusedStream for VirtioWaylandImporterEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for VirtioWaylandImporterEventStream {
type Item = Result<VirtioWaylandImporterEvent, 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(VirtioWaylandImporterEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum VirtioWaylandImporterEvent {}
impl VirtioWaylandImporterEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<VirtioWaylandImporterEvent, 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:
<VirtioWaylandImporterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct VirtioWaylandImporterRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for VirtioWaylandImporterRequestStream {}
impl futures::stream::FusedStream for VirtioWaylandImporterRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for VirtioWaylandImporterRequestStream {
type Protocol = VirtioWaylandImporterMarker;
type ControlHandle = VirtioWaylandImporterControlHandle;
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 {
VirtioWaylandImporterControlHandle { 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 VirtioWaylandImporterRequestStream {
type Item = Result<VirtioWaylandImporterRequest, 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 VirtioWaylandImporterRequestStream 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 {
0x3f8f3f75c34de5c => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(VirtioWaylandImporterImportImageRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioWaylandImporterImportImageRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = VirtioWaylandImporterControlHandle {
inner: this.inner.clone(),
};
Ok(VirtioWaylandImporterRequest::ImportImage {image: req.image,
responder: VirtioWaylandImporterImportImageResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x25a33daa7c0307c4 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(VirtioWaylandImporterExportImageRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtioWaylandImporterExportImageRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = VirtioWaylandImporterControlHandle {
inner: this.inner.clone(),
};
Ok(VirtioWaylandImporterRequest::ExportImage {vfd_id: req.vfd_id,
responder: VirtioWaylandImporterExportImageResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <VirtioWaylandImporterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum VirtioWaylandImporterRequest {
ImportImage { image: VirtioImage, responder: VirtioWaylandImporterImportImageResponder },
ExportImage { vfd_id: u32, responder: VirtioWaylandImporterExportImageResponder },
}
impl VirtioWaylandImporterRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_import_image(
self,
) -> Option<(VirtioImage, VirtioWaylandImporterImportImageResponder)> {
if let VirtioWaylandImporterRequest::ImportImage { image, responder } = self {
Some((image, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_export_image(self) -> Option<(u32, VirtioWaylandImporterExportImageResponder)> {
if let VirtioWaylandImporterRequest::ExportImage { vfd_id, responder } = self {
Some((vfd_id, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
VirtioWaylandImporterRequest::ImportImage { .. } => "import_image",
VirtioWaylandImporterRequest::ExportImage { .. } => "export_image",
}
}
}
#[derive(Debug, Clone)]
pub struct VirtioWaylandImporterControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for VirtioWaylandImporterControlHandle {
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 VirtioWaylandImporterControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct VirtioWaylandImporterImportImageResponder {
control_handle: std::mem::ManuallyDrop<VirtioWaylandImporterControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for VirtioWaylandImporterImportImageResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for VirtioWaylandImporterImportImageResponder {
type ControlHandle = VirtioWaylandImporterControlHandle;
fn control_handle(&self) -> &VirtioWaylandImporterControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl VirtioWaylandImporterImportImageResponder {
pub fn send(self, mut vfd_id: u32) -> Result<(), fidl::Error> {
let _result = self.send_raw(vfd_id);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut vfd_id: u32) -> Result<(), fidl::Error> {
let _result = self.send_raw(vfd_id);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut vfd_id: u32) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<VirtioWaylandImporterImportImageResponse>(
(vfd_id,),
self.tx_id,
0x3f8f3f75c34de5c,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct VirtioWaylandImporterExportImageResponder {
control_handle: std::mem::ManuallyDrop<VirtioWaylandImporterControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for VirtioWaylandImporterExportImageResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for VirtioWaylandImporterExportImageResponder {
type ControlHandle = VirtioWaylandImporterControlHandle;
fn control_handle(&self) -> &VirtioWaylandImporterControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl VirtioWaylandImporterExportImageResponder {
pub fn send(self, mut status: i32, mut image: Option<VirtioImage>) -> Result<(), fidl::Error> {
let _result = self.send_raw(status, image);
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 image: Option<VirtioImage>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(status, image);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut status: i32, mut image: Option<VirtioImage>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<VirtioWaylandImporterExportImageResponse>(
(status, image.as_mut()),
self.tx_id,
0x25a33daa7c0307c4,
fidl::encoding::DynamicFlags::empty(),
)
}
}
mod internal {
use super::*;
impl fidl::encoding::ResourceTypeMarker for StartInfo {
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 StartInfo {
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 fidl::encoding::Encode<StartInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
for &mut StartInfo
{
#[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::<StartInfo>(offset);
fidl::encoding::Encode::<StartInfo, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<Trap as fidl::encoding::ValueTypeMarker>::borrow(&self.trap),
<fidl::encoding::Optional<fidl::encoding::HandleType<fidl::Guest, { fidl::ObjectType::GUEST.into_raw() }, 2147483648>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.guest),
<fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.event),
<fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.vmo),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<Trap, fidl::encoding::DefaultFuchsiaResourceDialect>,
T1: fidl::encoding::Encode<
fidl::encoding::Optional<
fidl::encoding::HandleType<
fidl::Guest,
{ fidl::ObjectType::GUEST.into_raw() },
2147483648,
>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T2: fidl::encoding::Encode<
fidl::encoding::HandleType<
fidl::Event,
{ fidl::ObjectType::EVENT.into_raw() },
2147483648,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T3: fidl::encoding::Encode<
fidl::encoding::HandleType<
fidl::Vmo,
{ fidl::ObjectType::VMO.into_raw() },
2147483648,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
> fidl::encoding::Encode<StartInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
for (T0, T1, T2, T3)
{
#[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::<StartInfo>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(24);
(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 + 20, depth)?;
self.3.encode(encoder, offset + 24, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for StartInfo {
#[inline(always)]
fn new_empty() -> Self {
Self {
trap: fidl::new_empty!(Trap, fidl::encoding::DefaultFuchsiaResourceDialect),
guest: fidl::new_empty!(
fidl::encoding::Optional<
fidl::encoding::HandleType<
fidl::Guest,
{ fidl::ObjectType::GUEST.into_raw() },
2147483648,
>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
event: fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
vmo: fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(24) };
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 + 24 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(
Trap,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.trap,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::Optional<
fidl::encoding::HandleType<
fidl::Guest,
{ fidl::ObjectType::GUEST.into_raw() },
2147483648,
>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.guest,
decoder,
offset + 16,
_depth
)?;
fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.event, decoder, offset + 20, _depth)?;
fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.vmo, decoder, offset + 24, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for Trap {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for Trap {
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
}
#[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<Trap, D> for &Trap {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Trap>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut Trap).write_unaligned((self as *const Trap).read());
}
Ok(())
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<u64, D>,
T1: fidl::encoding::Encode<u64, D>,
> fidl::encoding::Encode<Trap, 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::<Trap>(offset);
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 Trap {
#[inline(always)]
fn new_empty() -> Self {
Self { addr: fidl::new_empty!(u64, D), 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, 16);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for VirtioBalloonGetMemStatsResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for VirtioBalloonGetMemStatsResponse {
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<VirtioBalloonGetMemStatsResponse, D>
for &VirtioBalloonGetMemStatsResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<VirtioBalloonGetMemStatsResponse>(offset);
fidl::encoding::Encode::<VirtioBalloonGetMemStatsResponse, D>::encode(
(
<i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.status),
<fidl::encoding::Optional<
fidl::encoding::UnboundedVector<fidl_fuchsia_virtualization::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<fidl_fuchsia_virtualization::MemStat>,
>,
D,
>,
> fidl::encoding::Encode<VirtioBalloonGetMemStatsResponse, 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::<VirtioBalloonGetMemStatsResponse>(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 VirtioBalloonGetMemStatsResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self {
status: fidl::new_empty!(i32, D),
mem_stats: fidl::new_empty!(
fidl::encoding::Optional<
fidl::encoding::UnboundedVector<fidl_fuchsia_virtualization::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<fidl_fuchsia_virtualization::MemStat>,
>,
D,
&mut self.mem_stats,
decoder,
offset + 8,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for VirtioBalloonStartRequest {
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 VirtioBalloonStartRequest {
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
fidl::encoding::Encode<
VirtioBalloonStartRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut VirtioBalloonStartRequest
{
#[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::<VirtioBalloonStartRequest>(offset);
fidl::encoding::Encode::<
VirtioBalloonStartRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(<StartInfo as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.start_info,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<T0: fidl::encoding::Encode<StartInfo, fidl::encoding::DefaultFuchsiaResourceDialect>>
fidl::encoding::Encode<
VirtioBalloonStartRequest,
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::<VirtioBalloonStartRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for VirtioBalloonStartRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
start_info: fidl::new_empty!(
StartInfo,
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!(
StartInfo,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.start_info,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for VirtioBlockStartRequest {
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 VirtioBlockStartRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
72
}
}
unsafe impl
fidl::encoding::Encode<
VirtioBlockStartRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut VirtioBlockStartRequest
{
#[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::<VirtioBlockStartRequest>(offset);
fidl::encoding::Encode::<VirtioBlockStartRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<StartInfo as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.start_info),
<fidl_fuchsia_virtualization::BlockSpec as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.spec),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<StartInfo, fidl::encoding::DefaultFuchsiaResourceDialect>,
T1: fidl::encoding::Encode<
fidl_fuchsia_virtualization::BlockSpec,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
VirtioBlockStartRequest,
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::<VirtioBlockStartRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 32, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for VirtioBlockStartRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
start_info: fidl::new_empty!(
StartInfo,
fidl::encoding::DefaultFuchsiaResourceDialect
),
spec: fidl::new_empty!(
fidl_fuchsia_virtualization::BlockSpec,
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!(
StartInfo,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.start_info,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl_fuchsia_virtualization::BlockSpec,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.spec,
decoder,
offset + 32,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for VirtioBlockStartResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for VirtioBlockStartResponse {
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<VirtioBlockStartResponse, D> for &VirtioBlockStartResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<VirtioBlockStartResponse>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut VirtioBlockStartResponse)
.write_unaligned((self as *const VirtioBlockStartResponse).read());
let padding_ptr = buf_ptr.offset(8) as *mut u64;
let padding_mask = 0xffffffff00000000u64;
padding_ptr.write_unaligned(padding_ptr.read_unaligned() & !padding_mask);
}
Ok(())
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<u64, D>,
T1: fidl::encoding::Encode<u32, D>,
> fidl::encoding::Encode<VirtioBlockStartResponse, 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::<VirtioBlockStartResponse>(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<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for VirtioBlockStartResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { capacity: fidl::new_empty!(u64, D), block_size: 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) };
let ptr = unsafe { buf_ptr.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,
});
}
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
}
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for VirtioConsoleStartRequest {
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 VirtioConsoleStartRequest {
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<
VirtioConsoleStartRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut VirtioConsoleStartRequest
{
#[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::<VirtioConsoleStartRequest>(offset);
fidl::encoding::Encode::<
VirtioConsoleStartRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(
<StartInfo as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.start_info,
),
<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<StartInfo, fidl::encoding::DefaultFuchsiaResourceDialect>,
T1: fidl::encoding::Encode<
fidl::encoding::HandleType<
fidl::Socket,
{ fidl::ObjectType::SOCKET.into_raw() },
2147483648,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
VirtioConsoleStartRequest,
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::<VirtioConsoleStartRequest>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 32, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for VirtioConsoleStartRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
start_info: fidl::new_empty!(
StartInfo,
fidl::encoding::DefaultFuchsiaResourceDialect
),
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);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffff00000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(
StartInfo,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.start_info,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.socket, decoder, offset + 32, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for VirtioDeviceConfigureQueueRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for VirtioDeviceConfigureQueueRequest {
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<VirtioDeviceConfigureQueueRequest, D>
for &VirtioDeviceConfigureQueueRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<VirtioDeviceConfigureQueueRequest>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut VirtioDeviceConfigureQueueRequest)
.write_unaligned((self as *const VirtioDeviceConfigureQueueRequest).read());
let padding_ptr = buf_ptr.offset(0) as *mut u64;
let padding_mask = 0xffffffff00000000u64;
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<u16, D>,
T2: fidl::encoding::Encode<u64, D>,
T3: fidl::encoding::Encode<u64, D>,
T4: fidl::encoding::Encode<u64, D>,
> fidl::encoding::Encode<VirtioDeviceConfigureQueueRequest, 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::<VirtioDeviceConfigureQueueRequest>(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 + 2, depth)?;
self.2.encode(encoder, offset + 8, depth)?;
self.3.encode(encoder, offset + 16, depth)?;
self.4.encode(encoder, offset + 24, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for VirtioDeviceConfigureQueueRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
queue: fidl::new_empty!(u16, D),
size: fidl::new_empty!(u16, D),
desc: fidl::new_empty!(u64, D),
avail: fidl::new_empty!(u64, D),
used: 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 = 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,
});
}
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 32);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for VirtioDeviceNotifyQueueRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for VirtioDeviceNotifyQueueRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
2
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
2
}
#[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<VirtioDeviceNotifyQueueRequest, D>
for &VirtioDeviceNotifyQueueRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<VirtioDeviceNotifyQueueRequest>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut VirtioDeviceNotifyQueueRequest)
.write_unaligned((self as *const VirtioDeviceNotifyQueueRequest).read());
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u16, D>>
fidl::encoding::Encode<VirtioDeviceNotifyQueueRequest, 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::<VirtioDeviceNotifyQueueRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for VirtioDeviceNotifyQueueRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { queue: fidl::new_empty!(u16, 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, 2);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for VirtioDeviceReadyRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for VirtioDeviceReadyRequest {
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<VirtioDeviceReadyRequest, D> for &VirtioDeviceReadyRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<VirtioDeviceReadyRequest>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut VirtioDeviceReadyRequest)
.write_unaligned((self as *const VirtioDeviceReadyRequest).read());
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
fidl::encoding::Encode<VirtioDeviceReadyRequest, 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::<VirtioDeviceReadyRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for VirtioDeviceReadyRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { negotiated_features: 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 VirtioGpuStartRequest {
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 VirtioGpuStartRequest {
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<VirtioGpuStartRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
for &mut VirtioGpuStartRequest
{
#[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::<VirtioGpuStartRequest>(offset);
fidl::encoding::Encode::<
VirtioGpuStartRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(
<StartInfo as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.start_info,
),
<fidl::encoding::Optional<
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<
fidl_fuchsia_ui_input3::KeyboardListenerMarker,
>,
>,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.keyboard_listener,
),
<fidl::encoding::Optional<
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>,
>,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.mouse_source,
),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<StartInfo, fidl::encoding::DefaultFuchsiaResourceDialect>,
T1: fidl::encoding::Encode<
fidl::encoding::Optional<
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_ui_input3::KeyboardListenerMarker>,
>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T2: fidl::encoding::Encode<
fidl::encoding::Optional<
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>,
>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<VirtioGpuStartRequest, 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::<VirtioGpuStartRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 32, depth)?;
self.2.encode(encoder, offset + 36, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for VirtioGpuStartRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
start_info: fidl::new_empty!(
StartInfo,
fidl::encoding::DefaultFuchsiaResourceDialect
),
keyboard_listener: fidl::new_empty!(
fidl::encoding::Optional<
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<
fidl_fuchsia_ui_input3::KeyboardListenerMarker,
>,
>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
mouse_source: fidl::new_empty!(
fidl::encoding::Optional<
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>,
>,
>,
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!(
StartInfo,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.start_info,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::Optional<
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_ui_input3::KeyboardListenerMarker>,
>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.keyboard_listener,
decoder,
offset + 32,
_depth
)?;
fidl::decode!(
fidl::encoding::Optional<
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>,
>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.mouse_source,
decoder,
offset + 36,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for VirtioImage {
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 VirtioImage {
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<VirtioImage, fidl::encoding::DefaultFuchsiaResourceDialect>
for &mut VirtioImage
{
#[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::<VirtioImage>(offset);
fidl::encoding::Encode::<VirtioImage, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.vmo),
<fidl::encoding::Optional<fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.token),
<fidl::encoding::Vector<u8, 128> as fidl::encoding::ValueTypeMarker>::borrow(&self.info),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::HandleType<
fidl::Vmo,
{ fidl::ObjectType::VMO.into_raw() },
2147483648,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T1: fidl::encoding::Encode<
fidl::encoding::Optional<
fidl::encoding::HandleType<
fidl::EventPair,
{ fidl::ObjectType::EVENTPAIR.into_raw() },
2147483648,
>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T2: fidl::encoding::Encode<
fidl::encoding::Vector<u8, 128>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
> fidl::encoding::Encode<VirtioImage, 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::<VirtioImage>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 4, depth)?;
self.2.encode(encoder, offset + 8, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for VirtioImage {
#[inline(always)]
fn new_empty() -> Self {
Self {
vmo: fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
token: fidl::new_empty!(
fidl::encoding::Optional<
fidl::encoding::HandleType<
fidl::EventPair,
{ fidl::ObjectType::EVENTPAIR.into_raw() },
2147483648,
>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
info: fidl::new_empty!(fidl::encoding::Vector<u8, 128>, 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::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.vmo, decoder, offset + 0, _depth)?;
fidl::decode!(
fidl::encoding::Optional<
fidl::encoding::HandleType<
fidl::EventPair,
{ fidl::ObjectType::EVENTPAIR.into_raw() },
2147483648,
>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.token,
decoder,
offset + 4,
_depth
)?;
fidl::decode!(fidl::encoding::Vector<u8, 128>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.info, decoder, offset + 8, _depth)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for VirtioInputStartRequest {
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 VirtioInputStartRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
48
}
}
unsafe impl
fidl::encoding::Encode<
VirtioInputStartRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut VirtioInputStartRequest
{
#[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::<VirtioInputStartRequest>(offset);
fidl::encoding::Encode::<
VirtioInputStartRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(
<StartInfo as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.start_info,
),
<InputType as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.input_type,
),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<StartInfo, fidl::encoding::DefaultFuchsiaResourceDialect>,
T1: fidl::encoding::Encode<InputType, fidl::encoding::DefaultFuchsiaResourceDialect>,
>
fidl::encoding::Encode<
VirtioInputStartRequest,
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::<VirtioInputStartRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 32, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for VirtioInputStartRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
start_info: fidl::new_empty!(
StartInfo,
fidl::encoding::DefaultFuchsiaResourceDialect
),
input_type: fidl::new_empty!(
InputType,
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!(
StartInfo,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.start_info,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
InputType,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.input_type,
decoder,
offset + 32,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for VirtioMagmaStartRequest {
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 VirtioMagmaStartRequest {
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<
VirtioMagmaStartRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut VirtioMagmaStartRequest
{
#[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::<VirtioMagmaStartRequest>(offset);
fidl::encoding::Encode::<
VirtioMagmaStartRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(
<StartInfo as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.start_info,
),
<fidl::encoding::HandleType<
fidl::Vmar,
{ fidl::ObjectType::VMAR.into_raw() },
2147483648,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.vmar
),
<fidl::encoding::Optional<
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<VirtioWaylandImporterMarker>,
>,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.wayland_importer,
),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<StartInfo, fidl::encoding::DefaultFuchsiaResourceDialect>,
T1: fidl::encoding::Encode<
fidl::encoding::HandleType<
fidl::Vmar,
{ fidl::ObjectType::VMAR.into_raw() },
2147483648,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T2: fidl::encoding::Encode<
fidl::encoding::Optional<
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<VirtioWaylandImporterMarker>,
>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
VirtioMagmaStartRequest,
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::<VirtioMagmaStartRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 32, depth)?;
self.2.encode(encoder, offset + 36, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for VirtioMagmaStartRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
start_info: fidl::new_empty!(
StartInfo,
fidl::encoding::DefaultFuchsiaResourceDialect
),
vmar: fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmar, { fidl::ObjectType::VMAR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
wayland_importer: fidl::new_empty!(
fidl::encoding::Optional<
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<VirtioWaylandImporterMarker>,
>,
>,
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!(
StartInfo,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.start_info,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(fidl::encoding::HandleType<fidl::Vmar, { fidl::ObjectType::VMAR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.vmar, decoder, offset + 32, _depth)?;
fidl::decode!(
fidl::encoding::Optional<
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<VirtioWaylandImporterMarker>,
>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.wayland_importer,
decoder,
offset + 36,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for VirtioMagmaStartResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for VirtioMagmaStartResponse {
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<VirtioMagmaStartResponse, D> for &VirtioMagmaStartResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<VirtioMagmaStartResponse>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut VirtioMagmaStartResponse)
.write_unaligned((self as *const VirtioMagmaStartResponse).read());
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i32, D>>
fidl::encoding::Encode<VirtioMagmaStartResponse, 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::<VirtioMagmaStartResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for VirtioMagmaStartResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { status: fidl::new_empty!(i32, 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::ValueTypeMarker for VirtioMemOnConfigChangedRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for VirtioMemOnConfigChangedRequest {
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<VirtioMemOnConfigChangedRequest, D>
for &VirtioMemOnConfigChangedRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<VirtioMemOnConfigChangedRequest>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut VirtioMemOnConfigChangedRequest)
.write_unaligned((self as *const VirtioMemOnConfigChangedRequest).read());
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
fidl::encoding::Encode<VirtioMemOnConfigChangedRequest, 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::<VirtioMemOnConfigChangedRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for VirtioMemOnConfigChangedRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { plugged_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::ResourceTypeMarker for VirtioMemStartRequest {
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 VirtioMemStartRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
56
}
}
unsafe impl
fidl::encoding::Encode<VirtioMemStartRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
for &mut VirtioMemStartRequest
{
#[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::<VirtioMemStartRequest>(offset);
fidl::encoding::Encode::<
VirtioMemStartRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(
<StartInfo as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.start_info,
),
<u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.region_addr),
<u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.plugged_block_size),
<u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.region_size),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<StartInfo, fidl::encoding::DefaultFuchsiaResourceDialect>,
T1: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
T2: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
T3: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
>
fidl::encoding::Encode<VirtioMemStartRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
for (T0, T1, T2, T3)
{
#[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::<VirtioMemStartRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 32, depth)?;
self.2.encode(encoder, offset + 40, depth)?;
self.3.encode(encoder, offset + 48, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for VirtioMemStartRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
start_info: fidl::new_empty!(
StartInfo,
fidl::encoding::DefaultFuchsiaResourceDialect
),
region_addr: fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect),
plugged_block_size: fidl::new_empty!(
u64,
fidl::encoding::DefaultFuchsiaResourceDialect
),
region_size: fidl::new_empty!(u64, 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!(
StartInfo,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.start_info,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
u64,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.region_addr,
decoder,
offset + 32,
_depth
)?;
fidl::decode!(
u64,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.plugged_block_size,
decoder,
offset + 40,
_depth
)?;
fidl::decode!(
u64,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.region_size,
decoder,
offset + 48,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for VirtioNetStartRequest {
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 VirtioNetStartRequest {
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<VirtioNetStartRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
for &mut VirtioNetStartRequest
{
#[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::<VirtioNetStartRequest>(offset);
fidl::encoding::Encode::<
VirtioNetStartRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(
<StartInfo as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.start_info,
),
<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<
T0: fidl::encoding::Encode<StartInfo, fidl::encoding::DefaultFuchsiaResourceDialect>,
T1: fidl::encoding::Encode<
fidl_fuchsia_net::MacAddress,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T2: fidl::encoding::Encode<bool, fidl::encoding::DefaultFuchsiaResourceDialect>,
>
fidl::encoding::Encode<VirtioNetStartRequest, 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::<VirtioNetStartRequest>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 32, depth)?;
self.2.encode(encoder, offset + 38, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for VirtioNetStartRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
start_info: fidl::new_empty!(
StartInfo,
fidl::encoding::DefaultFuchsiaResourceDialect
),
mac_address: fidl::new_empty!(
fidl_fuchsia_net::MacAddress,
fidl::encoding::DefaultFuchsiaResourceDialect
),
enable_bridge: fidl::new_empty!(
bool,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xff00000000000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(
StartInfo,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.start_info,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl_fuchsia_net::MacAddress,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.mac_address,
decoder,
offset + 32,
_depth
)?;
fidl::decode!(
bool,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.enable_bridge,
decoder,
offset + 38,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for VirtioRngStartRequest {
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 VirtioRngStartRequest {
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
fidl::encoding::Encode<VirtioRngStartRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
for &mut VirtioRngStartRequest
{
#[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::<VirtioRngStartRequest>(offset);
fidl::encoding::Encode::<
VirtioRngStartRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(<StartInfo as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.start_info,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<T0: fidl::encoding::Encode<StartInfo, fidl::encoding::DefaultFuchsiaResourceDialect>>
fidl::encoding::Encode<VirtioRngStartRequest, 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::<VirtioRngStartRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for VirtioRngStartRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
start_info: fidl::new_empty!(
StartInfo,
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!(
StartInfo,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.start_info,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for VirtioSoundStartRequest {
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 VirtioSoundStartRequest {
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<
VirtioSoundStartRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut VirtioSoundStartRequest
{
#[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::<VirtioSoundStartRequest>(offset);
fidl::encoding::Encode::<
VirtioSoundStartRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(
<StartInfo as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.start_info,
),
<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.enable_input),
<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.enable_verbose_logging),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<StartInfo, fidl::encoding::DefaultFuchsiaResourceDialect>,
T1: fidl::encoding::Encode<bool, fidl::encoding::DefaultFuchsiaResourceDialect>,
T2: fidl::encoding::Encode<bool, fidl::encoding::DefaultFuchsiaResourceDialect>,
>
fidl::encoding::Encode<
VirtioSoundStartRequest,
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::<VirtioSoundStartRequest>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 32, depth)?;
self.2.encode(encoder, offset + 33, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for VirtioSoundStartRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
start_info: fidl::new_empty!(
StartInfo,
fidl::encoding::DefaultFuchsiaResourceDialect
),
enable_input: fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect),
enable_verbose_logging: fidl::new_empty!(
bool,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffffffff0000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(
StartInfo,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.start_info,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
bool,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.enable_input,
decoder,
offset + 32,
_depth
)?;
fidl::decode!(
bool,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.enable_verbose_logging,
decoder,
offset + 33,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for VirtioSoundStartResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for VirtioSoundStartResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
#[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<VirtioSoundStartResponse, D> for &VirtioSoundStartResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<VirtioSoundStartResponse>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut VirtioSoundStartResponse)
.write_unaligned((self as *const VirtioSoundStartResponse).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>,
T3: fidl::encoding::Encode<u32, D>,
> fidl::encoding::Encode<VirtioSoundStartResponse, D> for (T0, T1, T2, T3)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<VirtioSoundStartResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 4, depth)?;
self.2.encode(encoder, offset + 8, depth)?;
self.3.encode(encoder, offset + 12, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for VirtioSoundStartResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self {
features: fidl::new_empty!(u32, D),
jacks: fidl::new_empty!(u32, D),
streams: fidl::new_empty!(u32, D),
chmaps: 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, 16);
}
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for VirtioVsockStartRequest {
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 VirtioVsockStartRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
56
}
}
unsafe impl
fidl::encoding::Encode<
VirtioVsockStartRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut VirtioVsockStartRequest
{
#[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::<VirtioVsockStartRequest>(offset);
fidl::encoding::Encode::<VirtioVsockStartRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<StartInfo as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.start_info),
<u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.guest_cid),
<fidl::encoding::UnboundedVector<fidl_fuchsia_virtualization::Listener> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.listeners),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<StartInfo, fidl::encoding::DefaultFuchsiaResourceDialect>,
T1: fidl::encoding::Encode<u32, fidl::encoding::DefaultFuchsiaResourceDialect>,
T2: fidl::encoding::Encode<
fidl::encoding::UnboundedVector<fidl_fuchsia_virtualization::Listener>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
VirtioVsockStartRequest,
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::<VirtioVsockStartRequest>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 32, depth)?;
self.2.encode(encoder, offset + 40, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for VirtioVsockStartRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
start_info: fidl::new_empty!(
StartInfo,
fidl::encoding::DefaultFuchsiaResourceDialect
),
guest_cid: fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect),
listeners: fidl::new_empty!(
fidl::encoding::UnboundedVector<fidl_fuchsia_virtualization::Listener>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffff00000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(
StartInfo,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.start_info,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
u32,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.guest_cid,
decoder,
offset + 32,
_depth
)?;
fidl::decode!(
fidl::encoding::UnboundedVector<fidl_fuchsia_virtualization::Listener>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.listeners,
decoder,
offset + 40,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for VirtioWaylandGetImporterRequest {
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 VirtioWaylandGetImporterRequest {
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<
VirtioWaylandGetImporterRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut VirtioWaylandGetImporterRequest
{
#[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::<VirtioWaylandGetImporterRequest>(offset);
fidl::encoding::Encode::<
VirtioWaylandGetImporterRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(
<fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<VirtioWaylandImporterMarker>,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.importer
),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<VirtioWaylandImporterMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
VirtioWaylandGetImporterRequest,
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::<VirtioWaylandGetImporterRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for VirtioWaylandGetImporterRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
importer: fidl::new_empty!(
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<VirtioWaylandImporterMarker>,
>,
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<VirtioWaylandImporterMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.importer,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for VirtioWaylandImporterExportImageRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for VirtioWaylandImporterExportImageRequest {
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<VirtioWaylandImporterExportImageRequest, D>
for &VirtioWaylandImporterExportImageRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<VirtioWaylandImporterExportImageRequest>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut VirtioWaylandImporterExportImageRequest).write_unaligned(
(self as *const VirtioWaylandImporterExportImageRequest).read(),
);
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
fidl::encoding::Encode<VirtioWaylandImporterExportImageRequest, 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::<VirtioWaylandImporterExportImageRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for VirtioWaylandImporterExportImageRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { vfd_id: 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 VirtioWaylandImporterExportImageResponse {
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 VirtioWaylandImporterExportImageResponse {
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<
VirtioWaylandImporterExportImageResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut VirtioWaylandImporterExportImageResponse
{
#[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::<VirtioWaylandImporterExportImageResponse>(offset);
fidl::encoding::Encode::<VirtioWaylandImporterExportImageResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.status),
<fidl::encoding::Boxed<VirtioImage> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.image),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<i32, fidl::encoding::DefaultFuchsiaResourceDialect>,
T1: fidl::encoding::Encode<
fidl::encoding::Boxed<VirtioImage>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
VirtioWaylandImporterExportImageResponse,
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::<VirtioWaylandImporterExportImageResponse>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for VirtioWaylandImporterExportImageResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self {
status: fidl::new_empty!(i32, fidl::encoding::DefaultFuchsiaResourceDialect),
image: fidl::new_empty!(
fidl::encoding::Boxed<VirtioImage>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffff00000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(
i32,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.status,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::Boxed<VirtioImage>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.image,
decoder,
offset + 8,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for VirtioWaylandImporterImportImageRequest {
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 VirtioWaylandImporterImportImageRequest {
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<
VirtioWaylandImporterImportImageRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut VirtioWaylandImporterImportImageRequest
{
#[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::<VirtioWaylandImporterImportImageRequest>(offset);
fidl::encoding::Encode::<
VirtioWaylandImporterImportImageRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(<VirtioImage as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.image,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<VirtioImage, fidl::encoding::DefaultFuchsiaResourceDialect>,
>
fidl::encoding::Encode<
VirtioWaylandImporterImportImageRequest,
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::<VirtioWaylandImporterImportImageRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for VirtioWaylandImporterImportImageRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
image: fidl::new_empty!(VirtioImage, 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!(
VirtioImage,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.image,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for VirtioWaylandImporterImportImageResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for VirtioWaylandImporterImportImageResponse {
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<VirtioWaylandImporterImportImageResponse, D>
for &VirtioWaylandImporterImportImageResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<VirtioWaylandImporterImportImageResponse>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut VirtioWaylandImporterImportImageResponse).write_unaligned(
(self as *const VirtioWaylandImporterImportImageResponse).read(),
);
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
fidl::encoding::Encode<VirtioWaylandImporterImportImageResponse, 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::<VirtioWaylandImporterImportImageResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for VirtioWaylandImporterImportImageResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { vfd_id: 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 VirtioWaylandStartRequest {
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 VirtioWaylandStartRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
48
}
}
unsafe impl
fidl::encoding::Encode<
VirtioWaylandStartRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut VirtioWaylandStartRequest
{
#[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::<VirtioWaylandStartRequest>(offset);
fidl::encoding::Encode::<
VirtioWaylandStartRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(
<StartInfo as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.start_info,
),
<fidl::encoding::HandleType<
fidl::Vmar,
{ fidl::ObjectType::VMAR.into_raw() },
2147483648,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.vmar
),
<fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::AllocatorMarker>,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.sysmem_allocator,
),
<fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_ui_composition::AllocatorMarker>,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.scenic_allocator,
),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<StartInfo, fidl::encoding::DefaultFuchsiaResourceDialect>,
T1: fidl::encoding::Encode<
fidl::encoding::HandleType<
fidl::Vmar,
{ fidl::ObjectType::VMAR.into_raw() },
2147483648,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T2: fidl::encoding::Encode<
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::AllocatorMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T3: fidl::encoding::Encode<
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_ui_composition::AllocatorMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
VirtioWaylandStartRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0, T1, T2, T3)
{
#[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::<VirtioWaylandStartRequest>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(40);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 32, depth)?;
self.2.encode(encoder, offset + 36, depth)?;
self.3.encode(encoder, offset + 40, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for VirtioWaylandStartRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
start_info: fidl::new_empty!(
StartInfo,
fidl::encoding::DefaultFuchsiaResourceDialect
),
vmar: fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmar, { fidl::ObjectType::VMAR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
sysmem_allocator: fidl::new_empty!(
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::AllocatorMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
scenic_allocator: fidl::new_empty!(
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_ui_composition::AllocatorMarker>,
>,
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(40) };
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 + 40 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(
StartInfo,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.start_info,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(fidl::encoding::HandleType<fidl::Vmar, { fidl::ObjectType::VMAR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.vmar, decoder, offset + 32, _depth)?;
fidl::decode!(
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::AllocatorMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.sysmem_allocator,
decoder,
offset + 36,
_depth
)?;
fidl::decode!(
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_ui_composition::AllocatorMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.scenic_allocator,
decoder,
offset + 40,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for VirtioWaylandStartWithWaylandServerRequest {
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 VirtioWaylandStartWithWaylandServerRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
48
}
}
unsafe impl
fidl::encoding::Encode<
VirtioWaylandStartWithWaylandServerRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut VirtioWaylandStartWithWaylandServerRequest
{
#[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::<VirtioWaylandStartWithWaylandServerRequest>(offset);
fidl::encoding::Encode::<
VirtioWaylandStartWithWaylandServerRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(
<StartInfo as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.start_info,
),
<fidl::encoding::HandleType<
fidl::Vmar,
{ fidl::ObjectType::VMAR.into_raw() },
2147483648,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.vmar
),
<fidl::encoding::Optional<
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_wayland::Server_Marker>,
>,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.wayland_server,
),
<fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::AllocatorMarker>,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.sysmem_allocator,
),
<fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_ui_composition::AllocatorMarker>,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.scenic_allocator,
),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<StartInfo, fidl::encoding::DefaultFuchsiaResourceDialect>,
T1: fidl::encoding::Encode<
fidl::encoding::HandleType<
fidl::Vmar,
{ fidl::ObjectType::VMAR.into_raw() },
2147483648,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T2: fidl::encoding::Encode<
fidl::encoding::Optional<
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_wayland::Server_Marker>,
>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T3: fidl::encoding::Encode<
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::AllocatorMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T4: fidl::encoding::Encode<
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_ui_composition::AllocatorMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
VirtioWaylandStartWithWaylandServerRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0, T1, T2, T3, T4)
{
#[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::<VirtioWaylandStartWithWaylandServerRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 32, depth)?;
self.2.encode(encoder, offset + 36, depth)?;
self.3.encode(encoder, offset + 40, depth)?;
self.4.encode(encoder, offset + 44, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for VirtioWaylandStartWithWaylandServerRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
start_info: fidl::new_empty!(
StartInfo,
fidl::encoding::DefaultFuchsiaResourceDialect
),
vmar: fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmar, { fidl::ObjectType::VMAR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
wayland_server: fidl::new_empty!(
fidl::encoding::Optional<
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_wayland::Server_Marker>,
>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
sysmem_allocator: fidl::new_empty!(
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::AllocatorMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
scenic_allocator: fidl::new_empty!(
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_ui_composition::AllocatorMarker>,
>,
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!(
StartInfo,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.start_info,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(fidl::encoding::HandleType<fidl::Vmar, { fidl::ObjectType::VMAR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.vmar, decoder, offset + 32, _depth)?;
fidl::decode!(
fidl::encoding::Optional<
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_wayland::Server_Marker>,
>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.wayland_server,
decoder,
offset + 36,
_depth
)?;
fidl::decode!(
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_sysmem2::AllocatorMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.sysmem_allocator,
decoder,
offset + 40,
_depth
)?;
fidl::decode!(
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_ui_composition::AllocatorMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.scenic_allocator,
decoder,
offset + 44,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for InputType {
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 InputType {
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<InputType, fidl::encoding::DefaultFuchsiaResourceDialect>
for &mut InputType
{
#[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::<InputType>(offset);
encoder.write_num::<u64>(self.ordinal(), offset);
match self {
InputType::Keyboard(ref mut val) => fidl::encoding::encode_in_envelope::<
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<fidl_fuchsia_ui_input3::KeyboardListenerMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
<fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<fidl_fuchsia_ui_input3::KeyboardListenerMarker>,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
val
),
encoder,
offset + 8,
_depth,
),
InputType::Mouse(ref mut val) => fidl::encoding::encode_in_envelope::<
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
<fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
val
),
encoder,
offset + 8,
_depth,
),
}
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for InputType {
#[inline(always)]
fn new_empty() -> Self {
Self::Keyboard(fidl::new_empty!(
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<fidl_fuchsia_ui_input3::KeyboardListenerMarker>,
>,
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::ServerEnd<fidl_fuchsia_ui_input3::KeyboardListenerMarker>,
> as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2 => <fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_ui_pointer::MouseSourceMarker>,
> 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 InputType::Keyboard(_) = self {
} else {
*self = InputType::Keyboard(fidl::new_empty!(
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<
fidl_fuchsia_ui_input3::KeyboardListenerMarker,
>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect
));
}
#[allow(irrefutable_let_patterns)]
if let InputType::Keyboard(ref mut val) = self {
fidl::decode!(
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<
fidl_fuchsia_ui_input3::KeyboardListenerMarker,
>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
val,
decoder,
_inner_offset,
depth
)?;
} else {
unreachable!()
}
}
2 => {
#[allow(irrefutable_let_patterns)]
if let InputType::Mouse(_) = self {
} else {
*self = InputType::Mouse(fidl::new_empty!(
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<
fidl_fuchsia_ui_pointer::MouseSourceMarker,
>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect
));
}
#[allow(irrefutable_let_patterns)]
if let InputType::Mouse(ref mut val) = self {
fidl::decode!(
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<
fidl_fuchsia_ui_pointer::MouseSourceMarker,
>,
>,
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(())
}
}
}