#![warn(clippy::all)]
#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
use {
bitflags::bitflags,
fidl::{
client::QueryResponseFut,
endpoints::{ControlHandle as _, Responder as _},
},
fuchsia_zircon_status as zx_status,
futures::future::{self, MaybeDone, TryFutureExt},
};
#[cfg(target_os = "fuchsia")]
use fuchsia_zircon as zx;
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub enum CompressionAlgorithm {
ZstdChunked,
Uncompressed,
#[doc(hidden)]
__SourceBreaking {
unknown_ordinal: u32,
},
}
#[macro_export]
macro_rules! CompressionAlgorithmUnknown {
() => {
_
};
}
impl CompressionAlgorithm {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
0 => Some(Self::ZstdChunked),
1 => Some(Self::Uncompressed),
_ => None,
}
}
#[inline]
pub fn from_primitive_allow_unknown(prim: u32) -> Self {
match prim {
0 => Self::ZstdChunked,
1 => Self::Uncompressed,
unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
}
}
#[inline]
pub fn unknown() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
}
#[inline]
pub const fn into_primitive(self) -> u32 {
match self {
Self::ZstdChunked => 0,
Self::Uncompressed => 1,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { unknown_ordinal: _ } => true,
_ => false,
}
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub enum EvictionPolicyOverride {
None,
NeverEvict,
EvictImmediately,
#[doc(hidden)]
__SourceBreaking { unknown_ordinal: u32 },
}
#[macro_export]
macro_rules! EvictionPolicyOverrideUnknown {
() => {
_
};
}
impl EvictionPolicyOverride {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
0 => Some(Self::None),
1 => Some(Self::NeverEvict),
2 => Some(Self::EvictImmediately),
_ => None,
}
}
#[inline]
pub fn from_primitive_allow_unknown(prim: u32) -> Self {
match prim {
0 => Self::None,
1 => Self::NeverEvict,
2 => Self::EvictImmediately,
unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
}
}
#[inline]
pub fn unknown() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
}
#[inline]
pub const fn into_primitive(self) -> u32 {
match self {
Self::None => 0,
Self::NeverEvict => 1,
Self::EvictImmediately => 2,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { unknown_ordinal: _ } => true,
_ => false,
}
}
}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct CheckOptions;
impl fidl::Standalone for CheckOptions {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct StartOptions {
pub read_only: bool,
pub verbose: bool,
pub fsck_after_every_transaction: bool,
pub write_compression_algorithm: CompressionAlgorithm,
pub write_compression_level: i32,
pub cache_eviction_policy_override: EvictionPolicyOverride,
pub startup_profiling_seconds: u32,
}
impl fidl::Standalone for StartOptions {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct StartupCheckRequest {
pub device: fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_block::BlockMarker>,
pub options: CheckOptions,
}
impl fidl::Standalone for StartupCheckRequest {}
#[derive(Debug, PartialEq)]
pub struct StartupFormatRequest {
pub device: fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_block::BlockMarker>,
pub options: FormatOptions,
}
impl fidl::Standalone for StartupFormatRequest {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct StartupStartRequest {
pub device: fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_block::BlockMarker>,
pub options: StartOptions,
}
impl fidl::Standalone for StartupStartRequest {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct FormatOptions {
pub verbose: Option<bool>,
pub deprecated_padded_blobfs_format: Option<bool>,
pub num_inodes: Option<u64>,
pub fvm_data_slices: Option<u32>,
pub sectors_per_cluster: Option<u16>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for FormatOptions {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct StartupMarker;
impl fidl::endpoints::ProtocolMarker for StartupMarker {
type Proxy = StartupProxy;
type RequestStream = StartupRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = StartupSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.fs.startup.Startup";
}
impl fidl::endpoints::DiscoverableProtocolMarker for StartupMarker {}
pub type StartupStartResult = Result<(), i32>;
pub type StartupFormatResult = Result<(), i32>;
pub type StartupCheckResult = Result<(), i32>;
pub trait StartupProxyInterface: Send + Sync {
type StartResponseFut: std::future::Future<Output = Result<StartupStartResult, fidl::Error>>
+ Send;
fn r#start(
&self,
device: fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_block::BlockMarker>,
options: StartOptions,
) -> Self::StartResponseFut;
type FormatResponseFut: std::future::Future<Output = Result<StartupFormatResult, fidl::Error>>
+ Send;
fn r#format(
&self,
device: fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_block::BlockMarker>,
options: &FormatOptions,
) -> Self::FormatResponseFut;
type CheckResponseFut: std::future::Future<Output = Result<StartupCheckResult, fidl::Error>>
+ Send;
fn r#check(
&self,
device: fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_block::BlockMarker>,
options: CheckOptions,
) -> Self::CheckResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct StartupSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for StartupSynchronousProxy {
type Proxy = StartupProxy;
type Protocol = StartupMarker;
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 StartupSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <StartupMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
}
pub fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
pub fn wait_for_event(&self, deadline: zx::Time) -> Result<StartupEvent, fidl::Error> {
StartupEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#start(
&self,
mut device: fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_block::BlockMarker>,
mut options: StartOptions,
___deadline: zx::Time,
) -> Result<StartupStartResult, fidl::Error> {
let _response = self.client.send_query::<
StartupStartRequest,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
>(
(device, &mut options,),
0x317aa9458d3190c8,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#format(
&self,
mut device: fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_block::BlockMarker>,
mut options: &FormatOptions,
___deadline: zx::Time,
) -> Result<StartupFormatResult, fidl::Error> {
let _response = self.client.send_query::<
StartupFormatRequest,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
>(
(device, options,),
0x3124676dd91933de,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#check(
&self,
mut device: fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_block::BlockMarker>,
mut options: CheckOptions,
___deadline: zx::Time,
) -> Result<StartupCheckResult, fidl::Error> {
let _response = self.client.send_query::<
StartupCheckRequest,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
>(
(device, &mut options,),
0x81e85b3190e7db3,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
}
#[derive(Debug, Clone)]
pub struct StartupProxy {
client: fidl::client::Client,
}
impl fidl::endpoints::Proxy for StartupProxy {
type Protocol = StartupMarker;
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 StartupProxy {
pub fn new(channel: fidl::AsyncChannel) -> Self {
let protocol_name = <StartupMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> StartupEventStream {
StartupEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#start(
&self,
mut device: fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_block::BlockMarker>,
mut options: StartOptions,
) -> fidl::client::QueryResponseFut<StartupStartResult> {
StartupProxyInterface::r#start(self, device, options)
}
pub fn r#format(
&self,
mut device: fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_block::BlockMarker>,
mut options: &FormatOptions,
) -> fidl::client::QueryResponseFut<StartupFormatResult> {
StartupProxyInterface::r#format(self, device, options)
}
pub fn r#check(
&self,
mut device: fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_block::BlockMarker>,
mut options: CheckOptions,
) -> fidl::client::QueryResponseFut<StartupCheckResult> {
StartupProxyInterface::r#check(self, device, options)
}
}
impl StartupProxyInterface for StartupProxy {
type StartResponseFut = fidl::client::QueryResponseFut<StartupStartResult>;
fn r#start(
&self,
mut device: fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_block::BlockMarker>,
mut options: StartOptions,
) -> Self::StartResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<StartupStartResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
0x317aa9458d3190c8,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<StartupStartRequest, StartupStartResult>(
(device, &mut options),
0x317aa9458d3190c8,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type FormatResponseFut = fidl::client::QueryResponseFut<StartupFormatResult>;
fn r#format(
&self,
mut device: fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_block::BlockMarker>,
mut options: &FormatOptions,
) -> Self::FormatResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<StartupFormatResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
0x3124676dd91933de,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<StartupFormatRequest, StartupFormatResult>(
(device, options),
0x3124676dd91933de,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type CheckResponseFut = fidl::client::QueryResponseFut<StartupCheckResult>;
fn r#check(
&self,
mut device: fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_block::BlockMarker>,
mut options: CheckOptions,
) -> Self::CheckResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<StartupCheckResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
0x81e85b3190e7db3,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<StartupCheckRequest, StartupCheckResult>(
(device, &mut options),
0x81e85b3190e7db3,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct StartupEventStream {
event_receiver: fidl::client::EventReceiver,
}
impl std::marker::Unpin for StartupEventStream {}
impl futures::stream::FusedStream for StartupEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for StartupEventStream {
type Item = Result<StartupEvent, 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(StartupEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum StartupEvent {}
impl StartupEvent {
fn decode(mut buf: fidl::MessageBufEtc) -> Result<StartupEvent, 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: <StartupMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct StartupRequestStream {
inner: std::sync::Arc<fidl::ServeInner>,
is_terminated: bool,
}
impl std::marker::Unpin for StartupRequestStream {}
impl futures::stream::FusedStream for StartupRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for StartupRequestStream {
type Protocol = StartupMarker;
type ControlHandle = StartupControlHandle;
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 {
StartupControlHandle { inner: self.inner.clone() }
}
fn into_inner(self) -> (::std::sync::Arc<fidl::ServeInner>, bool) {
(self.inner, self.is_terminated)
}
fn from_inner(inner: std::sync::Arc<fidl::ServeInner>, is_terminated: bool) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for StartupRequestStream {
type Item = Result<StartupRequest, 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 StartupRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf(|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(e))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x317aa9458d3190c8 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(StartupStartRequest);
fidl::encoding::Decoder::decode_into::<StartupStartRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = StartupControlHandle { inner: this.inner.clone() };
Ok(StartupRequest::Start {
device: req.device,
options: req.options,
responder: StartupStartResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x3124676dd91933de => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(StartupFormatRequest);
fidl::encoding::Decoder::decode_into::<StartupFormatRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = StartupControlHandle { inner: this.inner.clone() };
Ok(StartupRequest::Format {
device: req.device,
options: req.options,
responder: StartupFormatResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x81e85b3190e7db3 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(StartupCheckRequest);
fidl::encoding::Decoder::decode_into::<StartupCheckRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = StartupControlHandle { inner: this.inner.clone() };
Ok(StartupRequest::Check {
device: req.device,
options: req.options,
responder: StartupCheckResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <StartupMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
})
}
}
#[derive(Debug)]
pub enum StartupRequest {
Start {
device: fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_block::BlockMarker>,
options: StartOptions,
responder: StartupStartResponder,
},
Format {
device: fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_block::BlockMarker>,
options: FormatOptions,
responder: StartupFormatResponder,
},
Check {
device: fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_block::BlockMarker>,
options: CheckOptions,
responder: StartupCheckResponder,
},
}
impl StartupRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_start(
self,
) -> Option<(
fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_block::BlockMarker>,
StartOptions,
StartupStartResponder,
)> {
if let StartupRequest::Start { device, options, responder } = self {
Some((device, options, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_format(
self,
) -> Option<(
fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_block::BlockMarker>,
FormatOptions,
StartupFormatResponder,
)> {
if let StartupRequest::Format { device, options, responder } = self {
Some((device, options, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_check(
self,
) -> Option<(
fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_block::BlockMarker>,
CheckOptions,
StartupCheckResponder,
)> {
if let StartupRequest::Check { device, options, responder } = self {
Some((device, options, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
StartupRequest::Start { .. } => "start",
StartupRequest::Format { .. } => "format",
StartupRequest::Check { .. } => "check",
}
}
}
#[derive(Debug, Clone)]
pub struct StartupControlHandle {
inner: std::sync::Arc<fidl::ServeInner>,
}
impl fidl::endpoints::ControlHandle for StartupControlHandle {
fn shutdown(&self) {
self.inner.shutdown()
}
fn shutdown_with_epitaph(&self, status: zx_status::Status) {
self.inner.shutdown_with_epitaph(status)
}
fn is_closed(&self) -> bool {
self.inner.channel().is_closed()
}
fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
}
impl StartupControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct StartupStartResponder {
control_handle: std::mem::ManuallyDrop<StartupControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for StartupStartResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for StartupStartResponder {
type ControlHandle = StartupControlHandle;
fn control_handle(&self) -> &StartupControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl StartupStartResponder {
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,
0x317aa9458d3190c8,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct StartupFormatResponder {
control_handle: std::mem::ManuallyDrop<StartupControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for StartupFormatResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for StartupFormatResponder {
type ControlHandle = StartupControlHandle;
fn control_handle(&self) -> &StartupControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl StartupFormatResponder {
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,
0x3124676dd91933de,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct StartupCheckResponder {
control_handle: std::mem::ManuallyDrop<StartupControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for StartupCheckResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for StartupCheckResponder {
type ControlHandle = StartupControlHandle;
fn control_handle(&self) -> &StartupControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl StartupCheckResponder {
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,
0x81e85b3190e7db3,
fidl::encoding::DynamicFlags::empty(),
)
}
}
mod internal {
use super::*;
unsafe impl fidl::encoding::TypeMarker for CompressionAlgorithm {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
std::mem::align_of::<u32>()
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
std::mem::size_of::<u32>()
}
#[inline(always)]
fn encode_is_copy() -> bool {
false
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for CompressionAlgorithm {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
*value
}
}
unsafe impl fidl::encoding::Encode<Self> for CompressionAlgorithm {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl fidl::encoding::Decode<Self> for CompressionAlgorithm {
#[inline(always)]
fn new_empty() -> Self {
Self::unknown()
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u32>(offset);
*self = Self::from_primitive_allow_unknown(prim);
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for EvictionPolicyOverride {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
std::mem::align_of::<u32>()
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
std::mem::size_of::<u32>()
}
#[inline(always)]
fn encode_is_copy() -> bool {
false
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for EvictionPolicyOverride {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
*value
}
}
unsafe impl fidl::encoding::Encode<Self> for EvictionPolicyOverride {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl fidl::encoding::Decode<Self> for EvictionPolicyOverride {
#[inline(always)]
fn new_empty() -> Self {
Self::unknown()
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u32>(offset);
*self = Self::from_primitive_allow_unknown(prim);
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for CheckOptions {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
1
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
1
}
}
impl fidl::encoding::ResourceTypeMarker for CheckOptions {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<CheckOptions> for &mut CheckOptions {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<CheckOptions>(offset);
encoder.write_num(0u8, offset);
Ok(())
}
}
impl fidl::encoding::Decode<Self> for CheckOptions {
#[inline(always)]
fn new_empty() -> Self {
Self
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
match decoder.read_num::<u8>(offset) {
0 => Ok(()),
_ => Err(fidl::Error::Invalid),
}
}
}
unsafe impl fidl::encoding::TypeMarker for StartOptions {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
20
}
}
impl fidl::encoding::ResourceTypeMarker for StartOptions {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<StartOptions> for &mut StartOptions {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<StartOptions>(offset);
fidl::encoding::Encode::<StartOptions>::encode(
(
<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.read_only),
<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.verbose),
<bool as fidl::encoding::ValueTypeMarker>::borrow(
&self.fsck_after_every_transaction,
),
<CompressionAlgorithm as fidl::encoding::ValueTypeMarker>::borrow(
&self.write_compression_algorithm,
),
<i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.write_compression_level),
<EvictionPolicyOverride as fidl::encoding::ValueTypeMarker>::borrow(
&self.cache_eviction_policy_override,
),
<u32 as fidl::encoding::ValueTypeMarker>::borrow(
&self.startup_profiling_seconds,
),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<bool>,
T1: fidl::encoding::Encode<bool>,
T2: fidl::encoding::Encode<bool>,
T3: fidl::encoding::Encode<CompressionAlgorithm>,
T4: fidl::encoding::Encode<i32>,
T5: fidl::encoding::Encode<EvictionPolicyOverride>,
T6: fidl::encoding::Encode<u32>,
> fidl::encoding::Encode<StartOptions> for (T0, T1, T2, T3, T4, T5, T6)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<StartOptions>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
(ptr as *mut u32).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 1, depth)?;
self.2.encode(encoder, offset + 2, depth)?;
self.3.encode(encoder, offset + 4, depth)?;
self.4.encode(encoder, offset + 8, depth)?;
self.5.encode(encoder, offset + 12, depth)?;
self.6.encode(encoder, offset + 16, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for StartOptions {
#[inline(always)]
fn new_empty() -> Self {
Self {
read_only: fidl::new_empty!(bool),
verbose: fidl::new_empty!(bool),
fsck_after_every_transaction: fidl::new_empty!(bool),
write_compression_algorithm: fidl::new_empty!(CompressionAlgorithm),
write_compression_level: fidl::new_empty!(i32),
cache_eviction_policy_override: fidl::new_empty!(EvictionPolicyOverride),
startup_profiling_seconds: fidl::new_empty!(u32),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
let padval = unsafe { (ptr as *const u32).read_unaligned() };
let mask = 0xff000000u32;
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!(bool, &mut self.read_only, decoder, offset + 0, _depth)?;
fidl::decode!(bool, &mut self.verbose, decoder, offset + 1, _depth)?;
fidl::decode!(
bool,
&mut self.fsck_after_every_transaction,
decoder,
offset + 2,
_depth
)?;
fidl::decode!(
CompressionAlgorithm,
&mut self.write_compression_algorithm,
decoder,
offset + 4,
_depth
)?;
fidl::decode!(i32, &mut self.write_compression_level, decoder, offset + 8, _depth)?;
fidl::decode!(
EvictionPolicyOverride,
&mut self.cache_eviction_policy_override,
decoder,
offset + 12,
_depth
)?;
fidl::decode!(u32, &mut self.startup_profiling_seconds, decoder, offset + 16, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for StartupCheckRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
8
}
}
impl fidl::encoding::ResourceTypeMarker for StartupCheckRequest {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<StartupCheckRequest> for &mut StartupCheckRequest {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<StartupCheckRequest>(offset);
fidl::encoding::Encode::<StartupCheckRequest>::encode(
(
<fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_block::BlockMarker>,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.device
),
<CheckOptions as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.options,
),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_block::BlockMarker>,
>,
>,
T1: fidl::encoding::Encode<CheckOptions>,
> fidl::encoding::Encode<StartupCheckRequest> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<StartupCheckRequest>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(4);
(ptr as *mut u32).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 4, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for StartupCheckRequest {
#[inline(always)]
fn new_empty() -> Self {
Self {
device: fidl::new_empty!(
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_block::BlockMarker>,
>
),
options: fidl::new_empty!(CheckOptions),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(4) };
let padval = unsafe { (ptr as *const u32).read_unaligned() };
let mask = 0xffffff00u32;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 4 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_block::BlockMarker>,
>,
&mut self.device,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(CheckOptions, &mut self.options, decoder, offset + 4, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for StartupFormatRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
24
}
}
impl fidl::encoding::ResourceTypeMarker for StartupFormatRequest {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<StartupFormatRequest> for &mut StartupFormatRequest {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<StartupFormatRequest>(offset);
fidl::encoding::Encode::<StartupFormatRequest>::encode(
(
<fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_block::BlockMarker>,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.device
),
<FormatOptions as fidl::encoding::ValueTypeMarker>::borrow(&self.options),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_block::BlockMarker>,
>,
>,
T1: fidl::encoding::Encode<FormatOptions>,
> fidl::encoding::Encode<StartupFormatRequest> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<StartupFormatRequest>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for StartupFormatRequest {
#[inline(always)]
fn new_empty() -> Self {
Self {
device: fidl::new_empty!(
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_block::BlockMarker>,
>
),
options: fidl::new_empty!(FormatOptions),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffff00000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_block::BlockMarker>,
>,
&mut self.device,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(FormatOptions, &mut self.options, decoder, offset + 8, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for StartupStartRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
24
}
}
impl fidl::encoding::ResourceTypeMarker for StartupStartRequest {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<StartupStartRequest> for &mut StartupStartRequest {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<StartupStartRequest>(offset);
fidl::encoding::Encode::<StartupStartRequest>::encode(
(
<fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_block::BlockMarker>,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.device
),
<StartOptions as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.options,
),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_block::BlockMarker>,
>,
>,
T1: fidl::encoding::Encode<StartOptions>,
> fidl::encoding::Encode<StartupStartRequest> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<StartupStartRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 4, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for StartupStartRequest {
#[inline(always)]
fn new_empty() -> Self {
Self {
device: fidl::new_empty!(
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_block::BlockMarker>,
>
),
options: fidl::new_empty!(StartOptions),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_block::BlockMarker>,
>,
&mut self.device,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(StartOptions, &mut self.options, decoder, offset + 4, _depth)?;
Ok(())
}
}
impl FormatOptions {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.sectors_per_cluster {
return 5;
}
if let Some(_) = self.fvm_data_slices {
return 4;
}
if let Some(_) = self.num_inodes {
return 3;
}
if let Some(_) = self.deprecated_padded_blobfs_format {
return 2;
}
if let Some(_) = self.verbose {
return 1;
}
0
}
}
unsafe impl fidl::encoding::TypeMarker for FormatOptions {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
impl fidl::encoding::ValueTypeMarker for FormatOptions {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<FormatOptions> for &FormatOptions {
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<FormatOptions>(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::<bool>(
self.verbose.as_ref().map(<bool 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::<bool>(
self.deprecated_padded_blobfs_format
.as_ref()
.map(<bool 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>(
self.num_inodes.as_ref().map(<u64 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::<u32>(
self.fvm_data_slices.as_ref().map(<u32 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::<u16>(
self.sectors_per_cluster
.as_ref()
.map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for FormatOptions {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
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 =
<bool 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.verbose.get_or_insert_with(|| fidl::new_empty!(bool));
fidl::decode!(bool, 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 =
<bool 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
.deprecated_padded_blobfs_format
.get_or_insert_with(|| fidl::new_empty!(bool));
fidl::decode!(bool, 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.num_inodes.get_or_insert_with(|| fidl::new_empty!(u64));
fidl::decode!(u64, 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 =
<u32 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.fvm_data_slices.get_or_insert_with(|| fidl::new_empty!(u32));
fidl::decode!(u32, 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 =
<u16 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.sectors_per_cluster.get_or_insert_with(|| fidl::new_empty!(u16));
fidl::decode!(u16, 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(())
}
}
}