#![warn(clippy::all)]
#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
use {
bitflags::bitflags,
fidl::{
client::QueryResponseFut,
endpoints::{ControlHandle as _, Responder as _},
},
fuchsia_zircon_status as zx_status,
futures::future::{self, MaybeDone, TryFutureExt},
};
#[cfg(target_os = "fuchsia")]
use fuchsia_zircon as zx;
pub const MAX_TRANSFER_UNBOUNDED: u32 = 4294967295;
pub const VMOID_INVALID: u16 = 0;
bitflags! {
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct Flag: u32 {
const READONLY = 1;
const REMOVABLE = 2;
const BOOTPART = 4;
const TRIM_SUPPORT = 8;
const FUA_SUPPORT = 16;
}
}
impl Flag {
#[deprecated = "Strict bits should not use `has_unknown_bits`"]
#[inline(always)]
pub fn has_unknown_bits(&self) -> bool {
false
}
#[deprecated = "Strict bits should not use `get_unknown_bits`"]
#[inline(always)]
pub fn get_unknown_bits(&self) -> u32 {
0
}
}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct BlockGetStatsRequest {
pub clear: bool,
}
impl fidl::Persistable for BlockGetStatsRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct BlockInfo {
pub block_count: u64,
pub block_size: u32,
pub max_transfer_size: u32,
pub flags: Flag,
}
impl fidl::Persistable for BlockInfo {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct BlockOpenSessionRequest {
pub session: fidl::endpoints::ServerEnd<SessionMarker>,
}
impl fidl::Standalone for BlockOpenSessionRequest {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct BlockReadBlocksRequest {
pub vmo: fidl::Vmo,
pub length: u64,
pub dev_offset: u64,
pub vmo_offset: u64,
}
impl fidl::Standalone for BlockReadBlocksRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct BlockStats {
pub read: OperationStats,
pub write: OperationStats,
pub trim: OperationStats,
pub flush: OperationStats,
}
impl fidl::Persistable for BlockStats {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct BlockWriteBlocksRequest {
pub vmo: fidl::Vmo,
pub length: u64,
pub dev_offset: u64,
pub vmo_offset: u64,
}
impl fidl::Standalone for BlockWriteBlocksRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct BlockGetInfoResponse {
pub info: BlockInfo,
}
impl fidl::Persistable for BlockGetInfoResponse {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct BlockGetStatsResponse {
pub stats: BlockStats,
}
impl fidl::Persistable for BlockGetStatsResponse {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct FtlFormatResponse {
pub status: i32,
}
impl fidl::Persistable for FtlFormatResponse {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct InspectVmoProviderGetVmoResponse {
pub vmo: fidl::Vmo,
}
impl fidl::Standalone for InspectVmoProviderGetVmoResponse {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct OperationStats {
pub success: RequestStats,
pub failure: RequestStats,
}
impl fidl::Persistable for OperationStats {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct RequestStats {
pub minimum_latency: u64,
pub maximum_latency: u64,
pub total_time_spent: u64,
pub total_calls: u64,
pub bytes_transferred: u64,
}
impl fidl::Persistable for RequestStats {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct SessionAttachVmoRequest {
pub vmo: fidl::Vmo,
}
impl fidl::Standalone for SessionAttachVmoRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct SessionAttachVmoResponse {
pub vmoid: VmoId,
}
impl fidl::Persistable for SessionAttachVmoResponse {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct SessionGetFifoResponse {
pub fifo: fidl::Fifo,
}
impl fidl::Standalone for SessionGetFifoResponse {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct VmoId {
pub id: u16,
}
impl fidl::Persistable for VmoId {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct BlockMarker;
impl fidl::endpoints::ProtocolMarker for BlockMarker {
type Proxy = BlockProxy;
type RequestStream = BlockRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = BlockSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) Block";
}
pub type BlockGetInfoResult = Result<BlockInfo, i32>;
pub type BlockGetStatsResult = Result<BlockStats, i32>;
pub type BlockReadBlocksResult = Result<(), i32>;
pub type BlockWriteBlocksResult = Result<(), i32>;
pub trait BlockProxyInterface: Send + Sync {
type GetInfoResponseFut: std::future::Future<Output = Result<BlockGetInfoResult, fidl::Error>>
+ Send;
fn r#get_info(&self) -> Self::GetInfoResponseFut;
type GetStatsResponseFut: std::future::Future<Output = Result<BlockGetStatsResult, fidl::Error>>
+ Send;
fn r#get_stats(&self, clear: bool) -> Self::GetStatsResponseFut;
fn r#open_session(
&self,
session: fidl::endpoints::ServerEnd<SessionMarker>,
) -> Result<(), fidl::Error>;
type ReadBlocksResponseFut: std::future::Future<Output = Result<BlockReadBlocksResult, fidl::Error>>
+ Send;
fn r#read_blocks(
&self,
vmo: fidl::Vmo,
length: u64,
dev_offset: u64,
vmo_offset: u64,
) -> Self::ReadBlocksResponseFut;
type WriteBlocksResponseFut: std::future::Future<Output = Result<BlockWriteBlocksResult, fidl::Error>>
+ Send;
fn r#write_blocks(
&self,
vmo: fidl::Vmo,
length: u64,
dev_offset: u64,
vmo_offset: u64,
) -> Self::WriteBlocksResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct BlockSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for BlockSynchronousProxy {
type Proxy = BlockProxy;
type Protocol = BlockMarker;
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 BlockSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <BlockMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
}
pub fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
pub fn wait_for_event(&self, deadline: zx::Time) -> Result<BlockEvent, fidl::Error> {
BlockEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#get_info(&self, ___deadline: zx::Time) -> Result<BlockGetInfoResult, fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
fidl::encoding::ResultType<BlockGetInfoResponse, i32>,
>(
(),
0x79df1a5cdb6cc6a3,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x.info))
}
pub fn r#get_stats(
&self,
mut clear: bool,
___deadline: zx::Time,
) -> Result<BlockGetStatsResult, fidl::Error> {
let _response = self.client.send_query::<
BlockGetStatsRequest,
fidl::encoding::ResultType<BlockGetStatsResponse, i32>,
>(
(clear,),
0x53d9542a778385ae,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x.stats))
}
pub fn r#open_session(
&self,
mut session: fidl::endpoints::ServerEnd<SessionMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<BlockOpenSessionRequest>(
(session,),
0x7241c68d17614a31,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#read_blocks(
&self,
mut vmo: fidl::Vmo,
mut length: u64,
mut dev_offset: u64,
mut vmo_offset: u64,
___deadline: zx::Time,
) -> Result<BlockReadBlocksResult, fidl::Error> {
let _response = self.client.send_query::<
BlockReadBlocksRequest,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
>(
(vmo, length, dev_offset, vmo_offset,),
0x7906bed7f5c10fda,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#write_blocks(
&self,
mut vmo: fidl::Vmo,
mut length: u64,
mut dev_offset: u64,
mut vmo_offset: u64,
___deadline: zx::Time,
) -> Result<BlockWriteBlocksResult, fidl::Error> {
let _response = self.client.send_query::<
BlockWriteBlocksRequest,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
>(
(vmo, length, dev_offset, vmo_offset,),
0x1500d79edc8cc71f,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
}
#[derive(Debug, Clone)]
pub struct BlockProxy {
client: fidl::client::Client,
}
impl fidl::endpoints::Proxy for BlockProxy {
type Protocol = BlockMarker;
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 BlockProxy {
pub fn new(channel: fidl::AsyncChannel) -> Self {
let protocol_name = <BlockMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> BlockEventStream {
BlockEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#get_info(&self) -> fidl::client::QueryResponseFut<BlockGetInfoResult> {
BlockProxyInterface::r#get_info(self)
}
pub fn r#get_stats(
&self,
mut clear: bool,
) -> fidl::client::QueryResponseFut<BlockGetStatsResult> {
BlockProxyInterface::r#get_stats(self, clear)
}
pub fn r#open_session(
&self,
mut session: fidl::endpoints::ServerEnd<SessionMarker>,
) -> Result<(), fidl::Error> {
BlockProxyInterface::r#open_session(self, session)
}
pub fn r#read_blocks(
&self,
mut vmo: fidl::Vmo,
mut length: u64,
mut dev_offset: u64,
mut vmo_offset: u64,
) -> fidl::client::QueryResponseFut<BlockReadBlocksResult> {
BlockProxyInterface::r#read_blocks(self, vmo, length, dev_offset, vmo_offset)
}
pub fn r#write_blocks(
&self,
mut vmo: fidl::Vmo,
mut length: u64,
mut dev_offset: u64,
mut vmo_offset: u64,
) -> fidl::client::QueryResponseFut<BlockWriteBlocksResult> {
BlockProxyInterface::r#write_blocks(self, vmo, length, dev_offset, vmo_offset)
}
}
impl BlockProxyInterface for BlockProxy {
type GetInfoResponseFut = fidl::client::QueryResponseFut<BlockGetInfoResult>;
fn r#get_info(&self) -> Self::GetInfoResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<BlockGetInfoResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<BlockGetInfoResponse, i32>,
0x79df1a5cdb6cc6a3,
>(_buf?)?;
Ok(_response.map(|x| x.info))
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, BlockGetInfoResult>(
(),
0x79df1a5cdb6cc6a3,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type GetStatsResponseFut = fidl::client::QueryResponseFut<BlockGetStatsResult>;
fn r#get_stats(&self, mut clear: bool) -> Self::GetStatsResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<BlockGetStatsResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<BlockGetStatsResponse, i32>,
0x53d9542a778385ae,
>(_buf?)?;
Ok(_response.map(|x| x.stats))
}
self.client.send_query_and_decode::<BlockGetStatsRequest, BlockGetStatsResult>(
(clear,),
0x53d9542a778385ae,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
fn r#open_session(
&self,
mut session: fidl::endpoints::ServerEnd<SessionMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<BlockOpenSessionRequest>(
(session,),
0x7241c68d17614a31,
fidl::encoding::DynamicFlags::empty(),
)
}
type ReadBlocksResponseFut = fidl::client::QueryResponseFut<BlockReadBlocksResult>;
fn r#read_blocks(
&self,
mut vmo: fidl::Vmo,
mut length: u64,
mut dev_offset: u64,
mut vmo_offset: u64,
) -> Self::ReadBlocksResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<BlockReadBlocksResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
0x7906bed7f5c10fda,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<BlockReadBlocksRequest, BlockReadBlocksResult>(
(vmo, length, dev_offset, vmo_offset),
0x7906bed7f5c10fda,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type WriteBlocksResponseFut = fidl::client::QueryResponseFut<BlockWriteBlocksResult>;
fn r#write_blocks(
&self,
mut vmo: fidl::Vmo,
mut length: u64,
mut dev_offset: u64,
mut vmo_offset: u64,
) -> Self::WriteBlocksResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<BlockWriteBlocksResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
0x1500d79edc8cc71f,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<BlockWriteBlocksRequest, BlockWriteBlocksResult>(
(vmo, length, dev_offset, vmo_offset),
0x1500d79edc8cc71f,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct BlockEventStream {
event_receiver: fidl::client::EventReceiver,
}
impl std::marker::Unpin for BlockEventStream {}
impl futures::stream::FusedStream for BlockEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for BlockEventStream {
type Item = Result<BlockEvent, 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(BlockEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum BlockEvent {}
impl BlockEvent {
fn decode(mut buf: fidl::MessageBufEtc) -> Result<BlockEvent, 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: <BlockMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct BlockRequestStream {
inner: std::sync::Arc<fidl::ServeInner>,
is_terminated: bool,
}
impl std::marker::Unpin for BlockRequestStream {}
impl futures::stream::FusedStream for BlockRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for BlockRequestStream {
type Protocol = BlockMarker;
type ControlHandle = BlockControlHandle;
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 {
BlockControlHandle { inner: self.inner.clone() }
}
fn into_inner(self) -> (::std::sync::Arc<fidl::ServeInner>, bool) {
(self.inner, self.is_terminated)
}
fn from_inner(inner: std::sync::Arc<fidl::ServeInner>, is_terminated: bool) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for BlockRequestStream {
type Item = Result<BlockRequest, 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 BlockRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf(|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(e))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x79df1a5cdb6cc6a3 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload);
fidl::encoding::Decoder::decode_into::<fidl::encoding::EmptyPayload>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = BlockControlHandle { inner: this.inner.clone() };
Ok(BlockRequest::GetInfo {
responder: BlockGetInfoResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x53d9542a778385ae => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(BlockGetStatsRequest);
fidl::encoding::Decoder::decode_into::<BlockGetStatsRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = BlockControlHandle { inner: this.inner.clone() };
Ok(BlockRequest::GetStats {
clear: req.clear,
responder: BlockGetStatsResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x7241c68d17614a31 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(BlockOpenSessionRequest);
fidl::encoding::Decoder::decode_into::<BlockOpenSessionRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = BlockControlHandle { inner: this.inner.clone() };
Ok(BlockRequest::OpenSession { session: req.session, control_handle })
}
0x7906bed7f5c10fda => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(BlockReadBlocksRequest);
fidl::encoding::Decoder::decode_into::<BlockReadBlocksRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = BlockControlHandle { inner: this.inner.clone() };
Ok(BlockRequest::ReadBlocks {
vmo: req.vmo,
length: req.length,
dev_offset: req.dev_offset,
vmo_offset: req.vmo_offset,
responder: BlockReadBlocksResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x1500d79edc8cc71f => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(BlockWriteBlocksRequest);
fidl::encoding::Decoder::decode_into::<BlockWriteBlocksRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = BlockControlHandle { inner: this.inner.clone() };
Ok(BlockRequest::WriteBlocks {
vmo: req.vmo,
length: req.length,
dev_offset: req.dev_offset,
vmo_offset: req.vmo_offset,
responder: BlockWriteBlocksResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <BlockMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
})
}
}
#[derive(Debug)]
pub enum BlockRequest {
GetInfo { responder: BlockGetInfoResponder },
GetStats { clear: bool, responder: BlockGetStatsResponder },
OpenSession {
session: fidl::endpoints::ServerEnd<SessionMarker>,
control_handle: BlockControlHandle,
},
ReadBlocks {
vmo: fidl::Vmo,
length: u64,
dev_offset: u64,
vmo_offset: u64,
responder: BlockReadBlocksResponder,
},
WriteBlocks {
vmo: fidl::Vmo,
length: u64,
dev_offset: u64,
vmo_offset: u64,
responder: BlockWriteBlocksResponder,
},
}
impl BlockRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_get_info(self) -> Option<(BlockGetInfoResponder)> {
if let BlockRequest::GetInfo { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_get_stats(self) -> Option<(bool, BlockGetStatsResponder)> {
if let BlockRequest::GetStats { clear, responder } = self {
Some((clear, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_open_session(
self,
) -> Option<(fidl::endpoints::ServerEnd<SessionMarker>, BlockControlHandle)> {
if let BlockRequest::OpenSession { session, control_handle } = self {
Some((session, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_read_blocks(self) -> Option<(fidl::Vmo, u64, u64, u64, BlockReadBlocksResponder)> {
if let BlockRequest::ReadBlocks { vmo, length, dev_offset, vmo_offset, responder } = self {
Some((vmo, length, dev_offset, vmo_offset, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_write_blocks(
self,
) -> Option<(fidl::Vmo, u64, u64, u64, BlockWriteBlocksResponder)> {
if let BlockRequest::WriteBlocks { vmo, length, dev_offset, vmo_offset, responder } = self {
Some((vmo, length, dev_offset, vmo_offset, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
BlockRequest::GetInfo { .. } => "get_info",
BlockRequest::GetStats { .. } => "get_stats",
BlockRequest::OpenSession { .. } => "open_session",
BlockRequest::ReadBlocks { .. } => "read_blocks",
BlockRequest::WriteBlocks { .. } => "write_blocks",
}
}
}
#[derive(Debug, Clone)]
pub struct BlockControlHandle {
inner: std::sync::Arc<fidl::ServeInner>,
}
impl fidl::endpoints::ControlHandle for BlockControlHandle {
fn shutdown(&self) {
self.inner.shutdown()
}
fn shutdown_with_epitaph(&self, status: zx_status::Status) {
self.inner.shutdown_with_epitaph(status)
}
fn is_closed(&self) -> bool {
self.inner.channel().is_closed()
}
fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
}
impl BlockControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct BlockGetInfoResponder {
control_handle: std::mem::ManuallyDrop<BlockControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for BlockGetInfoResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for BlockGetInfoResponder {
type ControlHandle = BlockControlHandle;
fn control_handle(&self) -> &BlockControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl BlockGetInfoResponder {
pub fn send(self, mut result: Result<&BlockInfo, 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<&BlockInfo, i32>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<&BlockInfo, i32>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<BlockGetInfoResponse, i32>>(
result.map(|info| (info,)),
self.tx_id,
0x79df1a5cdb6cc6a3,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct BlockGetStatsResponder {
control_handle: std::mem::ManuallyDrop<BlockControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for BlockGetStatsResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for BlockGetStatsResponder {
type ControlHandle = BlockControlHandle;
fn control_handle(&self) -> &BlockControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl BlockGetStatsResponder {
pub fn send(self, mut result: Result<&BlockStats, 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<&BlockStats, i32>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<&BlockStats, i32>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<BlockGetStatsResponse, i32>>(
result.map(|stats| (stats,)),
self.tx_id,
0x53d9542a778385ae,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct BlockReadBlocksResponder {
control_handle: std::mem::ManuallyDrop<BlockControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for BlockReadBlocksResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for BlockReadBlocksResponder {
type ControlHandle = BlockControlHandle;
fn control_handle(&self) -> &BlockControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl BlockReadBlocksResponder {
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,
0x7906bed7f5c10fda,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct BlockWriteBlocksResponder {
control_handle: std::mem::ManuallyDrop<BlockControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for BlockWriteBlocksResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for BlockWriteBlocksResponder {
type ControlHandle = BlockControlHandle;
fn control_handle(&self) -> &BlockControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl BlockWriteBlocksResponder {
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,
0x1500d79edc8cc71f,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct FtlMarker;
impl fidl::endpoints::ProtocolMarker for FtlMarker {
type Proxy = FtlProxy;
type RequestStream = FtlRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = FtlSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) Ftl";
}
pub trait FtlProxyInterface: Send + Sync {
type GetVmoResponseFut: std::future::Future<Output = Result<InspectVmoProviderGetVmoResult, fidl::Error>>
+ Send;
fn r#get_vmo(&self) -> Self::GetVmoResponseFut;
type FormatResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
fn r#format(&self) -> Self::FormatResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct FtlSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for FtlSynchronousProxy {
type Proxy = FtlProxy;
type Protocol = FtlMarker;
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 FtlSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <FtlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
}
pub fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
pub fn wait_for_event(&self, deadline: zx::Time) -> Result<FtlEvent, fidl::Error> {
FtlEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#get_vmo(
&self,
___deadline: zx::Time,
) -> Result<InspectVmoProviderGetVmoResult, fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
fidl::encoding::ResultType<InspectVmoProviderGetVmoResponse, i32>,
>(
(),
0xf523185c6e67738,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x.vmo))
}
pub fn r#format(&self, ___deadline: zx::Time) -> Result<i32, fidl::Error> {
let _response = self.client.send_query::<fidl::encoding::EmptyPayload, FtlFormatResponse>(
(),
0x79751d9c0b48a0d6,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.status)
}
}
#[derive(Debug, Clone)]
pub struct FtlProxy {
client: fidl::client::Client,
}
impl fidl::endpoints::Proxy for FtlProxy {
type Protocol = FtlMarker;
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 FtlProxy {
pub fn new(channel: fidl::AsyncChannel) -> Self {
let protocol_name = <FtlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> FtlEventStream {
FtlEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#get_vmo(&self) -> fidl::client::QueryResponseFut<InspectVmoProviderGetVmoResult> {
FtlProxyInterface::r#get_vmo(self)
}
pub fn r#format(&self) -> fidl::client::QueryResponseFut<i32> {
FtlProxyInterface::r#format(self)
}
}
impl FtlProxyInterface for FtlProxy {
type GetVmoResponseFut = fidl::client::QueryResponseFut<InspectVmoProviderGetVmoResult>;
fn r#get_vmo(&self) -> Self::GetVmoResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<InspectVmoProviderGetVmoResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<InspectVmoProviderGetVmoResponse, i32>,
0xf523185c6e67738,
>(_buf?)?;
Ok(_response.map(|x| x.vmo))
}
self.client
.send_query_and_decode::<fidl::encoding::EmptyPayload, InspectVmoProviderGetVmoResult>(
(),
0xf523185c6e67738,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type FormatResponseFut = fidl::client::QueryResponseFut<i32>;
fn r#format(&self) -> Self::FormatResponseFut {
fn _decode(mut _buf: Result<fidl::MessageBufEtc, fidl::Error>) -> Result<i32, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
FtlFormatResponse,
0x79751d9c0b48a0d6,
>(_buf?)?;
Ok(_response.status)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, i32>(
(),
0x79751d9c0b48a0d6,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct FtlEventStream {
event_receiver: fidl::client::EventReceiver,
}
impl std::marker::Unpin for FtlEventStream {}
impl futures::stream::FusedStream for FtlEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for FtlEventStream {
type Item = Result<FtlEvent, 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(FtlEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum FtlEvent {}
impl FtlEvent {
fn decode(mut buf: fidl::MessageBufEtc) -> Result<FtlEvent, 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: <FtlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct FtlRequestStream {
inner: std::sync::Arc<fidl::ServeInner>,
is_terminated: bool,
}
impl std::marker::Unpin for FtlRequestStream {}
impl futures::stream::FusedStream for FtlRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for FtlRequestStream {
type Protocol = FtlMarker;
type ControlHandle = FtlControlHandle;
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 {
FtlControlHandle { inner: self.inner.clone() }
}
fn into_inner(self) -> (::std::sync::Arc<fidl::ServeInner>, bool) {
(self.inner, self.is_terminated)
}
fn from_inner(inner: std::sync::Arc<fidl::ServeInner>, is_terminated: bool) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for FtlRequestStream {
type Item = Result<FtlRequest, 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 FtlRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf(|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(e))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0xf523185c6e67738 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload);
fidl::encoding::Decoder::decode_into::<fidl::encoding::EmptyPayload>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = FtlControlHandle { inner: this.inner.clone() };
Ok(FtlRequest::GetVmo {
responder: FtlGetVmoResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x79751d9c0b48a0d6 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload);
fidl::encoding::Decoder::decode_into::<fidl::encoding::EmptyPayload>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = FtlControlHandle { inner: this.inner.clone() };
Ok(FtlRequest::Format {
responder: FtlFormatResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <FtlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
})
}
}
#[derive(Debug)]
pub enum FtlRequest {
GetVmo { responder: FtlGetVmoResponder },
Format { responder: FtlFormatResponder },
}
impl FtlRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_get_vmo(self) -> Option<(FtlGetVmoResponder)> {
if let FtlRequest::GetVmo { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_format(self) -> Option<(FtlFormatResponder)> {
if let FtlRequest::Format { responder } = self {
Some((responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
FtlRequest::GetVmo { .. } => "get_vmo",
FtlRequest::Format { .. } => "format",
}
}
}
#[derive(Debug, Clone)]
pub struct FtlControlHandle {
inner: std::sync::Arc<fidl::ServeInner>,
}
impl fidl::endpoints::ControlHandle for FtlControlHandle {
fn shutdown(&self) {
self.inner.shutdown()
}
fn shutdown_with_epitaph(&self, status: zx_status::Status) {
self.inner.shutdown_with_epitaph(status)
}
fn is_closed(&self) -> bool {
self.inner.channel().is_closed()
}
fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
}
impl FtlControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct FtlGetVmoResponder {
control_handle: std::mem::ManuallyDrop<FtlControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for FtlGetVmoResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for FtlGetVmoResponder {
type ControlHandle = FtlControlHandle;
fn control_handle(&self) -> &FtlControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl FtlGetVmoResponder {
pub fn send(self, mut result: Result<fidl::Vmo, i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut result: Result<fidl::Vmo, i32>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<fidl::Vmo, i32>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<InspectVmoProviderGetVmoResponse, i32>>(
result.map(|vmo| (vmo,)),
self.tx_id,
0xf523185c6e67738,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct FtlFormatResponder {
control_handle: std::mem::ManuallyDrop<FtlControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for FtlFormatResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for FtlFormatResponder {
type ControlHandle = FtlControlHandle;
fn control_handle(&self) -> &FtlControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl FtlFormatResponder {
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::<FtlFormatResponse>(
(status,),
self.tx_id,
0x79751d9c0b48a0d6,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct InspectVmoProviderMarker;
impl fidl::endpoints::ProtocolMarker for InspectVmoProviderMarker {
type Proxy = InspectVmoProviderProxy;
type RequestStream = InspectVmoProviderRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = InspectVmoProviderSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) InspectVmoProvider";
}
pub type InspectVmoProviderGetVmoResult = Result<fidl::Vmo, i32>;
pub trait InspectVmoProviderProxyInterface: Send + Sync {
type GetVmoResponseFut: std::future::Future<Output = Result<InspectVmoProviderGetVmoResult, fidl::Error>>
+ Send;
fn r#get_vmo(&self) -> Self::GetVmoResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct InspectVmoProviderSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for InspectVmoProviderSynchronousProxy {
type Proxy = InspectVmoProviderProxy;
type Protocol = InspectVmoProviderMarker;
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 InspectVmoProviderSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name =
<InspectVmoProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
}
pub fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
pub fn wait_for_event(
&self,
deadline: zx::Time,
) -> Result<InspectVmoProviderEvent, fidl::Error> {
InspectVmoProviderEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#get_vmo(
&self,
___deadline: zx::Time,
) -> Result<InspectVmoProviderGetVmoResult, fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
fidl::encoding::ResultType<InspectVmoProviderGetVmoResponse, i32>,
>(
(),
0xf523185c6e67738,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x.vmo))
}
}
#[derive(Debug, Clone)]
pub struct InspectVmoProviderProxy {
client: fidl::client::Client,
}
impl fidl::endpoints::Proxy for InspectVmoProviderProxy {
type Protocol = InspectVmoProviderMarker;
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 InspectVmoProviderProxy {
pub fn new(channel: fidl::AsyncChannel) -> Self {
let protocol_name =
<InspectVmoProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> InspectVmoProviderEventStream {
InspectVmoProviderEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#get_vmo(&self) -> fidl::client::QueryResponseFut<InspectVmoProviderGetVmoResult> {
InspectVmoProviderProxyInterface::r#get_vmo(self)
}
}
impl InspectVmoProviderProxyInterface for InspectVmoProviderProxy {
type GetVmoResponseFut = fidl::client::QueryResponseFut<InspectVmoProviderGetVmoResult>;
fn r#get_vmo(&self) -> Self::GetVmoResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<InspectVmoProviderGetVmoResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<InspectVmoProviderGetVmoResponse, i32>,
0xf523185c6e67738,
>(_buf?)?;
Ok(_response.map(|x| x.vmo))
}
self.client
.send_query_and_decode::<fidl::encoding::EmptyPayload, InspectVmoProviderGetVmoResult>(
(),
0xf523185c6e67738,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct InspectVmoProviderEventStream {
event_receiver: fidl::client::EventReceiver,
}
impl std::marker::Unpin for InspectVmoProviderEventStream {}
impl futures::stream::FusedStream for InspectVmoProviderEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for InspectVmoProviderEventStream {
type Item = Result<InspectVmoProviderEvent, 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(InspectVmoProviderEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum InspectVmoProviderEvent {}
impl InspectVmoProviderEvent {
fn decode(mut buf: fidl::MessageBufEtc) -> Result<InspectVmoProviderEvent, 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:
<InspectVmoProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct InspectVmoProviderRequestStream {
inner: std::sync::Arc<fidl::ServeInner>,
is_terminated: bool,
}
impl std::marker::Unpin for InspectVmoProviderRequestStream {}
impl futures::stream::FusedStream for InspectVmoProviderRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for InspectVmoProviderRequestStream {
type Protocol = InspectVmoProviderMarker;
type ControlHandle = InspectVmoProviderControlHandle;
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 {
InspectVmoProviderControlHandle { inner: self.inner.clone() }
}
fn into_inner(self) -> (::std::sync::Arc<fidl::ServeInner>, bool) {
(self.inner, self.is_terminated)
}
fn from_inner(inner: std::sync::Arc<fidl::ServeInner>, is_terminated: bool) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for InspectVmoProviderRequestStream {
type Item = Result<InspectVmoProviderRequest, 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 InspectVmoProviderRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf(|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(e))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0xf523185c6e67738 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload);
fidl::encoding::Decoder::decode_into::<fidl::encoding::EmptyPayload>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle =
InspectVmoProviderControlHandle { inner: this.inner.clone() };
Ok(InspectVmoProviderRequest::GetVmo {
responder: InspectVmoProviderGetVmoResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<InspectVmoProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
})
}
}
#[derive(Debug)]
pub enum InspectVmoProviderRequest {
GetVmo { responder: InspectVmoProviderGetVmoResponder },
}
impl InspectVmoProviderRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_get_vmo(self) -> Option<(InspectVmoProviderGetVmoResponder)> {
if let InspectVmoProviderRequest::GetVmo { responder } = self {
Some((responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
InspectVmoProviderRequest::GetVmo { .. } => "get_vmo",
}
}
}
#[derive(Debug, Clone)]
pub struct InspectVmoProviderControlHandle {
inner: std::sync::Arc<fidl::ServeInner>,
}
impl fidl::endpoints::ControlHandle for InspectVmoProviderControlHandle {
fn shutdown(&self) {
self.inner.shutdown()
}
fn shutdown_with_epitaph(&self, status: zx_status::Status) {
self.inner.shutdown_with_epitaph(status)
}
fn is_closed(&self) -> bool {
self.inner.channel().is_closed()
}
fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
}
impl InspectVmoProviderControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct InspectVmoProviderGetVmoResponder {
control_handle: std::mem::ManuallyDrop<InspectVmoProviderControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for InspectVmoProviderGetVmoResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for InspectVmoProviderGetVmoResponder {
type ControlHandle = InspectVmoProviderControlHandle;
fn control_handle(&self) -> &InspectVmoProviderControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl InspectVmoProviderGetVmoResponder {
pub fn send(self, mut result: Result<fidl::Vmo, i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut result: Result<fidl::Vmo, i32>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<fidl::Vmo, i32>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<InspectVmoProviderGetVmoResponse, i32>>(
result.map(|vmo| (vmo,)),
self.tx_id,
0xf523185c6e67738,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct SessionMarker;
impl fidl::endpoints::ProtocolMarker for SessionMarker {
type Proxy = SessionProxy;
type RequestStream = SessionRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = SessionSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) Session";
}
pub type SessionGetFifoResult = Result<fidl::Fifo, i32>;
pub type SessionAttachVmoResult = Result<VmoId, i32>;
pub trait SessionProxyInterface: Send + Sync {
type CloseResponseFut: std::future::Future<
Output = Result<fidl_fuchsia_unknown::CloseableCloseResult, fidl::Error>,
> + Send;
fn r#close(&self) -> Self::CloseResponseFut;
type GetFifoResponseFut: std::future::Future<Output = Result<SessionGetFifoResult, fidl::Error>>
+ Send;
fn r#get_fifo(&self) -> Self::GetFifoResponseFut;
type AttachVmoResponseFut: std::future::Future<Output = Result<SessionAttachVmoResult, fidl::Error>>
+ Send;
fn r#attach_vmo(&self, vmo: fidl::Vmo) -> Self::AttachVmoResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct SessionSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for SessionSynchronousProxy {
type Proxy = SessionProxy;
type Protocol = SessionMarker;
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 SessionSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <SessionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
}
pub fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
pub fn wait_for_event(&self, deadline: zx::Time) -> Result<SessionEvent, fidl::Error> {
SessionEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#close(
&self,
___deadline: zx::Time,
) -> Result<fidl_fuchsia_unknown::CloseableCloseResult, fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
>(
(),
0x5ac5d459ad7f657e,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#get_fifo(&self, ___deadline: zx::Time) -> Result<SessionGetFifoResult, fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
fidl::encoding::ResultType<SessionGetFifoResponse, i32>,
>(
(),
0x61a31a92a206b7d5,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x.fifo))
}
pub fn r#attach_vmo(
&self,
mut vmo: fidl::Vmo,
___deadline: zx::Time,
) -> Result<SessionAttachVmoResult, fidl::Error> {
let _response = self.client.send_query::<
SessionAttachVmoRequest,
fidl::encoding::ResultType<SessionAttachVmoResponse, i32>,
>(
(vmo,),
0x54edc4641d9569f5,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x.vmoid))
}
}
#[derive(Debug, Clone)]
pub struct SessionProxy {
client: fidl::client::Client,
}
impl fidl::endpoints::Proxy for SessionProxy {
type Protocol = SessionMarker;
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 SessionProxy {
pub fn new(channel: fidl::AsyncChannel) -> Self {
let protocol_name = <SessionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> SessionEventStream {
SessionEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#close(
&self,
) -> fidl::client::QueryResponseFut<fidl_fuchsia_unknown::CloseableCloseResult> {
SessionProxyInterface::r#close(self)
}
pub fn r#get_fifo(&self) -> fidl::client::QueryResponseFut<SessionGetFifoResult> {
SessionProxyInterface::r#get_fifo(self)
}
pub fn r#attach_vmo(
&self,
mut vmo: fidl::Vmo,
) -> fidl::client::QueryResponseFut<SessionAttachVmoResult> {
SessionProxyInterface::r#attach_vmo(self, vmo)
}
}
impl SessionProxyInterface for SessionProxy {
type CloseResponseFut =
fidl::client::QueryResponseFut<fidl_fuchsia_unknown::CloseableCloseResult>;
fn r#close(&self) -> Self::CloseResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<fidl_fuchsia_unknown::CloseableCloseResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
0x5ac5d459ad7f657e,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
fidl::encoding::EmptyPayload,
fidl_fuchsia_unknown::CloseableCloseResult,
>(
(),
0x5ac5d459ad7f657e,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type GetFifoResponseFut = fidl::client::QueryResponseFut<SessionGetFifoResult>;
fn r#get_fifo(&self) -> Self::GetFifoResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<SessionGetFifoResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<SessionGetFifoResponse, i32>,
0x61a31a92a206b7d5,
>(_buf?)?;
Ok(_response.map(|x| x.fifo))
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, SessionGetFifoResult>(
(),
0x61a31a92a206b7d5,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type AttachVmoResponseFut = fidl::client::QueryResponseFut<SessionAttachVmoResult>;
fn r#attach_vmo(&self, mut vmo: fidl::Vmo) -> Self::AttachVmoResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<SessionAttachVmoResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<SessionAttachVmoResponse, i32>,
0x54edc4641d9569f5,
>(_buf?)?;
Ok(_response.map(|x| x.vmoid))
}
self.client.send_query_and_decode::<SessionAttachVmoRequest, SessionAttachVmoResult>(
(vmo,),
0x54edc4641d9569f5,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct SessionEventStream {
event_receiver: fidl::client::EventReceiver,
}
impl std::marker::Unpin for SessionEventStream {}
impl futures::stream::FusedStream for SessionEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for SessionEventStream {
type Item = Result<SessionEvent, 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(SessionEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum SessionEvent {}
impl SessionEvent {
fn decode(mut buf: fidl::MessageBufEtc) -> Result<SessionEvent, 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: <SessionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct SessionRequestStream {
inner: std::sync::Arc<fidl::ServeInner>,
is_terminated: bool,
}
impl std::marker::Unpin for SessionRequestStream {}
impl futures::stream::FusedStream for SessionRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for SessionRequestStream {
type Protocol = SessionMarker;
type ControlHandle = SessionControlHandle;
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 {
SessionControlHandle { inner: self.inner.clone() }
}
fn into_inner(self) -> (::std::sync::Arc<fidl::ServeInner>, bool) {
(self.inner, self.is_terminated)
}
fn from_inner(inner: std::sync::Arc<fidl::ServeInner>, is_terminated: bool) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for SessionRequestStream {
type Item = Result<SessionRequest, 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 SessionRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf(|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(e))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x5ac5d459ad7f657e => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload);
fidl::encoding::Decoder::decode_into::<fidl::encoding::EmptyPayload>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = SessionControlHandle { inner: this.inner.clone() };
Ok(SessionRequest::Close {
responder: SessionCloseResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x61a31a92a206b7d5 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload);
fidl::encoding::Decoder::decode_into::<fidl::encoding::EmptyPayload>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = SessionControlHandle { inner: this.inner.clone() };
Ok(SessionRequest::GetFifo {
responder: SessionGetFifoResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x54edc4641d9569f5 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(SessionAttachVmoRequest);
fidl::encoding::Decoder::decode_into::<SessionAttachVmoRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = SessionControlHandle { inner: this.inner.clone() };
Ok(SessionRequest::AttachVmo {
vmo: req.vmo,
responder: SessionAttachVmoResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <SessionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
})
}
}
#[derive(Debug)]
pub enum SessionRequest {
Close { responder: SessionCloseResponder },
GetFifo { responder: SessionGetFifoResponder },
AttachVmo { vmo: fidl::Vmo, responder: SessionAttachVmoResponder },
}
impl SessionRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_close(self) -> Option<(SessionCloseResponder)> {
if let SessionRequest::Close { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_get_fifo(self) -> Option<(SessionGetFifoResponder)> {
if let SessionRequest::GetFifo { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_attach_vmo(self) -> Option<(fidl::Vmo, SessionAttachVmoResponder)> {
if let SessionRequest::AttachVmo { vmo, responder } = self {
Some((vmo, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
SessionRequest::Close { .. } => "close",
SessionRequest::GetFifo { .. } => "get_fifo",
SessionRequest::AttachVmo { .. } => "attach_vmo",
}
}
}
#[derive(Debug, Clone)]
pub struct SessionControlHandle {
inner: std::sync::Arc<fidl::ServeInner>,
}
impl fidl::endpoints::ControlHandle for SessionControlHandle {
fn shutdown(&self) {
self.inner.shutdown()
}
fn shutdown_with_epitaph(&self, status: zx_status::Status) {
self.inner.shutdown_with_epitaph(status)
}
fn is_closed(&self) -> bool {
self.inner.channel().is_closed()
}
fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
}
impl SessionControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct SessionCloseResponder {
control_handle: std::mem::ManuallyDrop<SessionControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for SessionCloseResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for SessionCloseResponder {
type ControlHandle = SessionControlHandle;
fn control_handle(&self) -> &SessionControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl SessionCloseResponder {
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,
0x5ac5d459ad7f657e,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct SessionGetFifoResponder {
control_handle: std::mem::ManuallyDrop<SessionControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for SessionGetFifoResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for SessionGetFifoResponder {
type ControlHandle = SessionControlHandle;
fn control_handle(&self) -> &SessionControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl SessionGetFifoResponder {
pub fn send(self, mut result: Result<fidl::Fifo, i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut result: Result<fidl::Fifo, i32>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<fidl::Fifo, i32>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<SessionGetFifoResponse, i32>>(
result.map(|fifo| (fifo,)),
self.tx_id,
0x61a31a92a206b7d5,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct SessionAttachVmoResponder {
control_handle: std::mem::ManuallyDrop<SessionControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for SessionAttachVmoResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for SessionAttachVmoResponder {
type ControlHandle = SessionControlHandle;
fn control_handle(&self) -> &SessionControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl SessionAttachVmoResponder {
pub fn send(self, mut result: Result<&VmoId, 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<&VmoId, i32>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<&VmoId, i32>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<SessionAttachVmoResponse, i32>>(
result.map(|vmoid| (vmoid,)),
self.tx_id,
0x54edc4641d9569f5,
fidl::encoding::DynamicFlags::empty(),
)
}
}
mod internal {
use super::*;
unsafe impl fidl::encoding::TypeMarker for Flag {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
}
impl fidl::encoding::ValueTypeMarker for Flag {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
*value
}
}
unsafe impl fidl::encoding::Encode<Self> for Flag {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
if self.bits() & Self::all().bits() != self.bits() {
return Err(fidl::Error::InvalidBitsValue);
}
encoder.write_num(self.bits(), offset);
Ok(())
}
}
impl fidl::encoding::Decode<Self> for Flag {
#[inline(always)]
fn new_empty() -> Self {
Self::empty()
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u32>(offset);
*self = Self::from_bits(prim).ok_or(fidl::Error::InvalidBitsValue)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for BlockGetStatsRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
1
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
1
}
}
impl fidl::encoding::ValueTypeMarker for BlockGetStatsRequest {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<BlockGetStatsRequest> for &BlockGetStatsRequest {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<BlockGetStatsRequest>(offset);
fidl::encoding::Encode::<BlockGetStatsRequest>::encode(
(<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.clear),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<T0: fidl::encoding::Encode<bool>> fidl::encoding::Encode<BlockGetStatsRequest>
for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<BlockGetStatsRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for BlockGetStatsRequest {
#[inline(always)]
fn new_empty() -> Self {
Self { clear: fidl::new_empty!(bool) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(bool, &mut self.clear, decoder, offset + 0, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for BlockInfo {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
24
}
}
impl fidl::encoding::ValueTypeMarker for BlockInfo {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<BlockInfo> for &BlockInfo {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<BlockInfo>(offset);
fidl::encoding::Encode::<BlockInfo>::encode(
(
<u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.block_count),
<u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.block_size),
<u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.max_transfer_size),
<Flag as fidl::encoding::ValueTypeMarker>::borrow(&self.flags),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<u64>,
T1: fidl::encoding::Encode<u32>,
T2: fidl::encoding::Encode<u32>,
T3: fidl::encoding::Encode<Flag>,
> fidl::encoding::Encode<BlockInfo> for (T0, T1, T2, T3)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<BlockInfo>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
self.2.encode(encoder, offset + 12, depth)?;
self.3.encode(encoder, offset + 16, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for BlockInfo {
#[inline(always)]
fn new_empty() -> Self {
Self {
block_count: fidl::new_empty!(u64),
block_size: fidl::new_empty!(u32),
max_transfer_size: fidl::new_empty!(u32),
flags: fidl::new_empty!(Flag),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffff00000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(u64, &mut self.block_count, decoder, offset + 0, _depth)?;
fidl::decode!(u32, &mut self.block_size, decoder, offset + 8, _depth)?;
fidl::decode!(u32, &mut self.max_transfer_size, decoder, offset + 12, _depth)?;
fidl::decode!(Flag, &mut self.flags, decoder, offset + 16, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for BlockOpenSessionRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
}
impl fidl::encoding::ResourceTypeMarker for BlockOpenSessionRequest {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<BlockOpenSessionRequest> for &mut BlockOpenSessionRequest {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<BlockOpenSessionRequest>(offset);
fidl::encoding::Encode::<BlockOpenSessionRequest>::encode(
(
<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SessionMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.session),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SessionMarker>>,
>,
> fidl::encoding::Encode<BlockOpenSessionRequest> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<BlockOpenSessionRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for BlockOpenSessionRequest {
#[inline(always)]
fn new_empty() -> Self {
Self {
session: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SessionMarker>>
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SessionMarker>>,
&mut self.session,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for BlockReadBlocksRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
32
}
}
impl fidl::encoding::ResourceTypeMarker for BlockReadBlocksRequest {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<BlockReadBlocksRequest> for &mut BlockReadBlocksRequest {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<BlockReadBlocksRequest>(offset);
fidl::encoding::Encode::<BlockReadBlocksRequest>::encode(
(
<fidl::encoding::HandleType<
fidl::Vmo,
{ fidl::ObjectType::VMO.into_raw() },
2147483648,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.vmo
),
<u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.length),
<u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.dev_offset),
<u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.vmo_offset),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::HandleType<
fidl::Vmo,
{ fidl::ObjectType::VMO.into_raw() },
2147483648,
>,
>,
T1: fidl::encoding::Encode<u64>,
T2: fidl::encoding::Encode<u64>,
T3: fidl::encoding::Encode<u64>,
> fidl::encoding::Encode<BlockReadBlocksRequest> for (T0, T1, T2, T3)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<BlockReadBlocksRequest>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
self.2.encode(encoder, offset + 16, depth)?;
self.3.encode(encoder, offset + 24, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for BlockReadBlocksRequest {
#[inline(always)]
fn new_empty() -> Self {
Self {
vmo: fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>),
length: fidl::new_empty!(u64),
dev_offset: fidl::new_empty!(u64),
vmo_offset: fidl::new_empty!(u64),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffff00000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, &mut self.vmo, decoder, offset + 0, _depth)?;
fidl::decode!(u64, &mut self.length, decoder, offset + 8, _depth)?;
fidl::decode!(u64, &mut self.dev_offset, decoder, offset + 16, _depth)?;
fidl::decode!(u64, &mut self.vmo_offset, decoder, offset + 24, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for BlockStats {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
320
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
impl fidl::encoding::ValueTypeMarker for BlockStats {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<BlockStats> for &BlockStats {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<BlockStats>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut BlockStats).write_unaligned((self as *const BlockStats).read());
}
Ok(())
}
}
unsafe impl<
T0: fidl::encoding::Encode<OperationStats>,
T1: fidl::encoding::Encode<OperationStats>,
T2: fidl::encoding::Encode<OperationStats>,
T3: fidl::encoding::Encode<OperationStats>,
> fidl::encoding::Encode<BlockStats> for (T0, T1, T2, T3)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<BlockStats>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 80, depth)?;
self.2.encode(encoder, offset + 160, depth)?;
self.3.encode(encoder, offset + 240, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for BlockStats {
#[inline(always)]
fn new_empty() -> Self {
Self {
read: fidl::new_empty!(OperationStats),
write: fidl::new_empty!(OperationStats),
trim: fidl::new_empty!(OperationStats),
flush: fidl::new_empty!(OperationStats),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 320);
}
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for BlockWriteBlocksRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
32
}
}
impl fidl::encoding::ResourceTypeMarker for BlockWriteBlocksRequest {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<BlockWriteBlocksRequest> for &mut BlockWriteBlocksRequest {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<BlockWriteBlocksRequest>(offset);
fidl::encoding::Encode::<BlockWriteBlocksRequest>::encode(
(
<fidl::encoding::HandleType<
fidl::Vmo,
{ fidl::ObjectType::VMO.into_raw() },
2147483648,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.vmo
),
<u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.length),
<u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.dev_offset),
<u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.vmo_offset),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::HandleType<
fidl::Vmo,
{ fidl::ObjectType::VMO.into_raw() },
2147483648,
>,
>,
T1: fidl::encoding::Encode<u64>,
T2: fidl::encoding::Encode<u64>,
T3: fidl::encoding::Encode<u64>,
> fidl::encoding::Encode<BlockWriteBlocksRequest> for (T0, T1, T2, T3)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<BlockWriteBlocksRequest>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
self.2.encode(encoder, offset + 16, depth)?;
self.3.encode(encoder, offset + 24, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for BlockWriteBlocksRequest {
#[inline(always)]
fn new_empty() -> Self {
Self {
vmo: fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>),
length: fidl::new_empty!(u64),
dev_offset: fidl::new_empty!(u64),
vmo_offset: fidl::new_empty!(u64),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffff00000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, &mut self.vmo, decoder, offset + 0, _depth)?;
fidl::decode!(u64, &mut self.length, decoder, offset + 8, _depth)?;
fidl::decode!(u64, &mut self.dev_offset, decoder, offset + 16, _depth)?;
fidl::decode!(u64, &mut self.vmo_offset, decoder, offset + 24, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for BlockGetInfoResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
24
}
}
impl fidl::encoding::ValueTypeMarker for BlockGetInfoResponse {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<BlockGetInfoResponse> for &BlockGetInfoResponse {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<BlockGetInfoResponse>(offset);
fidl::encoding::Encode::<BlockGetInfoResponse>::encode(
(<BlockInfo as fidl::encoding::ValueTypeMarker>::borrow(&self.info),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<T0: fidl::encoding::Encode<BlockInfo>> fidl::encoding::Encode<BlockGetInfoResponse>
for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<BlockGetInfoResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for BlockGetInfoResponse {
#[inline(always)]
fn new_empty() -> Self {
Self { info: fidl::new_empty!(BlockInfo) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(BlockInfo, &mut self.info, decoder, offset + 0, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for BlockGetStatsResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
320
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
impl fidl::encoding::ValueTypeMarker for BlockGetStatsResponse {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<BlockGetStatsResponse> for &BlockGetStatsResponse {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<BlockGetStatsResponse>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut BlockGetStatsResponse)
.write_unaligned((self as *const BlockGetStatsResponse).read());
}
Ok(())
}
}
unsafe impl<T0: fidl::encoding::Encode<BlockStats>>
fidl::encoding::Encode<BlockGetStatsResponse> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<BlockGetStatsResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for BlockGetStatsResponse {
#[inline(always)]
fn new_empty() -> Self {
Self { stats: fidl::new_empty!(BlockStats) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 320);
}
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for FtlFormatResponse {
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
}
}
impl fidl::encoding::ValueTypeMarker for FtlFormatResponse {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<FtlFormatResponse> for &FtlFormatResponse {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<FtlFormatResponse>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut FtlFormatResponse)
.write_unaligned((self as *const FtlFormatResponse).read());
}
Ok(())
}
}
unsafe impl<T0: fidl::encoding::Encode<i32>> fidl::encoding::Encode<FtlFormatResponse> for (T0,) {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<FtlFormatResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for FtlFormatResponse {
#[inline(always)]
fn new_empty() -> Self {
Self { status: fidl::new_empty!(i32) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let 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(())
}
}
unsafe impl fidl::encoding::TypeMarker for InspectVmoProviderGetVmoResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
}
impl fidl::encoding::ResourceTypeMarker for InspectVmoProviderGetVmoResponse {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<InspectVmoProviderGetVmoResponse>
for &mut InspectVmoProviderGetVmoResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<InspectVmoProviderGetVmoResponse>(offset);
fidl::encoding::Encode::<InspectVmoProviderGetVmoResponse>::encode(
(<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<
fidl::encoding::HandleType<
fidl::Vmo,
{ fidl::ObjectType::VMO.into_raw() },
2147483648,
>,
>,
> fidl::encoding::Encode<InspectVmoProviderGetVmoResponse> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<InspectVmoProviderGetVmoResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for InspectVmoProviderGetVmoResponse {
#[inline(always)]
fn new_empty() -> Self {
Self {
vmo: fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, &mut self.vmo, decoder, offset + 0, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for OperationStats {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
80
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
impl fidl::encoding::ValueTypeMarker for OperationStats {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<OperationStats> for &OperationStats {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<OperationStats>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut OperationStats)
.write_unaligned((self as *const OperationStats).read());
}
Ok(())
}
}
unsafe impl<T0: fidl::encoding::Encode<RequestStats>, T1: fidl::encoding::Encode<RequestStats>>
fidl::encoding::Encode<OperationStats> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<OperationStats>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 40, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for OperationStats {
#[inline(always)]
fn new_empty() -> Self {
Self {
success: fidl::new_empty!(RequestStats),
failure: fidl::new_empty!(RequestStats),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 80);
}
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for RequestStats {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
40
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
impl fidl::encoding::ValueTypeMarker for RequestStats {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<RequestStats> for &RequestStats {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RequestStats>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut RequestStats)
.write_unaligned((self as *const RequestStats).read());
}
Ok(())
}
}
unsafe impl<
T0: fidl::encoding::Encode<u64>,
T1: fidl::encoding::Encode<u64>,
T2: fidl::encoding::Encode<u64>,
T3: fidl::encoding::Encode<u64>,
T4: fidl::encoding::Encode<u64>,
> fidl::encoding::Encode<RequestStats> for (T0, T1, T2, T3, T4)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RequestStats>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
self.2.encode(encoder, offset + 16, depth)?;
self.3.encode(encoder, offset + 24, depth)?;
self.4.encode(encoder, offset + 32, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for RequestStats {
#[inline(always)]
fn new_empty() -> Self {
Self {
minimum_latency: fidl::new_empty!(u64),
maximum_latency: fidl::new_empty!(u64),
total_time_spent: fidl::new_empty!(u64),
total_calls: fidl::new_empty!(u64),
bytes_transferred: fidl::new_empty!(u64),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 40);
}
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for SessionAttachVmoRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
}
impl fidl::encoding::ResourceTypeMarker for SessionAttachVmoRequest {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<SessionAttachVmoRequest> for &mut SessionAttachVmoRequest {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<SessionAttachVmoRequest>(offset);
fidl::encoding::Encode::<SessionAttachVmoRequest>::encode(
(<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<
fidl::encoding::HandleType<
fidl::Vmo,
{ fidl::ObjectType::VMO.into_raw() },
2147483648,
>,
>,
> fidl::encoding::Encode<SessionAttachVmoRequest> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<SessionAttachVmoRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for SessionAttachVmoRequest {
#[inline(always)]
fn new_empty() -> Self {
Self {
vmo: fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, &mut self.vmo, decoder, offset + 0, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for SessionAttachVmoResponse {
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
}
}
impl fidl::encoding::ValueTypeMarker for SessionAttachVmoResponse {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<SessionAttachVmoResponse> for &SessionAttachVmoResponse {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<SessionAttachVmoResponse>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut SessionAttachVmoResponse)
.write_unaligned((self as *const SessionAttachVmoResponse).read());
}
Ok(())
}
}
unsafe impl<T0: fidl::encoding::Encode<VmoId>> fidl::encoding::Encode<SessionAttachVmoResponse>
for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<SessionAttachVmoResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for SessionAttachVmoResponse {
#[inline(always)]
fn new_empty() -> Self {
Self { vmoid: fidl::new_empty!(VmoId) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let 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(())
}
}
unsafe impl fidl::encoding::TypeMarker for SessionGetFifoResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
}
impl fidl::encoding::ResourceTypeMarker for SessionGetFifoResponse {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<SessionGetFifoResponse> for &mut SessionGetFifoResponse {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<SessionGetFifoResponse>(offset);
fidl::encoding::Encode::<SessionGetFifoResponse>::encode(
(<fidl::encoding::HandleType<
fidl::Fifo,
{ fidl::ObjectType::FIFO.into_raw() },
2147483648,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.fifo
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::HandleType<
fidl::Fifo,
{ fidl::ObjectType::FIFO.into_raw() },
2147483648,
>,
>,
> fidl::encoding::Encode<SessionGetFifoResponse> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<SessionGetFifoResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for SessionGetFifoResponse {
#[inline(always)]
fn new_empty() -> Self {
Self {
fifo: fidl::new_empty!(fidl::encoding::HandleType<fidl::Fifo, { fidl::ObjectType::FIFO.into_raw() }, 2147483648>),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(fidl::encoding::HandleType<fidl::Fifo, { fidl::ObjectType::FIFO.into_raw() }, 2147483648>, &mut self.fifo, decoder, offset + 0, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for VmoId {
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
}
}
impl fidl::encoding::ValueTypeMarker for VmoId {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<VmoId> for &VmoId {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<VmoId>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut VmoId).write_unaligned((self as *const VmoId).read());
}
Ok(())
}
}
unsafe impl<T0: fidl::encoding::Encode<u16>> fidl::encoding::Encode<VmoId> for (T0,) {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<VmoId>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for VmoId {
#[inline(always)]
fn new_empty() -> Self {
Self { id: fidl::new_empty!(u16) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let 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(())
}
}
}