#![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 MAX_PARTITIONS: u32 = 128;
#[derive(Clone, Debug, PartialEq)]
pub struct PartitionInfo {
pub name: String,
pub type_guid: fidl_fuchsia_hardware_block_partition::Guid,
pub instance_guid: fidl_fuchsia_hardware_block_partition::Guid,
pub start_block: u64,
pub num_blocks: u64,
pub flags: u64,
}
impl fidl::Persistable for PartitionInfo {}
#[derive(Clone, Debug, PartialEq)]
pub struct PartitionsAdminResetPartitionTableRequest {
pub partitions: Vec<PartitionInfo>,
}
impl fidl::Persistable for PartitionsAdminResetPartitionTableRequest {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct PartitionsManagerCommitTransactionRequest {
pub transaction: fidl::EventPair,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for PartitionsManagerCommitTransactionRequest
{
}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct PartitionsManagerCreateTransactionResponse {
pub transaction: fidl::EventPair,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for PartitionsManagerCreateTransactionResponse
{
}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct PartitionsManagerGetBlockInfoResponse {
pub block_count: u64,
pub block_size: u32,
}
impl fidl::Persistable for PartitionsManagerGetBlockInfoResponse {}
#[derive(Debug, Default, PartialEq)]
pub struct PartitionUpdateMetadataRequest {
pub transaction: Option<fidl::EventPair>,
pub type_guid: Option<fidl_fuchsia_hardware_block_partition::Guid>,
pub flags: Option<u64>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for PartitionUpdateMetadataRequest
{
}
#[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 = "fuchsia.storage.partitions.Partition";
}
impl fidl::endpoints::DiscoverableProtocolMarker for PartitionMarker {}
pub type PartitionUpdateMetadataResult = Result<(), i32>;
pub trait PartitionProxyInterface: Send + Sync {
type UpdateMetadataResponseFut: std::future::Future<Output = Result<PartitionUpdateMetadataResult, fidl::Error>>
+ Send;
fn r#update_metadata(
&self,
payload: PartitionUpdateMetadataRequest,
) -> Self::UpdateMetadataResponseFut;
}
#[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#update_metadata(
&self,
mut payload: PartitionUpdateMetadataRequest,
___deadline: zx::MonotonicInstant,
) -> Result<PartitionUpdateMetadataResult, fidl::Error> {
let _response = self.client.send_query::<
PartitionUpdateMetadataRequest,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
>(
&mut payload,
0x7bce44e5c9d5009c,
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#update_metadata(
&self,
mut payload: PartitionUpdateMetadataRequest,
) -> fidl::client::QueryResponseFut<
PartitionUpdateMetadataResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
PartitionProxyInterface::r#update_metadata(self, payload)
}
}
impl PartitionProxyInterface for PartitionProxy {
type UpdateMetadataResponseFut = fidl::client::QueryResponseFut<
PartitionUpdateMetadataResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#update_metadata(
&self,
mut payload: PartitionUpdateMetadataRequest,
) -> Self::UpdateMetadataResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<PartitionUpdateMetadataResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x7bce44e5c9d5009c,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client
.send_query_and_decode::<PartitionUpdateMetadataRequest, PartitionUpdateMetadataResult>(
&mut payload,
0x7bce44e5c9d5009c,
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 {
0x7bce44e5c9d5009c => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
PartitionUpdateMetadataRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PartitionUpdateMetadataRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = PartitionControlHandle { inner: this.inner.clone() };
Ok(PartitionRequest::UpdateMetadata {
payload: req,
responder: PartitionUpdateMetadataResponder {
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 {
UpdateMetadata {
payload: PartitionUpdateMetadataRequest,
responder: PartitionUpdateMetadataResponder,
},
}
impl PartitionRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_update_metadata(
self,
) -> Option<(PartitionUpdateMetadataRequest, PartitionUpdateMetadataResponder)> {
if let PartitionRequest::UpdateMetadata { payload, responder } = self {
Some((payload, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
PartitionRequest::UpdateMetadata { .. } => "update_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 PartitionUpdateMetadataResponder {
control_handle: std::mem::ManuallyDrop<PartitionControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for PartitionUpdateMetadataResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for PartitionUpdateMetadataResponder {
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 PartitionUpdateMetadataResponder {
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,
0x7bce44e5c9d5009c,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct PartitionsAdminMarker;
impl fidl::endpoints::ProtocolMarker for PartitionsAdminMarker {
type Proxy = PartitionsAdminProxy;
type RequestStream = PartitionsAdminRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = PartitionsAdminSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.storage.partitions.PartitionsAdmin";
}
impl fidl::endpoints::DiscoverableProtocolMarker for PartitionsAdminMarker {}
pub type PartitionsAdminResetPartitionTableResult = Result<(), i32>;
pub trait PartitionsAdminProxyInterface: Send + Sync {
type ResetPartitionTableResponseFut: std::future::Future<Output = Result<PartitionsAdminResetPartitionTableResult, fidl::Error>>
+ Send;
fn r#reset_partition_table(
&self,
partitions: &[PartitionInfo],
) -> Self::ResetPartitionTableResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct PartitionsAdminSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for PartitionsAdminSynchronousProxy {
type Proxy = PartitionsAdminProxy;
type Protocol = PartitionsAdminMarker;
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 PartitionsAdminSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <PartitionsAdminMarker 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<PartitionsAdminEvent, fidl::Error> {
PartitionsAdminEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#reset_partition_table(
&self,
mut partitions: &[PartitionInfo],
___deadline: zx::MonotonicInstant,
) -> Result<PartitionsAdminResetPartitionTableResult, fidl::Error> {
let _response = self.client.send_query::<
PartitionsAdminResetPartitionTableRequest,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
>(
(partitions,),
0x6d999e2c120fef14,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
}
#[derive(Debug, Clone)]
pub struct PartitionsAdminProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for PartitionsAdminProxy {
type Protocol = PartitionsAdminMarker;
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 PartitionsAdminProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <PartitionsAdminMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> PartitionsAdminEventStream {
PartitionsAdminEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#reset_partition_table(
&self,
mut partitions: &[PartitionInfo],
) -> fidl::client::QueryResponseFut<
PartitionsAdminResetPartitionTableResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
PartitionsAdminProxyInterface::r#reset_partition_table(self, partitions)
}
}
impl PartitionsAdminProxyInterface for PartitionsAdminProxy {
type ResetPartitionTableResponseFut = fidl::client::QueryResponseFut<
PartitionsAdminResetPartitionTableResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#reset_partition_table(
&self,
mut partitions: &[PartitionInfo],
) -> Self::ResetPartitionTableResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<PartitionsAdminResetPartitionTableResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x6d999e2c120fef14,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
PartitionsAdminResetPartitionTableRequest,
PartitionsAdminResetPartitionTableResult,
>(
(partitions,),
0x6d999e2c120fef14,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct PartitionsAdminEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for PartitionsAdminEventStream {}
impl futures::stream::FusedStream for PartitionsAdminEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for PartitionsAdminEventStream {
type Item = Result<PartitionsAdminEvent, 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(PartitionsAdminEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum PartitionsAdminEvent {}
impl PartitionsAdminEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<PartitionsAdminEvent, 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:
<PartitionsAdminMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct PartitionsAdminRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for PartitionsAdminRequestStream {}
impl futures::stream::FusedStream for PartitionsAdminRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for PartitionsAdminRequestStream {
type Protocol = PartitionsAdminMarker;
type ControlHandle = PartitionsAdminControlHandle;
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 {
PartitionsAdminControlHandle { 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 PartitionsAdminRequestStream {
type Item = Result<PartitionsAdminRequest, 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 PartitionsAdminRequestStream 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 {
0x6d999e2c120fef14 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
PartitionsAdminResetPartitionTableRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PartitionsAdminResetPartitionTableRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
PartitionsAdminControlHandle { inner: this.inner.clone() };
Ok(PartitionsAdminRequest::ResetPartitionTable {
partitions: req.partitions,
responder: PartitionsAdminResetPartitionTableResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<PartitionsAdminMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum PartitionsAdminRequest {
ResetPartitionTable {
partitions: Vec<PartitionInfo>,
responder: PartitionsAdminResetPartitionTableResponder,
},
}
impl PartitionsAdminRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_reset_partition_table(
self,
) -> Option<(Vec<PartitionInfo>, PartitionsAdminResetPartitionTableResponder)> {
if let PartitionsAdminRequest::ResetPartitionTable { partitions, responder } = self {
Some((partitions, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
PartitionsAdminRequest::ResetPartitionTable { .. } => "reset_partition_table",
}
}
}
#[derive(Debug, Clone)]
pub struct PartitionsAdminControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for PartitionsAdminControlHandle {
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 PartitionsAdminControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct PartitionsAdminResetPartitionTableResponder {
control_handle: std::mem::ManuallyDrop<PartitionsAdminControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for PartitionsAdminResetPartitionTableResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for PartitionsAdminResetPartitionTableResponder {
type ControlHandle = PartitionsAdminControlHandle;
fn control_handle(&self) -> &PartitionsAdminControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl PartitionsAdminResetPartitionTableResponder {
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,
0x6d999e2c120fef14,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct PartitionsManagerMarker;
impl fidl::endpoints::ProtocolMarker for PartitionsManagerMarker {
type Proxy = PartitionsManagerProxy;
type RequestStream = PartitionsManagerRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = PartitionsManagerSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.storage.partitions.PartitionsManager";
}
impl fidl::endpoints::DiscoverableProtocolMarker for PartitionsManagerMarker {}
pub type PartitionsManagerGetBlockInfoResult = Result<(u64, u32), i32>;
pub type PartitionsManagerCreateTransactionResult = Result<fidl::EventPair, i32>;
pub type PartitionsManagerCommitTransactionResult = Result<(), i32>;
pub trait PartitionsManagerProxyInterface: Send + Sync {
type GetBlockInfoResponseFut: std::future::Future<Output = Result<PartitionsManagerGetBlockInfoResult, fidl::Error>>
+ Send;
fn r#get_block_info(&self) -> Self::GetBlockInfoResponseFut;
type CreateTransactionResponseFut: std::future::Future<Output = Result<PartitionsManagerCreateTransactionResult, fidl::Error>>
+ Send;
fn r#create_transaction(&self) -> Self::CreateTransactionResponseFut;
type CommitTransactionResponseFut: std::future::Future<Output = Result<PartitionsManagerCommitTransactionResult, fidl::Error>>
+ Send;
fn r#commit_transaction(
&self,
transaction: fidl::EventPair,
) -> Self::CommitTransactionResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct PartitionsManagerSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for PartitionsManagerSynchronousProxy {
type Proxy = PartitionsManagerProxy;
type Protocol = PartitionsManagerMarker;
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 PartitionsManagerSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name =
<PartitionsManagerMarker 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<PartitionsManagerEvent, fidl::Error> {
PartitionsManagerEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#get_block_info(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<PartitionsManagerGetBlockInfoResult, fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
fidl::encoding::ResultType<PartitionsManagerGetBlockInfoResponse, i32>,
>(
(),
0x55663648cae3a1ef,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| (x.block_count, x.block_size)))
}
pub fn r#create_transaction(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<PartitionsManagerCreateTransactionResult, fidl::Error> {
let _response =
self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::ResultType<
PartitionsManagerCreateTransactionResponse,
i32,
>>(
(),
0x5cedad08ef04fd02,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x.transaction))
}
pub fn r#commit_transaction(
&self,
mut transaction: fidl::EventPair,
___deadline: zx::MonotonicInstant,
) -> Result<PartitionsManagerCommitTransactionResult, fidl::Error> {
let _response = self.client.send_query::<
PartitionsManagerCommitTransactionRequest,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
>(
(transaction,),
0x2354762d579c7654,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
}
#[derive(Debug, Clone)]
pub struct PartitionsManagerProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for PartitionsManagerProxy {
type Protocol = PartitionsManagerMarker;
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 PartitionsManagerProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name =
<PartitionsManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> PartitionsManagerEventStream {
PartitionsManagerEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#get_block_info(
&self,
) -> fidl::client::QueryResponseFut<
PartitionsManagerGetBlockInfoResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
PartitionsManagerProxyInterface::r#get_block_info(self)
}
pub fn r#create_transaction(
&self,
) -> fidl::client::QueryResponseFut<
PartitionsManagerCreateTransactionResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
PartitionsManagerProxyInterface::r#create_transaction(self)
}
pub fn r#commit_transaction(
&self,
mut transaction: fidl::EventPair,
) -> fidl::client::QueryResponseFut<
PartitionsManagerCommitTransactionResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
PartitionsManagerProxyInterface::r#commit_transaction(self, transaction)
}
}
impl PartitionsManagerProxyInterface for PartitionsManagerProxy {
type GetBlockInfoResponseFut = fidl::client::QueryResponseFut<
PartitionsManagerGetBlockInfoResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#get_block_info(&self) -> Self::GetBlockInfoResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<PartitionsManagerGetBlockInfoResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<PartitionsManagerGetBlockInfoResponse, i32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x55663648cae3a1ef,
>(_buf?)?;
Ok(_response.map(|x| (x.block_count, x.block_size)))
}
self.client.send_query_and_decode::<
fidl::encoding::EmptyPayload,
PartitionsManagerGetBlockInfoResult,
>(
(),
0x55663648cae3a1ef,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type CreateTransactionResponseFut = fidl::client::QueryResponseFut<
PartitionsManagerCreateTransactionResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#create_transaction(&self) -> Self::CreateTransactionResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<PartitionsManagerCreateTransactionResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<PartitionsManagerCreateTransactionResponse, i32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x5cedad08ef04fd02,
>(_buf?)?;
Ok(_response.map(|x| x.transaction))
}
self.client.send_query_and_decode::<
fidl::encoding::EmptyPayload,
PartitionsManagerCreateTransactionResult,
>(
(),
0x5cedad08ef04fd02,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type CommitTransactionResponseFut = fidl::client::QueryResponseFut<
PartitionsManagerCommitTransactionResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#commit_transaction(
&self,
mut transaction: fidl::EventPair,
) -> Self::CommitTransactionResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<PartitionsManagerCommitTransactionResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x2354762d579c7654,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
PartitionsManagerCommitTransactionRequest,
PartitionsManagerCommitTransactionResult,
>(
(transaction,),
0x2354762d579c7654,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct PartitionsManagerEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for PartitionsManagerEventStream {}
impl futures::stream::FusedStream for PartitionsManagerEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for PartitionsManagerEventStream {
type Item = Result<PartitionsManagerEvent, 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(PartitionsManagerEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum PartitionsManagerEvent {}
impl PartitionsManagerEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<PartitionsManagerEvent, 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:
<PartitionsManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct PartitionsManagerRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for PartitionsManagerRequestStream {}
impl futures::stream::FusedStream for PartitionsManagerRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for PartitionsManagerRequestStream {
type Protocol = PartitionsManagerMarker;
type ControlHandle = PartitionsManagerControlHandle;
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 {
PartitionsManagerControlHandle { 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 PartitionsManagerRequestStream {
type Item = Result<PartitionsManagerRequest, 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 PartitionsManagerRequestStream 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 {
0x55663648cae3a1ef => {
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 =
PartitionsManagerControlHandle { inner: this.inner.clone() };
Ok(PartitionsManagerRequest::GetBlockInfo {
responder: PartitionsManagerGetBlockInfoResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x5cedad08ef04fd02 => {
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 =
PartitionsManagerControlHandle { inner: this.inner.clone() };
Ok(PartitionsManagerRequest::CreateTransaction {
responder: PartitionsManagerCreateTransactionResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x2354762d579c7654 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
PartitionsManagerCommitTransactionRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PartitionsManagerCommitTransactionRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
PartitionsManagerControlHandle { inner: this.inner.clone() };
Ok(PartitionsManagerRequest::CommitTransaction {
transaction: req.transaction,
responder: PartitionsManagerCommitTransactionResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<PartitionsManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum PartitionsManagerRequest {
GetBlockInfo { responder: PartitionsManagerGetBlockInfoResponder },
CreateTransaction { responder: PartitionsManagerCreateTransactionResponder },
CommitTransaction {
transaction: fidl::EventPair,
responder: PartitionsManagerCommitTransactionResponder,
},
}
impl PartitionsManagerRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_get_block_info(self) -> Option<(PartitionsManagerGetBlockInfoResponder)> {
if let PartitionsManagerRequest::GetBlockInfo { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_create_transaction(self) -> Option<(PartitionsManagerCreateTransactionResponder)> {
if let PartitionsManagerRequest::CreateTransaction { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_commit_transaction(
self,
) -> Option<(fidl::EventPair, PartitionsManagerCommitTransactionResponder)> {
if let PartitionsManagerRequest::CommitTransaction { transaction, responder } = self {
Some((transaction, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
PartitionsManagerRequest::GetBlockInfo { .. } => "get_block_info",
PartitionsManagerRequest::CreateTransaction { .. } => "create_transaction",
PartitionsManagerRequest::CommitTransaction { .. } => "commit_transaction",
}
}
}
#[derive(Debug, Clone)]
pub struct PartitionsManagerControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for PartitionsManagerControlHandle {
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 PartitionsManagerControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct PartitionsManagerGetBlockInfoResponder {
control_handle: std::mem::ManuallyDrop<PartitionsManagerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for PartitionsManagerGetBlockInfoResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for PartitionsManagerGetBlockInfoResponder {
type ControlHandle = PartitionsManagerControlHandle;
fn control_handle(&self) -> &PartitionsManagerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl PartitionsManagerGetBlockInfoResponder {
pub fn send(self, mut result: Result<(u64, u32), 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<(u64, u32), i32>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(u64, u32), i32>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
PartitionsManagerGetBlockInfoResponse,
i32,
>>(
result,
self.tx_id,
0x55663648cae3a1ef,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct PartitionsManagerCreateTransactionResponder {
control_handle: std::mem::ManuallyDrop<PartitionsManagerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for PartitionsManagerCreateTransactionResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for PartitionsManagerCreateTransactionResponder {
type ControlHandle = PartitionsManagerControlHandle;
fn control_handle(&self) -> &PartitionsManagerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl PartitionsManagerCreateTransactionResponder {
pub fn send(self, mut result: Result<fidl::EventPair, 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::EventPair, i32>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<fidl::EventPair, i32>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
PartitionsManagerCreateTransactionResponse,
i32,
>>(
result.map(|transaction| (transaction,)),
self.tx_id,
0x5cedad08ef04fd02,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct PartitionsManagerCommitTransactionResponder {
control_handle: std::mem::ManuallyDrop<PartitionsManagerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for PartitionsManagerCommitTransactionResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for PartitionsManagerCommitTransactionResponder {
type ControlHandle = PartitionsManagerControlHandle;
fn control_handle(&self) -> &PartitionsManagerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl PartitionsManagerCommitTransactionResponder {
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,
0x2354762d579c7654,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct PartitionServiceMarker;
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::ServiceMarker for PartitionServiceMarker {
type Proxy = PartitionServiceProxy;
type Request = PartitionServiceRequest;
const SERVICE_NAME: &'static str = "fuchsia.storage.partitions.PartitionService";
}
#[cfg(target_os = "fuchsia")]
pub enum PartitionServiceRequest {
Volume(fidl_fuchsia_hardware_block_volume::VolumeRequestStream),
Partition(PartitionRequestStream),
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::ServiceRequest for PartitionServiceRequest {
type Service = PartitionServiceMarker;
fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
match name {
"volume" => Self::Volume(
<fidl_fuchsia_hardware_block_volume::VolumeRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
),
"partition" => Self::Partition(
<PartitionRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
),
_ => panic!("no such member protocol name for service PartitionService"),
}
}
fn member_names() -> &'static [&'static str] {
&["volume", "partition"]
}
}
#[cfg(target_os = "fuchsia")]
pub struct PartitionServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::ServiceProxy for PartitionServiceProxy {
type Service = PartitionServiceMarker;
fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
Self(opener)
}
}
#[cfg(target_os = "fuchsia")]
impl PartitionServiceProxy {
pub fn connect_to_volume(
&self,
) -> Result<fidl_fuchsia_hardware_block_volume::VolumeProxy, fidl::Error> {
let (proxy, server_end) =
fidl::endpoints::create_proxy::<fidl_fuchsia_hardware_block_volume::VolumeMarker>();
self.connect_channel_to_volume(server_end)?;
Ok(proxy)
}
pub fn connect_to_volume_sync(
&self,
) -> Result<fidl_fuchsia_hardware_block_volume::VolumeSynchronousProxy, fidl::Error> {
let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<
fidl_fuchsia_hardware_block_volume::VolumeMarker,
>();
self.connect_channel_to_volume(server_end)?;
Ok(proxy)
}
pub fn connect_channel_to_volume(
&self,
server_end: fidl::endpoints::ServerEnd<fidl_fuchsia_hardware_block_volume::VolumeMarker>,
) -> Result<(), fidl::Error> {
self.0.open_member("volume", server_end.into_channel())
}
pub fn connect_to_partition(&self) -> Result<PartitionProxy, fidl::Error> {
let (proxy, server_end) = fidl::endpoints::create_proxy::<PartitionMarker>();
self.connect_channel_to_partition(server_end)?;
Ok(proxy)
}
pub fn connect_to_partition_sync(&self) -> Result<PartitionSynchronousProxy, fidl::Error> {
let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<PartitionMarker>();
self.connect_channel_to_partition(server_end)?;
Ok(proxy)
}
pub fn connect_channel_to_partition(
&self,
server_end: fidl::endpoints::ServerEnd<PartitionMarker>,
) -> Result<(), fidl::Error> {
self.0.open_member("partition", server_end.into_channel())
}
pub fn instance_name(&self) -> &str {
self.0.instance_name()
}
}
mod internal {
use super::*;
impl fidl::encoding::ValueTypeMarker for PartitionInfo {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for PartitionInfo {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
72
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PartitionInfo, D>
for &PartitionInfo
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PartitionInfo>(offset);
fidl::encoding::Encode::<PartitionInfo, D>::encode(
(
<fidl::encoding::BoundedString<128> as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
<fidl_fuchsia_hardware_block_partition::Guid as fidl::encoding::ValueTypeMarker>::borrow(&self.type_guid),
<fidl_fuchsia_hardware_block_partition::Guid as fidl::encoding::ValueTypeMarker>::borrow(&self.instance_guid),
<u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.start_block),
<u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.num_blocks),
<u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.flags),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::BoundedString<128>, D>,
T1: fidl::encoding::Encode<fidl_fuchsia_hardware_block_partition::Guid, D>,
T2: fidl::encoding::Encode<fidl_fuchsia_hardware_block_partition::Guid, D>,
T3: fidl::encoding::Encode<u64, D>,
T4: fidl::encoding::Encode<u64, D>,
T5: fidl::encoding::Encode<u64, D>,
> fidl::encoding::Encode<PartitionInfo, D> for (T0, T1, T2, T3, T4, T5)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PartitionInfo>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
self.2.encode(encoder, offset + 32, depth)?;
self.3.encode(encoder, offset + 48, depth)?;
self.4.encode(encoder, offset + 56, depth)?;
self.5.encode(encoder, offset + 64, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PartitionInfo {
#[inline(always)]
fn new_empty() -> Self {
Self {
name: fidl::new_empty!(fidl::encoding::BoundedString<128>, D),
type_guid: fidl::new_empty!(fidl_fuchsia_hardware_block_partition::Guid, D),
instance_guid: fidl::new_empty!(fidl_fuchsia_hardware_block_partition::Guid, D),
start_block: fidl::new_empty!(u64, D),
num_blocks: fidl::new_empty!(u64, D),
flags: fidl::new_empty!(u64, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::BoundedString<128>,
D,
&mut self.name,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl_fuchsia_hardware_block_partition::Guid,
D,
&mut self.type_guid,
decoder,
offset + 16,
_depth
)?;
fidl::decode!(
fidl_fuchsia_hardware_block_partition::Guid,
D,
&mut self.instance_guid,
decoder,
offset + 32,
_depth
)?;
fidl::decode!(u64, D, &mut self.start_block, decoder, offset + 48, _depth)?;
fidl::decode!(u64, D, &mut self.num_blocks, decoder, offset + 56, _depth)?;
fidl::decode!(u64, D, &mut self.flags, decoder, offset + 64, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for PartitionsAdminResetPartitionTableRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for PartitionsAdminResetPartitionTableRequest {
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<PartitionsAdminResetPartitionTableRequest, D>
for &PartitionsAdminResetPartitionTableRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PartitionsAdminResetPartitionTableRequest>(offset);
fidl::encoding::Encode::<PartitionsAdminResetPartitionTableRequest, D>::encode(
(
<fidl::encoding::Vector<PartitionInfo, 128> as fidl::encoding::ValueTypeMarker>::borrow(&self.partitions),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::Vector<PartitionInfo, 128>, D>,
> fidl::encoding::Encode<PartitionsAdminResetPartitionTableRequest, 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::<PartitionsAdminResetPartitionTableRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for PartitionsAdminResetPartitionTableRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { partitions: fidl::new_empty!(fidl::encoding::Vector<PartitionInfo, 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);
fidl::decode!(fidl::encoding::Vector<PartitionInfo, 128>, D, &mut self.partitions, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for PartitionsManagerCommitTransactionRequest {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for PartitionsManagerCommitTransactionRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
}
unsafe impl
fidl::encoding::Encode<
PartitionsManagerCommitTransactionRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut PartitionsManagerCommitTransactionRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PartitionsManagerCommitTransactionRequest>(offset);
fidl::encoding::Encode::<
PartitionsManagerCommitTransactionRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(<fidl::encoding::HandleType<
fidl::EventPair,
{ fidl::ObjectType::EVENTPAIR.into_raw() },
2147483648,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.transaction
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::HandleType<
fidl::EventPair,
{ fidl::ObjectType::EVENTPAIR.into_raw() },
2147483648,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
PartitionsManagerCommitTransactionRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PartitionsManagerCommitTransactionRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for PartitionsManagerCommitTransactionRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
transaction: fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.transaction, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for PartitionsManagerCreateTransactionResponse {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for PartitionsManagerCreateTransactionResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
}
unsafe impl
fidl::encoding::Encode<
PartitionsManagerCreateTransactionResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut PartitionsManagerCreateTransactionResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PartitionsManagerCreateTransactionResponse>(offset);
fidl::encoding::Encode::<
PartitionsManagerCreateTransactionResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(<fidl::encoding::HandleType<
fidl::EventPair,
{ fidl::ObjectType::EVENTPAIR.into_raw() },
2147483648,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.transaction
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::HandleType<
fidl::EventPair,
{ fidl::ObjectType::EVENTPAIR.into_raw() },
2147483648,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
PartitionsManagerCreateTransactionResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PartitionsManagerCreateTransactionResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for PartitionsManagerCreateTransactionResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self {
transaction: fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.transaction, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for PartitionsManagerGetBlockInfoResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for PartitionsManagerGetBlockInfoResponse {
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<PartitionsManagerGetBlockInfoResponse, D>
for &PartitionsManagerGetBlockInfoResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PartitionsManagerGetBlockInfoResponse>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut PartitionsManagerGetBlockInfoResponse)
.write_unaligned((self as *const PartitionsManagerGetBlockInfoResponse).read());
let padding_ptr = buf_ptr.offset(8) as *mut u64;
let padding_mask = 0xffffffff00000000u64;
padding_ptr.write_unaligned(padding_ptr.read_unaligned() & !padding_mask);
}
Ok(())
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<u64, D>,
T1: fidl::encoding::Encode<u32, D>,
> fidl::encoding::Encode<PartitionsManagerGetBlockInfoResponse, 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::<PartitionsManagerGetBlockInfoResponse>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for PartitionsManagerGetBlockInfoResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { block_count: fidl::new_empty!(u64, D), block_size: fidl::new_empty!(u32, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
let ptr = unsafe { buf_ptr.offset(8) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffff00000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
}
Ok(())
}
}
impl PartitionUpdateMetadataRequest {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.flags {
return 3;
}
if let Some(_) = self.type_guid {
return 2;
}
if let Some(_) = self.transaction {
return 1;
}
0
}
}
impl fidl::encoding::ResourceTypeMarker for PartitionUpdateMetadataRequest {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for PartitionUpdateMetadataRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl
fidl::encoding::Encode<
PartitionUpdateMetadataRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut PartitionUpdateMetadataRequest
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PartitionUpdateMetadataRequest>(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::HandleType<
fidl::EventPair,
{ fidl::ObjectType::EVENTPAIR.into_raw() },
2147483648,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
self.transaction.as_mut().map(
<fidl::encoding::HandleType<
fidl::EventPair,
{ fidl::ObjectType::EVENTPAIR.into_raw() },
2147483648,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 2 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (2 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_hardware_block_partition::Guid, fidl::encoding::DefaultFuchsiaResourceDialect>(
self.type_guid.as_ref().map(<fidl_fuchsia_hardware_block_partition::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::<
u64,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
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 fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for PartitionUpdateMetadataRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
if len == 0 {
return Ok(());
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 1 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size = <fidl::encoding::HandleType<
fidl::EventPair,
{ fidl::ObjectType::EVENTPAIR.into_raw() },
2147483648,
> 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.transaction.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 2 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size = <fidl_fuchsia_hardware_block_partition::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!(
fidl_fuchsia_hardware_block_partition::Guid,
fidl::encoding::DefaultFuchsiaResourceDialect
)
});
fidl::decode!(
fidl_fuchsia_hardware_block_partition::Guid,
fidl::encoding::DefaultFuchsiaResourceDialect,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 3 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<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, fidl::encoding::DefaultFuchsiaResourceDialect)
});
fidl::decode!(
u64,
fidl::encoding::DefaultFuchsiaResourceDialect,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
while next_offset < end_offset {
_next_ordinal_to_read += 1;
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
next_offset += envelope_size;
}
Ok(())
}
}
}