#![warn(clippy::all)]
#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
use {
bitflags::bitflags,
fidl::{
client::QueryResponseFut,
endpoints::{ControlHandle as _, Responder as _},
},
fuchsia_zircon_status as zx_status,
futures::future::{self, MaybeDone, TryFutureExt},
};
#[cfg(target_os = "fuchsia")]
use fuchsia_zircon as zx;
pub const MAX_KEY_SIZE: u32 = 256;
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct DeviceManagerFormatRequest {
pub key: Vec<u8>,
pub slot: u8,
}
impl fidl::Persistable for DeviceManagerFormatRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct DeviceManagerFormatResponse {
pub status: i32,
}
impl fidl::Persistable for DeviceManagerFormatResponse {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct DeviceManagerSealResponse {
pub status: i32,
}
impl fidl::Persistable for DeviceManagerSealResponse {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct DeviceManagerShredResponse {
pub status: i32,
}
impl fidl::Persistable for DeviceManagerShredResponse {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct DeviceManagerUnsealRequest {
pub key: Vec<u8>,
pub slot: u8,
}
impl fidl::Persistable for DeviceManagerUnsealRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct DeviceManagerUnsealResponse {
pub status: i32,
}
impl fidl::Persistable for DeviceManagerUnsealResponse {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct DeviceManagerMarker;
impl fidl::endpoints::ProtocolMarker for DeviceManagerMarker {
type Proxy = DeviceManagerProxy;
type RequestStream = DeviceManagerRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = DeviceManagerSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) DeviceManager";
}
pub trait DeviceManagerProxyInterface: Send + Sync {
type FormatResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
fn r#format(&self, key: &[u8], slot: u8) -> Self::FormatResponseFut;
type UnsealResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
fn r#unseal(&self, key: &[u8], slot: u8) -> Self::UnsealResponseFut;
type SealResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
fn r#seal(&self) -> Self::SealResponseFut;
type ShredResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
fn r#shred(&self) -> Self::ShredResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct DeviceManagerSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for DeviceManagerSynchronousProxy {
type Proxy = DeviceManagerProxy;
type Protocol = DeviceManagerMarker;
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 DeviceManagerSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <DeviceManagerMarker 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<DeviceManagerEvent, fidl::Error> {
DeviceManagerEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#format(
&self,
mut key: &[u8],
mut slot: u8,
___deadline: zx::Time,
) -> Result<i32, fidl::Error> {
let _response =
self.client.send_query::<DeviceManagerFormatRequest, DeviceManagerFormatResponse>(
(key, slot),
0x5d10415465425f82,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.status)
}
pub fn r#unseal(
&self,
mut key: &[u8],
mut slot: u8,
___deadline: zx::Time,
) -> Result<i32, fidl::Error> {
let _response =
self.client.send_query::<DeviceManagerUnsealRequest, DeviceManagerUnsealResponse>(
(key, slot),
0x170f834d39ed94fb,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.status)
}
pub fn r#seal(&self, ___deadline: zx::Time) -> Result<i32, fidl::Error> {
let _response =
self.client.send_query::<fidl::encoding::EmptyPayload, DeviceManagerSealResponse>(
(),
0xe63c7aa7840fbf4,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.status)
}
pub fn r#shred(&self, ___deadline: zx::Time) -> Result<i32, fidl::Error> {
let _response =
self.client.send_query::<fidl::encoding::EmptyPayload, DeviceManagerShredResponse>(
(),
0x1fbff042770086c,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.status)
}
}
#[derive(Debug, Clone)]
pub struct DeviceManagerProxy {
client: fidl::client::Client,
}
impl fidl::endpoints::Proxy for DeviceManagerProxy {
type Protocol = DeviceManagerMarker;
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 DeviceManagerProxy {
pub fn new(channel: fidl::AsyncChannel) -> Self {
let protocol_name = <DeviceManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> DeviceManagerEventStream {
DeviceManagerEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#format(&self, mut key: &[u8], mut slot: u8) -> fidl::client::QueryResponseFut<i32> {
DeviceManagerProxyInterface::r#format(self, key, slot)
}
pub fn r#unseal(&self, mut key: &[u8], mut slot: u8) -> fidl::client::QueryResponseFut<i32> {
DeviceManagerProxyInterface::r#unseal(self, key, slot)
}
pub fn r#seal(&self) -> fidl::client::QueryResponseFut<i32> {
DeviceManagerProxyInterface::r#seal(self)
}
pub fn r#shred(&self) -> fidl::client::QueryResponseFut<i32> {
DeviceManagerProxyInterface::r#shred(self)
}
}
impl DeviceManagerProxyInterface for DeviceManagerProxy {
type FormatResponseFut = fidl::client::QueryResponseFut<i32>;
fn r#format(&self, mut key: &[u8], mut slot: u8) -> Self::FormatResponseFut {
fn _decode(mut _buf: Result<fidl::MessageBufEtc, fidl::Error>) -> Result<i32, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
DeviceManagerFormatResponse,
0x5d10415465425f82,
>(_buf?)?;
Ok(_response.status)
}
self.client.send_query_and_decode::<DeviceManagerFormatRequest, i32>(
(key, slot),
0x5d10415465425f82,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type UnsealResponseFut = fidl::client::QueryResponseFut<i32>;
fn r#unseal(&self, mut key: &[u8], mut slot: u8) -> Self::UnsealResponseFut {
fn _decode(mut _buf: Result<fidl::MessageBufEtc, fidl::Error>) -> Result<i32, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
DeviceManagerUnsealResponse,
0x170f834d39ed94fb,
>(_buf?)?;
Ok(_response.status)
}
self.client.send_query_and_decode::<DeviceManagerUnsealRequest, i32>(
(key, slot),
0x170f834d39ed94fb,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type SealResponseFut = fidl::client::QueryResponseFut<i32>;
fn r#seal(&self) -> Self::SealResponseFut {
fn _decode(mut _buf: Result<fidl::MessageBufEtc, fidl::Error>) -> Result<i32, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
DeviceManagerSealResponse,
0xe63c7aa7840fbf4,
>(_buf?)?;
Ok(_response.status)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, i32>(
(),
0xe63c7aa7840fbf4,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type ShredResponseFut = fidl::client::QueryResponseFut<i32>;
fn r#shred(&self) -> Self::ShredResponseFut {
fn _decode(mut _buf: Result<fidl::MessageBufEtc, fidl::Error>) -> Result<i32, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
DeviceManagerShredResponse,
0x1fbff042770086c,
>(_buf?)?;
Ok(_response.status)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, i32>(
(),
0x1fbff042770086c,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct DeviceManagerEventStream {
event_receiver: fidl::client::EventReceiver,
}
impl std::marker::Unpin for DeviceManagerEventStream {}
impl futures::stream::FusedStream for DeviceManagerEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for DeviceManagerEventStream {
type Item = Result<DeviceManagerEvent, 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(DeviceManagerEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum DeviceManagerEvent {}
impl DeviceManagerEvent {
fn decode(mut buf: fidl::MessageBufEtc) -> Result<DeviceManagerEvent, 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: <DeviceManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct DeviceManagerRequestStream {
inner: std::sync::Arc<fidl::ServeInner>,
is_terminated: bool,
}
impl std::marker::Unpin for DeviceManagerRequestStream {}
impl futures::stream::FusedStream for DeviceManagerRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for DeviceManagerRequestStream {
type Protocol = DeviceManagerMarker;
type ControlHandle = DeviceManagerControlHandle;
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 {
DeviceManagerControlHandle { 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 DeviceManagerRequestStream {
type Item = Result<DeviceManagerRequest, 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 DeviceManagerRequestStream 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 {
0x5d10415465425f82 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(DeviceManagerFormatRequest);
fidl::encoding::Decoder::decode_into::<DeviceManagerFormatRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = DeviceManagerControlHandle { inner: this.inner.clone() };
Ok(DeviceManagerRequest::Format {
key: req.key,
slot: req.slot,
responder: DeviceManagerFormatResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x170f834d39ed94fb => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(DeviceManagerUnsealRequest);
fidl::encoding::Decoder::decode_into::<DeviceManagerUnsealRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = DeviceManagerControlHandle { inner: this.inner.clone() };
Ok(DeviceManagerRequest::Unseal {
key: req.key,
slot: req.slot,
responder: DeviceManagerUnsealResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0xe63c7aa7840fbf4 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload);
fidl::encoding::Decoder::decode_into::<fidl::encoding::EmptyPayload>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = DeviceManagerControlHandle { inner: this.inner.clone() };
Ok(DeviceManagerRequest::Seal {
responder: DeviceManagerSealResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x1fbff042770086c => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload);
fidl::encoding::Decoder::decode_into::<fidl::encoding::EmptyPayload>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = DeviceManagerControlHandle { inner: this.inner.clone() };
Ok(DeviceManagerRequest::Shred {
responder: DeviceManagerShredResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<DeviceManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
})
}
}
#[derive(Debug)]
pub enum DeviceManagerRequest {
Format { key: Vec<u8>, slot: u8, responder: DeviceManagerFormatResponder },
Unseal { key: Vec<u8>, slot: u8, responder: DeviceManagerUnsealResponder },
Seal { responder: DeviceManagerSealResponder },
Shred { responder: DeviceManagerShredResponder },
}
impl DeviceManagerRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_format(self) -> Option<(Vec<u8>, u8, DeviceManagerFormatResponder)> {
if let DeviceManagerRequest::Format { key, slot, responder } = self {
Some((key, slot, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_unseal(self) -> Option<(Vec<u8>, u8, DeviceManagerUnsealResponder)> {
if let DeviceManagerRequest::Unseal { key, slot, responder } = self {
Some((key, slot, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_seal(self) -> Option<(DeviceManagerSealResponder)> {
if let DeviceManagerRequest::Seal { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_shred(self) -> Option<(DeviceManagerShredResponder)> {
if let DeviceManagerRequest::Shred { responder } = self {
Some((responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
DeviceManagerRequest::Format { .. } => "format",
DeviceManagerRequest::Unseal { .. } => "unseal",
DeviceManagerRequest::Seal { .. } => "seal",
DeviceManagerRequest::Shred { .. } => "shred",
}
}
}
#[derive(Debug, Clone)]
pub struct DeviceManagerControlHandle {
inner: std::sync::Arc<fidl::ServeInner>,
}
impl fidl::endpoints::ControlHandle for DeviceManagerControlHandle {
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<'a>(&'a self) -> fidl::OnSignals<'a> {
self.inner.channel().on_closed()
}
}
impl DeviceManagerControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct DeviceManagerFormatResponder {
control_handle: std::mem::ManuallyDrop<DeviceManagerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for DeviceManagerFormatResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for DeviceManagerFormatResponder {
type ControlHandle = DeviceManagerControlHandle;
fn control_handle(&self) -> &DeviceManagerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl DeviceManagerFormatResponder {
pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
let _result = self.send_raw(status);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
let _result = self.send_raw(status);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<DeviceManagerFormatResponse>(
(status,),
self.tx_id,
0x5d10415465425f82,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct DeviceManagerUnsealResponder {
control_handle: std::mem::ManuallyDrop<DeviceManagerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for DeviceManagerUnsealResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for DeviceManagerUnsealResponder {
type ControlHandle = DeviceManagerControlHandle;
fn control_handle(&self) -> &DeviceManagerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl DeviceManagerUnsealResponder {
pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
let _result = self.send_raw(status);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
let _result = self.send_raw(status);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<DeviceManagerUnsealResponse>(
(status,),
self.tx_id,
0x170f834d39ed94fb,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct DeviceManagerSealResponder {
control_handle: std::mem::ManuallyDrop<DeviceManagerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for DeviceManagerSealResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for DeviceManagerSealResponder {
type ControlHandle = DeviceManagerControlHandle;
fn control_handle(&self) -> &DeviceManagerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl DeviceManagerSealResponder {
pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
let _result = self.send_raw(status);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
let _result = self.send_raw(status);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<DeviceManagerSealResponse>(
(status,),
self.tx_id,
0xe63c7aa7840fbf4,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct DeviceManagerShredResponder {
control_handle: std::mem::ManuallyDrop<DeviceManagerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for DeviceManagerShredResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for DeviceManagerShredResponder {
type ControlHandle = DeviceManagerControlHandle;
fn control_handle(&self) -> &DeviceManagerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl DeviceManagerShredResponder {
pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
let _result = self.send_raw(status);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
let _result = self.send_raw(status);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<DeviceManagerShredResponse>(
(status,),
self.tx_id,
0x1fbff042770086c,
fidl::encoding::DynamicFlags::empty(),
)
}
}
mod internal {
use super::*;
unsafe impl fidl::encoding::TypeMarker for DeviceManagerFormatRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
24
}
}
impl fidl::encoding::ValueTypeMarker for DeviceManagerFormatRequest {
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<DeviceManagerFormatRequest> for &DeviceManagerFormatRequest {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceManagerFormatRequest>(offset);
fidl::encoding::Encode::<DeviceManagerFormatRequest>::encode(
(
<fidl::encoding::Vector<u8, 256> as fidl::encoding::ValueTypeMarker>::borrow(
&self.key,
),
<u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.slot),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<fidl::encoding::Vector<u8, 256>>,
T1: fidl::encoding::Encode<u8>,
> fidl::encoding::Encode<DeviceManagerFormatRequest> 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::<DeviceManagerFormatRequest>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for DeviceManagerFormatRequest {
#[inline(always)]
fn new_empty() -> Self {
Self {
key: fidl::new_empty!(fidl::encoding::Vector<u8, 256>),
slot: fidl::new_empty!(u8),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffffffffff00u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(fidl::encoding::Vector<u8, 256>, &mut self.key, decoder, offset + 0, _depth)?;
fidl::decode!(u8, &mut self.slot, decoder, offset + 16, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for DeviceManagerFormatResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
impl fidl::encoding::ValueTypeMarker for DeviceManagerFormatResponse {
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<DeviceManagerFormatResponse> for &DeviceManagerFormatResponse {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceManagerFormatResponse>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut DeviceManagerFormatResponse)
.write_unaligned((self as *const DeviceManagerFormatResponse).read());
}
Ok(())
}
}
unsafe impl<T0: fidl::encoding::Encode<i32>> fidl::encoding::Encode<DeviceManagerFormatResponse>
for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceManagerFormatResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for DeviceManagerFormatResponse {
#[inline(always)]
fn new_empty() -> Self {
Self { status: fidl::new_empty!(i32) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
}
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for DeviceManagerSealResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
impl fidl::encoding::ValueTypeMarker for DeviceManagerSealResponse {
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<DeviceManagerSealResponse> for &DeviceManagerSealResponse {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceManagerSealResponse>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut DeviceManagerSealResponse)
.write_unaligned((self as *const DeviceManagerSealResponse).read());
}
Ok(())
}
}
unsafe impl<T0: fidl::encoding::Encode<i32>> fidl::encoding::Encode<DeviceManagerSealResponse>
for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceManagerSealResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for DeviceManagerSealResponse {
#[inline(always)]
fn new_empty() -> Self {
Self { status: fidl::new_empty!(i32) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
}
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for DeviceManagerShredResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
impl fidl::encoding::ValueTypeMarker for DeviceManagerShredResponse {
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<DeviceManagerShredResponse> for &DeviceManagerShredResponse {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceManagerShredResponse>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut DeviceManagerShredResponse)
.write_unaligned((self as *const DeviceManagerShredResponse).read());
}
Ok(())
}
}
unsafe impl<T0: fidl::encoding::Encode<i32>> fidl::encoding::Encode<DeviceManagerShredResponse>
for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceManagerShredResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for DeviceManagerShredResponse {
#[inline(always)]
fn new_empty() -> Self {
Self { status: fidl::new_empty!(i32) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
}
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for DeviceManagerUnsealRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
24
}
}
impl fidl::encoding::ValueTypeMarker for DeviceManagerUnsealRequest {
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<DeviceManagerUnsealRequest> for &DeviceManagerUnsealRequest {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceManagerUnsealRequest>(offset);
fidl::encoding::Encode::<DeviceManagerUnsealRequest>::encode(
(
<fidl::encoding::Vector<u8, 256> as fidl::encoding::ValueTypeMarker>::borrow(
&self.key,
),
<u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.slot),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<fidl::encoding::Vector<u8, 256>>,
T1: fidl::encoding::Encode<u8>,
> fidl::encoding::Encode<DeviceManagerUnsealRequest> 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::<DeviceManagerUnsealRequest>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for DeviceManagerUnsealRequest {
#[inline(always)]
fn new_empty() -> Self {
Self {
key: fidl::new_empty!(fidl::encoding::Vector<u8, 256>),
slot: fidl::new_empty!(u8),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffffffffff00u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(fidl::encoding::Vector<u8, 256>, &mut self.key, decoder, offset + 0, _depth)?;
fidl::decode!(u8, &mut self.slot, decoder, offset + 16, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for DeviceManagerUnsealResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
impl fidl::encoding::ValueTypeMarker for DeviceManagerUnsealResponse {
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<DeviceManagerUnsealResponse> for &DeviceManagerUnsealResponse {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceManagerUnsealResponse>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut DeviceManagerUnsealResponse)
.write_unaligned((self as *const DeviceManagerUnsealResponse).read());
}
Ok(())
}
}
unsafe impl<T0: fidl::encoding::Encode<i32>> fidl::encoding::Encode<DeviceManagerUnsealResponse>
for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceManagerUnsealResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for DeviceManagerUnsealResponse {
#[inline(always)]
fn new_empty() -> Self {
Self { status: fidl::new_empty!(i32) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
}
Ok(())
}
}
}