#![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 GUID_LENGTH: u32 = 16;
pub const NAME_LENGTH: u32 = 128;
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct Guid {
pub value: [u8; 16],
}
impl fidl::Persistable for Guid {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct PartitionGetInstanceGuidResponse {
pub status: i32,
pub guid: Option<Box<Guid>>,
}
impl fidl::Persistable for PartitionGetInstanceGuidResponse {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct PartitionGetNameResponse {
pub status: i32,
pub name: Option<String>,
}
impl fidl::Persistable for PartitionGetNameResponse {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct PartitionGetTypeGuidResponse {
pub status: i32,
pub guid: Option<Box<Guid>>,
}
impl fidl::Persistable for PartitionGetTypeGuidResponse {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct PartitionMarker;
impl fidl::endpoints::ProtocolMarker for PartitionMarker {
type Proxy = PartitionProxy;
type RequestStream = PartitionRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = PartitionSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) Partition";
}
pub trait PartitionProxyInterface: Send + Sync {
type GetInfoResponseFut: std::future::Future<
Output = Result<fidl_fuchsia_hardware_block::BlockGetInfoResult, fidl::Error>,
> + Send;
fn r#get_info(&self) -> Self::GetInfoResponseFut;
type GetStatsResponseFut: std::future::Future<
Output = Result<fidl_fuchsia_hardware_block::BlockGetStatsResult, fidl::Error>,
> + Send;
fn r#get_stats(&self, clear: bool) -> Self::GetStatsResponseFut;
fn r#open_session(
&self,
session: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_block::SessionMarker>,
) -> Result<(), fidl::Error>;
type ReadBlocksResponseFut: std::future::Future<
Output = Result<fidl_fuchsia_hardware_block::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<fidl_fuchsia_hardware_block::BlockWriteBlocksResult, fidl::Error>,
> + Send;
fn r#write_blocks(
&self,
vmo: fidl::Vmo,
length: u64,
dev_offset: u64,
vmo_offset: u64,
) -> Self::WriteBlocksResponseFut;
type GetTypeGuidResponseFut: std::future::Future<Output = Result<(i32, Option<Box<Guid>>), fidl::Error>>
+ Send;
fn r#get_type_guid(&self) -> Self::GetTypeGuidResponseFut;
type GetInstanceGuidResponseFut: std::future::Future<Output = Result<(i32, Option<Box<Guid>>), fidl::Error>>
+ Send;
fn r#get_instance_guid(&self) -> Self::GetInstanceGuidResponseFut;
type GetNameResponseFut: std::future::Future<Output = Result<(i32, Option<String>), fidl::Error>>
+ Send;
fn r#get_name(&self) -> Self::GetNameResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct PartitionSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for PartitionSynchronousProxy {
type Proxy = PartitionProxy;
type Protocol = PartitionMarker;
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 PartitionSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <PartitionMarker 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<PartitionEvent, fidl::Error> {
PartitionEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#get_info(
&self,
___deadline: zx::Time,
) -> Result<fidl_fuchsia_hardware_block::BlockGetInfoResult, fidl::Error> {
let _response =
self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::ResultType<
fidl_fuchsia_hardware_block::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<fidl_fuchsia_hardware_block::BlockGetStatsResult, fidl::Error> {
let _response = self.client.send_query::<
fidl_fuchsia_hardware_block::BlockGetStatsRequest,
fidl::encoding::ResultType<fidl_fuchsia_hardware_block::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<fidl_fuchsia_hardware_block::SessionMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<fidl_fuchsia_hardware_block::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<fidl_fuchsia_hardware_block::BlockReadBlocksResult, fidl::Error> {
let _response = self.client.send_query::<
fidl_fuchsia_hardware_block::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<fidl_fuchsia_hardware_block::BlockWriteBlocksResult, fidl::Error> {
let _response = self.client.send_query::<
fidl_fuchsia_hardware_block::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))
}
pub fn r#get_type_guid(
&self,
___deadline: zx::Time,
) -> Result<(i32, Option<Box<Guid>>), fidl::Error> {
let _response =
self.client.send_query::<fidl::encoding::EmptyPayload, PartitionGetTypeGuidResponse>(
(),
0x111843d737a9b847,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok((_response.status, _response.guid))
}
pub fn r#get_instance_guid(
&self,
___deadline: zx::Time,
) -> Result<(i32, Option<Box<Guid>>), fidl::Error> {
let _response = self
.client
.send_query::<fidl::encoding::EmptyPayload, PartitionGetInstanceGuidResponse>(
(),
0x14a5a573b275d435,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok((_response.status, _response.guid))
}
pub fn r#get_name(&self, ___deadline: zx::Time) -> Result<(i32, Option<String>), fidl::Error> {
let _response =
self.client.send_query::<fidl::encoding::EmptyPayload, PartitionGetNameResponse>(
(),
0x7e3c6f0b0937fc02,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok((_response.status, _response.name))
}
}
#[derive(Debug, Clone)]
pub struct PartitionProxy {
client: fidl::client::Client,
}
impl fidl::endpoints::Proxy for PartitionProxy {
type Protocol = PartitionMarker;
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 PartitionProxy {
pub fn new(channel: fidl::AsyncChannel) -> Self {
let protocol_name = <PartitionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> PartitionEventStream {
PartitionEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#get_info(
&self,
) -> fidl::client::QueryResponseFut<fidl_fuchsia_hardware_block::BlockGetInfoResult> {
PartitionProxyInterface::r#get_info(self)
}
pub fn r#get_stats(
&self,
mut clear: bool,
) -> fidl::client::QueryResponseFut<fidl_fuchsia_hardware_block::BlockGetStatsResult> {
PartitionProxyInterface::r#get_stats(self, clear)
}
pub fn r#open_session(
&self,
mut session: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_block::SessionMarker>,
) -> Result<(), fidl::Error> {
PartitionProxyInterface::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<fidl_fuchsia_hardware_block::BlockReadBlocksResult> {
PartitionProxyInterface::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<fidl_fuchsia_hardware_block::BlockWriteBlocksResult> {
PartitionProxyInterface::r#write_blocks(self, vmo, length, dev_offset, vmo_offset)
}
pub fn r#get_type_guid(&self) -> fidl::client::QueryResponseFut<(i32, Option<Box<Guid>>)> {
PartitionProxyInterface::r#get_type_guid(self)
}
pub fn r#get_instance_guid(&self) -> fidl::client::QueryResponseFut<(i32, Option<Box<Guid>>)> {
PartitionProxyInterface::r#get_instance_guid(self)
}
pub fn r#get_name(&self) -> fidl::client::QueryResponseFut<(i32, Option<String>)> {
PartitionProxyInterface::r#get_name(self)
}
}
impl PartitionProxyInterface for PartitionProxy {
type GetInfoResponseFut =
fidl::client::QueryResponseFut<fidl_fuchsia_hardware_block::BlockGetInfoResult>;
fn r#get_info(&self) -> Self::GetInfoResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<fidl_fuchsia_hardware_block::BlockGetInfoResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl_fuchsia_hardware_block::BlockGetInfoResponse, i32>,
0x79df1a5cdb6cc6a3,
>(_buf?)?;
Ok(_response.map(|x| x.info))
}
self.client.send_query_and_decode::<
fidl::encoding::EmptyPayload,
fidl_fuchsia_hardware_block::BlockGetInfoResult,
>(
(),
0x79df1a5cdb6cc6a3,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type GetStatsResponseFut =
fidl::client::QueryResponseFut<fidl_fuchsia_hardware_block::BlockGetStatsResult>;
fn r#get_stats(&self, mut clear: bool) -> Self::GetStatsResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<fidl_fuchsia_hardware_block::BlockGetStatsResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl_fuchsia_hardware_block::BlockGetStatsResponse, i32>,
0x53d9542a778385ae,
>(_buf?)?;
Ok(_response.map(|x| x.stats))
}
self.client.send_query_and_decode::<
fidl_fuchsia_hardware_block::BlockGetStatsRequest,
fidl_fuchsia_hardware_block::BlockGetStatsResult,
>(
(clear,),
0x53d9542a778385ae,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
fn r#open_session(
&self,
mut session: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_block::SessionMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<fidl_fuchsia_hardware_block::BlockOpenSessionRequest>(
(session,),
0x7241c68d17614a31,
fidl::encoding::DynamicFlags::empty(),
)
}
type ReadBlocksResponseFut =
fidl::client::QueryResponseFut<fidl_fuchsia_hardware_block::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<fidl_fuchsia_hardware_block::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::<
fidl_fuchsia_hardware_block::BlockReadBlocksRequest,
fidl_fuchsia_hardware_block::BlockReadBlocksResult,
>(
(vmo, length, dev_offset, vmo_offset,),
0x7906bed7f5c10fda,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type WriteBlocksResponseFut =
fidl::client::QueryResponseFut<fidl_fuchsia_hardware_block::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<fidl_fuchsia_hardware_block::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::<
fidl_fuchsia_hardware_block::BlockWriteBlocksRequest,
fidl_fuchsia_hardware_block::BlockWriteBlocksResult,
>(
(vmo, length, dev_offset, vmo_offset,),
0x1500d79edc8cc71f,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type GetTypeGuidResponseFut = fidl::client::QueryResponseFut<(i32, Option<Box<Guid>>)>;
fn r#get_type_guid(&self) -> Self::GetTypeGuidResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<(i32, Option<Box<Guid>>), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
PartitionGetTypeGuidResponse,
0x111843d737a9b847,
>(_buf?)?;
Ok((_response.status, _response.guid))
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, (i32, Option<Box<Guid>>)>(
(),
0x111843d737a9b847,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type GetInstanceGuidResponseFut = fidl::client::QueryResponseFut<(i32, Option<Box<Guid>>)>;
fn r#get_instance_guid(&self) -> Self::GetInstanceGuidResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<(i32, Option<Box<Guid>>), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
PartitionGetInstanceGuidResponse,
0x14a5a573b275d435,
>(_buf?)?;
Ok((_response.status, _response.guid))
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, (i32, Option<Box<Guid>>)>(
(),
0x14a5a573b275d435,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type GetNameResponseFut = fidl::client::QueryResponseFut<(i32, Option<String>)>;
fn r#get_name(&self) -> Self::GetNameResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<(i32, Option<String>), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
PartitionGetNameResponse,
0x7e3c6f0b0937fc02,
>(_buf?)?;
Ok((_response.status, _response.name))
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, (i32, Option<String>)>(
(),
0x7e3c6f0b0937fc02,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct PartitionEventStream {
event_receiver: fidl::client::EventReceiver,
}
impl std::marker::Unpin for PartitionEventStream {}
impl futures::stream::FusedStream for PartitionEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for PartitionEventStream {
type Item = Result<PartitionEvent, 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(PartitionEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum PartitionEvent {}
impl PartitionEvent {
fn decode(mut buf: fidl::MessageBufEtc) -> Result<PartitionEvent, 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: <PartitionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct PartitionRequestStream {
inner: std::sync::Arc<fidl::ServeInner>,
is_terminated: bool,
}
impl std::marker::Unpin for PartitionRequestStream {}
impl futures::stream::FusedStream for PartitionRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for PartitionRequestStream {
type Protocol = PartitionMarker;
type ControlHandle = PartitionControlHandle;
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 {
PartitionControlHandle { 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 PartitionRequestStream {
type Item = Result<PartitionRequest, 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 PartitionRequestStream 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 = PartitionControlHandle { inner: this.inner.clone() };
Ok(PartitionRequest::GetInfo {
responder: PartitionGetInfoResponder {
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!(fidl_fuchsia_hardware_block::BlockGetStatsRequest);
fidl::encoding::Decoder::decode_into::<
fidl_fuchsia_hardware_block::BlockGetStatsRequest,
>(&header, _body_bytes, handles, &mut req)?;
let control_handle = PartitionControlHandle { inner: this.inner.clone() };
Ok(PartitionRequest::GetStats {
clear: req.clear,
responder: PartitionGetStatsResponder {
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!(fidl_fuchsia_hardware_block::BlockOpenSessionRequest);
fidl::encoding::Decoder::decode_into::<
fidl_fuchsia_hardware_block::BlockOpenSessionRequest,
>(&header, _body_bytes, handles, &mut req)?;
let control_handle = PartitionControlHandle { inner: this.inner.clone() };
Ok(PartitionRequest::OpenSession { session: req.session, control_handle })
}
0x7906bed7f5c10fda => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req =
fidl::new_empty!(fidl_fuchsia_hardware_block::BlockReadBlocksRequest);
fidl::encoding::Decoder::decode_into::<
fidl_fuchsia_hardware_block::BlockReadBlocksRequest,
>(&header, _body_bytes, handles, &mut req)?;
let control_handle = PartitionControlHandle { inner: this.inner.clone() };
Ok(PartitionRequest::ReadBlocks {
vmo: req.vmo,
length: req.length,
dev_offset: req.dev_offset,
vmo_offset: req.vmo_offset,
responder: PartitionReadBlocksResponder {
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!(fidl_fuchsia_hardware_block::BlockWriteBlocksRequest);
fidl::encoding::Decoder::decode_into::<
fidl_fuchsia_hardware_block::BlockWriteBlocksRequest,
>(&header, _body_bytes, handles, &mut req)?;
let control_handle = PartitionControlHandle { inner: this.inner.clone() };
Ok(PartitionRequest::WriteBlocks {
vmo: req.vmo,
length: req.length,
dev_offset: req.dev_offset,
vmo_offset: req.vmo_offset,
responder: PartitionWriteBlocksResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x111843d737a9b847 => {
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 = PartitionControlHandle { inner: this.inner.clone() };
Ok(PartitionRequest::GetTypeGuid {
responder: PartitionGetTypeGuidResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x14a5a573b275d435 => {
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 = PartitionControlHandle { inner: this.inner.clone() };
Ok(PartitionRequest::GetInstanceGuid {
responder: PartitionGetInstanceGuidResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x7e3c6f0b0937fc02 => {
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 = PartitionControlHandle { inner: this.inner.clone() };
Ok(PartitionRequest::GetName {
responder: PartitionGetNameResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <PartitionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
})
}
}
#[derive(Debug)]
pub enum PartitionRequest {
GetInfo { responder: PartitionGetInfoResponder },
GetStats { clear: bool, responder: PartitionGetStatsResponder },
OpenSession {
session: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_block::SessionMarker>,
control_handle: PartitionControlHandle,
},
ReadBlocks {
vmo: fidl::Vmo,
length: u64,
dev_offset: u64,
vmo_offset: u64,
responder: PartitionReadBlocksResponder,
},
WriteBlocks {
vmo: fidl::Vmo,
length: u64,
dev_offset: u64,
vmo_offset: u64,
responder: PartitionWriteBlocksResponder,
},
GetTypeGuid { responder: PartitionGetTypeGuidResponder },
GetInstanceGuid { responder: PartitionGetInstanceGuidResponder },
GetName { responder: PartitionGetNameResponder },
}
impl PartitionRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_get_info(self) -> Option<(PartitionGetInfoResponder)> {
if let PartitionRequest::GetInfo { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_get_stats(self) -> Option<(bool, PartitionGetStatsResponder)> {
if let PartitionRequest::GetStats { clear, responder } = self {
Some((clear, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_open_session(
self,
) -> Option<(
fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_block::SessionMarker>,
PartitionControlHandle,
)> {
if let PartitionRequest::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, PartitionReadBlocksResponder)> {
if let PartitionRequest::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, PartitionWriteBlocksResponder)> {
if let PartitionRequest::WriteBlocks { 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_get_type_guid(self) -> Option<(PartitionGetTypeGuidResponder)> {
if let PartitionRequest::GetTypeGuid { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_get_instance_guid(self) -> Option<(PartitionGetInstanceGuidResponder)> {
if let PartitionRequest::GetInstanceGuid { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_get_name(self) -> Option<(PartitionGetNameResponder)> {
if let PartitionRequest::GetName { responder } = self {
Some((responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
PartitionRequest::GetInfo { .. } => "get_info",
PartitionRequest::GetStats { .. } => "get_stats",
PartitionRequest::OpenSession { .. } => "open_session",
PartitionRequest::ReadBlocks { .. } => "read_blocks",
PartitionRequest::WriteBlocks { .. } => "write_blocks",
PartitionRequest::GetTypeGuid { .. } => "get_type_guid",
PartitionRequest::GetInstanceGuid { .. } => "get_instance_guid",
PartitionRequest::GetName { .. } => "get_name",
}
}
}
#[derive(Debug, Clone)]
pub struct PartitionControlHandle {
inner: std::sync::Arc<fidl::ServeInner>,
}
impl fidl::endpoints::ControlHandle for PartitionControlHandle {
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 PartitionControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct PartitionGetInfoResponder {
control_handle: std::mem::ManuallyDrop<PartitionControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for PartitionGetInfoResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for PartitionGetInfoResponder {
type ControlHandle = PartitionControlHandle;
fn control_handle(&self) -> &PartitionControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl PartitionGetInfoResponder {
pub fn send(
self,
mut result: Result<&fidl_fuchsia_hardware_block::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<&fidl_fuchsia_hardware_block::BlockInfo, i32>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut result: Result<&fidl_fuchsia_hardware_block::BlockInfo, i32>,
) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
fidl_fuchsia_hardware_block::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 PartitionGetStatsResponder {
control_handle: std::mem::ManuallyDrop<PartitionControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for PartitionGetStatsResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for PartitionGetStatsResponder {
type ControlHandle = PartitionControlHandle;
fn control_handle(&self) -> &PartitionControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl PartitionGetStatsResponder {
pub fn send(
self,
mut result: Result<&fidl_fuchsia_hardware_block::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<&fidl_fuchsia_hardware_block::BlockStats, i32>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut result: Result<&fidl_fuchsia_hardware_block::BlockStats, i32>,
) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
fidl_fuchsia_hardware_block::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 PartitionReadBlocksResponder {
control_handle: std::mem::ManuallyDrop<PartitionControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for PartitionReadBlocksResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for PartitionReadBlocksResponder {
type ControlHandle = PartitionControlHandle;
fn control_handle(&self) -> &PartitionControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl PartitionReadBlocksResponder {
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 PartitionWriteBlocksResponder {
control_handle: std::mem::ManuallyDrop<PartitionControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for PartitionWriteBlocksResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for PartitionWriteBlocksResponder {
type ControlHandle = PartitionControlHandle;
fn control_handle(&self) -> &PartitionControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl PartitionWriteBlocksResponder {
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(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct PartitionGetTypeGuidResponder {
control_handle: std::mem::ManuallyDrop<PartitionControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for PartitionGetTypeGuidResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for PartitionGetTypeGuidResponder {
type ControlHandle = PartitionControlHandle;
fn control_handle(&self) -> &PartitionControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl PartitionGetTypeGuidResponder {
pub fn send(self, mut status: i32, mut guid: Option<&Guid>) -> Result<(), fidl::Error> {
let _result = self.send_raw(status, guid);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut status: i32,
mut guid: Option<&Guid>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(status, guid);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut status: i32, mut guid: Option<&Guid>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<PartitionGetTypeGuidResponse>(
(status, guid),
self.tx_id,
0x111843d737a9b847,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct PartitionGetInstanceGuidResponder {
control_handle: std::mem::ManuallyDrop<PartitionControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for PartitionGetInstanceGuidResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for PartitionGetInstanceGuidResponder {
type ControlHandle = PartitionControlHandle;
fn control_handle(&self) -> &PartitionControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl PartitionGetInstanceGuidResponder {
pub fn send(self, mut status: i32, mut guid: Option<&Guid>) -> Result<(), fidl::Error> {
let _result = self.send_raw(status, guid);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut status: i32,
mut guid: Option<&Guid>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(status, guid);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut status: i32, mut guid: Option<&Guid>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<PartitionGetInstanceGuidResponse>(
(status, guid),
self.tx_id,
0x14a5a573b275d435,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct PartitionGetNameResponder {
control_handle: std::mem::ManuallyDrop<PartitionControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for PartitionGetNameResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for PartitionGetNameResponder {
type ControlHandle = PartitionControlHandle;
fn control_handle(&self) -> &PartitionControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl PartitionGetNameResponder {
pub fn send(self, mut status: i32, mut name: Option<&str>) -> Result<(), fidl::Error> {
let _result = self.send_raw(status, name);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut status: i32,
mut name: Option<&str>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(status, name);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut status: i32, mut name: Option<&str>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<PartitionGetNameResponse>(
(status, name),
self.tx_id,
0x7e3c6f0b0937fc02,
fidl::encoding::DynamicFlags::empty(),
)
}
}
mod internal {
use super::*;
unsafe impl fidl::encoding::TypeMarker for Guid {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
1
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
impl fidl::encoding::ValueTypeMarker for Guid {
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<Guid> for &Guid {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Guid>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut Guid).write_unaligned((self as *const Guid).read());
}
Ok(())
}
}
unsafe impl<T0: fidl::encoding::Encode<fidl::encoding::Array<u8, 16>>>
fidl::encoding::Encode<Guid> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Guid>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for Guid {
#[inline(always)]
fn new_empty() -> Self {
Self { value: fidl::new_empty!(fidl::encoding::Array<u8, 16>) }
}
#[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, 16);
}
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for PartitionGetInstanceGuidResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
impl fidl::encoding::ValueTypeMarker for PartitionGetInstanceGuidResponse {
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<PartitionGetInstanceGuidResponse>
for &PartitionGetInstanceGuidResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PartitionGetInstanceGuidResponse>(offset);
fidl::encoding::Encode::<PartitionGetInstanceGuidResponse>::encode(
(
<i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.status),
<fidl::encoding::Boxed<Guid> as fidl::encoding::ValueTypeMarker>::borrow(
&self.guid,
),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<i32>,
T1: fidl::encoding::Encode<fidl::encoding::Boxed<Guid>>,
> fidl::encoding::Encode<PartitionGetInstanceGuidResponse> 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::<PartitionGetInstanceGuidResponse>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for PartitionGetInstanceGuidResponse {
#[inline(always)]
fn new_empty() -> Self {
Self {
status: fidl::new_empty!(i32),
guid: fidl::new_empty!(fidl::encoding::Boxed<Guid>),
}
}
#[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!(i32, &mut self.status, decoder, offset + 0, _depth)?;
fidl::decode!(
fidl::encoding::Boxed<Guid>,
&mut self.guid,
decoder,
offset + 8,
_depth
)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for PartitionGetNameResponse {
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 PartitionGetNameResponse {
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<PartitionGetNameResponse> for &PartitionGetNameResponse {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PartitionGetNameResponse>(offset);
fidl::encoding::Encode::<PartitionGetNameResponse>::encode(
(
<i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.status),
<fidl::encoding::Optional<fidl::encoding::BoundedString<128>> as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<i32>,
T1: fidl::encoding::Encode<fidl::encoding::Optional<fidl::encoding::BoundedString<128>>>,
> fidl::encoding::Encode<PartitionGetNameResponse> 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::<PartitionGetNameResponse>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for PartitionGetNameResponse {
#[inline(always)]
fn new_empty() -> Self {
Self {
status: fidl::new_empty!(i32),
name: fidl::new_empty!(
fidl::encoding::Optional<fidl::encoding::BoundedString<128>>
),
}
}
#[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!(i32, &mut self.status, decoder, offset + 0, _depth)?;
fidl::decode!(
fidl::encoding::Optional<fidl::encoding::BoundedString<128>>,
&mut self.name,
decoder,
offset + 8,
_depth
)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for PartitionGetTypeGuidResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
impl fidl::encoding::ValueTypeMarker for PartitionGetTypeGuidResponse {
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<PartitionGetTypeGuidResponse> for &PartitionGetTypeGuidResponse {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PartitionGetTypeGuidResponse>(offset);
fidl::encoding::Encode::<PartitionGetTypeGuidResponse>::encode(
(
<i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.status),
<fidl::encoding::Boxed<Guid> as fidl::encoding::ValueTypeMarker>::borrow(
&self.guid,
),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<i32>,
T1: fidl::encoding::Encode<fidl::encoding::Boxed<Guid>>,
> fidl::encoding::Encode<PartitionGetTypeGuidResponse> 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::<PartitionGetTypeGuidResponse>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for PartitionGetTypeGuidResponse {
#[inline(always)]
fn new_empty() -> Self {
Self {
status: fidl::new_empty!(i32),
guid: fidl::new_empty!(fidl::encoding::Boxed<Guid>),
}
}
#[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!(i32, &mut self.status, decoder, offset + 0, _depth)?;
fidl::decode!(
fidl::encoding::Boxed<Guid>,
&mut self.guid,
decoder,
offset + 8,
_depth
)?;
Ok(())
}
}
}