#![warn(clippy::all)]
#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
use bitflags::bitflags;
use fidl::client::QueryResponseFut;
use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
use fidl::endpoints::{ControlHandle as _, Responder as _};
use futures::future::{self, MaybeDone, TryFutureExt};
use zx_status;
pub const 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(Clone, Debug, Default, PartialEq)]
pub struct PartitionGetMetadataResponse {
pub name: Option<String>,
pub type_guid: Option<Guid>,
pub instance_guid: Option<Guid>,
pub start_block_offset: Option<u64>,
pub num_blocks: Option<u64>,
pub flags: Option<u64>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for PartitionGetMetadataResponse {}
#[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 type PartitionGetMetadataResult = Result<PartitionGetMetadataResponse, i32>;
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 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;
type GetMetadataResponseFut: std::future::Future<Output = Result<PartitionGetMetadataResult, fidl::Error>>
+ Send;
fn r#get_metadata(&self) -> Self::GetMetadataResponseFut;
}
#[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::MonotonicInstant,
) -> Result<PartitionEvent, fidl::Error> {
PartitionEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#get_info(
&self,
___deadline: zx::MonotonicInstant,
) -> 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::MonotonicInstant,
) -> 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#get_type_guid(
&self,
___deadline: zx::MonotonicInstant,
) -> 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::MonotonicInstant,
) -> 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::MonotonicInstant,
) -> 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))
}
pub fn r#get_metadata(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<PartitionGetMetadataResult, fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
fidl::encoding::ResultType<PartitionGetMetadataResponse, i32>,
>(
(),
0x42d1464c96c3f3ff,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
}
#[derive(Debug, Clone)]
pub struct PartitionProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
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,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
PartitionProxyInterface::r#get_info(self)
}
pub fn r#get_stats(
&self,
mut clear: bool,
) -> fidl::client::QueryResponseFut<
fidl_fuchsia_hardware_block::BlockGetStatsResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
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#get_type_guid(
&self,
) -> fidl::client::QueryResponseFut<
(i32, Option<Box<Guid>>),
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
PartitionProxyInterface::r#get_type_guid(self)
}
pub fn r#get_instance_guid(
&self,
) -> fidl::client::QueryResponseFut<
(i32, Option<Box<Guid>>),
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
PartitionProxyInterface::r#get_instance_guid(self)
}
pub fn r#get_name(
&self,
) -> fidl::client::QueryResponseFut<
(i32, Option<String>),
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
PartitionProxyInterface::r#get_name(self)
}
pub fn r#get_metadata(
&self,
) -> fidl::client::QueryResponseFut<
PartitionGetMetadataResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
PartitionProxyInterface::r#get_metadata(self)
}
}
impl PartitionProxyInterface for PartitionProxy {
type GetInfoResponseFut = fidl::client::QueryResponseFut<
fidl_fuchsia_hardware_block::BlockGetInfoResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#get_info(&self) -> Self::GetInfoResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<fidl_fuchsia_hardware_block::BlockGetInfoResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl_fuchsia_hardware_block::BlockGetInfoResponse, i32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
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,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#get_stats(&self, mut clear: bool) -> Self::GetStatsResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::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>,
fidl::encoding::DefaultFuchsiaResourceDialect,
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 GetTypeGuidResponseFut = fidl::client::QueryResponseFut<
(i32, Option<Box<Guid>>),
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#get_type_guid(&self) -> Self::GetTypeGuidResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<(i32, Option<Box<Guid>>), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
PartitionGetTypeGuidResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
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>>),
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#get_instance_guid(&self) -> Self::GetInstanceGuidResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<(i32, Option<Box<Guid>>), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
PartitionGetInstanceGuidResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
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>),
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#get_name(&self) -> Self::GetNameResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<(i32, Option<String>), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
PartitionGetNameResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
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,
)
}
type GetMetadataResponseFut = fidl::client::QueryResponseFut<
PartitionGetMetadataResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#get_metadata(&self) -> Self::GetMetadataResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<PartitionGetMetadataResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<PartitionGetMetadataResponse, i32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x42d1464c96c3f3ff,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client
.send_query_and_decode::<fidl::encoding::EmptyPayload, PartitionGetMetadataResult>(
(),
0x42d1464c96c3f3ff,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct PartitionEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
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::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::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<fidl::encoding::DefaultFuchsiaResourceDialect>>,
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<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
{
(self.inner, self.is_terminated)
}
fn from_inner(
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for 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::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
e.into(),
))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x79df1a5cdb6cc6a3 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle = 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::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::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::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::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 })
}
0x111843d737a9b847 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle = 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::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::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::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::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,
},
})
}
0x42d1464c96c3f3ff => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle = PartitionControlHandle { inner: this.inner.clone() };
Ok(PartitionRequest::GetMetadata {
responder: PartitionGetMetadataResponder {
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,
},
GetTypeGuid { responder: PartitionGetTypeGuidResponder },
GetInstanceGuid { responder: PartitionGetInstanceGuidResponder },
GetName { responder: PartitionGetNameResponder },
GetMetadata { responder: PartitionGetMetadataResponder },
}
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_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
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_get_metadata(self) -> Option<(PartitionGetMetadataResponder)> {
if let PartitionRequest::GetMetadata { 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::GetTypeGuid { .. } => "get_type_guid",
PartitionRequest::GetInstanceGuid { .. } => "get_instance_guid",
PartitionRequest::GetName { .. } => "get_name",
PartitionRequest::GetMetadata { .. } => "get_metadata",
}
}
}
#[derive(Debug, Clone)]
pub struct PartitionControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
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()
}
#[cfg(target_os = "fuchsia")]
fn signal_peer(
&self,
clear_mask: zx::Signals,
set_mask: zx::Signals,
) -> Result<(), zx_status::Status> {
use fidl::Peered;
self.inner.channel().signal_peer(clear_mask, set_mask)
}
}
impl 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 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(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct PartitionGetMetadataResponder {
control_handle: std::mem::ManuallyDrop<PartitionControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for PartitionGetMetadataResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for PartitionGetMetadataResponder {
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 PartitionGetMetadataResponder {
pub fn send(
self,
mut result: Result<&PartitionGetMetadataResponse, 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<&PartitionGetMetadataResponse, i32>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut result: Result<&PartitionGetMetadataResponse, i32>,
) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<PartitionGetMetadataResponse, i32>>(
result,
self.tx_id,
0x42d1464c96c3f3ff,
fidl::encoding::DynamicFlags::empty(),
)
}
}
mod internal {
use super::*;
impl fidl::encoding::ValueTypeMarker for Guid {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Guid, D> for &Guid {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
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<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::Array<u8, 16>, D>,
> fidl::encoding::Encode<Guid, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Guid>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Guid {
#[inline(always)]
fn new_empty() -> Self {
Self { value: fidl::new_empty!(fidl::encoding::Array<u8, 16>, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for PartitionGetInstanceGuidResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<PartitionGetInstanceGuidResponse, D>
for &PartitionGetInstanceGuidResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PartitionGetInstanceGuidResponse>(offset);
fidl::encoding::Encode::<PartitionGetInstanceGuidResponse, D>::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<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<i32, D>,
T1: fidl::encoding::Encode<fidl::encoding::Boxed<Guid>, D>,
> fidl::encoding::Encode<PartitionGetInstanceGuidResponse, D> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<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<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for PartitionGetInstanceGuidResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self {
status: fidl::new_empty!(i32, D),
guid: fidl::new_empty!(fidl::encoding::Boxed<Guid>, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffff00000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(i32, D, &mut self.status, decoder, offset + 0, _depth)?;
fidl::decode!(
fidl::encoding::Boxed<Guid>,
D,
&mut self.guid,
decoder,
offset + 8,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for PartitionGetNameResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<PartitionGetNameResponse, D> for &PartitionGetNameResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PartitionGetNameResponse>(offset);
fidl::encoding::Encode::<PartitionGetNameResponse, D>::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<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<i32, D>,
T1: fidl::encoding::Encode<fidl::encoding::Optional<fidl::encoding::BoundedString<128>>, D>,
> fidl::encoding::Encode<PartitionGetNameResponse, D> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<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<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for PartitionGetNameResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self {
status: fidl::new_empty!(i32, D),
name: fidl::new_empty!(
fidl::encoding::Optional<fidl::encoding::BoundedString<128>>,
D
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffff00000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(i32, D, &mut self.status, decoder, offset + 0, _depth)?;
fidl::decode!(
fidl::encoding::Optional<fidl::encoding::BoundedString<128>>,
D,
&mut self.name,
decoder,
offset + 8,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for PartitionGetTypeGuidResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<PartitionGetTypeGuidResponse, D> for &PartitionGetTypeGuidResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PartitionGetTypeGuidResponse>(offset);
fidl::encoding::Encode::<PartitionGetTypeGuidResponse, D>::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<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<i32, D>,
T1: fidl::encoding::Encode<fidl::encoding::Boxed<Guid>, D>,
> fidl::encoding::Encode<PartitionGetTypeGuidResponse, D> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<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<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for PartitionGetTypeGuidResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self {
status: fidl::new_empty!(i32, D),
guid: fidl::new_empty!(fidl::encoding::Boxed<Guid>, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffff00000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(i32, D, &mut self.status, decoder, offset + 0, _depth)?;
fidl::decode!(
fidl::encoding::Boxed<Guid>,
D,
&mut self.guid,
decoder,
offset + 8,
_depth
)?;
Ok(())
}
}
impl PartitionGetMetadataResponse {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.flags {
return 6;
}
if let Some(_) = self.num_blocks {
return 5;
}
if let Some(_) = self.start_block_offset {
return 4;
}
if let Some(_) = self.instance_guid {
return 3;
}
if let Some(_) = self.type_guid {
return 2;
}
if let Some(_) = self.name {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for PartitionGetMetadataResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for PartitionGetMetadataResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<PartitionGetMetadataResponse, D> for &PartitionGetMetadataResponse
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PartitionGetMetadataResponse>(offset);
let max_ordinal: u64 = self.max_ordinal_present();
encoder.write_num(max_ordinal, offset);
encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
if max_ordinal == 0 {
return Ok(());
}
depth.increment()?;
let envelope_size = 8;
let bytes_len = max_ordinal as usize * envelope_size;
#[allow(unused_variables)]
let offset = encoder.out_of_line_offset(bytes_len);
let mut _prev_end_offset: usize = 0;
if 1 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (1 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<128>, D>(
self.name.as_ref().map(
<fidl::encoding::BoundedString<128> as fidl::encoding::ValueTypeMarker>::borrow,
),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 2 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (2 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<Guid, D>(
self.type_guid.as_ref().map(<Guid as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 3 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (3 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<Guid, D>(
self.instance_guid.as_ref().map(<Guid as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 4 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (4 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<u64, D>(
self.start_block_offset
.as_ref()
.map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 5 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (5 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<u64, D>(
self.num_blocks.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 6 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (6 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<u64, D>(
self.flags.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for PartitionGetMetadataResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
if len == 0 {
return Ok(());
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 1 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<fidl::encoding::BoundedString<128> as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self
.name
.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<128>, D));
fidl::decode!(
fidl::encoding::BoundedString<128>,
D,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 2 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<Guid as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.type_guid.get_or_insert_with(|| fidl::new_empty!(Guid, D));
fidl::decode!(Guid, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 3 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<Guid as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.instance_guid.get_or_insert_with(|| fidl::new_empty!(Guid, D));
fidl::decode!(Guid, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 4 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref =
self.start_block_offset.get_or_insert_with(|| fidl::new_empty!(u64, D));
fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 5 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.num_blocks.get_or_insert_with(|| fidl::new_empty!(u64, D));
fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 6 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.flags.get_or_insert_with(|| fidl::new_empty!(u64, D));
fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
while next_offset < end_offset {
_next_ordinal_to_read += 1;
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
next_offset += envelope_size;
}
Ok(())
}
}
}