#![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 BOARD_NAME_LEN: u8 = 32;
pub const BOOTLOADER_VENDOR_LEN: u8 = 32;
pub const SERIAL_NUMBER_LEN: u8 = 32;
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub enum InterruptControllerType {
Unknown,
Apic,
GicV2,
GicV3,
Plic,
#[doc(hidden)]
__SourceBreaking {
unknown_ordinal: u32,
},
}
#[macro_export]
macro_rules! InterruptControllerTypeUnknown {
() => {
_
};
}
impl InterruptControllerType {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
0 => Some(Self::Unknown),
1 => Some(Self::Apic),
2 => Some(Self::GicV2),
3 => Some(Self::GicV3),
4 => Some(Self::Plic),
_ => None,
}
}
#[inline]
pub fn from_primitive_allow_unknown(prim: u32) -> Self {
match prim {
0 => Self::Unknown,
1 => Self::Apic,
2 => Self::GicV2,
3 => Self::GicV3,
4 => Self::Plic,
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::Unknown => 0,
Self::Apic => 1,
Self::GicV2 => 2,
Self::GicV3 => 3,
Self::Plic => 4,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { unknown_ordinal: _ } => true,
_ => false,
}
}
}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct InterruptControllerInfo {
pub type_: InterruptControllerType,
}
impl fidl::Persistable for InterruptControllerInfo {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct SysInfoGetBoardNameResponse {
pub status: i32,
pub name: Option<String>,
}
impl fidl::Persistable for SysInfoGetBoardNameResponse {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct SysInfoGetBoardRevisionResponse {
pub status: i32,
pub revision: u32,
}
impl fidl::Persistable for SysInfoGetBoardRevisionResponse {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct SysInfoGetBootloaderVendorResponse {
pub status: i32,
pub vendor: Option<String>,
}
impl fidl::Persistable for SysInfoGetBootloaderVendorResponse {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct SysInfoGetInterruptControllerInfoResponse {
pub status: i32,
pub info: Option<Box<InterruptControllerInfo>>,
}
impl fidl::Persistable for SysInfoGetInterruptControllerInfoResponse {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct SysInfoGetSerialNumberResponse {
pub serial: String,
}
impl fidl::Persistable for SysInfoGetSerialNumberResponse {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct SysInfoMarker;
impl fidl::endpoints::ProtocolMarker for SysInfoMarker {
type Proxy = SysInfoProxy;
type RequestStream = SysInfoRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = SysInfoSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.sysinfo.SysInfo";
}
impl fidl::endpoints::DiscoverableProtocolMarker for SysInfoMarker {}
pub type SysInfoGetSerialNumberResult = Result<String, i32>;
pub trait SysInfoProxyInterface: Send + Sync {
type GetBoardNameResponseFut: std::future::Future<Output = Result<(i32, Option<String>), fidl::Error>>
+ Send;
fn r#get_board_name(&self) -> Self::GetBoardNameResponseFut;
type GetBoardRevisionResponseFut: std::future::Future<Output = Result<(i32, u32), fidl::Error>>
+ Send;
fn r#get_board_revision(&self) -> Self::GetBoardRevisionResponseFut;
type GetBootloaderVendorResponseFut: std::future::Future<Output = Result<(i32, Option<String>), fidl::Error>>
+ Send;
fn r#get_bootloader_vendor(&self) -> Self::GetBootloaderVendorResponseFut;
type GetInterruptControllerInfoResponseFut: std::future::Future<
Output = Result<(i32, Option<Box<InterruptControllerInfo>>), fidl::Error>,
> + Send;
fn r#get_interrupt_controller_info(&self) -> Self::GetInterruptControllerInfoResponseFut;
type GetSerialNumberResponseFut: std::future::Future<Output = Result<SysInfoGetSerialNumberResult, fidl::Error>>
+ Send;
fn r#get_serial_number(&self) -> Self::GetSerialNumberResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct SysInfoSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for SysInfoSynchronousProxy {
type Proxy = SysInfoProxy;
type Protocol = SysInfoMarker;
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 SysInfoSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <SysInfoMarker 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<SysInfoEvent, fidl::Error> {
SysInfoEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#get_board_name(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<(i32, Option<String>), fidl::Error> {
let _response =
self.client.send_query::<fidl::encoding::EmptyPayload, SysInfoGetBoardNameResponse>(
(),
0x6d29d1a6edf9a614,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok((_response.status, _response.name))
}
pub fn r#get_board_revision(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<(i32, u32), fidl::Error> {
let _response = self
.client
.send_query::<fidl::encoding::EmptyPayload, SysInfoGetBoardRevisionResponse>(
(),
0x3dd050d99012e9cc,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok((_response.status, _response.revision))
}
pub fn r#get_bootloader_vendor(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<(i32, Option<String>), fidl::Error> {
let _response = self
.client
.send_query::<fidl::encoding::EmptyPayload, SysInfoGetBootloaderVendorResponse>(
(),
0x2511f1c2f9ae2017,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok((_response.status, _response.vendor))
}
pub fn r#get_interrupt_controller_info(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<(i32, Option<Box<InterruptControllerInfo>>), fidl::Error> {
let _response = self
.client
.send_query::<fidl::encoding::EmptyPayload, SysInfoGetInterruptControllerInfoResponse>(
(),
0x31a438b28dca119c,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok((_response.status, _response.info))
}
pub fn r#get_serial_number(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<SysInfoGetSerialNumberResult, fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
fidl::encoding::ResultType<SysInfoGetSerialNumberResponse, i32>,
>(
(),
0x3b6920410a59f01f,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x.serial))
}
}
#[derive(Debug, Clone)]
pub struct SysInfoProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for SysInfoProxy {
type Protocol = SysInfoMarker;
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 SysInfoProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <SysInfoMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> SysInfoEventStream {
SysInfoEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#get_board_name(
&self,
) -> fidl::client::QueryResponseFut<
(i32, Option<String>),
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
SysInfoProxyInterface::r#get_board_name(self)
}
pub fn r#get_board_revision(
&self,
) -> fidl::client::QueryResponseFut<(i32, u32), fidl::encoding::DefaultFuchsiaResourceDialect>
{
SysInfoProxyInterface::r#get_board_revision(self)
}
pub fn r#get_bootloader_vendor(
&self,
) -> fidl::client::QueryResponseFut<
(i32, Option<String>),
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
SysInfoProxyInterface::r#get_bootloader_vendor(self)
}
pub fn r#get_interrupt_controller_info(
&self,
) -> fidl::client::QueryResponseFut<
(i32, Option<Box<InterruptControllerInfo>>),
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
SysInfoProxyInterface::r#get_interrupt_controller_info(self)
}
pub fn r#get_serial_number(
&self,
) -> fidl::client::QueryResponseFut<
SysInfoGetSerialNumberResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
SysInfoProxyInterface::r#get_serial_number(self)
}
}
impl SysInfoProxyInterface for SysInfoProxy {
type GetBoardNameResponseFut = fidl::client::QueryResponseFut<
(i32, Option<String>),
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#get_board_name(&self) -> Self::GetBoardNameResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<(i32, Option<String>), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
SysInfoGetBoardNameResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x6d29d1a6edf9a614,
>(_buf?)?;
Ok((_response.status, _response.name))
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, (i32, Option<String>)>(
(),
0x6d29d1a6edf9a614,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type GetBoardRevisionResponseFut =
fidl::client::QueryResponseFut<(i32, u32), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#get_board_revision(&self) -> Self::GetBoardRevisionResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<(i32, u32), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
SysInfoGetBoardRevisionResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x3dd050d99012e9cc,
>(_buf?)?;
Ok((_response.status, _response.revision))
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, (i32, u32)>(
(),
0x3dd050d99012e9cc,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type GetBootloaderVendorResponseFut = fidl::client::QueryResponseFut<
(i32, Option<String>),
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#get_bootloader_vendor(&self) -> Self::GetBootloaderVendorResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<(i32, Option<String>), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
SysInfoGetBootloaderVendorResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x2511f1c2f9ae2017,
>(_buf?)?;
Ok((_response.status, _response.vendor))
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, (i32, Option<String>)>(
(),
0x2511f1c2f9ae2017,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type GetInterruptControllerInfoResponseFut = fidl::client::QueryResponseFut<
(i32, Option<Box<InterruptControllerInfo>>),
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#get_interrupt_controller_info(&self) -> Self::GetInterruptControllerInfoResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<(i32, Option<Box<InterruptControllerInfo>>), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
SysInfoGetInterruptControllerInfoResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x31a438b28dca119c,
>(_buf?)?;
Ok((_response.status, _response.info))
}
self.client.send_query_and_decode::<
fidl::encoding::EmptyPayload,
(i32, Option<Box<InterruptControllerInfo>>),
>(
(),
0x31a438b28dca119c,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type GetSerialNumberResponseFut = fidl::client::QueryResponseFut<
SysInfoGetSerialNumberResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#get_serial_number(&self) -> Self::GetSerialNumberResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<SysInfoGetSerialNumberResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<SysInfoGetSerialNumberResponse, i32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x3b6920410a59f01f,
>(_buf?)?;
Ok(_response.map(|x| x.serial))
}
self.client
.send_query_and_decode::<fidl::encoding::EmptyPayload, SysInfoGetSerialNumberResult>(
(),
0x3b6920410a59f01f,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct SysInfoEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for SysInfoEventStream {}
impl futures::stream::FusedStream for SysInfoEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for SysInfoEventStream {
type Item = Result<SysInfoEvent, 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(SysInfoEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum SysInfoEvent {}
impl SysInfoEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<SysInfoEvent, 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: <SysInfoMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct SysInfoRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for SysInfoRequestStream {}
impl futures::stream::FusedStream for SysInfoRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for SysInfoRequestStream {
type Protocol = SysInfoMarker;
type ControlHandle = SysInfoControlHandle;
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 {
SysInfoControlHandle { 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 SysInfoRequestStream {
type Item = Result<SysInfoRequest, 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 SysInfoRequestStream 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 {
0x6d29d1a6edf9a614 => {
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 = SysInfoControlHandle { inner: this.inner.clone() };
Ok(SysInfoRequest::GetBoardName {
responder: SysInfoGetBoardNameResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x3dd050d99012e9cc => {
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 = SysInfoControlHandle { inner: this.inner.clone() };
Ok(SysInfoRequest::GetBoardRevision {
responder: SysInfoGetBoardRevisionResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x2511f1c2f9ae2017 => {
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 = SysInfoControlHandle { inner: this.inner.clone() };
Ok(SysInfoRequest::GetBootloaderVendor {
responder: SysInfoGetBootloaderVendorResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x31a438b28dca119c => {
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 = SysInfoControlHandle { inner: this.inner.clone() };
Ok(SysInfoRequest::GetInterruptControllerInfo {
responder: SysInfoGetInterruptControllerInfoResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x3b6920410a59f01f => {
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 = SysInfoControlHandle { inner: this.inner.clone() };
Ok(SysInfoRequest::GetSerialNumber {
responder: SysInfoGetSerialNumberResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<SysInfoMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum SysInfoRequest {
GetBoardName {
responder: SysInfoGetBoardNameResponder,
},
GetBoardRevision {
responder: SysInfoGetBoardRevisionResponder,
},
GetBootloaderVendor {
responder: SysInfoGetBootloaderVendorResponder,
},
GetInterruptControllerInfo {
responder: SysInfoGetInterruptControllerInfoResponder,
},
GetSerialNumber {
responder: SysInfoGetSerialNumberResponder,
},
}
impl SysInfoRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_get_board_name(self) -> Option<(SysInfoGetBoardNameResponder)> {
if let SysInfoRequest::GetBoardName { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_get_board_revision(self) -> Option<(SysInfoGetBoardRevisionResponder)> {
if let SysInfoRequest::GetBoardRevision { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_get_bootloader_vendor(self) -> Option<(SysInfoGetBootloaderVendorResponder)> {
if let SysInfoRequest::GetBootloaderVendor { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_get_interrupt_controller_info(
self,
) -> Option<(SysInfoGetInterruptControllerInfoResponder)> {
if let SysInfoRequest::GetInterruptControllerInfo { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_get_serial_number(self) -> Option<(SysInfoGetSerialNumberResponder)> {
if let SysInfoRequest::GetSerialNumber { responder } = self {
Some((responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
SysInfoRequest::GetBoardName { .. } => "get_board_name",
SysInfoRequest::GetBoardRevision { .. } => "get_board_revision",
SysInfoRequest::GetBootloaderVendor { .. } => "get_bootloader_vendor",
SysInfoRequest::GetInterruptControllerInfo { .. } => "get_interrupt_controller_info",
SysInfoRequest::GetSerialNumber { .. } => "get_serial_number",
}
}
}
#[derive(Debug, Clone)]
pub struct SysInfoControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for SysInfoControlHandle {
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 SysInfoControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct SysInfoGetBoardNameResponder {
control_handle: std::mem::ManuallyDrop<SysInfoControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for SysInfoGetBoardNameResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for SysInfoGetBoardNameResponder {
type ControlHandle = SysInfoControlHandle;
fn control_handle(&self) -> &SysInfoControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl SysInfoGetBoardNameResponder {
pub fn send(self, mut status: i32, mut name: Option<&str>) -> Result<(), fidl::Error> {
let _result = self.send_raw(status, name);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut status: i32,
mut name: Option<&str>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(status, name);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut status: i32, mut name: Option<&str>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<SysInfoGetBoardNameResponse>(
(status, name),
self.tx_id,
0x6d29d1a6edf9a614,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct SysInfoGetBoardRevisionResponder {
control_handle: std::mem::ManuallyDrop<SysInfoControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for SysInfoGetBoardRevisionResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for SysInfoGetBoardRevisionResponder {
type ControlHandle = SysInfoControlHandle;
fn control_handle(&self) -> &SysInfoControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl SysInfoGetBoardRevisionResponder {
pub fn send(self, mut status: i32, mut revision: u32) -> Result<(), fidl::Error> {
let _result = self.send_raw(status, revision);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut status: i32,
mut revision: u32,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(status, revision);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut status: i32, mut revision: u32) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<SysInfoGetBoardRevisionResponse>(
(status, revision),
self.tx_id,
0x3dd050d99012e9cc,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct SysInfoGetBootloaderVendorResponder {
control_handle: std::mem::ManuallyDrop<SysInfoControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for SysInfoGetBootloaderVendorResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for SysInfoGetBootloaderVendorResponder {
type ControlHandle = SysInfoControlHandle;
fn control_handle(&self) -> &SysInfoControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl SysInfoGetBootloaderVendorResponder {
pub fn send(self, mut status: i32, mut vendor: Option<&str>) -> Result<(), fidl::Error> {
let _result = self.send_raw(status, vendor);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut status: i32,
mut vendor: Option<&str>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(status, vendor);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut status: i32, mut vendor: Option<&str>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<SysInfoGetBootloaderVendorResponse>(
(status, vendor),
self.tx_id,
0x2511f1c2f9ae2017,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct SysInfoGetInterruptControllerInfoResponder {
control_handle: std::mem::ManuallyDrop<SysInfoControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for SysInfoGetInterruptControllerInfoResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for SysInfoGetInterruptControllerInfoResponder {
type ControlHandle = SysInfoControlHandle;
fn control_handle(&self) -> &SysInfoControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl SysInfoGetInterruptControllerInfoResponder {
pub fn send(
self,
mut status: i32,
mut info: Option<&InterruptControllerInfo>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(status, info);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut status: i32,
mut info: Option<&InterruptControllerInfo>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(status, info);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut status: i32,
mut info: Option<&InterruptControllerInfo>,
) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<SysInfoGetInterruptControllerInfoResponse>(
(status, info),
self.tx_id,
0x31a438b28dca119c,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct SysInfoGetSerialNumberResponder {
control_handle: std::mem::ManuallyDrop<SysInfoControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for SysInfoGetSerialNumberResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for SysInfoGetSerialNumberResponder {
type ControlHandle = SysInfoControlHandle;
fn control_handle(&self) -> &SysInfoControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl SysInfoGetSerialNumberResponder {
pub fn send(self, mut result: Result<&str, 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<&str, i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<&str, i32>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<SysInfoGetSerialNumberResponse, i32>>(
result.map(|serial| (serial,)),
self.tx_id,
0x3b6920410a59f01f,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct ServiceMarker;
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::ServiceMarker for ServiceMarker {
type Proxy = ServiceProxy;
type Request = ServiceRequest;
const SERVICE_NAME: &'static str = "fuchsia.sysinfo.Service";
}
#[cfg(target_os = "fuchsia")]
pub enum ServiceRequest {
Device(SysInfoRequestStream),
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::ServiceRequest for ServiceRequest {
type Service = ServiceMarker;
fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
match name {
"device" => Self::Device(
<SysInfoRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
),
_ => panic!("no such member protocol name for service Service"),
}
}
fn member_names() -> &'static [&'static str] {
&["device"]
}
}
#[cfg(target_os = "fuchsia")]
pub struct ServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::ServiceProxy for ServiceProxy {
type Service = ServiceMarker;
fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
Self(opener)
}
}
#[cfg(target_os = "fuchsia")]
impl ServiceProxy {
pub fn connect_to_device(&self) -> Result<SysInfoProxy, fidl::Error> {
let (proxy, server_end) = fidl::endpoints::create_proxy::<SysInfoMarker>();
self.connect_channel_to_device(server_end)?;
Ok(proxy)
}
pub fn connect_to_device_sync(&self) -> Result<SysInfoSynchronousProxy, fidl::Error> {
let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<SysInfoMarker>();
self.connect_channel_to_device(server_end)?;
Ok(proxy)
}
pub fn connect_channel_to_device(
&self,
server_end: fidl::endpoints::ServerEnd<SysInfoMarker>,
) -> Result<(), fidl::Error> {
self.0.open_member("device", server_end.into_channel())
}
pub fn instance_name(&self) -> &str {
self.0.instance_name()
}
}
mod internal {
use super::*;
unsafe impl fidl::encoding::TypeMarker for InterruptControllerType {
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 InterruptControllerType {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
*value
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
for InterruptControllerType
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for InterruptControllerType
{
#[inline(always)]
fn new_empty() -> Self {
Self::unknown()
}
#[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 prim = decoder.read_num::<u32>(offset);
*self = Self::from_primitive_allow_unknown(prim);
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for InterruptControllerInfo {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for InterruptControllerInfo {
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<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<InterruptControllerInfo, D> for &InterruptControllerInfo
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<InterruptControllerInfo>(offset);
fidl::encoding::Encode::<InterruptControllerInfo, D>::encode(
(<InterruptControllerType as fidl::encoding::ValueTypeMarker>::borrow(&self.type_),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<InterruptControllerType, D>,
> fidl::encoding::Encode<InterruptControllerInfo, 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::<InterruptControllerInfo>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for InterruptControllerInfo
{
#[inline(always)]
fn new_empty() -> Self {
Self { type_: fidl::new_empty!(InterruptControllerType, 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!(
InterruptControllerType,
D,
&mut self.type_,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for SysInfoGetBoardNameResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for SysInfoGetBoardNameResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
24
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<SysInfoGetBoardNameResponse, D> for &SysInfoGetBoardNameResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<SysInfoGetBoardNameResponse>(offset);
fidl::encoding::Encode::<SysInfoGetBoardNameResponse, D>::encode(
(
<i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.status),
<fidl::encoding::Optional<fidl::encoding::BoundedString<32>> as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<i32, D>,
T1: fidl::encoding::Encode<fidl::encoding::Optional<fidl::encoding::BoundedString<32>>, D>,
> fidl::encoding::Encode<SysInfoGetBoardNameResponse, 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::<SysInfoGetBoardNameResponse>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for SysInfoGetBoardNameResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self {
status: fidl::new_empty!(i32, D),
name: fidl::new_empty!(
fidl::encoding::Optional<fidl::encoding::BoundedString<32>>,
D
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffff00000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(i32, D, &mut self.status, decoder, offset + 0, _depth)?;
fidl::decode!(
fidl::encoding::Optional<fidl::encoding::BoundedString<32>>,
D,
&mut self.name,
decoder,
offset + 8,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for SysInfoGetBoardRevisionResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for SysInfoGetBoardRevisionResponse {
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
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<SysInfoGetBoardRevisionResponse, D>
for &SysInfoGetBoardRevisionResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<SysInfoGetBoardRevisionResponse>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut SysInfoGetBoardRevisionResponse)
.write_unaligned((self as *const SysInfoGetBoardRevisionResponse).read());
}
Ok(())
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<i32, D>,
T1: fidl::encoding::Encode<u32, D>,
> fidl::encoding::Encode<SysInfoGetBoardRevisionResponse, 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::<SysInfoGetBoardRevisionResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 4, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for SysInfoGetBoardRevisionResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { status: fidl::new_empty!(i32, D), revision: 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) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for SysInfoGetBootloaderVendorResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for SysInfoGetBootloaderVendorResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
24
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<SysInfoGetBootloaderVendorResponse, D>
for &SysInfoGetBootloaderVendorResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<SysInfoGetBootloaderVendorResponse>(offset);
fidl::encoding::Encode::<SysInfoGetBootloaderVendorResponse, D>::encode(
(
<i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.status),
<fidl::encoding::Optional<fidl::encoding::BoundedString<32>> as fidl::encoding::ValueTypeMarker>::borrow(&self.vendor),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<i32, D>,
T1: fidl::encoding::Encode<fidl::encoding::Optional<fidl::encoding::BoundedString<32>>, D>,
> fidl::encoding::Encode<SysInfoGetBootloaderVendorResponse, 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::<SysInfoGetBootloaderVendorResponse>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for SysInfoGetBootloaderVendorResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self {
status: fidl::new_empty!(i32, D),
vendor: fidl::new_empty!(
fidl::encoding::Optional<fidl::encoding::BoundedString<32>>,
D
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffff00000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(i32, D, &mut self.status, decoder, offset + 0, _depth)?;
fidl::decode!(
fidl::encoding::Optional<fidl::encoding::BoundedString<32>>,
D,
&mut self.vendor,
decoder,
offset + 8,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for SysInfoGetInterruptControllerInfoResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for SysInfoGetInterruptControllerInfoResponse {
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<SysInfoGetInterruptControllerInfoResponse, D>
for &SysInfoGetInterruptControllerInfoResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<SysInfoGetInterruptControllerInfoResponse>(offset);
fidl::encoding::Encode::<SysInfoGetInterruptControllerInfoResponse, D>::encode(
(
<i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.status),
<fidl::encoding::Boxed<InterruptControllerInfo> as fidl::encoding::ValueTypeMarker>::borrow(&self.info),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<i32, D>,
T1: fidl::encoding::Encode<fidl::encoding::Boxed<InterruptControllerInfo>, D>,
> fidl::encoding::Encode<SysInfoGetInterruptControllerInfoResponse, 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::<SysInfoGetInterruptControllerInfoResponse>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for SysInfoGetInterruptControllerInfoResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self {
status: fidl::new_empty!(i32, D),
info: fidl::new_empty!(fidl::encoding::Boxed<InterruptControllerInfo>, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffff00000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(i32, D, &mut self.status, decoder, offset + 0, _depth)?;
fidl::decode!(
fidl::encoding::Boxed<InterruptControllerInfo>,
D,
&mut self.info,
decoder,
offset + 8,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for SysInfoGetSerialNumberResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for SysInfoGetSerialNumberResponse {
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<SysInfoGetSerialNumberResponse, D>
for &SysInfoGetSerialNumberResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<SysInfoGetSerialNumberResponse>(offset);
fidl::encoding::Encode::<SysInfoGetSerialNumberResponse, D>::encode(
(<fidl::encoding::BoundedString<32> as fidl::encoding::ValueTypeMarker>::borrow(
&self.serial,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::BoundedString<32>, D>,
> fidl::encoding::Encode<SysInfoGetSerialNumberResponse, 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::<SysInfoGetSerialNumberResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for SysInfoGetSerialNumberResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { serial: fidl::new_empty!(fidl::encoding::BoundedString<32>, 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<32>,
D,
&mut self.serial,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
}