#![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 type ContextId = u32;
pub type ObjectId = u64;
pub type PerformanceCounterPoolId = u64;
pub type PerformanceCounterSet = Vec<u64>;
pub type PerformanceCounterTriggerId = u32;
pub const MAX_ICD_COUNT: u64 = 8;
pub const MAX_IMMEDIATE_COMMANDS_DATA_SIZE: u32 = 2048;
pub const MAX_INLINE_COMMANDS_DATA_SIZE: u32 = 2048;
bitflags! {
#[derive(Default)]
pub struct CommandBufferFlags: u64 {
const VENDOR_FLAG_0 = 65536;
}
}
impl CommandBufferFlags {
#[inline(always)]
pub fn from_bits_allow_unknown(bits: u64) -> Self {
unsafe { Self::from_bits_unchecked(bits) }
}
#[inline(always)]
pub fn has_unknown_bits(&self) -> bool {
self.get_unknown_bits() != 0
}
#[inline(always)]
pub fn get_unknown_bits(&self) -> u64 {
self.bits & !Self::all().bits
}
}
bitflags! {
#[derive(Default)]
pub struct IcdFlags: u32 {
const SUPPORTS_VULKAN = 1;
const SUPPORTS_OPENCL = 2;
const SUPPORTS_MEDIA_CODEC_FACTORY = 4;
}
}
impl IcdFlags {
#[inline(always)]
pub fn from_bits_allow_unknown(bits: u32) -> Self {
unsafe { Self::from_bits_unchecked(bits) }
}
#[inline(always)]
pub fn has_unknown_bits(&self) -> bool {
self.get_unknown_bits() != 0
}
#[inline(always)]
pub fn get_unknown_bits(&self) -> u32 {
self.bits & !Self::all().bits
}
}
bitflags! {
#[derive(Default)]
pub struct ImportFlags: u64 {
const SEMAPHORE_ONE_SHOT = 1;
}
}
impl ImportFlags {
#[inline(always)]
pub fn from_bits_allow_unknown(bits: u64) -> Self {
unsafe { Self::from_bits_unchecked(bits) }
}
#[inline(always)]
pub fn has_unknown_bits(&self) -> bool {
self.get_unknown_bits() != 0
}
#[inline(always)]
pub fn get_unknown_bits(&self) -> u64 {
self.bits & !Self::all().bits
}
}
bitflags! {
#[derive(Default)]
pub struct MapFlags: u64 {
const READ = 1;
const WRITE = 2;
const EXECUTE = 4;
const GROWABLE = 8;
const VENDOR_FLAG_0 = 65536;
}
}
impl MapFlags {
#[inline(always)]
pub fn from_bits_allow_unknown(bits: u64) -> Self {
unsafe { Self::from_bits_unchecked(bits) }
}
#[inline(always)]
pub fn has_unknown_bits(&self) -> bool {
self.get_unknown_bits() != 0
}
#[inline(always)]
pub fn get_unknown_bits(&self) -> u64 {
self.bits & !Self::all().bits
}
}
bitflags! {
#[derive(Default)]
pub struct ResultFlags: u32 {
const DISCONTINUITY = 1;
}
}
impl ResultFlags {
#[inline(always)]
pub fn from_bits_allow_unknown(bits: u32) -> Self {
unsafe { Self::from_bits_unchecked(bits) }
}
#[inline(always)]
pub fn has_unknown_bits(&self) -> bool {
self.get_unknown_bits() != 0
}
#[inline(always)]
pub fn get_unknown_bits(&self) -> u32 {
self.bits & !Self::all().bits
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub enum BufferOp {
PopulateTables,
DepopulateTables,
#[doc(hidden)]
__SourceBreaking { unknown_ordinal: u32 },
}
#[macro_export]
macro_rules! BufferOpUnknown {
() => {
_
};
}
impl BufferOp {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::PopulateTables),
2 => Some(Self::DepopulateTables),
_ => None,
}
}
#[inline]
pub fn from_primitive_allow_unknown(prim: u32) -> Self {
match prim {
1 => Self::PopulateTables,
2 => Self::DepopulateTables,
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::PopulateTables => 1,
Self::DepopulateTables => 2,
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 ObjectType {
Event,
Buffer,
Semaphore,
#[doc(hidden)]
__SourceBreaking { unknown_ordinal: u32 },
}
#[macro_export]
macro_rules! ObjectTypeUnknown {
() => {
_
};
}
impl ObjectType {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
10 => Some(Self::Event),
11 => Some(Self::Buffer),
12 => Some(Self::Semaphore),
_ => None,
}
}
#[inline]
pub fn from_primitive_allow_unknown(prim: u32) -> Self {
match prim {
10 => Self::Event,
11 => Self::Buffer,
12 => Self::Semaphore,
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::Event => 10,
Self::Buffer => 11,
Self::Semaphore => 12,
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 QueryId {
VendorId,
DeviceId,
VendorVersion,
IsTotalTimeSupported,
MaximumInflightParams,
MagmaQueryTotalTime,
VendorQuery0,
#[doc(hidden)]
__SourceBreaking { unknown_ordinal: u64 },
}
#[macro_export]
macro_rules! QueryIdUnknown {
() => {
_
};
}
impl QueryId {
#[inline]
pub fn from_primitive(prim: u64) -> Option<Self> {
match prim {
0 => Some(Self::VendorId),
1 => Some(Self::DeviceId),
2 => Some(Self::VendorVersion),
3 => Some(Self::IsTotalTimeSupported),
5 => Some(Self::MaximumInflightParams),
500 => Some(Self::MagmaQueryTotalTime),
10000 => Some(Self::VendorQuery0),
_ => None,
}
}
#[inline]
pub fn from_primitive_allow_unknown(prim: u64) -> Self {
match prim {
0 => Self::VendorId,
1 => Self::DeviceId,
2 => Self::VendorVersion,
3 => Self::IsTotalTimeSupported,
5 => Self::MaximumInflightParams,
500 => Self::MagmaQueryTotalTime,
10000 => Self::VendorQuery0,
unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
}
}
#[inline]
pub fn unknown() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0xffffffffffffffff }
}
#[inline]
pub const fn into_primitive(self) -> u64 {
match self {
Self::VendorId => 0,
Self::DeviceId => 1,
Self::VendorVersion => 2,
Self::IsTotalTimeSupported => 3,
Self::MaximumInflightParams => 5,
Self::MagmaQueryTotalTime => 500,
Self::VendorQuery0 => 10000,
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)]
#[repr(C)]
pub struct BufferRange {
pub buffer_id: u64,
pub offset: u64,
pub size: u64,
}
impl fidl::Persistable for BufferRange {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct CommandBuffer {
pub resource_index: u32,
pub start_offset: u64,
}
impl fidl::Persistable for CommandBuffer {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct DependencyInjectionSetMemoryPressureProviderRequest {
pub provider: fidl::endpoints::ClientEnd<fidl_fuchsia_memorypressure::ProviderMarker>,
}
impl fidl::Standalone for DependencyInjectionSetMemoryPressureProviderRequest {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct DeviceConnect2Request {
pub client_id: u64,
pub primary_channel: fidl::endpoints::ServerEnd<PrimaryMarker>,
pub notification_channel: fidl::endpoints::ServerEnd<NotificationMarker>,
}
impl fidl::Standalone for DeviceConnect2Request {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct DeviceQueryRequest {
pub query_id: QueryId,
}
impl fidl::Persistable for DeviceQueryRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct DiagnosticDeviceDumpStateRequest {
pub dump_type: u32,
}
impl fidl::Persistable for DiagnosticDeviceDumpStateRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct IcdLoaderDeviceGetIcdListResponse {
pub icd_list: Vec<IcdInfo>,
}
impl fidl::Persistable for IcdLoaderDeviceGetIcdListResponse {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct PerformanceCounterAccessGetPerformanceCountTokenResponse {
pub access_token: fidl::Event,
}
impl fidl::Standalone for PerformanceCounterAccessGetPerformanceCountTokenResponse {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct PrimaryAddPerformanceCounterBufferOffsetsToPoolRequest {
pub pool_id: u64,
pub offsets: Vec<BufferRange>,
}
impl fidl::Persistable for PrimaryAddPerformanceCounterBufferOffsetsToPoolRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct PrimaryBufferRangeOp2Request {
pub op: BufferOp,
pub range: BufferRange,
}
impl fidl::Persistable for PrimaryBufferRangeOp2Request {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct PrimaryClearPerformanceCountersRequest {
pub counters: Vec<u64>,
}
impl fidl::Persistable for PrimaryClearPerformanceCountersRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct PrimaryCreateContextRequest {
pub context_id: u32,
}
impl fidl::Persistable for PrimaryCreateContextRequest {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct PrimaryCreatePerformanceCounterBufferPoolRequest {
pub pool_id: u64,
pub event_channel: fidl::endpoints::ServerEnd<PerformanceCounterEventsMarker>,
}
impl fidl::Standalone for PrimaryCreatePerformanceCounterBufferPoolRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct PrimaryDestroyContextRequest {
pub context_id: u32,
}
impl fidl::Persistable for PrimaryDestroyContextRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct PrimaryDumpPerformanceCountersRequest {
pub pool_id: u64,
pub trigger_id: u32,
}
impl fidl::Persistable for PrimaryDumpPerformanceCountersRequest {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct PrimaryEnablePerformanceCounterAccessRequest {
pub access_token: fidl::Event,
}
impl fidl::Standalone for PrimaryEnablePerformanceCounterAccessRequest {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct PrimaryEnablePerformanceCountersRequest {
pub counters: Vec<u64>,
}
impl fidl::Persistable for PrimaryEnablePerformanceCountersRequest {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct PrimaryExecuteCommandRequest {
pub context_id: u32,
pub resources: Vec<BufferRange>,
pub command_buffers: Vec<CommandBuffer>,
pub wait_semaphores: Vec<u64>,
pub signal_semaphores: Vec<u64>,
pub flags: CommandBufferFlags,
}
impl fidl::Persistable for PrimaryExecuteCommandRequest {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct PrimaryExecuteImmediateCommandsRequest {
pub context_id: u32,
pub command_data: Vec<u8>,
pub semaphores: Vec<u64>,
}
impl fidl::Persistable for PrimaryExecuteImmediateCommandsRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct PrimaryExecuteInlineCommandsRequest {
pub context_id: u32,
pub commands: Vec<InlineCommand>,
}
impl fidl::Persistable for PrimaryExecuteInlineCommandsRequest {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct PrimaryImportObject2Request {
pub object: fidl::Handle,
pub object_type: ObjectType,
pub object_id: u64,
}
impl fidl::Standalone for PrimaryImportObject2Request {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct PrimaryIsPerformanceCounterAccessAllowedResponse {
pub enabled: bool,
}
impl fidl::Persistable for PrimaryIsPerformanceCounterAccessAllowedResponse {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct PrimaryOnNotifyMemoryImportedRequest {
pub bytes: u64,
}
impl fidl::Persistable for PrimaryOnNotifyMemoryImportedRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct PrimaryOnNotifyMessagesConsumedRequest {
pub count: u64,
}
impl fidl::Persistable for PrimaryOnNotifyMessagesConsumedRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct PrimaryReleaseObjectRequest {
pub object_id: u64,
pub object_type: ObjectType,
}
impl fidl::Persistable for PrimaryReleaseObjectRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct PrimaryReleasePerformanceCounterBufferPoolRequest {
pub pool_id: u64,
}
impl fidl::Persistable for PrimaryReleasePerformanceCounterBufferPoolRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct PrimaryRemovePerformanceCounterBufferFromPoolRequest {
pub pool_id: u64,
pub buffer_id: u64,
}
impl fidl::Persistable for PrimaryRemovePerformanceCounterBufferFromPoolRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct TestDeviceGetUnitTestStatusResponse {
pub status: i32,
}
impl fidl::Persistable for TestDeviceGetUnitTestStatusResponse {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct IcdInfo {
pub component_url: Option<String>,
pub flags: Option<IcdFlags>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for IcdInfo {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct InlineCommand {
pub data: Option<Vec<u8>>,
pub semaphores: Option<Vec<u64>>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for InlineCommand {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct PerformanceCounterEventsOnPerformanceCounterReadCompletedRequest {
pub trigger_id: Option<u32>,
pub buffer_id: Option<u64>,
pub buffer_offset: Option<u32>,
pub timestamp: Option<i64>,
pub flags: Option<ResultFlags>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for PerformanceCounterEventsOnPerformanceCounterReadCompletedRequest {}
#[derive(Debug, Default, PartialEq)]
pub struct PrimaryImportObjectRequest {
pub object: Option<Object>,
pub object_type: Option<ObjectType>,
pub object_id: Option<u64>,
pub flags: Option<ImportFlags>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Standalone for PrimaryImportObjectRequest {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct PrimaryMapBufferRequest {
pub hw_va: Option<u64>,
pub range: Option<BufferRange>,
pub flags: Option<MapFlags>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for PrimaryMapBufferRequest {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct PrimaryUnmapBufferRequest {
pub hw_va: Option<u64>,
pub buffer_id: Option<u64>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for PrimaryUnmapBufferRequest {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub enum DeviceQueryResponse {
SimpleResult(u64),
BufferResult(fidl::Vmo),
}
impl DeviceQueryResponse {
#[inline]
pub fn ordinal(&self) -> u64 {
match *self {
Self::SimpleResult(_) => 1,
Self::BufferResult(_) => 2,
}
}
#[deprecated = "Strict unions should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
impl fidl::Standalone for DeviceQueryResponse {}
#[derive(Debug)]
pub enum Object {
Semaphore(fidl::Event),
Buffer(fidl::Vmo),
VmoSemaphore(fidl::Vmo),
#[doc(hidden)]
__SourceBreaking {
unknown_ordinal: u64,
},
}
#[macro_export]
macro_rules! ObjectUnknown {
() => {
_
};
}
impl PartialEq for Object {
fn eq(&self, other: &Self) -> bool {
match (self, other) {
(Self::Semaphore(x), Self::Semaphore(y)) => *x == *y,
(Self::Buffer(x), Self::Buffer(y)) => *x == *y,
(Self::VmoSemaphore(x), Self::VmoSemaphore(y)) => *x == *y,
_ => false,
}
}
}
impl Object {
#[inline]
pub fn ordinal(&self) -> u64 {
match *self {
Self::Semaphore(_) => 1,
Self::Buffer(_) => 2,
Self::VmoSemaphore(_) => 3,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn unknown_variant_for_testing() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0 }
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { .. } => true,
_ => false,
}
}
}
impl fidl::Standalone for Object {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct CombinedDeviceMarker;
impl fidl::endpoints::ProtocolMarker for CombinedDeviceMarker {
type Proxy = CombinedDeviceProxy;
type RequestStream = CombinedDeviceRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = CombinedDeviceSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) CombinedDevice";
}
pub trait CombinedDeviceProxyInterface: Send + Sync {
type QueryResponseFut: std::future::Future<Output = Result<DeviceQueryResult, fidl::Error>>
+ Send;
fn r#query(&self, query_id: QueryId) -> Self::QueryResponseFut;
fn r#connect2(
&self,
client_id: u64,
primary_channel: fidl::endpoints::ServerEnd<PrimaryMarker>,
notification_channel: fidl::endpoints::ServerEnd<NotificationMarker>,
) -> Result<(), fidl::Error>;
fn r#dump_state(&self, dump_type: u32) -> Result<(), fidl::Error>;
type GetIcdListResponseFut: std::future::Future<Output = Result<Vec<IcdInfo>, fidl::Error>>
+ Send;
fn r#get_icd_list(&self) -> Self::GetIcdListResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct CombinedDeviceSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for CombinedDeviceSynchronousProxy {
type Proxy = CombinedDeviceProxy;
type Protocol = CombinedDeviceMarker;
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 CombinedDeviceSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <CombinedDeviceMarker 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<CombinedDeviceEvent, fidl::Error> {
CombinedDeviceEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#query(
&self,
mut query_id: QueryId,
___deadline: zx::Time,
) -> Result<DeviceQueryResult, fidl::Error> {
let _response = self
.client
.send_query::<DeviceQueryRequest, fidl::encoding::ResultType<DeviceQueryResponse, i32>>(
(query_id,),
0x627d4c6093b078e7,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#connect2(
&self,
mut client_id: u64,
mut primary_channel: fidl::endpoints::ServerEnd<PrimaryMarker>,
mut notification_channel: fidl::endpoints::ServerEnd<NotificationMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<DeviceConnect2Request>(
(client_id, primary_channel, notification_channel),
0x3a5b134714c67914,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#dump_state(&self, mut dump_type: u32) -> Result<(), fidl::Error> {
self.client.send::<DiagnosticDeviceDumpStateRequest>(
(dump_type,),
0x5420df493d4fa915,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#get_icd_list(&self, ___deadline: zx::Time) -> Result<Vec<IcdInfo>, fidl::Error> {
let _response = self
.client
.send_query::<fidl::encoding::EmptyPayload, IcdLoaderDeviceGetIcdListResponse>(
(),
0x7673e76395008257,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.icd_list)
}
}
#[derive(Debug, Clone)]
pub struct CombinedDeviceProxy {
client: fidl::client::Client,
}
impl fidl::endpoints::Proxy for CombinedDeviceProxy {
type Protocol = CombinedDeviceMarker;
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 CombinedDeviceProxy {
pub fn new(channel: fidl::AsyncChannel) -> Self {
let protocol_name = <CombinedDeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> CombinedDeviceEventStream {
CombinedDeviceEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#query(
&self,
mut query_id: QueryId,
) -> fidl::client::QueryResponseFut<DeviceQueryResult> {
CombinedDeviceProxyInterface::r#query(self, query_id)
}
pub fn r#connect2(
&self,
mut client_id: u64,
mut primary_channel: fidl::endpoints::ServerEnd<PrimaryMarker>,
mut notification_channel: fidl::endpoints::ServerEnd<NotificationMarker>,
) -> Result<(), fidl::Error> {
CombinedDeviceProxyInterface::r#connect2(
self,
client_id,
primary_channel,
notification_channel,
)
}
pub fn r#dump_state(&self, mut dump_type: u32) -> Result<(), fidl::Error> {
CombinedDeviceProxyInterface::r#dump_state(self, dump_type)
}
pub fn r#get_icd_list(&self) -> fidl::client::QueryResponseFut<Vec<IcdInfo>> {
CombinedDeviceProxyInterface::r#get_icd_list(self)
}
}
impl CombinedDeviceProxyInterface for CombinedDeviceProxy {
type QueryResponseFut = fidl::client::QueryResponseFut<DeviceQueryResult>;
fn r#query(&self, mut query_id: QueryId) -> Self::QueryResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<DeviceQueryResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<DeviceQueryResponse, i32>,
0x627d4c6093b078e7,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<DeviceQueryRequest, DeviceQueryResult>(
(query_id,),
0x627d4c6093b078e7,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
fn r#connect2(
&self,
mut client_id: u64,
mut primary_channel: fidl::endpoints::ServerEnd<PrimaryMarker>,
mut notification_channel: fidl::endpoints::ServerEnd<NotificationMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<DeviceConnect2Request>(
(client_id, primary_channel, notification_channel),
0x3a5b134714c67914,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#dump_state(&self, mut dump_type: u32) -> Result<(), fidl::Error> {
self.client.send::<DiagnosticDeviceDumpStateRequest>(
(dump_type,),
0x5420df493d4fa915,
fidl::encoding::DynamicFlags::empty(),
)
}
type GetIcdListResponseFut = fidl::client::QueryResponseFut<Vec<IcdInfo>>;
fn r#get_icd_list(&self) -> Self::GetIcdListResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<Vec<IcdInfo>, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
IcdLoaderDeviceGetIcdListResponse,
0x7673e76395008257,
>(_buf?)?;
Ok(_response.icd_list)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<IcdInfo>>(
(),
0x7673e76395008257,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct CombinedDeviceEventStream {
event_receiver: fidl::client::EventReceiver,
}
impl std::marker::Unpin for CombinedDeviceEventStream {}
impl futures::stream::FusedStream for CombinedDeviceEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for CombinedDeviceEventStream {
type Item = Result<CombinedDeviceEvent, 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(CombinedDeviceEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum CombinedDeviceEvent {}
impl CombinedDeviceEvent {
fn decode(mut buf: fidl::MessageBufEtc) -> Result<CombinedDeviceEvent, 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:
<CombinedDeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct CombinedDeviceRequestStream {
inner: std::sync::Arc<fidl::ServeInner>,
is_terminated: bool,
}
impl std::marker::Unpin for CombinedDeviceRequestStream {}
impl futures::stream::FusedStream for CombinedDeviceRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for CombinedDeviceRequestStream {
type Protocol = CombinedDeviceMarker;
type ControlHandle = CombinedDeviceControlHandle;
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 {
CombinedDeviceControlHandle { 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 CombinedDeviceRequestStream {
type Item = Result<CombinedDeviceRequest, 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 CombinedDeviceRequestStream 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 {
0x627d4c6093b078e7 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(DeviceQueryRequest);
fidl::encoding::Decoder::decode_into::<DeviceQueryRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = CombinedDeviceControlHandle { inner: this.inner.clone() };
Ok(CombinedDeviceRequest::Query {
query_id: req.query_id,
responder: CombinedDeviceQueryResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x3a5b134714c67914 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(DeviceConnect2Request);
fidl::encoding::Decoder::decode_into::<DeviceConnect2Request>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = CombinedDeviceControlHandle { inner: this.inner.clone() };
Ok(CombinedDeviceRequest::Connect2 {
client_id: req.client_id,
primary_channel: req.primary_channel,
notification_channel: req.notification_channel,
control_handle,
})
}
0x5420df493d4fa915 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(DiagnosticDeviceDumpStateRequest);
fidl::encoding::Decoder::decode_into::<DiagnosticDeviceDumpStateRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = CombinedDeviceControlHandle { inner: this.inner.clone() };
Ok(CombinedDeviceRequest::DumpState {
dump_type: req.dump_type,
control_handle,
})
}
0x7673e76395008257 => {
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 = CombinedDeviceControlHandle { inner: this.inner.clone() };
Ok(CombinedDeviceRequest::GetIcdList {
responder: CombinedDeviceGetIcdListResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<CombinedDeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
})
}
}
#[derive(Debug)]
pub enum CombinedDeviceRequest {
Query { query_id: QueryId, responder: CombinedDeviceQueryResponder },
Connect2 {
client_id: u64,
primary_channel: fidl::endpoints::ServerEnd<PrimaryMarker>,
notification_channel: fidl::endpoints::ServerEnd<NotificationMarker>,
control_handle: CombinedDeviceControlHandle,
},
DumpState { dump_type: u32, control_handle: CombinedDeviceControlHandle },
GetIcdList { responder: CombinedDeviceGetIcdListResponder },
}
impl CombinedDeviceRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_query(self) -> Option<(QueryId, CombinedDeviceQueryResponder)> {
if let CombinedDeviceRequest::Query { query_id, responder } = self {
Some((query_id, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_connect2(
self,
) -> Option<(
u64,
fidl::endpoints::ServerEnd<PrimaryMarker>,
fidl::endpoints::ServerEnd<NotificationMarker>,
CombinedDeviceControlHandle,
)> {
if let CombinedDeviceRequest::Connect2 {
client_id,
primary_channel,
notification_channel,
control_handle,
} = self
{
Some((client_id, primary_channel, notification_channel, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_dump_state(self) -> Option<(u32, CombinedDeviceControlHandle)> {
if let CombinedDeviceRequest::DumpState { dump_type, control_handle } = self {
Some((dump_type, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_get_icd_list(self) -> Option<(CombinedDeviceGetIcdListResponder)> {
if let CombinedDeviceRequest::GetIcdList { responder } = self {
Some((responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
CombinedDeviceRequest::Query { .. } => "query",
CombinedDeviceRequest::Connect2 { .. } => "connect2",
CombinedDeviceRequest::DumpState { .. } => "dump_state",
CombinedDeviceRequest::GetIcdList { .. } => "get_icd_list",
}
}
}
#[derive(Debug, Clone)]
pub struct CombinedDeviceControlHandle {
inner: std::sync::Arc<fidl::ServeInner>,
}
impl fidl::endpoints::ControlHandle for CombinedDeviceControlHandle {
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 CombinedDeviceControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct CombinedDeviceQueryResponder {
control_handle: std::mem::ManuallyDrop<CombinedDeviceControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for CombinedDeviceQueryResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for CombinedDeviceQueryResponder {
type ControlHandle = CombinedDeviceControlHandle;
fn control_handle(&self) -> &CombinedDeviceControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl CombinedDeviceQueryResponder {
pub fn send(self, mut result: Result<DeviceQueryResponse, 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<DeviceQueryResponse, i32>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<DeviceQueryResponse, i32>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<DeviceQueryResponse, i32>>(
result.as_mut().map_err(|e| *e),
self.tx_id,
0x627d4c6093b078e7,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct CombinedDeviceGetIcdListResponder {
control_handle: std::mem::ManuallyDrop<CombinedDeviceControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for CombinedDeviceGetIcdListResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for CombinedDeviceGetIcdListResponder {
type ControlHandle = CombinedDeviceControlHandle;
fn control_handle(&self) -> &CombinedDeviceControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl CombinedDeviceGetIcdListResponder {
pub fn send(self, mut icd_list: &[IcdInfo]) -> Result<(), fidl::Error> {
let _result = self.send_raw(icd_list);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut icd_list: &[IcdInfo]) -> Result<(), fidl::Error> {
let _result = self.send_raw(icd_list);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut icd_list: &[IcdInfo]) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<IcdLoaderDeviceGetIcdListResponse>(
(icd_list,),
self.tx_id,
0x7673e76395008257,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct DependencyInjectionMarker;
impl fidl::endpoints::ProtocolMarker for DependencyInjectionMarker {
type Proxy = DependencyInjectionProxy;
type RequestStream = DependencyInjectionRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = DependencyInjectionSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) DependencyInjection";
}
pub trait DependencyInjectionProxyInterface: Send + Sync {
fn r#set_memory_pressure_provider(
&self,
provider: fidl::endpoints::ClientEnd<fidl_fuchsia_memorypressure::ProviderMarker>,
) -> Result<(), fidl::Error>;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct DependencyInjectionSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for DependencyInjectionSynchronousProxy {
type Proxy = DependencyInjectionProxy;
type Protocol = DependencyInjectionMarker;
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 DependencyInjectionSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name =
<DependencyInjectionMarker 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<DependencyInjectionEvent, fidl::Error> {
DependencyInjectionEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#set_memory_pressure_provider(
&self,
mut provider: fidl::endpoints::ClientEnd<fidl_fuchsia_memorypressure::ProviderMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<DependencyInjectionSetMemoryPressureProviderRequest>(
(provider,),
0x5ef0be960d4b0f4c,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Clone)]
pub struct DependencyInjectionProxy {
client: fidl::client::Client,
}
impl fidl::endpoints::Proxy for DependencyInjectionProxy {
type Protocol = DependencyInjectionMarker;
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 DependencyInjectionProxy {
pub fn new(channel: fidl::AsyncChannel) -> Self {
let protocol_name =
<DependencyInjectionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> DependencyInjectionEventStream {
DependencyInjectionEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#set_memory_pressure_provider(
&self,
mut provider: fidl::endpoints::ClientEnd<fidl_fuchsia_memorypressure::ProviderMarker>,
) -> Result<(), fidl::Error> {
DependencyInjectionProxyInterface::r#set_memory_pressure_provider(self, provider)
}
}
impl DependencyInjectionProxyInterface for DependencyInjectionProxy {
fn r#set_memory_pressure_provider(
&self,
mut provider: fidl::endpoints::ClientEnd<fidl_fuchsia_memorypressure::ProviderMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<DependencyInjectionSetMemoryPressureProviderRequest>(
(provider,),
0x5ef0be960d4b0f4c,
fidl::encoding::DynamicFlags::empty(),
)
}
}
pub struct DependencyInjectionEventStream {
event_receiver: fidl::client::EventReceiver,
}
impl std::marker::Unpin for DependencyInjectionEventStream {}
impl futures::stream::FusedStream for DependencyInjectionEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for DependencyInjectionEventStream {
type Item = Result<DependencyInjectionEvent, 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(DependencyInjectionEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum DependencyInjectionEvent {}
impl DependencyInjectionEvent {
fn decode(mut buf: fidl::MessageBufEtc) -> Result<DependencyInjectionEvent, 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:
<DependencyInjectionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct DependencyInjectionRequestStream {
inner: std::sync::Arc<fidl::ServeInner>,
is_terminated: bool,
}
impl std::marker::Unpin for DependencyInjectionRequestStream {}
impl futures::stream::FusedStream for DependencyInjectionRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for DependencyInjectionRequestStream {
type Protocol = DependencyInjectionMarker;
type ControlHandle = DependencyInjectionControlHandle;
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 {
DependencyInjectionControlHandle { 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 DependencyInjectionRequestStream {
type Item = Result<DependencyInjectionRequest, 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 DependencyInjectionRequestStream 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 {
0x5ef0be960d4b0f4c => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req =
fidl::new_empty!(DependencyInjectionSetMemoryPressureProviderRequest);
fidl::encoding::Decoder::decode_into::<
DependencyInjectionSetMemoryPressureProviderRequest,
>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
DependencyInjectionControlHandle { inner: this.inner.clone() };
Ok(DependencyInjectionRequest::SetMemoryPressureProvider {
provider: req.provider,
control_handle,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<DependencyInjectionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
})
}
}
#[derive(Debug)]
pub enum DependencyInjectionRequest {
SetMemoryPressureProvider {
provider: fidl::endpoints::ClientEnd<fidl_fuchsia_memorypressure::ProviderMarker>,
control_handle: DependencyInjectionControlHandle,
},
}
impl DependencyInjectionRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_set_memory_pressure_provider(
self,
) -> Option<(
fidl::endpoints::ClientEnd<fidl_fuchsia_memorypressure::ProviderMarker>,
DependencyInjectionControlHandle,
)> {
if let DependencyInjectionRequest::SetMemoryPressureProvider { provider, control_handle } =
self
{
Some((provider, control_handle))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
DependencyInjectionRequest::SetMemoryPressureProvider { .. } => {
"set_memory_pressure_provider"
}
}
}
}
#[derive(Debug, Clone)]
pub struct DependencyInjectionControlHandle {
inner: std::sync::Arc<fidl::ServeInner>,
}
impl fidl::endpoints::ControlHandle for DependencyInjectionControlHandle {
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 DependencyInjectionControlHandle {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct DeviceMarker;
impl fidl::endpoints::ProtocolMarker for DeviceMarker {
type Proxy = DeviceProxy;
type RequestStream = DeviceRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = DeviceSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) Device";
}
pub type DeviceQueryResult = Result<DeviceQueryResponse, i32>;
pub trait DeviceProxyInterface: Send + Sync {
type QueryResponseFut: std::future::Future<Output = Result<DeviceQueryResult, fidl::Error>>
+ Send;
fn r#query(&self, query_id: QueryId) -> Self::QueryResponseFut;
fn r#connect2(
&self,
client_id: u64,
primary_channel: fidl::endpoints::ServerEnd<PrimaryMarker>,
notification_channel: fidl::endpoints::ServerEnd<NotificationMarker>,
) -> Result<(), fidl::Error>;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct DeviceSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for DeviceSynchronousProxy {
type Proxy = DeviceProxy;
type Protocol = DeviceMarker;
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 DeviceSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <DeviceMarker 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<DeviceEvent, fidl::Error> {
DeviceEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#query(
&self,
mut query_id: QueryId,
___deadline: zx::Time,
) -> Result<DeviceQueryResult, fidl::Error> {
let _response = self
.client
.send_query::<DeviceQueryRequest, fidl::encoding::ResultType<DeviceQueryResponse, i32>>(
(query_id,),
0x627d4c6093b078e7,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#connect2(
&self,
mut client_id: u64,
mut primary_channel: fidl::endpoints::ServerEnd<PrimaryMarker>,
mut notification_channel: fidl::endpoints::ServerEnd<NotificationMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<DeviceConnect2Request>(
(client_id, primary_channel, notification_channel),
0x3a5b134714c67914,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Clone)]
pub struct DeviceProxy {
client: fidl::client::Client,
}
impl fidl::endpoints::Proxy for DeviceProxy {
type Protocol = DeviceMarker;
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 DeviceProxy {
pub fn new(channel: fidl::AsyncChannel) -> Self {
let protocol_name = <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> DeviceEventStream {
DeviceEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#query(
&self,
mut query_id: QueryId,
) -> fidl::client::QueryResponseFut<DeviceQueryResult> {
DeviceProxyInterface::r#query(self, query_id)
}
pub fn r#connect2(
&self,
mut client_id: u64,
mut primary_channel: fidl::endpoints::ServerEnd<PrimaryMarker>,
mut notification_channel: fidl::endpoints::ServerEnd<NotificationMarker>,
) -> Result<(), fidl::Error> {
DeviceProxyInterface::r#connect2(self, client_id, primary_channel, notification_channel)
}
}
impl DeviceProxyInterface for DeviceProxy {
type QueryResponseFut = fidl::client::QueryResponseFut<DeviceQueryResult>;
fn r#query(&self, mut query_id: QueryId) -> Self::QueryResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<DeviceQueryResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<DeviceQueryResponse, i32>,
0x627d4c6093b078e7,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<DeviceQueryRequest, DeviceQueryResult>(
(query_id,),
0x627d4c6093b078e7,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
fn r#connect2(
&self,
mut client_id: u64,
mut primary_channel: fidl::endpoints::ServerEnd<PrimaryMarker>,
mut notification_channel: fidl::endpoints::ServerEnd<NotificationMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<DeviceConnect2Request>(
(client_id, primary_channel, notification_channel),
0x3a5b134714c67914,
fidl::encoding::DynamicFlags::empty(),
)
}
}
pub struct DeviceEventStream {
event_receiver: fidl::client::EventReceiver,
}
impl std::marker::Unpin for DeviceEventStream {}
impl futures::stream::FusedStream for DeviceEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for DeviceEventStream {
type Item = Result<DeviceEvent, 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(DeviceEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum DeviceEvent {}
impl DeviceEvent {
fn decode(mut buf: fidl::MessageBufEtc) -> Result<DeviceEvent, 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: <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct DeviceRequestStream {
inner: std::sync::Arc<fidl::ServeInner>,
is_terminated: bool,
}
impl std::marker::Unpin for DeviceRequestStream {}
impl futures::stream::FusedStream for DeviceRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for DeviceRequestStream {
type Protocol = DeviceMarker;
type ControlHandle = DeviceControlHandle;
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 {
DeviceControlHandle { 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 DeviceRequestStream {
type Item = Result<DeviceRequest, 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 DeviceRequestStream 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 {
0x627d4c6093b078e7 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(DeviceQueryRequest);
fidl::encoding::Decoder::decode_into::<DeviceQueryRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = DeviceControlHandle { inner: this.inner.clone() };
Ok(DeviceRequest::Query {
query_id: req.query_id,
responder: DeviceQueryResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x3a5b134714c67914 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(DeviceConnect2Request);
fidl::encoding::Decoder::decode_into::<DeviceConnect2Request>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = DeviceControlHandle { inner: this.inner.clone() };
Ok(DeviceRequest::Connect2 {
client_id: req.client_id,
primary_channel: req.primary_channel,
notification_channel: req.notification_channel,
control_handle,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
})
}
}
#[derive(Debug)]
pub enum DeviceRequest {
Query { query_id: QueryId, responder: DeviceQueryResponder },
Connect2 {
client_id: u64,
primary_channel: fidl::endpoints::ServerEnd<PrimaryMarker>,
notification_channel: fidl::endpoints::ServerEnd<NotificationMarker>,
control_handle: DeviceControlHandle,
},
}
impl DeviceRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_query(self) -> Option<(QueryId, DeviceQueryResponder)> {
if let DeviceRequest::Query { query_id, responder } = self {
Some((query_id, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_connect2(
self,
) -> Option<(
u64,
fidl::endpoints::ServerEnd<PrimaryMarker>,
fidl::endpoints::ServerEnd<NotificationMarker>,
DeviceControlHandle,
)> {
if let DeviceRequest::Connect2 {
client_id,
primary_channel,
notification_channel,
control_handle,
} = self
{
Some((client_id, primary_channel, notification_channel, control_handle))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
DeviceRequest::Query { .. } => "query",
DeviceRequest::Connect2 { .. } => "connect2",
}
}
}
#[derive(Debug, Clone)]
pub struct DeviceControlHandle {
inner: std::sync::Arc<fidl::ServeInner>,
}
impl fidl::endpoints::ControlHandle for DeviceControlHandle {
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 DeviceControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct DeviceQueryResponder {
control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for DeviceQueryResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for DeviceQueryResponder {
type ControlHandle = DeviceControlHandle;
fn control_handle(&self) -> &DeviceControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl DeviceQueryResponder {
pub fn send(self, mut result: Result<DeviceQueryResponse, 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<DeviceQueryResponse, i32>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<DeviceQueryResponse, i32>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<DeviceQueryResponse, i32>>(
result.as_mut().map_err(|e| *e),
self.tx_id,
0x627d4c6093b078e7,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct DiagnosticDeviceMarker;
impl fidl::endpoints::ProtocolMarker for DiagnosticDeviceMarker {
type Proxy = DiagnosticDeviceProxy;
type RequestStream = DiagnosticDeviceRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = DiagnosticDeviceSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) DiagnosticDevice";
}
pub trait DiagnosticDeviceProxyInterface: Send + Sync {
fn r#dump_state(&self, dump_type: u32) -> Result<(), fidl::Error>;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct DiagnosticDeviceSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for DiagnosticDeviceSynchronousProxy {
type Proxy = DiagnosticDeviceProxy;
type Protocol = DiagnosticDeviceMarker;
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 DiagnosticDeviceSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <DiagnosticDeviceMarker 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<DiagnosticDeviceEvent, fidl::Error> {
DiagnosticDeviceEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#dump_state(&self, mut dump_type: u32) -> Result<(), fidl::Error> {
self.client.send::<DiagnosticDeviceDumpStateRequest>(
(dump_type,),
0x5420df493d4fa915,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Clone)]
pub struct DiagnosticDeviceProxy {
client: fidl::client::Client,
}
impl fidl::endpoints::Proxy for DiagnosticDeviceProxy {
type Protocol = DiagnosticDeviceMarker;
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 DiagnosticDeviceProxy {
pub fn new(channel: fidl::AsyncChannel) -> Self {
let protocol_name = <DiagnosticDeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> DiagnosticDeviceEventStream {
DiagnosticDeviceEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#dump_state(&self, mut dump_type: u32) -> Result<(), fidl::Error> {
DiagnosticDeviceProxyInterface::r#dump_state(self, dump_type)
}
}
impl DiagnosticDeviceProxyInterface for DiagnosticDeviceProxy {
fn r#dump_state(&self, mut dump_type: u32) -> Result<(), fidl::Error> {
self.client.send::<DiagnosticDeviceDumpStateRequest>(
(dump_type,),
0x5420df493d4fa915,
fidl::encoding::DynamicFlags::empty(),
)
}
}
pub struct DiagnosticDeviceEventStream {
event_receiver: fidl::client::EventReceiver,
}
impl std::marker::Unpin for DiagnosticDeviceEventStream {}
impl futures::stream::FusedStream for DiagnosticDeviceEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for DiagnosticDeviceEventStream {
type Item = Result<DiagnosticDeviceEvent, 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(DiagnosticDeviceEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum DiagnosticDeviceEvent {}
impl DiagnosticDeviceEvent {
fn decode(mut buf: fidl::MessageBufEtc) -> Result<DiagnosticDeviceEvent, 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:
<DiagnosticDeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct DiagnosticDeviceRequestStream {
inner: std::sync::Arc<fidl::ServeInner>,
is_terminated: bool,
}
impl std::marker::Unpin for DiagnosticDeviceRequestStream {}
impl futures::stream::FusedStream for DiagnosticDeviceRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for DiagnosticDeviceRequestStream {
type Protocol = DiagnosticDeviceMarker;
type ControlHandle = DiagnosticDeviceControlHandle;
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 {
DiagnosticDeviceControlHandle { 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 DiagnosticDeviceRequestStream {
type Item = Result<DiagnosticDeviceRequest, 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 DiagnosticDeviceRequestStream 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 {
0x5420df493d4fa915 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(DiagnosticDeviceDumpStateRequest);
fidl::encoding::Decoder::decode_into::<DiagnosticDeviceDumpStateRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle =
DiagnosticDeviceControlHandle { inner: this.inner.clone() };
Ok(DiagnosticDeviceRequest::DumpState {
dump_type: req.dump_type,
control_handle,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<DiagnosticDeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
})
}
}
#[derive(Debug)]
pub enum DiagnosticDeviceRequest {
DumpState { dump_type: u32, control_handle: DiagnosticDeviceControlHandle },
}
impl DiagnosticDeviceRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_dump_state(self) -> Option<(u32, DiagnosticDeviceControlHandle)> {
if let DiagnosticDeviceRequest::DumpState { dump_type, control_handle } = self {
Some((dump_type, control_handle))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
DiagnosticDeviceRequest::DumpState { .. } => "dump_state",
}
}
}
#[derive(Debug, Clone)]
pub struct DiagnosticDeviceControlHandle {
inner: std::sync::Arc<fidl::ServeInner>,
}
impl fidl::endpoints::ControlHandle for DiagnosticDeviceControlHandle {
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 DiagnosticDeviceControlHandle {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct IcdLoaderDeviceMarker;
impl fidl::endpoints::ProtocolMarker for IcdLoaderDeviceMarker {
type Proxy = IcdLoaderDeviceProxy;
type RequestStream = IcdLoaderDeviceRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = IcdLoaderDeviceSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) IcdLoaderDevice";
}
pub trait IcdLoaderDeviceProxyInterface: Send + Sync {
type GetIcdListResponseFut: std::future::Future<Output = Result<Vec<IcdInfo>, fidl::Error>>
+ Send;
fn r#get_icd_list(&self) -> Self::GetIcdListResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct IcdLoaderDeviceSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for IcdLoaderDeviceSynchronousProxy {
type Proxy = IcdLoaderDeviceProxy;
type Protocol = IcdLoaderDeviceMarker;
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 IcdLoaderDeviceSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <IcdLoaderDeviceMarker 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<IcdLoaderDeviceEvent, fidl::Error> {
IcdLoaderDeviceEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#get_icd_list(&self, ___deadline: zx::Time) -> Result<Vec<IcdInfo>, fidl::Error> {
let _response = self
.client
.send_query::<fidl::encoding::EmptyPayload, IcdLoaderDeviceGetIcdListResponse>(
(),
0x7673e76395008257,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.icd_list)
}
}
#[derive(Debug, Clone)]
pub struct IcdLoaderDeviceProxy {
client: fidl::client::Client,
}
impl fidl::endpoints::Proxy for IcdLoaderDeviceProxy {
type Protocol = IcdLoaderDeviceMarker;
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 IcdLoaderDeviceProxy {
pub fn new(channel: fidl::AsyncChannel) -> Self {
let protocol_name = <IcdLoaderDeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> IcdLoaderDeviceEventStream {
IcdLoaderDeviceEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#get_icd_list(&self) -> fidl::client::QueryResponseFut<Vec<IcdInfo>> {
IcdLoaderDeviceProxyInterface::r#get_icd_list(self)
}
}
impl IcdLoaderDeviceProxyInterface for IcdLoaderDeviceProxy {
type GetIcdListResponseFut = fidl::client::QueryResponseFut<Vec<IcdInfo>>;
fn r#get_icd_list(&self) -> Self::GetIcdListResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<Vec<IcdInfo>, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
IcdLoaderDeviceGetIcdListResponse,
0x7673e76395008257,
>(_buf?)?;
Ok(_response.icd_list)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<IcdInfo>>(
(),
0x7673e76395008257,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct IcdLoaderDeviceEventStream {
event_receiver: fidl::client::EventReceiver,
}
impl std::marker::Unpin for IcdLoaderDeviceEventStream {}
impl futures::stream::FusedStream for IcdLoaderDeviceEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for IcdLoaderDeviceEventStream {
type Item = Result<IcdLoaderDeviceEvent, 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(IcdLoaderDeviceEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum IcdLoaderDeviceEvent {}
impl IcdLoaderDeviceEvent {
fn decode(mut buf: fidl::MessageBufEtc) -> Result<IcdLoaderDeviceEvent, 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:
<IcdLoaderDeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct IcdLoaderDeviceRequestStream {
inner: std::sync::Arc<fidl::ServeInner>,
is_terminated: bool,
}
impl std::marker::Unpin for IcdLoaderDeviceRequestStream {}
impl futures::stream::FusedStream for IcdLoaderDeviceRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for IcdLoaderDeviceRequestStream {
type Protocol = IcdLoaderDeviceMarker;
type ControlHandle = IcdLoaderDeviceControlHandle;
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 {
IcdLoaderDeviceControlHandle { 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 IcdLoaderDeviceRequestStream {
type Item = Result<IcdLoaderDeviceRequest, 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 IcdLoaderDeviceRequestStream 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 {
0x7673e76395008257 => {
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 = IcdLoaderDeviceControlHandle { inner: this.inner.clone() };
Ok(IcdLoaderDeviceRequest::GetIcdList {
responder: IcdLoaderDeviceGetIcdListResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<IcdLoaderDeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
})
}
}
#[derive(Debug)]
pub enum IcdLoaderDeviceRequest {
GetIcdList { responder: IcdLoaderDeviceGetIcdListResponder },
}
impl IcdLoaderDeviceRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_get_icd_list(self) -> Option<(IcdLoaderDeviceGetIcdListResponder)> {
if let IcdLoaderDeviceRequest::GetIcdList { responder } = self {
Some((responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
IcdLoaderDeviceRequest::GetIcdList { .. } => "get_icd_list",
}
}
}
#[derive(Debug, Clone)]
pub struct IcdLoaderDeviceControlHandle {
inner: std::sync::Arc<fidl::ServeInner>,
}
impl fidl::endpoints::ControlHandle for IcdLoaderDeviceControlHandle {
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 IcdLoaderDeviceControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct IcdLoaderDeviceGetIcdListResponder {
control_handle: std::mem::ManuallyDrop<IcdLoaderDeviceControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for IcdLoaderDeviceGetIcdListResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for IcdLoaderDeviceGetIcdListResponder {
type ControlHandle = IcdLoaderDeviceControlHandle;
fn control_handle(&self) -> &IcdLoaderDeviceControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl IcdLoaderDeviceGetIcdListResponder {
pub fn send(self, mut icd_list: &[IcdInfo]) -> Result<(), fidl::Error> {
let _result = self.send_raw(icd_list);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut icd_list: &[IcdInfo]) -> Result<(), fidl::Error> {
let _result = self.send_raw(icd_list);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut icd_list: &[IcdInfo]) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<IcdLoaderDeviceGetIcdListResponse>(
(icd_list,),
self.tx_id,
0x7673e76395008257,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct NotificationMarker;
impl fidl::endpoints::ProtocolMarker for NotificationMarker {
type Proxy = NotificationProxy;
type RequestStream = NotificationRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = NotificationSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) Notification";
}
pub trait NotificationProxyInterface: Send + Sync {}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct NotificationSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for NotificationSynchronousProxy {
type Proxy = NotificationProxy;
type Protocol = NotificationMarker;
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 NotificationSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <NotificationMarker 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<NotificationEvent, fidl::Error> {
NotificationEvent::decode(self.client.wait_for_event(deadline)?)
}
}
#[derive(Debug, Clone)]
pub struct NotificationProxy {
client: fidl::client::Client,
}
impl fidl::endpoints::Proxy for NotificationProxy {
type Protocol = NotificationMarker;
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 NotificationProxy {
pub fn new(channel: fidl::AsyncChannel) -> Self {
let protocol_name = <NotificationMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> NotificationEventStream {
NotificationEventStream { event_receiver: self.client.take_event_receiver() }
}
}
impl NotificationProxyInterface for NotificationProxy {}
pub struct NotificationEventStream {
event_receiver: fidl::client::EventReceiver,
}
impl std::marker::Unpin for NotificationEventStream {}
impl futures::stream::FusedStream for NotificationEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for NotificationEventStream {
type Item = Result<NotificationEvent, 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(NotificationEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum NotificationEvent {}
impl NotificationEvent {
fn decode(mut buf: fidl::MessageBufEtc) -> Result<NotificationEvent, 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: <NotificationMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct NotificationRequestStream {
inner: std::sync::Arc<fidl::ServeInner>,
is_terminated: bool,
}
impl std::marker::Unpin for NotificationRequestStream {}
impl futures::stream::FusedStream for NotificationRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for NotificationRequestStream {
type Protocol = NotificationMarker;
type ControlHandle = NotificationControlHandle;
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 {
NotificationControlHandle { 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 NotificationRequestStream {
type Item = Result<NotificationRequest, 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 NotificationRequestStream 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 {
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<NotificationMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
})
}
}
#[derive(Debug)]
pub enum NotificationRequest {}
impl NotificationRequest {
pub fn method_name(&self) -> &'static str {
match *self {}
}
}
#[derive(Debug, Clone)]
pub struct NotificationControlHandle {
inner: std::sync::Arc<fidl::ServeInner>,
}
impl fidl::endpoints::ControlHandle for NotificationControlHandle {
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 NotificationControlHandle {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct PerformanceCounterAccessMarker;
impl fidl::endpoints::ProtocolMarker for PerformanceCounterAccessMarker {
type Proxy = PerformanceCounterAccessProxy;
type RequestStream = PerformanceCounterAccessRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = PerformanceCounterAccessSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) PerformanceCounterAccess";
}
pub trait PerformanceCounterAccessProxyInterface: Send + Sync {
type GetPerformanceCountTokenResponseFut: std::future::Future<Output = Result<fidl::Event, fidl::Error>>
+ Send;
fn r#get_performance_count_token(&self) -> Self::GetPerformanceCountTokenResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct PerformanceCounterAccessSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for PerformanceCounterAccessSynchronousProxy {
type Proxy = PerformanceCounterAccessProxy;
type Protocol = PerformanceCounterAccessMarker;
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 PerformanceCounterAccessSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name =
<PerformanceCounterAccessMarker 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<PerformanceCounterAccessEvent, fidl::Error> {
PerformanceCounterAccessEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#get_performance_count_token(
&self,
___deadline: zx::Time,
) -> Result<fidl::Event, fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
PerformanceCounterAccessGetPerformanceCountTokenResponse,
>(
(),
0x48410470c5f00f92,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.access_token)
}
}
#[derive(Debug, Clone)]
pub struct PerformanceCounterAccessProxy {
client: fidl::client::Client,
}
impl fidl::endpoints::Proxy for PerformanceCounterAccessProxy {
type Protocol = PerformanceCounterAccessMarker;
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 PerformanceCounterAccessProxy {
pub fn new(channel: fidl::AsyncChannel) -> Self {
let protocol_name =
<PerformanceCounterAccessMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> PerformanceCounterAccessEventStream {
PerformanceCounterAccessEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#get_performance_count_token(&self) -> fidl::client::QueryResponseFut<fidl::Event> {
PerformanceCounterAccessProxyInterface::r#get_performance_count_token(self)
}
}
impl PerformanceCounterAccessProxyInterface for PerformanceCounterAccessProxy {
type GetPerformanceCountTokenResponseFut = fidl::client::QueryResponseFut<fidl::Event>;
fn r#get_performance_count_token(&self) -> Self::GetPerformanceCountTokenResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<fidl::Event, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
PerformanceCounterAccessGetPerformanceCountTokenResponse,
0x48410470c5f00f92,
>(_buf?)?;
Ok(_response.access_token)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Event>(
(),
0x48410470c5f00f92,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct PerformanceCounterAccessEventStream {
event_receiver: fidl::client::EventReceiver,
}
impl std::marker::Unpin for PerformanceCounterAccessEventStream {}
impl futures::stream::FusedStream for PerformanceCounterAccessEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for PerformanceCounterAccessEventStream {
type Item = Result<PerformanceCounterAccessEvent, 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(PerformanceCounterAccessEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum PerformanceCounterAccessEvent {}
impl PerformanceCounterAccessEvent {
fn decode(mut buf: fidl::MessageBufEtc) -> Result<PerformanceCounterAccessEvent, 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:
<PerformanceCounterAccessMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct PerformanceCounterAccessRequestStream {
inner: std::sync::Arc<fidl::ServeInner>,
is_terminated: bool,
}
impl std::marker::Unpin for PerformanceCounterAccessRequestStream {}
impl futures::stream::FusedStream for PerformanceCounterAccessRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for PerformanceCounterAccessRequestStream {
type Protocol = PerformanceCounterAccessMarker;
type ControlHandle = PerformanceCounterAccessControlHandle;
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 {
PerformanceCounterAccessControlHandle { 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 PerformanceCounterAccessRequestStream {
type Item = Result<PerformanceCounterAccessRequest, 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 PerformanceCounterAccessRequestStream 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 {
0x48410470c5f00f92 => {
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 = PerformanceCounterAccessControlHandle {
inner: this.inner.clone(),
};
Ok(PerformanceCounterAccessRequest::GetPerformanceCountToken {
responder: PerformanceCounterAccessGetPerformanceCountTokenResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <PerformanceCounterAccessMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
})
}
}
#[derive(Debug)]
pub enum PerformanceCounterAccessRequest {
GetPerformanceCountToken {
responder: PerformanceCounterAccessGetPerformanceCountTokenResponder,
},
}
impl PerformanceCounterAccessRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_get_performance_count_token(
self,
) -> Option<(PerformanceCounterAccessGetPerformanceCountTokenResponder)> {
if let PerformanceCounterAccessRequest::GetPerformanceCountToken { responder } = self {
Some((responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
PerformanceCounterAccessRequest::GetPerformanceCountToken { .. } => {
"get_performance_count_token"
}
}
}
}
#[derive(Debug, Clone)]
pub struct PerformanceCounterAccessControlHandle {
inner: std::sync::Arc<fidl::ServeInner>,
}
impl fidl::endpoints::ControlHandle for PerformanceCounterAccessControlHandle {
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 PerformanceCounterAccessControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct PerformanceCounterAccessGetPerformanceCountTokenResponder {
control_handle: std::mem::ManuallyDrop<PerformanceCounterAccessControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for PerformanceCounterAccessGetPerformanceCountTokenResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for PerformanceCounterAccessGetPerformanceCountTokenResponder {
type ControlHandle = PerformanceCounterAccessControlHandle;
fn control_handle(&self) -> &PerformanceCounterAccessControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl PerformanceCounterAccessGetPerformanceCountTokenResponder {
pub fn send(self, mut access_token: fidl::Event) -> Result<(), fidl::Error> {
let _result = self.send_raw(access_token);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut access_token: fidl::Event) -> Result<(), fidl::Error> {
let _result = self.send_raw(access_token);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut access_token: fidl::Event) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<PerformanceCounterAccessGetPerformanceCountTokenResponse>(
(access_token,),
self.tx_id,
0x48410470c5f00f92,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct PerformanceCounterEventsMarker;
impl fidl::endpoints::ProtocolMarker for PerformanceCounterEventsMarker {
type Proxy = PerformanceCounterEventsProxy;
type RequestStream = PerformanceCounterEventsRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = PerformanceCounterEventsSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) PerformanceCounterEvents";
}
pub trait PerformanceCounterEventsProxyInterface: Send + Sync {}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct PerformanceCounterEventsSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for PerformanceCounterEventsSynchronousProxy {
type Proxy = PerformanceCounterEventsProxy;
type Protocol = PerformanceCounterEventsMarker;
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 PerformanceCounterEventsSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name =
<PerformanceCounterEventsMarker 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<PerformanceCounterEventsEvent, fidl::Error> {
PerformanceCounterEventsEvent::decode(self.client.wait_for_event(deadline)?)
}
}
#[derive(Debug, Clone)]
pub struct PerformanceCounterEventsProxy {
client: fidl::client::Client,
}
impl fidl::endpoints::Proxy for PerformanceCounterEventsProxy {
type Protocol = PerformanceCounterEventsMarker;
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 PerformanceCounterEventsProxy {
pub fn new(channel: fidl::AsyncChannel) -> Self {
let protocol_name =
<PerformanceCounterEventsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> PerformanceCounterEventsEventStream {
PerformanceCounterEventsEventStream { event_receiver: self.client.take_event_receiver() }
}
}
impl PerformanceCounterEventsProxyInterface for PerformanceCounterEventsProxy {}
pub struct PerformanceCounterEventsEventStream {
event_receiver: fidl::client::EventReceiver,
}
impl std::marker::Unpin for PerformanceCounterEventsEventStream {}
impl futures::stream::FusedStream for PerformanceCounterEventsEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for PerformanceCounterEventsEventStream {
type Item = Result<PerformanceCounterEventsEvent, 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(PerformanceCounterEventsEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum PerformanceCounterEventsEvent {
OnPerformanceCounterReadCompleted {
payload: PerformanceCounterEventsOnPerformanceCounterReadCompletedRequest,
},
}
impl PerformanceCounterEventsEvent {
#[allow(irrefutable_let_patterns)]
pub fn into_on_performance_counter_read_completed(
self,
) -> Option<PerformanceCounterEventsOnPerformanceCounterReadCompletedRequest> {
if let PerformanceCounterEventsEvent::OnPerformanceCounterReadCompleted { payload } = self {
Some((payload))
} else {
None
}
}
fn decode(mut buf: fidl::MessageBufEtc) -> Result<PerformanceCounterEventsEvent, 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 {
0x3f134926720d44d7 => {
let mut out = fidl::new_empty!(
PerformanceCounterEventsOnPerformanceCounterReadCompletedRequest
);
fidl::encoding::Decoder::decode_into::<
PerformanceCounterEventsOnPerformanceCounterReadCompletedRequest,
>(&tx_header, _body_bytes, _handles, &mut out)?;
Ok((PerformanceCounterEventsEvent::OnPerformanceCounterReadCompleted {
payload: out,
}))
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name:
<PerformanceCounterEventsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct PerformanceCounterEventsRequestStream {
inner: std::sync::Arc<fidl::ServeInner>,
is_terminated: bool,
}
impl std::marker::Unpin for PerformanceCounterEventsRequestStream {}
impl futures::stream::FusedStream for PerformanceCounterEventsRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for PerformanceCounterEventsRequestStream {
type Protocol = PerformanceCounterEventsMarker;
type ControlHandle = PerformanceCounterEventsControlHandle;
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 {
PerformanceCounterEventsControlHandle { 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 PerformanceCounterEventsRequestStream {
type Item = Result<PerformanceCounterEventsRequest, 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 PerformanceCounterEventsRequestStream 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 {
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <PerformanceCounterEventsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
})
}
}
#[derive(Debug)]
pub enum PerformanceCounterEventsRequest {}
impl PerformanceCounterEventsRequest {
pub fn method_name(&self) -> &'static str {
match *self {}
}
}
#[derive(Debug, Clone)]
pub struct PerformanceCounterEventsControlHandle {
inner: std::sync::Arc<fidl::ServeInner>,
}
impl fidl::endpoints::ControlHandle for PerformanceCounterEventsControlHandle {
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 PerformanceCounterEventsControlHandle {
pub fn send_on_performance_counter_read_completed(
&self,
mut payload: &PerformanceCounterEventsOnPerformanceCounterReadCompletedRequest,
) -> Result<(), fidl::Error> {
self.inner.send::<PerformanceCounterEventsOnPerformanceCounterReadCompletedRequest>(
payload,
0,
0x3f134926720d44d7,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct PrimaryMarker;
impl fidl::endpoints::ProtocolMarker for PrimaryMarker {
type Proxy = PrimaryProxy;
type RequestStream = PrimaryRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = PrimarySynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) Primary";
}
pub trait PrimaryProxyInterface: Send + Sync {
fn r#import_object2(
&self,
object: fidl::Handle,
object_type: ObjectType,
object_id: u64,
) -> Result<(), fidl::Error>;
fn r#import_object(&self, payload: PrimaryImportObjectRequest) -> Result<(), fidl::Error>;
fn r#release_object(&self, object_id: u64, object_type: ObjectType) -> Result<(), fidl::Error>;
fn r#create_context(&self, context_id: u32) -> Result<(), fidl::Error>;
fn r#destroy_context(&self, context_id: u32) -> Result<(), fidl::Error>;
fn r#execute_command(
&self,
context_id: u32,
resources: &[BufferRange],
command_buffers: &[CommandBuffer],
wait_semaphores: &[u64],
signal_semaphores: &[u64],
flags: CommandBufferFlags,
) -> Result<(), fidl::Error>;
fn r#execute_immediate_commands(
&self,
context_id: u32,
command_data: &[u8],
semaphores: &[u64],
) -> Result<(), fidl::Error>;
fn r#execute_inline_commands(
&self,
context_id: u32,
commands: &[InlineCommand],
) -> Result<(), fidl::Error>;
type FlushResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#flush(&self) -> Self::FlushResponseFut;
fn r#map_buffer(&self, payload: &PrimaryMapBufferRequest) -> Result<(), fidl::Error>;
fn r#unmap_buffer(&self, payload: &PrimaryUnmapBufferRequest) -> Result<(), fidl::Error>;
fn r#buffer_range_op2(&self, op: BufferOp, range: &BufferRange) -> Result<(), fidl::Error>;
fn r#enable_flow_control(&self) -> Result<(), fidl::Error>;
fn r#enable_performance_counter_access(
&self,
access_token: fidl::Event,
) -> Result<(), fidl::Error>;
type IsPerformanceCounterAccessAllowedResponseFut: std::future::Future<Output = Result<bool, fidl::Error>>
+ Send;
fn r#is_performance_counter_access_allowed(
&self,
) -> Self::IsPerformanceCounterAccessAllowedResponseFut;
fn r#enable_performance_counters(&self, counters: &[u64]) -> Result<(), fidl::Error>;
fn r#create_performance_counter_buffer_pool(
&self,
pool_id: u64,
event_channel: fidl::endpoints::ServerEnd<PerformanceCounterEventsMarker>,
) -> Result<(), fidl::Error>;
fn r#release_performance_counter_buffer_pool(&self, pool_id: u64) -> Result<(), fidl::Error>;
fn r#add_performance_counter_buffer_offsets_to_pool(
&self,
pool_id: u64,
offsets: &[BufferRange],
) -> Result<(), fidl::Error>;
fn r#remove_performance_counter_buffer_from_pool(
&self,
pool_id: u64,
buffer_id: u64,
) -> Result<(), fidl::Error>;
fn r#dump_performance_counters(&self, pool_id: u64, trigger_id: u32)
-> Result<(), fidl::Error>;
fn r#clear_performance_counters(&self, counters: &[u64]) -> Result<(), fidl::Error>;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct PrimarySynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for PrimarySynchronousProxy {
type Proxy = PrimaryProxy;
type Protocol = PrimaryMarker;
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 PrimarySynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <PrimaryMarker 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<PrimaryEvent, fidl::Error> {
PrimaryEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#import_object2(
&self,
mut object: fidl::Handle,
mut object_type: ObjectType,
mut object_id: u64,
) -> Result<(), fidl::Error> {
self.client.send::<PrimaryImportObject2Request>(
(object, object_type, object_id),
0x774ef4bc434f6b40,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#import_object(
&self,
mut payload: PrimaryImportObjectRequest,
) -> Result<(), fidl::Error> {
self.client.send::<PrimaryImportObjectRequest>(
&mut payload,
0x5f5a247abb1d9354,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#release_object(
&self,
mut object_id: u64,
mut object_type: ObjectType,
) -> Result<(), fidl::Error> {
self.client.send::<PrimaryReleaseObjectRequest>(
(object_id, object_type),
0x4a65d5885da5e88f,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#create_context(&self, mut context_id: u32) -> Result<(), fidl::Error> {
self.client.send::<PrimaryCreateContextRequest>(
(context_id,),
0x5a9a91c8b88b5da4,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#destroy_context(&self, mut context_id: u32) -> Result<(), fidl::Error> {
self.client.send::<PrimaryDestroyContextRequest>(
(context_id,),
0x26b626e6be162ef0,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#execute_command(
&self,
mut context_id: u32,
mut resources: &[BufferRange],
mut command_buffers: &[CommandBuffer],
mut wait_semaphores: &[u64],
mut signal_semaphores: &[u64],
mut flags: CommandBufferFlags,
) -> Result<(), fidl::Error> {
self.client.send::<PrimaryExecuteCommandRequest>(
(context_id, resources, command_buffers, wait_semaphores, signal_semaphores, flags),
0xf2799643aadb0db,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#execute_immediate_commands(
&self,
mut context_id: u32,
mut command_data: &[u8],
mut semaphores: &[u64],
) -> Result<(), fidl::Error> {
self.client.send::<PrimaryExecuteImmediateCommandsRequest>(
(context_id, command_data, semaphores),
0x3d7e0dcdbfd4b61f,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#execute_inline_commands(
&self,
mut context_id: u32,
mut commands: &[InlineCommand],
) -> Result<(), fidl::Error> {
self.client.send::<PrimaryExecuteInlineCommandsRequest>(
(context_id, commands),
0x766d5c86f35468a6,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#flush(&self, ___deadline: zx::Time) -> Result<(), fidl::Error> {
let _response =
self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::EmptyPayload>(
(),
0x54ccb5572d886039,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
pub fn r#map_buffer(&self, mut payload: &PrimaryMapBufferRequest) -> Result<(), fidl::Error> {
self.client.send::<PrimaryMapBufferRequest>(
payload,
0x56baa5d2092c8e33,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#unmap_buffer(
&self,
mut payload: &PrimaryUnmapBufferRequest,
) -> Result<(), fidl::Error> {
self.client.send::<PrimaryUnmapBufferRequest>(
payload,
0x305188ebd8bcd95c,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#buffer_range_op2(
&self,
mut op: BufferOp,
mut range: &BufferRange,
) -> Result<(), fidl::Error> {
self.client.send::<PrimaryBufferRangeOp2Request>(
(op, range),
0x4175c8dfef355396,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#enable_flow_control(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x8b5e68f3ee0b22e,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#enable_performance_counter_access(
&self,
mut access_token: fidl::Event,
) -> Result<(), fidl::Error> {
self.client.send::<PrimaryEnablePerformanceCounterAccessRequest>(
(access_token,),
0x51b369ac16588831,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#is_performance_counter_access_allowed(
&self,
___deadline: zx::Time,
) -> Result<bool, fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
PrimaryIsPerformanceCounterAccessAllowedResponse,
>(
(),
0x1933b70c06cc5702,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.enabled)
}
pub fn r#enable_performance_counters(&self, mut counters: &[u64]) -> Result<(), fidl::Error> {
self.client.send::<PrimaryEnablePerformanceCountersRequest>(
(counters,),
0x52c4db74b601aaa7,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#create_performance_counter_buffer_pool(
&self,
mut pool_id: u64,
mut event_channel: fidl::endpoints::ServerEnd<PerformanceCounterEventsMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<PrimaryCreatePerformanceCounterBufferPoolRequest>(
(pool_id, event_channel),
0x48ccf6519bbbc638,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#release_performance_counter_buffer_pool(
&self,
mut pool_id: u64,
) -> Result<(), fidl::Error> {
self.client.send::<PrimaryReleasePerformanceCounterBufferPoolRequest>(
(pool_id,),
0x18374c4b3ef0b4da,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#add_performance_counter_buffer_offsets_to_pool(
&self,
mut pool_id: u64,
mut offsets: &[BufferRange],
) -> Result<(), fidl::Error> {
self.client.send::<PrimaryAddPerformanceCounterBufferOffsetsToPoolRequest>(
(pool_id, offsets),
0x1f7889571111386b,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#remove_performance_counter_buffer_from_pool(
&self,
mut pool_id: u64,
mut buffer_id: u64,
) -> Result<(), fidl::Error> {
self.client.send::<PrimaryRemovePerformanceCounterBufferFromPoolRequest>(
(pool_id, buffer_id),
0xbf1275f5a36258e,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#dump_performance_counters(
&self,
mut pool_id: u64,
mut trigger_id: u32,
) -> Result<(), fidl::Error> {
self.client.send::<PrimaryDumpPerformanceCountersRequest>(
(pool_id, trigger_id),
0x250b29340be28807,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#clear_performance_counters(&self, mut counters: &[u64]) -> Result<(), fidl::Error> {
self.client.send::<PrimaryClearPerformanceCountersRequest>(
(counters,),
0x236831822eff741a,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Clone)]
pub struct PrimaryProxy {
client: fidl::client::Client,
}
impl fidl::endpoints::Proxy for PrimaryProxy {
type Protocol = PrimaryMarker;
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 PrimaryProxy {
pub fn new(channel: fidl::AsyncChannel) -> Self {
let protocol_name = <PrimaryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> PrimaryEventStream {
PrimaryEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#import_object2(
&self,
mut object: fidl::Handle,
mut object_type: ObjectType,
mut object_id: u64,
) -> Result<(), fidl::Error> {
PrimaryProxyInterface::r#import_object2(self, object, object_type, object_id)
}
pub fn r#import_object(
&self,
mut payload: PrimaryImportObjectRequest,
) -> Result<(), fidl::Error> {
PrimaryProxyInterface::r#import_object(self, payload)
}
pub fn r#release_object(
&self,
mut object_id: u64,
mut object_type: ObjectType,
) -> Result<(), fidl::Error> {
PrimaryProxyInterface::r#release_object(self, object_id, object_type)
}
pub fn r#create_context(&self, mut context_id: u32) -> Result<(), fidl::Error> {
PrimaryProxyInterface::r#create_context(self, context_id)
}
pub fn r#destroy_context(&self, mut context_id: u32) -> Result<(), fidl::Error> {
PrimaryProxyInterface::r#destroy_context(self, context_id)
}
pub fn r#execute_command(
&self,
mut context_id: u32,
mut resources: &[BufferRange],
mut command_buffers: &[CommandBuffer],
mut wait_semaphores: &[u64],
mut signal_semaphores: &[u64],
mut flags: CommandBufferFlags,
) -> Result<(), fidl::Error> {
PrimaryProxyInterface::r#execute_command(
self,
context_id,
resources,
command_buffers,
wait_semaphores,
signal_semaphores,
flags,
)
}
pub fn r#execute_immediate_commands(
&self,
mut context_id: u32,
mut command_data: &[u8],
mut semaphores: &[u64],
) -> Result<(), fidl::Error> {
PrimaryProxyInterface::r#execute_immediate_commands(
self,
context_id,
command_data,
semaphores,
)
}
pub fn r#execute_inline_commands(
&self,
mut context_id: u32,
mut commands: &[InlineCommand],
) -> Result<(), fidl::Error> {
PrimaryProxyInterface::r#execute_inline_commands(self, context_id, commands)
}
pub fn r#flush(&self) -> fidl::client::QueryResponseFut<()> {
PrimaryProxyInterface::r#flush(self)
}
pub fn r#map_buffer(&self, mut payload: &PrimaryMapBufferRequest) -> Result<(), fidl::Error> {
PrimaryProxyInterface::r#map_buffer(self, payload)
}
pub fn r#unmap_buffer(
&self,
mut payload: &PrimaryUnmapBufferRequest,
) -> Result<(), fidl::Error> {
PrimaryProxyInterface::r#unmap_buffer(self, payload)
}
pub fn r#buffer_range_op2(
&self,
mut op: BufferOp,
mut range: &BufferRange,
) -> Result<(), fidl::Error> {
PrimaryProxyInterface::r#buffer_range_op2(self, op, range)
}
pub fn r#enable_flow_control(&self) -> Result<(), fidl::Error> {
PrimaryProxyInterface::r#enable_flow_control(self)
}
pub fn r#enable_performance_counter_access(
&self,
mut access_token: fidl::Event,
) -> Result<(), fidl::Error> {
PrimaryProxyInterface::r#enable_performance_counter_access(self, access_token)
}
pub fn r#is_performance_counter_access_allowed(&self) -> fidl::client::QueryResponseFut<bool> {
PrimaryProxyInterface::r#is_performance_counter_access_allowed(self)
}
pub fn r#enable_performance_counters(&self, mut counters: &[u64]) -> Result<(), fidl::Error> {
PrimaryProxyInterface::r#enable_performance_counters(self, counters)
}
pub fn r#create_performance_counter_buffer_pool(
&self,
mut pool_id: u64,
mut event_channel: fidl::endpoints::ServerEnd<PerformanceCounterEventsMarker>,
) -> Result<(), fidl::Error> {
PrimaryProxyInterface::r#create_performance_counter_buffer_pool(
self,
pool_id,
event_channel,
)
}
pub fn r#release_performance_counter_buffer_pool(
&self,
mut pool_id: u64,
) -> Result<(), fidl::Error> {
PrimaryProxyInterface::r#release_performance_counter_buffer_pool(self, pool_id)
}
pub fn r#add_performance_counter_buffer_offsets_to_pool(
&self,
mut pool_id: u64,
mut offsets: &[BufferRange],
) -> Result<(), fidl::Error> {
PrimaryProxyInterface::r#add_performance_counter_buffer_offsets_to_pool(
self, pool_id, offsets,
)
}
pub fn r#remove_performance_counter_buffer_from_pool(
&self,
mut pool_id: u64,
mut buffer_id: u64,
) -> Result<(), fidl::Error> {
PrimaryProxyInterface::r#remove_performance_counter_buffer_from_pool(
self, pool_id, buffer_id,
)
}
pub fn r#dump_performance_counters(
&self,
mut pool_id: u64,
mut trigger_id: u32,
) -> Result<(), fidl::Error> {
PrimaryProxyInterface::r#dump_performance_counters(self, pool_id, trigger_id)
}
pub fn r#clear_performance_counters(&self, mut counters: &[u64]) -> Result<(), fidl::Error> {
PrimaryProxyInterface::r#clear_performance_counters(self, counters)
}
}
impl PrimaryProxyInterface for PrimaryProxy {
fn r#import_object2(
&self,
mut object: fidl::Handle,
mut object_type: ObjectType,
mut object_id: u64,
) -> Result<(), fidl::Error> {
self.client.send::<PrimaryImportObject2Request>(
(object, object_type, object_id),
0x774ef4bc434f6b40,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#import_object(&self, mut payload: PrimaryImportObjectRequest) -> Result<(), fidl::Error> {
self.client.send::<PrimaryImportObjectRequest>(
&mut payload,
0x5f5a247abb1d9354,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#release_object(
&self,
mut object_id: u64,
mut object_type: ObjectType,
) -> Result<(), fidl::Error> {
self.client.send::<PrimaryReleaseObjectRequest>(
(object_id, object_type),
0x4a65d5885da5e88f,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#create_context(&self, mut context_id: u32) -> Result<(), fidl::Error> {
self.client.send::<PrimaryCreateContextRequest>(
(context_id,),
0x5a9a91c8b88b5da4,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#destroy_context(&self, mut context_id: u32) -> Result<(), fidl::Error> {
self.client.send::<PrimaryDestroyContextRequest>(
(context_id,),
0x26b626e6be162ef0,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#execute_command(
&self,
mut context_id: u32,
mut resources: &[BufferRange],
mut command_buffers: &[CommandBuffer],
mut wait_semaphores: &[u64],
mut signal_semaphores: &[u64],
mut flags: CommandBufferFlags,
) -> Result<(), fidl::Error> {
self.client.send::<PrimaryExecuteCommandRequest>(
(context_id, resources, command_buffers, wait_semaphores, signal_semaphores, flags),
0xf2799643aadb0db,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#execute_immediate_commands(
&self,
mut context_id: u32,
mut command_data: &[u8],
mut semaphores: &[u64],
) -> Result<(), fidl::Error> {
self.client.send::<PrimaryExecuteImmediateCommandsRequest>(
(context_id, command_data, semaphores),
0x3d7e0dcdbfd4b61f,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#execute_inline_commands(
&self,
mut context_id: u32,
mut commands: &[InlineCommand],
) -> Result<(), fidl::Error> {
self.client.send::<PrimaryExecuteInlineCommandsRequest>(
(context_id, commands),
0x766d5c86f35468a6,
fidl::encoding::DynamicFlags::empty(),
)
}
type FlushResponseFut = fidl::client::QueryResponseFut<()>;
fn r#flush(&self) -> Self::FlushResponseFut {
fn _decode(mut _buf: Result<fidl::MessageBufEtc, fidl::Error>) -> Result<(), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::EmptyPayload,
0x54ccb5572d886039,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
(),
0x54ccb5572d886039,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
fn r#map_buffer(&self, mut payload: &PrimaryMapBufferRequest) -> Result<(), fidl::Error> {
self.client.send::<PrimaryMapBufferRequest>(
payload,
0x56baa5d2092c8e33,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#unmap_buffer(&self, mut payload: &PrimaryUnmapBufferRequest) -> Result<(), fidl::Error> {
self.client.send::<PrimaryUnmapBufferRequest>(
payload,
0x305188ebd8bcd95c,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#buffer_range_op2(
&self,
mut op: BufferOp,
mut range: &BufferRange,
) -> Result<(), fidl::Error> {
self.client.send::<PrimaryBufferRangeOp2Request>(
(op, range),
0x4175c8dfef355396,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#enable_flow_control(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x8b5e68f3ee0b22e,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#enable_performance_counter_access(
&self,
mut access_token: fidl::Event,
) -> Result<(), fidl::Error> {
self.client.send::<PrimaryEnablePerformanceCounterAccessRequest>(
(access_token,),
0x51b369ac16588831,
fidl::encoding::DynamicFlags::empty(),
)
}
type IsPerformanceCounterAccessAllowedResponseFut = fidl::client::QueryResponseFut<bool>;
fn r#is_performance_counter_access_allowed(
&self,
) -> Self::IsPerformanceCounterAccessAllowedResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<bool, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
PrimaryIsPerformanceCounterAccessAllowedResponse,
0x1933b70c06cc5702,
>(_buf?)?;
Ok(_response.enabled)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, bool>(
(),
0x1933b70c06cc5702,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
fn r#enable_performance_counters(&self, mut counters: &[u64]) -> Result<(), fidl::Error> {
self.client.send::<PrimaryEnablePerformanceCountersRequest>(
(counters,),
0x52c4db74b601aaa7,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#create_performance_counter_buffer_pool(
&self,
mut pool_id: u64,
mut event_channel: fidl::endpoints::ServerEnd<PerformanceCounterEventsMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<PrimaryCreatePerformanceCounterBufferPoolRequest>(
(pool_id, event_channel),
0x48ccf6519bbbc638,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#release_performance_counter_buffer_pool(
&self,
mut pool_id: u64,
) -> Result<(), fidl::Error> {
self.client.send::<PrimaryReleasePerformanceCounterBufferPoolRequest>(
(pool_id,),
0x18374c4b3ef0b4da,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#add_performance_counter_buffer_offsets_to_pool(
&self,
mut pool_id: u64,
mut offsets: &[BufferRange],
) -> Result<(), fidl::Error> {
self.client.send::<PrimaryAddPerformanceCounterBufferOffsetsToPoolRequest>(
(pool_id, offsets),
0x1f7889571111386b,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#remove_performance_counter_buffer_from_pool(
&self,
mut pool_id: u64,
mut buffer_id: u64,
) -> Result<(), fidl::Error> {
self.client.send::<PrimaryRemovePerformanceCounterBufferFromPoolRequest>(
(pool_id, buffer_id),
0xbf1275f5a36258e,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#dump_performance_counters(
&self,
mut pool_id: u64,
mut trigger_id: u32,
) -> Result<(), fidl::Error> {
self.client.send::<PrimaryDumpPerformanceCountersRequest>(
(pool_id, trigger_id),
0x250b29340be28807,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#clear_performance_counters(&self, mut counters: &[u64]) -> Result<(), fidl::Error> {
self.client.send::<PrimaryClearPerformanceCountersRequest>(
(counters,),
0x236831822eff741a,
fidl::encoding::DynamicFlags::empty(),
)
}
}
pub struct PrimaryEventStream {
event_receiver: fidl::client::EventReceiver,
}
impl std::marker::Unpin for PrimaryEventStream {}
impl futures::stream::FusedStream for PrimaryEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for PrimaryEventStream {
type Item = Result<PrimaryEvent, 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(PrimaryEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum PrimaryEvent {
OnNotifyMessagesConsumed { count: u64 },
OnNotifyMemoryImported { bytes: u64 },
}
impl PrimaryEvent {
#[allow(irrefutable_let_patterns)]
pub fn into_on_notify_messages_consumed(self) -> Option<u64> {
if let PrimaryEvent::OnNotifyMessagesConsumed { count } = self {
Some((count))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_on_notify_memory_imported(self) -> Option<u64> {
if let PrimaryEvent::OnNotifyMemoryImported { bytes } = self {
Some((bytes))
} else {
None
}
}
fn decode(mut buf: fidl::MessageBufEtc) -> Result<PrimaryEvent, 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 {
0x5e8dd0b0b753ac43 => {
let mut out = fidl::new_empty!(PrimaryOnNotifyMessagesConsumedRequest);
fidl::encoding::Decoder::decode_into::<PrimaryOnNotifyMessagesConsumedRequest>(
&tx_header,
_body_bytes,
_handles,
&mut out,
)?;
Ok((PrimaryEvent::OnNotifyMessagesConsumed { count: out.count }))
}
0x50524b7a3503aba6 => {
let mut out = fidl::new_empty!(PrimaryOnNotifyMemoryImportedRequest);
fidl::encoding::Decoder::decode_into::<PrimaryOnNotifyMemoryImportedRequest>(
&tx_header,
_body_bytes,
_handles,
&mut out,
)?;
Ok((PrimaryEvent::OnNotifyMemoryImported { bytes: out.bytes }))
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name: <PrimaryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct PrimaryRequestStream {
inner: std::sync::Arc<fidl::ServeInner>,
is_terminated: bool,
}
impl std::marker::Unpin for PrimaryRequestStream {}
impl futures::stream::FusedStream for PrimaryRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for PrimaryRequestStream {
type Protocol = PrimaryMarker;
type ControlHandle = PrimaryControlHandle;
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 {
PrimaryControlHandle { 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 PrimaryRequestStream {
type Item = Result<PrimaryRequest, 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 PrimaryRequestStream 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 {
0x774ef4bc434f6b40 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(PrimaryImportObject2Request);
fidl::encoding::Decoder::decode_into::<PrimaryImportObject2Request>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = PrimaryControlHandle { inner: this.inner.clone() };
Ok(PrimaryRequest::ImportObject2 {
object: req.object,
object_type: req.object_type,
object_id: req.object_id,
control_handle,
})
}
0x5f5a247abb1d9354 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(PrimaryImportObjectRequest);
fidl::encoding::Decoder::decode_into::<PrimaryImportObjectRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = PrimaryControlHandle { inner: this.inner.clone() };
Ok(PrimaryRequest::ImportObject { payload: req, control_handle })
}
0x4a65d5885da5e88f => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(PrimaryReleaseObjectRequest);
fidl::encoding::Decoder::decode_into::<PrimaryReleaseObjectRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = PrimaryControlHandle { inner: this.inner.clone() };
Ok(PrimaryRequest::ReleaseObject {
object_id: req.object_id,
object_type: req.object_type,
control_handle,
})
}
0x5a9a91c8b88b5da4 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(PrimaryCreateContextRequest);
fidl::encoding::Decoder::decode_into::<PrimaryCreateContextRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = PrimaryControlHandle { inner: this.inner.clone() };
Ok(PrimaryRequest::CreateContext { context_id: req.context_id, control_handle })
}
0x26b626e6be162ef0 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(PrimaryDestroyContextRequest);
fidl::encoding::Decoder::decode_into::<PrimaryDestroyContextRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = PrimaryControlHandle { inner: this.inner.clone() };
Ok(PrimaryRequest::DestroyContext {
context_id: req.context_id,
control_handle,
})
}
0xf2799643aadb0db => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(PrimaryExecuteCommandRequest);
fidl::encoding::Decoder::decode_into::<PrimaryExecuteCommandRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = PrimaryControlHandle { inner: this.inner.clone() };
Ok(PrimaryRequest::ExecuteCommand {
context_id: req.context_id,
resources: req.resources,
command_buffers: req.command_buffers,
wait_semaphores: req.wait_semaphores,
signal_semaphores: req.signal_semaphores,
flags: req.flags,
control_handle,
})
}
0x3d7e0dcdbfd4b61f => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(PrimaryExecuteImmediateCommandsRequest);
fidl::encoding::Decoder::decode_into::<PrimaryExecuteImmediateCommandsRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = PrimaryControlHandle { inner: this.inner.clone() };
Ok(PrimaryRequest::ExecuteImmediateCommands {
context_id: req.context_id,
command_data: req.command_data,
semaphores: req.semaphores,
control_handle,
})
}
0x766d5c86f35468a6 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(PrimaryExecuteInlineCommandsRequest);
fidl::encoding::Decoder::decode_into::<PrimaryExecuteInlineCommandsRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = PrimaryControlHandle { inner: this.inner.clone() };
Ok(PrimaryRequest::ExecuteInlineCommands {
context_id: req.context_id,
commands: req.commands,
control_handle,
})
}
0x54ccb5572d886039 => {
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 = PrimaryControlHandle { inner: this.inner.clone() };
Ok(PrimaryRequest::Flush {
responder: PrimaryFlushResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x56baa5d2092c8e33 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(PrimaryMapBufferRequest);
fidl::encoding::Decoder::decode_into::<PrimaryMapBufferRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = PrimaryControlHandle { inner: this.inner.clone() };
Ok(PrimaryRequest::MapBuffer { payload: req, control_handle })
}
0x305188ebd8bcd95c => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(PrimaryUnmapBufferRequest);
fidl::encoding::Decoder::decode_into::<PrimaryUnmapBufferRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = PrimaryControlHandle { inner: this.inner.clone() };
Ok(PrimaryRequest::UnmapBuffer { payload: req, control_handle })
}
0x4175c8dfef355396 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(PrimaryBufferRangeOp2Request);
fidl::encoding::Decoder::decode_into::<PrimaryBufferRangeOp2Request>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = PrimaryControlHandle { inner: this.inner.clone() };
Ok(PrimaryRequest::BufferRangeOp2 {
op: req.op,
range: req.range,
control_handle,
})
}
0x8b5e68f3ee0b22e => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
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 = PrimaryControlHandle { inner: this.inner.clone() };
Ok(PrimaryRequest::EnableFlowControl { control_handle })
}
0x51b369ac16588831 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(PrimaryEnablePerformanceCounterAccessRequest);
fidl::encoding::Decoder::decode_into::<
PrimaryEnablePerformanceCounterAccessRequest,
>(&header, _body_bytes, handles, &mut req)?;
let control_handle = PrimaryControlHandle { inner: this.inner.clone() };
Ok(PrimaryRequest::EnablePerformanceCounterAccess {
access_token: req.access_token,
control_handle,
})
}
0x1933b70c06cc5702 => {
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 = PrimaryControlHandle { inner: this.inner.clone() };
Ok(PrimaryRequest::IsPerformanceCounterAccessAllowed {
responder: PrimaryIsPerformanceCounterAccessAllowedResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x52c4db74b601aaa7 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(PrimaryEnablePerformanceCountersRequest);
fidl::encoding::Decoder::decode_into::<PrimaryEnablePerformanceCountersRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = PrimaryControlHandle { inner: this.inner.clone() };
Ok(PrimaryRequest::EnablePerformanceCounters {
counters: req.counters,
control_handle,
})
}
0x48ccf6519bbbc638 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req =
fidl::new_empty!(PrimaryCreatePerformanceCounterBufferPoolRequest);
fidl::encoding::Decoder::decode_into::<
PrimaryCreatePerformanceCounterBufferPoolRequest,
>(&header, _body_bytes, handles, &mut req)?;
let control_handle = PrimaryControlHandle { inner: this.inner.clone() };
Ok(PrimaryRequest::CreatePerformanceCounterBufferPool {
pool_id: req.pool_id,
event_channel: req.event_channel,
control_handle,
})
}
0x18374c4b3ef0b4da => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req =
fidl::new_empty!(PrimaryReleasePerformanceCounterBufferPoolRequest);
fidl::encoding::Decoder::decode_into::<
PrimaryReleasePerformanceCounterBufferPoolRequest,
>(&header, _body_bytes, handles, &mut req)?;
let control_handle = PrimaryControlHandle { inner: this.inner.clone() };
Ok(PrimaryRequest::ReleasePerformanceCounterBufferPool {
pool_id: req.pool_id,
control_handle,
})
}
0x1f7889571111386b => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req =
fidl::new_empty!(PrimaryAddPerformanceCounterBufferOffsetsToPoolRequest);
fidl::encoding::Decoder::decode_into::<
PrimaryAddPerformanceCounterBufferOffsetsToPoolRequest,
>(&header, _body_bytes, handles, &mut req)?;
let control_handle = PrimaryControlHandle { inner: this.inner.clone() };
Ok(PrimaryRequest::AddPerformanceCounterBufferOffsetsToPool {
pool_id: req.pool_id,
offsets: req.offsets,
control_handle,
})
}
0xbf1275f5a36258e => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req =
fidl::new_empty!(PrimaryRemovePerformanceCounterBufferFromPoolRequest);
fidl::encoding::Decoder::decode_into::<
PrimaryRemovePerformanceCounterBufferFromPoolRequest,
>(&header, _body_bytes, handles, &mut req)?;
let control_handle = PrimaryControlHandle { inner: this.inner.clone() };
Ok(PrimaryRequest::RemovePerformanceCounterBufferFromPool {
pool_id: req.pool_id,
buffer_id: req.buffer_id,
control_handle,
})
}
0x250b29340be28807 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(PrimaryDumpPerformanceCountersRequest);
fidl::encoding::Decoder::decode_into::<PrimaryDumpPerformanceCountersRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = PrimaryControlHandle { inner: this.inner.clone() };
Ok(PrimaryRequest::DumpPerformanceCounters {
pool_id: req.pool_id,
trigger_id: req.trigger_id,
control_handle,
})
}
0x236831822eff741a => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(PrimaryClearPerformanceCountersRequest);
fidl::encoding::Decoder::decode_into::<PrimaryClearPerformanceCountersRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = PrimaryControlHandle { inner: this.inner.clone() };
Ok(PrimaryRequest::ClearPerformanceCounters {
counters: req.counters,
control_handle,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <PrimaryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
})
}
}
#[derive(Debug)]
pub enum PrimaryRequest {
ImportObject2 {
object: fidl::Handle,
object_type: ObjectType,
object_id: u64,
control_handle: PrimaryControlHandle,
},
ImportObject { payload: PrimaryImportObjectRequest, control_handle: PrimaryControlHandle },
ReleaseObject { object_id: u64, object_type: ObjectType, control_handle: PrimaryControlHandle },
CreateContext { context_id: u32, control_handle: PrimaryControlHandle },
DestroyContext { context_id: u32, control_handle: PrimaryControlHandle },
ExecuteCommand {
context_id: u32,
resources: Vec<BufferRange>,
command_buffers: Vec<CommandBuffer>,
wait_semaphores: Vec<u64>,
signal_semaphores: Vec<u64>,
flags: CommandBufferFlags,
control_handle: PrimaryControlHandle,
},
ExecuteImmediateCommands {
context_id: u32,
command_data: Vec<u8>,
semaphores: Vec<u64>,
control_handle: PrimaryControlHandle,
},
ExecuteInlineCommands {
context_id: u32,
commands: Vec<InlineCommand>,
control_handle: PrimaryControlHandle,
},
Flush { responder: PrimaryFlushResponder },
MapBuffer { payload: PrimaryMapBufferRequest, control_handle: PrimaryControlHandle },
UnmapBuffer { payload: PrimaryUnmapBufferRequest, control_handle: PrimaryControlHandle },
BufferRangeOp2 { op: BufferOp, range: BufferRange, control_handle: PrimaryControlHandle },
EnableFlowControl { control_handle: PrimaryControlHandle },
EnablePerformanceCounterAccess {
access_token: fidl::Event,
control_handle: PrimaryControlHandle,
},
IsPerformanceCounterAccessAllowed {
responder: PrimaryIsPerformanceCounterAccessAllowedResponder,
},
EnablePerformanceCounters { counters: Vec<u64>, control_handle: PrimaryControlHandle },
CreatePerformanceCounterBufferPool {
pool_id: u64,
event_channel: fidl::endpoints::ServerEnd<PerformanceCounterEventsMarker>,
control_handle: PrimaryControlHandle,
},
ReleasePerformanceCounterBufferPool { pool_id: u64, control_handle: PrimaryControlHandle },
AddPerformanceCounterBufferOffsetsToPool {
pool_id: u64,
offsets: Vec<BufferRange>,
control_handle: PrimaryControlHandle,
},
RemovePerformanceCounterBufferFromPool {
pool_id: u64,
buffer_id: u64,
control_handle: PrimaryControlHandle,
},
DumpPerformanceCounters { pool_id: u64, trigger_id: u32, control_handle: PrimaryControlHandle },
ClearPerformanceCounters { counters: Vec<u64>, control_handle: PrimaryControlHandle },
}
impl PrimaryRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_import_object2(
self,
) -> Option<(fidl::Handle, ObjectType, u64, PrimaryControlHandle)> {
if let PrimaryRequest::ImportObject2 { object, object_type, object_id, control_handle } =
self
{
Some((object, object_type, object_id, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_import_object(self) -> Option<(PrimaryImportObjectRequest, PrimaryControlHandle)> {
if let PrimaryRequest::ImportObject { payload, control_handle } = self {
Some((payload, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_release_object(self) -> Option<(u64, ObjectType, PrimaryControlHandle)> {
if let PrimaryRequest::ReleaseObject { object_id, object_type, control_handle } = self {
Some((object_id, object_type, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_create_context(self) -> Option<(u32, PrimaryControlHandle)> {
if let PrimaryRequest::CreateContext { context_id, control_handle } = self {
Some((context_id, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_destroy_context(self) -> Option<(u32, PrimaryControlHandle)> {
if let PrimaryRequest::DestroyContext { context_id, control_handle } = self {
Some((context_id, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_execute_command(
self,
) -> Option<(
u32,
Vec<BufferRange>,
Vec<CommandBuffer>,
Vec<u64>,
Vec<u64>,
CommandBufferFlags,
PrimaryControlHandle,
)> {
if let PrimaryRequest::ExecuteCommand {
context_id,
resources,
command_buffers,
wait_semaphores,
signal_semaphores,
flags,
control_handle,
} = self
{
Some((
context_id,
resources,
command_buffers,
wait_semaphores,
signal_semaphores,
flags,
control_handle,
))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_execute_immediate_commands(
self,
) -> Option<(u32, Vec<u8>, Vec<u64>, PrimaryControlHandle)> {
if let PrimaryRequest::ExecuteImmediateCommands {
context_id,
command_data,
semaphores,
control_handle,
} = self
{
Some((context_id, command_data, semaphores, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_execute_inline_commands(
self,
) -> Option<(u32, Vec<InlineCommand>, PrimaryControlHandle)> {
if let PrimaryRequest::ExecuteInlineCommands { context_id, commands, control_handle } = self
{
Some((context_id, commands, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_flush(self) -> Option<(PrimaryFlushResponder)> {
if let PrimaryRequest::Flush { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_map_buffer(self) -> Option<(PrimaryMapBufferRequest, PrimaryControlHandle)> {
if let PrimaryRequest::MapBuffer { payload, control_handle } = self {
Some((payload, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_unmap_buffer(self) -> Option<(PrimaryUnmapBufferRequest, PrimaryControlHandle)> {
if let PrimaryRequest::UnmapBuffer { payload, control_handle } = self {
Some((payload, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_buffer_range_op2(self) -> Option<(BufferOp, BufferRange, PrimaryControlHandle)> {
if let PrimaryRequest::BufferRangeOp2 { op, range, control_handle } = self {
Some((op, range, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_enable_flow_control(self) -> Option<(PrimaryControlHandle)> {
if let PrimaryRequest::EnableFlowControl { control_handle } = self {
Some((control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_enable_performance_counter_access(
self,
) -> Option<(fidl::Event, PrimaryControlHandle)> {
if let PrimaryRequest::EnablePerformanceCounterAccess { access_token, control_handle } =
self
{
Some((access_token, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_is_performance_counter_access_allowed(
self,
) -> Option<(PrimaryIsPerformanceCounterAccessAllowedResponder)> {
if let PrimaryRequest::IsPerformanceCounterAccessAllowed { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_enable_performance_counters(self) -> Option<(Vec<u64>, PrimaryControlHandle)> {
if let PrimaryRequest::EnablePerformanceCounters { counters, control_handle } = self {
Some((counters, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_create_performance_counter_buffer_pool(
self,
) -> Option<(
u64,
fidl::endpoints::ServerEnd<PerformanceCounterEventsMarker>,
PrimaryControlHandle,
)> {
if let PrimaryRequest::CreatePerformanceCounterBufferPool {
pool_id,
event_channel,
control_handle,
} = self
{
Some((pool_id, event_channel, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_release_performance_counter_buffer_pool(
self,
) -> Option<(u64, PrimaryControlHandle)> {
if let PrimaryRequest::ReleasePerformanceCounterBufferPool { pool_id, control_handle } =
self
{
Some((pool_id, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_add_performance_counter_buffer_offsets_to_pool(
self,
) -> Option<(u64, Vec<BufferRange>, PrimaryControlHandle)> {
if let PrimaryRequest::AddPerformanceCounterBufferOffsetsToPool {
pool_id,
offsets,
control_handle,
} = self
{
Some((pool_id, offsets, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_remove_performance_counter_buffer_from_pool(
self,
) -> Option<(u64, u64, PrimaryControlHandle)> {
if let PrimaryRequest::RemovePerformanceCounterBufferFromPool {
pool_id,
buffer_id,
control_handle,
} = self
{
Some((pool_id, buffer_id, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_dump_performance_counters(self) -> Option<(u64, u32, PrimaryControlHandle)> {
if let PrimaryRequest::DumpPerformanceCounters { pool_id, trigger_id, control_handle } =
self
{
Some((pool_id, trigger_id, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_clear_performance_counters(self) -> Option<(Vec<u64>, PrimaryControlHandle)> {
if let PrimaryRequest::ClearPerformanceCounters { counters, control_handle } = self {
Some((counters, control_handle))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
PrimaryRequest::ImportObject2 { .. } => "import_object2",
PrimaryRequest::ImportObject { .. } => "import_object",
PrimaryRequest::ReleaseObject { .. } => "release_object",
PrimaryRequest::CreateContext { .. } => "create_context",
PrimaryRequest::DestroyContext { .. } => "destroy_context",
PrimaryRequest::ExecuteCommand { .. } => "execute_command",
PrimaryRequest::ExecuteImmediateCommands { .. } => "execute_immediate_commands",
PrimaryRequest::ExecuteInlineCommands { .. } => "execute_inline_commands",
PrimaryRequest::Flush { .. } => "flush",
PrimaryRequest::MapBuffer { .. } => "map_buffer",
PrimaryRequest::UnmapBuffer { .. } => "unmap_buffer",
PrimaryRequest::BufferRangeOp2 { .. } => "buffer_range_op2",
PrimaryRequest::EnableFlowControl { .. } => "enable_flow_control",
PrimaryRequest::EnablePerformanceCounterAccess { .. } => {
"enable_performance_counter_access"
}
PrimaryRequest::IsPerformanceCounterAccessAllowed { .. } => {
"is_performance_counter_access_allowed"
}
PrimaryRequest::EnablePerformanceCounters { .. } => "enable_performance_counters",
PrimaryRequest::CreatePerformanceCounterBufferPool { .. } => {
"create_performance_counter_buffer_pool"
}
PrimaryRequest::ReleasePerformanceCounterBufferPool { .. } => {
"release_performance_counter_buffer_pool"
}
PrimaryRequest::AddPerformanceCounterBufferOffsetsToPool { .. } => {
"add_performance_counter_buffer_offsets_to_pool"
}
PrimaryRequest::RemovePerformanceCounterBufferFromPool { .. } => {
"remove_performance_counter_buffer_from_pool"
}
PrimaryRequest::DumpPerformanceCounters { .. } => "dump_performance_counters",
PrimaryRequest::ClearPerformanceCounters { .. } => "clear_performance_counters",
}
}
}
#[derive(Debug, Clone)]
pub struct PrimaryControlHandle {
inner: std::sync::Arc<fidl::ServeInner>,
}
impl fidl::endpoints::ControlHandle for PrimaryControlHandle {
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 PrimaryControlHandle {
pub fn send_on_notify_messages_consumed(&self, mut count: u64) -> Result<(), fidl::Error> {
self.inner.send::<PrimaryOnNotifyMessagesConsumedRequest>(
(count,),
0,
0x5e8dd0b0b753ac43,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn send_on_notify_memory_imported(&self, mut bytes: u64) -> Result<(), fidl::Error> {
self.inner.send::<PrimaryOnNotifyMemoryImportedRequest>(
(bytes,),
0,
0x50524b7a3503aba6,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct PrimaryFlushResponder {
control_handle: std::mem::ManuallyDrop<PrimaryControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for PrimaryFlushResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for PrimaryFlushResponder {
type ControlHandle = PrimaryControlHandle;
fn control_handle(&self) -> &PrimaryControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl PrimaryFlushResponder {
pub fn send(self) -> Result<(), fidl::Error> {
let _result = self.send_raw();
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
let _result = self.send_raw();
self.drop_without_shutdown();
_result
}
fn send_raw(&self) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
(),
self.tx_id,
0x54ccb5572d886039,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct PrimaryIsPerformanceCounterAccessAllowedResponder {
control_handle: std::mem::ManuallyDrop<PrimaryControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for PrimaryIsPerformanceCounterAccessAllowedResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for PrimaryIsPerformanceCounterAccessAllowedResponder {
type ControlHandle = PrimaryControlHandle;
fn control_handle(&self) -> &PrimaryControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl PrimaryIsPerformanceCounterAccessAllowedResponder {
pub fn send(self, mut enabled: bool) -> Result<(), fidl::Error> {
let _result = self.send_raw(enabled);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut enabled: bool) -> Result<(), fidl::Error> {
let _result = self.send_raw(enabled);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut enabled: bool) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<PrimaryIsPerformanceCounterAccessAllowedResponse>(
(enabled,),
self.tx_id,
0x1933b70c06cc5702,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct TestDeviceMarker;
impl fidl::endpoints::ProtocolMarker for TestDeviceMarker {
type Proxy = TestDeviceProxy;
type RequestStream = TestDeviceRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = TestDeviceSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) TestDevice";
}
pub trait TestDeviceProxyInterface: Send + Sync {
type QueryResponseFut: std::future::Future<Output = Result<DeviceQueryResult, fidl::Error>>
+ Send;
fn r#query(&self, query_id: QueryId) -> Self::QueryResponseFut;
fn r#connect2(
&self,
client_id: u64,
primary_channel: fidl::endpoints::ServerEnd<PrimaryMarker>,
notification_channel: fidl::endpoints::ServerEnd<NotificationMarker>,
) -> Result<(), fidl::Error>;
fn r#dump_state(&self, dump_type: u32) -> Result<(), fidl::Error>;
type GetIcdListResponseFut: std::future::Future<Output = Result<Vec<IcdInfo>, fidl::Error>>
+ Send;
fn r#get_icd_list(&self) -> Self::GetIcdListResponseFut;
type GetUnitTestStatusResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
fn r#get_unit_test_status(&self) -> Self::GetUnitTestStatusResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct TestDeviceSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for TestDeviceSynchronousProxy {
type Proxy = TestDeviceProxy;
type Protocol = TestDeviceMarker;
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 TestDeviceSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <TestDeviceMarker 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<TestDeviceEvent, fidl::Error> {
TestDeviceEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#query(
&self,
mut query_id: QueryId,
___deadline: zx::Time,
) -> Result<DeviceQueryResult, fidl::Error> {
let _response = self
.client
.send_query::<DeviceQueryRequest, fidl::encoding::ResultType<DeviceQueryResponse, i32>>(
(query_id,),
0x627d4c6093b078e7,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#connect2(
&self,
mut client_id: u64,
mut primary_channel: fidl::endpoints::ServerEnd<PrimaryMarker>,
mut notification_channel: fidl::endpoints::ServerEnd<NotificationMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<DeviceConnect2Request>(
(client_id, primary_channel, notification_channel),
0x3a5b134714c67914,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#dump_state(&self, mut dump_type: u32) -> Result<(), fidl::Error> {
self.client.send::<DiagnosticDeviceDumpStateRequest>(
(dump_type,),
0x5420df493d4fa915,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#get_icd_list(&self, ___deadline: zx::Time) -> Result<Vec<IcdInfo>, fidl::Error> {
let _response = self
.client
.send_query::<fidl::encoding::EmptyPayload, IcdLoaderDeviceGetIcdListResponse>(
(),
0x7673e76395008257,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.icd_list)
}
pub fn r#get_unit_test_status(&self, ___deadline: zx::Time) -> Result<i32, fidl::Error> {
let _response = self
.client
.send_query::<fidl::encoding::EmptyPayload, TestDeviceGetUnitTestStatusResponse>(
(),
0x3ebcd9c409c248f1,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.status)
}
}
#[derive(Debug, Clone)]
pub struct TestDeviceProxy {
client: fidl::client::Client,
}
impl fidl::endpoints::Proxy for TestDeviceProxy {
type Protocol = TestDeviceMarker;
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 TestDeviceProxy {
pub fn new(channel: fidl::AsyncChannel) -> Self {
let protocol_name = <TestDeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> TestDeviceEventStream {
TestDeviceEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#query(
&self,
mut query_id: QueryId,
) -> fidl::client::QueryResponseFut<DeviceQueryResult> {
TestDeviceProxyInterface::r#query(self, query_id)
}
pub fn r#connect2(
&self,
mut client_id: u64,
mut primary_channel: fidl::endpoints::ServerEnd<PrimaryMarker>,
mut notification_channel: fidl::endpoints::ServerEnd<NotificationMarker>,
) -> Result<(), fidl::Error> {
TestDeviceProxyInterface::r#connect2(self, client_id, primary_channel, notification_channel)
}
pub fn r#dump_state(&self, mut dump_type: u32) -> Result<(), fidl::Error> {
TestDeviceProxyInterface::r#dump_state(self, dump_type)
}
pub fn r#get_icd_list(&self) -> fidl::client::QueryResponseFut<Vec<IcdInfo>> {
TestDeviceProxyInterface::r#get_icd_list(self)
}
pub fn r#get_unit_test_status(&self) -> fidl::client::QueryResponseFut<i32> {
TestDeviceProxyInterface::r#get_unit_test_status(self)
}
}
impl TestDeviceProxyInterface for TestDeviceProxy {
type QueryResponseFut = fidl::client::QueryResponseFut<DeviceQueryResult>;
fn r#query(&self, mut query_id: QueryId) -> Self::QueryResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<DeviceQueryResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<DeviceQueryResponse, i32>,
0x627d4c6093b078e7,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<DeviceQueryRequest, DeviceQueryResult>(
(query_id,),
0x627d4c6093b078e7,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
fn r#connect2(
&self,
mut client_id: u64,
mut primary_channel: fidl::endpoints::ServerEnd<PrimaryMarker>,
mut notification_channel: fidl::endpoints::ServerEnd<NotificationMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<DeviceConnect2Request>(
(client_id, primary_channel, notification_channel),
0x3a5b134714c67914,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#dump_state(&self, mut dump_type: u32) -> Result<(), fidl::Error> {
self.client.send::<DiagnosticDeviceDumpStateRequest>(
(dump_type,),
0x5420df493d4fa915,
fidl::encoding::DynamicFlags::empty(),
)
}
type GetIcdListResponseFut = fidl::client::QueryResponseFut<Vec<IcdInfo>>;
fn r#get_icd_list(&self) -> Self::GetIcdListResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<Vec<IcdInfo>, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
IcdLoaderDeviceGetIcdListResponse,
0x7673e76395008257,
>(_buf?)?;
Ok(_response.icd_list)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<IcdInfo>>(
(),
0x7673e76395008257,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type GetUnitTestStatusResponseFut = fidl::client::QueryResponseFut<i32>;
fn r#get_unit_test_status(&self) -> Self::GetUnitTestStatusResponseFut {
fn _decode(mut _buf: Result<fidl::MessageBufEtc, fidl::Error>) -> Result<i32, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
TestDeviceGetUnitTestStatusResponse,
0x3ebcd9c409c248f1,
>(_buf?)?;
Ok(_response.status)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, i32>(
(),
0x3ebcd9c409c248f1,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct TestDeviceEventStream {
event_receiver: fidl::client::EventReceiver,
}
impl std::marker::Unpin for TestDeviceEventStream {}
impl futures::stream::FusedStream for TestDeviceEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for TestDeviceEventStream {
type Item = Result<TestDeviceEvent, 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(TestDeviceEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum TestDeviceEvent {}
impl TestDeviceEvent {
fn decode(mut buf: fidl::MessageBufEtc) -> Result<TestDeviceEvent, 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: <TestDeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct TestDeviceRequestStream {
inner: std::sync::Arc<fidl::ServeInner>,
is_terminated: bool,
}
impl std::marker::Unpin for TestDeviceRequestStream {}
impl futures::stream::FusedStream for TestDeviceRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for TestDeviceRequestStream {
type Protocol = TestDeviceMarker;
type ControlHandle = TestDeviceControlHandle;
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 {
TestDeviceControlHandle { 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 TestDeviceRequestStream {
type Item = Result<TestDeviceRequest, 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 TestDeviceRequestStream 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 {
0x627d4c6093b078e7 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(DeviceQueryRequest);
fidl::encoding::Decoder::decode_into::<DeviceQueryRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = TestDeviceControlHandle { inner: this.inner.clone() };
Ok(TestDeviceRequest::Query {
query_id: req.query_id,
responder: TestDeviceQueryResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x3a5b134714c67914 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(DeviceConnect2Request);
fidl::encoding::Decoder::decode_into::<DeviceConnect2Request>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = TestDeviceControlHandle { inner: this.inner.clone() };
Ok(TestDeviceRequest::Connect2 {
client_id: req.client_id,
primary_channel: req.primary_channel,
notification_channel: req.notification_channel,
control_handle,
})
}
0x5420df493d4fa915 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(DiagnosticDeviceDumpStateRequest);
fidl::encoding::Decoder::decode_into::<DiagnosticDeviceDumpStateRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = TestDeviceControlHandle { inner: this.inner.clone() };
Ok(TestDeviceRequest::DumpState { dump_type: req.dump_type, control_handle })
}
0x7673e76395008257 => {
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 = TestDeviceControlHandle { inner: this.inner.clone() };
Ok(TestDeviceRequest::GetIcdList {
responder: TestDeviceGetIcdListResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x3ebcd9c409c248f1 => {
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 = TestDeviceControlHandle { inner: this.inner.clone() };
Ok(TestDeviceRequest::GetUnitTestStatus {
responder: TestDeviceGetUnitTestStatusResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<TestDeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
})
}
}
#[derive(Debug)]
pub enum TestDeviceRequest {
Query {
query_id: QueryId,
responder: TestDeviceQueryResponder,
},
Connect2 {
client_id: u64,
primary_channel: fidl::endpoints::ServerEnd<PrimaryMarker>,
notification_channel: fidl::endpoints::ServerEnd<NotificationMarker>,
control_handle: TestDeviceControlHandle,
},
DumpState {
dump_type: u32,
control_handle: TestDeviceControlHandle,
},
GetIcdList {
responder: TestDeviceGetIcdListResponder,
},
GetUnitTestStatus {
responder: TestDeviceGetUnitTestStatusResponder,
},
}
impl TestDeviceRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_query(self) -> Option<(QueryId, TestDeviceQueryResponder)> {
if let TestDeviceRequest::Query { query_id, responder } = self {
Some((query_id, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_connect2(
self,
) -> Option<(
u64,
fidl::endpoints::ServerEnd<PrimaryMarker>,
fidl::endpoints::ServerEnd<NotificationMarker>,
TestDeviceControlHandle,
)> {
if let TestDeviceRequest::Connect2 {
client_id,
primary_channel,
notification_channel,
control_handle,
} = self
{
Some((client_id, primary_channel, notification_channel, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_dump_state(self) -> Option<(u32, TestDeviceControlHandle)> {
if let TestDeviceRequest::DumpState { dump_type, control_handle } = self {
Some((dump_type, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_get_icd_list(self) -> Option<(TestDeviceGetIcdListResponder)> {
if let TestDeviceRequest::GetIcdList { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_get_unit_test_status(self) -> Option<(TestDeviceGetUnitTestStatusResponder)> {
if let TestDeviceRequest::GetUnitTestStatus { responder } = self {
Some((responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
TestDeviceRequest::Query { .. } => "query",
TestDeviceRequest::Connect2 { .. } => "connect2",
TestDeviceRequest::DumpState { .. } => "dump_state",
TestDeviceRequest::GetIcdList { .. } => "get_icd_list",
TestDeviceRequest::GetUnitTestStatus { .. } => "get_unit_test_status",
}
}
}
#[derive(Debug, Clone)]
pub struct TestDeviceControlHandle {
inner: std::sync::Arc<fidl::ServeInner>,
}
impl fidl::endpoints::ControlHandle for TestDeviceControlHandle {
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 TestDeviceControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct TestDeviceQueryResponder {
control_handle: std::mem::ManuallyDrop<TestDeviceControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for TestDeviceQueryResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for TestDeviceQueryResponder {
type ControlHandle = TestDeviceControlHandle;
fn control_handle(&self) -> &TestDeviceControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl TestDeviceQueryResponder {
pub fn send(self, mut result: Result<DeviceQueryResponse, 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<DeviceQueryResponse, i32>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<DeviceQueryResponse, i32>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<DeviceQueryResponse, i32>>(
result.as_mut().map_err(|e| *e),
self.tx_id,
0x627d4c6093b078e7,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct TestDeviceGetIcdListResponder {
control_handle: std::mem::ManuallyDrop<TestDeviceControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for TestDeviceGetIcdListResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for TestDeviceGetIcdListResponder {
type ControlHandle = TestDeviceControlHandle;
fn control_handle(&self) -> &TestDeviceControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl TestDeviceGetIcdListResponder {
pub fn send(self, mut icd_list: &[IcdInfo]) -> Result<(), fidl::Error> {
let _result = self.send_raw(icd_list);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut icd_list: &[IcdInfo]) -> Result<(), fidl::Error> {
let _result = self.send_raw(icd_list);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut icd_list: &[IcdInfo]) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<IcdLoaderDeviceGetIcdListResponse>(
(icd_list,),
self.tx_id,
0x7673e76395008257,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct TestDeviceGetUnitTestStatusResponder {
control_handle: std::mem::ManuallyDrop<TestDeviceControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for TestDeviceGetUnitTestStatusResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for TestDeviceGetUnitTestStatusResponder {
type ControlHandle = TestDeviceControlHandle;
fn control_handle(&self) -> &TestDeviceControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl TestDeviceGetUnitTestStatusResponder {
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::<TestDeviceGetUnitTestStatusResponse>(
(status,),
self.tx_id,
0x3ebcd9c409c248f1,
fidl::encoding::DynamicFlags::empty(),
)
}
}
mod internal {
use super::*;
unsafe impl fidl::encoding::TypeMarker for CommandBufferFlags {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
8
}
}
impl fidl::encoding::ValueTypeMarker for CommandBufferFlags {
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 CommandBufferFlags {
#[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.bits, offset);
Ok(())
}
}
impl fidl::encoding::Decode<Self> for CommandBufferFlags {
#[inline(always)]
fn new_empty() -> Self {
Self::empty()
}
#[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::<u64>(offset);
*self = Self::from_bits_allow_unknown(prim);
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for IcdFlags {
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
}
}
impl fidl::encoding::ValueTypeMarker for IcdFlags {
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 IcdFlags {
#[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.bits, offset);
Ok(())
}
}
impl fidl::encoding::Decode<Self> for IcdFlags {
#[inline(always)]
fn new_empty() -> Self {
Self::empty()
}
#[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_bits_allow_unknown(prim);
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for ImportFlags {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
8
}
}
impl fidl::encoding::ValueTypeMarker for ImportFlags {
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 ImportFlags {
#[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.bits, offset);
Ok(())
}
}
impl fidl::encoding::Decode<Self> for ImportFlags {
#[inline(always)]
fn new_empty() -> Self {
Self::empty()
}
#[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::<u64>(offset);
*self = Self::from_bits_allow_unknown(prim);
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for MapFlags {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
8
}
}
impl fidl::encoding::ValueTypeMarker for MapFlags {
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 MapFlags {
#[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.bits, offset);
Ok(())
}
}
impl fidl::encoding::Decode<Self> for MapFlags {
#[inline(always)]
fn new_empty() -> Self {
Self::empty()
}
#[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::<u64>(offset);
*self = Self::from_bits_allow_unknown(prim);
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for ResultFlags {
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
}
}
impl fidl::encoding::ValueTypeMarker for ResultFlags {
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 ResultFlags {
#[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.bits, offset);
Ok(())
}
}
impl fidl::encoding::Decode<Self> for ResultFlags {
#[inline(always)]
fn new_empty() -> Self {
Self::empty()
}
#[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_bits_allow_unknown(prim);
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for BufferOp {
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 BufferOp {
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 BufferOp {
#[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 BufferOp {
#[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 ObjectType {
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 ObjectType {
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 ObjectType {
#[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 ObjectType {
#[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 QueryId {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
std::mem::align_of::<u64>()
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
std::mem::size_of::<u64>()
}
#[inline(always)]
fn encode_is_copy() -> bool {
false
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for QueryId {
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 QueryId {
#[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 QueryId {
#[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::<u64>(offset);
*self = Self::from_primitive_allow_unknown(prim);
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for BufferRange {
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
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
impl fidl::encoding::ValueTypeMarker for BufferRange {
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<BufferRange> for &BufferRange {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<BufferRange>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut BufferRange).write_unaligned((self as *const BufferRange).read());
}
Ok(())
}
}
unsafe impl<
T0: fidl::encoding::Encode<u64>,
T1: fidl::encoding::Encode<u64>,
T2: fidl::encoding::Encode<u64>,
> fidl::encoding::Encode<BufferRange> for (T0, T1, T2)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<BufferRange>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
self.2.encode(encoder, offset + 16, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for BufferRange {
#[inline(always)]
fn new_empty() -> Self {
Self {
buffer_id: fidl::new_empty!(u64),
offset: fidl::new_empty!(u64),
size: fidl::new_empty!(u64),
}
}
#[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, 24);
}
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for CommandBuffer {
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 CommandBuffer {
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<CommandBuffer> for &CommandBuffer {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<CommandBuffer>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut CommandBuffer)
.write_unaligned((self as *const CommandBuffer).read());
let padding_ptr = buf_ptr.offset(0) as *mut u64;
let padding_mask = 0xffffffff00000000u64;
padding_ptr.write_unaligned(padding_ptr.read_unaligned() & !padding_mask);
}
Ok(())
}
}
unsafe impl<T0: fidl::encoding::Encode<u32>, T1: fidl::encoding::Encode<u64>>
fidl::encoding::Encode<CommandBuffer> 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::<CommandBuffer>(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 CommandBuffer {
#[inline(always)]
fn new_empty() -> Self {
Self { resource_index: fidl::new_empty!(u32), start_offset: fidl::new_empty!(u64) }
}
#[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) };
let ptr = unsafe { buf_ptr.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,
});
}
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
}
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for DependencyInjectionSetMemoryPressureProviderRequest {
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
}
}
impl fidl::encoding::ResourceTypeMarker for DependencyInjectionSetMemoryPressureProviderRequest {
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<DependencyInjectionSetMemoryPressureProviderRequest>
for &mut DependencyInjectionSetMemoryPressureProviderRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder
.debug_check_bounds::<DependencyInjectionSetMemoryPressureProviderRequest>(offset);
fidl::encoding::Encode::<DependencyInjectionSetMemoryPressureProviderRequest>::encode(
(<fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_memorypressure::ProviderMarker>,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.provider
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_memorypressure::ProviderMarker>,
>,
>,
> fidl::encoding::Encode<DependencyInjectionSetMemoryPressureProviderRequest> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder
.debug_check_bounds::<DependencyInjectionSetMemoryPressureProviderRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for DependencyInjectionSetMemoryPressureProviderRequest {
#[inline(always)]
fn new_empty() -> Self {
Self {
provider: fidl::new_empty!(
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_memorypressure::ProviderMarker>,
>
),
}
}
#[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_memorypressure::ProviderMarker>,
>,
&mut self.provider,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for DeviceConnect2Request {
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::ResourceTypeMarker for DeviceConnect2Request {
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<DeviceConnect2Request> for &mut DeviceConnect2Request {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceConnect2Request>(offset);
fidl::encoding::Encode::<DeviceConnect2Request>::encode(
(
<u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.client_id),
<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PrimaryMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.primary_channel),
<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<NotificationMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.notification_channel),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<u64>,
T1: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PrimaryMarker>>,
>,
T2: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<NotificationMarker>>,
>,
> fidl::encoding::Encode<DeviceConnect2Request> for (T0, T1, T2)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceConnect2Request>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
self.2.encode(encoder, offset + 12, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for DeviceConnect2Request {
#[inline(always)]
fn new_empty() -> Self {
Self {
client_id: fidl::new_empty!(u64),
primary_channel: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PrimaryMarker>>
),
notification_channel: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<NotificationMarker>>
),
}
}
#[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!(u64, &mut self.client_id, decoder, offset + 0, _depth)?;
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PrimaryMarker>>,
&mut self.primary_channel,
decoder,
offset + 8,
_depth
)?;
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<NotificationMarker>>,
&mut self.notification_channel,
decoder,
offset + 12,
_depth
)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for DeviceQueryRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
8
}
}
impl fidl::encoding::ValueTypeMarker for DeviceQueryRequest {
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<DeviceQueryRequest> for &DeviceQueryRequest {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceQueryRequest>(offset);
fidl::encoding::Encode::<DeviceQueryRequest>::encode(
(<QueryId as fidl::encoding::ValueTypeMarker>::borrow(&self.query_id),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<T0: fidl::encoding::Encode<QueryId>> fidl::encoding::Encode<DeviceQueryRequest>
for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceQueryRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for DeviceQueryRequest {
#[inline(always)]
fn new_empty() -> Self {
Self { query_id: fidl::new_empty!(QueryId) }
}
#[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!(QueryId, &mut self.query_id, decoder, offset + 0, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for DiagnosticDeviceDumpStateRequest {
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 DiagnosticDeviceDumpStateRequest {
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<DiagnosticDeviceDumpStateRequest>
for &DiagnosticDeviceDumpStateRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DiagnosticDeviceDumpStateRequest>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut DiagnosticDeviceDumpStateRequest)
.write_unaligned((self as *const DiagnosticDeviceDumpStateRequest).read());
}
Ok(())
}
}
unsafe impl<T0: fidl::encoding::Encode<u32>>
fidl::encoding::Encode<DiagnosticDeviceDumpStateRequest> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DiagnosticDeviceDumpStateRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for DiagnosticDeviceDumpStateRequest {
#[inline(always)]
fn new_empty() -> Self {
Self { dump_type: 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 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 IcdLoaderDeviceGetIcdListResponse {
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 IcdLoaderDeviceGetIcdListResponse {
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<IcdLoaderDeviceGetIcdListResponse>
for &IcdLoaderDeviceGetIcdListResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<IcdLoaderDeviceGetIcdListResponse>(offset);
fidl::encoding::Encode::<IcdLoaderDeviceGetIcdListResponse>::encode(
(<fidl::encoding::Vector<IcdInfo, 8> as fidl::encoding::ValueTypeMarker>::borrow(
&self.icd_list,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<T0: fidl::encoding::Encode<fidl::encoding::Vector<IcdInfo, 8>>>
fidl::encoding::Encode<IcdLoaderDeviceGetIcdListResponse> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<IcdLoaderDeviceGetIcdListResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for IcdLoaderDeviceGetIcdListResponse {
#[inline(always)]
fn new_empty() -> Self {
Self { icd_list: fidl::new_empty!(fidl::encoding::Vector<IcdInfo, 8>) }
}
#[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::Vector<IcdInfo, 8>, &mut self.icd_list, decoder, offset + 0, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker
for PerformanceCounterAccessGetPerformanceCountTokenResponse
{
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
}
}
impl fidl::encoding::ResourceTypeMarker
for PerformanceCounterAccessGetPerformanceCountTokenResponse
{
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<PerformanceCounterAccessGetPerformanceCountTokenResponse>
for &mut PerformanceCounterAccessGetPerformanceCountTokenResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PerformanceCounterAccessGetPerformanceCountTokenResponse>(
offset,
);
fidl::encoding::Encode::<PerformanceCounterAccessGetPerformanceCountTokenResponse>::encode(
(
<fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.access_token),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::HandleType<
fidl::Event,
{ fidl::ObjectType::EVENT.into_raw() },
2147483648,
>,
>,
> fidl::encoding::Encode<PerformanceCounterAccessGetPerformanceCountTokenResponse>
for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PerformanceCounterAccessGetPerformanceCountTokenResponse>(
offset,
);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for PerformanceCounterAccessGetPerformanceCountTokenResponse {
#[inline(always)]
fn new_empty() -> Self {
Self {
access_token: fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>),
}
}
#[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::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, &mut self.access_token, decoder, offset + 0, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for PrimaryAddPerformanceCounterBufferOffsetsToPoolRequest {
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 PrimaryAddPerformanceCounterBufferOffsetsToPoolRequest {
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<PrimaryAddPerformanceCounterBufferOffsetsToPoolRequest>
for &PrimaryAddPerformanceCounterBufferOffsetsToPoolRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PrimaryAddPerformanceCounterBufferOffsetsToPoolRequest>(
offset,
);
fidl::encoding::Encode::<PrimaryAddPerformanceCounterBufferOffsetsToPoolRequest>::encode(
(
<u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.pool_id),
<fidl::encoding::Vector<BufferRange, 64> as fidl::encoding::ValueTypeMarker>::borrow(&self.offsets),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<u64>,
T1: fidl::encoding::Encode<fidl::encoding::Vector<BufferRange, 64>>,
> fidl::encoding::Encode<PrimaryAddPerformanceCounterBufferOffsetsToPoolRequest>
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::<PrimaryAddPerformanceCounterBufferOffsetsToPoolRequest>(
offset,
);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for PrimaryAddPerformanceCounterBufferOffsetsToPoolRequest {
#[inline(always)]
fn new_empty() -> Self {
Self {
pool_id: fidl::new_empty!(u64),
offsets: fidl::new_empty!(fidl::encoding::Vector<BufferRange, 64>),
}
}
#[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!(u64, &mut self.pool_id, decoder, offset + 0, _depth)?;
fidl::decode!(fidl::encoding::Vector<BufferRange, 64>, &mut self.offsets, decoder, offset + 8, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for PrimaryBufferRangeOp2Request {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
32
}
}
impl fidl::encoding::ValueTypeMarker for PrimaryBufferRangeOp2Request {
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<PrimaryBufferRangeOp2Request> for &PrimaryBufferRangeOp2Request {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PrimaryBufferRangeOp2Request>(offset);
fidl::encoding::Encode::<PrimaryBufferRangeOp2Request>::encode(
(
<BufferOp as fidl::encoding::ValueTypeMarker>::borrow(&self.op),
<BufferRange as fidl::encoding::ValueTypeMarker>::borrow(&self.range),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<T0: fidl::encoding::Encode<BufferOp>, T1: fidl::encoding::Encode<BufferRange>>
fidl::encoding::Encode<PrimaryBufferRangeOp2Request> 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::<PrimaryBufferRangeOp2Request>(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 PrimaryBufferRangeOp2Request {
#[inline(always)]
fn new_empty() -> Self {
Self { op: fidl::new_empty!(BufferOp), range: fidl::new_empty!(BufferRange) }
}
#[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!(BufferOp, &mut self.op, decoder, offset + 0, _depth)?;
fidl::decode!(BufferRange, &mut self.range, decoder, offset + 8, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for PrimaryClearPerformanceCountersRequest {
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 PrimaryClearPerformanceCountersRequest {
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<PrimaryClearPerformanceCountersRequest>
for &PrimaryClearPerformanceCountersRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PrimaryClearPerformanceCountersRequest>(offset);
fidl::encoding::Encode::<PrimaryClearPerformanceCountersRequest>::encode(
(<fidl::encoding::Vector<u64, 64> as fidl::encoding::ValueTypeMarker>::borrow(
&self.counters,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<T0: fidl::encoding::Encode<fidl::encoding::Vector<u64, 64>>>
fidl::encoding::Encode<PrimaryClearPerformanceCountersRequest> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PrimaryClearPerformanceCountersRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for PrimaryClearPerformanceCountersRequest {
#[inline(always)]
fn new_empty() -> Self {
Self { counters: fidl::new_empty!(fidl::encoding::Vector<u64, 64>) }
}
#[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::Vector<u64, 64>, &mut self.counters, decoder, offset + 0, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for PrimaryCreateContextRequest {
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 PrimaryCreateContextRequest {
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<PrimaryCreateContextRequest> for &PrimaryCreateContextRequest {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PrimaryCreateContextRequest>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut PrimaryCreateContextRequest)
.write_unaligned((self as *const PrimaryCreateContextRequest).read());
}
Ok(())
}
}
unsafe impl<T0: fidl::encoding::Encode<u32>> fidl::encoding::Encode<PrimaryCreateContextRequest>
for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PrimaryCreateContextRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for PrimaryCreateContextRequest {
#[inline(always)]
fn new_empty() -> Self {
Self { context_id: 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 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 PrimaryCreatePerformanceCounterBufferPoolRequest {
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::ResourceTypeMarker for PrimaryCreatePerformanceCounterBufferPoolRequest {
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<PrimaryCreatePerformanceCounterBufferPoolRequest>
for &mut PrimaryCreatePerformanceCounterBufferPoolRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PrimaryCreatePerformanceCounterBufferPoolRequest>(offset);
fidl::encoding::Encode::<PrimaryCreatePerformanceCounterBufferPoolRequest>::encode(
(
<u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.pool_id),
<fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<PerformanceCounterEventsMarker>,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.event_channel,
),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<u64>,
T1: fidl::encoding::Encode<
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<PerformanceCounterEventsMarker>,
>,
>,
> fidl::encoding::Encode<PrimaryCreatePerformanceCounterBufferPoolRequest> 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::<PrimaryCreatePerformanceCounterBufferPoolRequest>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for PrimaryCreatePerformanceCounterBufferPoolRequest {
#[inline(always)]
fn new_empty() -> Self {
Self {
pool_id: fidl::new_empty!(u64),
event_channel: fidl::new_empty!(
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<PerformanceCounterEventsMarker>,
>
),
}
}
#[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(8) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffff00000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(u64, &mut self.pool_id, decoder, offset + 0, _depth)?;
fidl::decode!(
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<PerformanceCounterEventsMarker>,
>,
&mut self.event_channel,
decoder,
offset + 8,
_depth
)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for PrimaryDestroyContextRequest {
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 PrimaryDestroyContextRequest {
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<PrimaryDestroyContextRequest> for &PrimaryDestroyContextRequest {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PrimaryDestroyContextRequest>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut PrimaryDestroyContextRequest)
.write_unaligned((self as *const PrimaryDestroyContextRequest).read());
}
Ok(())
}
}
unsafe impl<T0: fidl::encoding::Encode<u32>>
fidl::encoding::Encode<PrimaryDestroyContextRequest> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PrimaryDestroyContextRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for PrimaryDestroyContextRequest {
#[inline(always)]
fn new_empty() -> Self {
Self { context_id: 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 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 PrimaryDumpPerformanceCountersRequest {
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 PrimaryDumpPerformanceCountersRequest {
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<PrimaryDumpPerformanceCountersRequest>
for &PrimaryDumpPerformanceCountersRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PrimaryDumpPerformanceCountersRequest>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut PrimaryDumpPerformanceCountersRequest)
.write_unaligned((self as *const PrimaryDumpPerformanceCountersRequest).read());
let padding_ptr = buf_ptr.offset(8) as *mut u64;
let padding_mask = 0xffffffff00000000u64;
padding_ptr.write_unaligned(padding_ptr.read_unaligned() & !padding_mask);
}
Ok(())
}
}
unsafe impl<T0: fidl::encoding::Encode<u64>, T1: fidl::encoding::Encode<u32>>
fidl::encoding::Encode<PrimaryDumpPerformanceCountersRequest> 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::<PrimaryDumpPerformanceCountersRequest>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for PrimaryDumpPerformanceCountersRequest {
#[inline(always)]
fn new_empty() -> Self {
Self { pool_id: fidl::new_empty!(u64), trigger_id: 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 buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
let ptr = unsafe { buf_ptr.offset(8) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffff00000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
}
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for PrimaryEnablePerformanceCounterAccessRequest {
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
}
}
impl fidl::encoding::ResourceTypeMarker for PrimaryEnablePerformanceCounterAccessRequest {
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<PrimaryEnablePerformanceCounterAccessRequest>
for &mut PrimaryEnablePerformanceCounterAccessRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PrimaryEnablePerformanceCounterAccessRequest>(offset);
fidl::encoding::Encode::<PrimaryEnablePerformanceCounterAccessRequest>::encode(
(<fidl::encoding::HandleType<
fidl::Event,
{ fidl::ObjectType::EVENT.into_raw() },
2147483648,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.access_token
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::HandleType<
fidl::Event,
{ fidl::ObjectType::EVENT.into_raw() },
2147483648,
>,
>,
> fidl::encoding::Encode<PrimaryEnablePerformanceCounterAccessRequest> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PrimaryEnablePerformanceCounterAccessRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for PrimaryEnablePerformanceCounterAccessRequest {
#[inline(always)]
fn new_empty() -> Self {
Self {
access_token: fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>),
}
}
#[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::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, &mut self.access_token, decoder, offset + 0, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for PrimaryEnablePerformanceCountersRequest {
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 PrimaryEnablePerformanceCountersRequest {
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<PrimaryEnablePerformanceCountersRequest>
for &PrimaryEnablePerformanceCountersRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PrimaryEnablePerformanceCountersRequest>(offset);
fidl::encoding::Encode::<PrimaryEnablePerformanceCountersRequest>::encode(
(<fidl::encoding::Vector<u64, 64> as fidl::encoding::ValueTypeMarker>::borrow(
&self.counters,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<T0: fidl::encoding::Encode<fidl::encoding::Vector<u64, 64>>>
fidl::encoding::Encode<PrimaryEnablePerformanceCountersRequest> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PrimaryEnablePerformanceCountersRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for PrimaryEnablePerformanceCountersRequest {
#[inline(always)]
fn new_empty() -> Self {
Self { counters: fidl::new_empty!(fidl::encoding::Vector<u64, 64>) }
}
#[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::Vector<u64, 64>, &mut self.counters, decoder, offset + 0, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for PrimaryExecuteCommandRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
80
}
}
impl fidl::encoding::ValueTypeMarker for PrimaryExecuteCommandRequest {
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<PrimaryExecuteCommandRequest> for &PrimaryExecuteCommandRequest {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PrimaryExecuteCommandRequest>(offset);
fidl::encoding::Encode::<PrimaryExecuteCommandRequest>::encode(
(
<u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.context_id),
<fidl::encoding::UnboundedVector<BufferRange> as fidl::encoding::ValueTypeMarker>::borrow(&self.resources),
<fidl::encoding::UnboundedVector<CommandBuffer> as fidl::encoding::ValueTypeMarker>::borrow(&self.command_buffers),
<fidl::encoding::UnboundedVector<u64> as fidl::encoding::ValueTypeMarker>::borrow(&self.wait_semaphores),
<fidl::encoding::UnboundedVector<u64> as fidl::encoding::ValueTypeMarker>::borrow(&self.signal_semaphores),
<CommandBufferFlags as fidl::encoding::ValueTypeMarker>::borrow(&self.flags),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<u32>,
T1: fidl::encoding::Encode<fidl::encoding::UnboundedVector<BufferRange>>,
T2: fidl::encoding::Encode<fidl::encoding::UnboundedVector<CommandBuffer>>,
T3: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u64>>,
T4: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u64>>,
T5: fidl::encoding::Encode<CommandBufferFlags>,
> fidl::encoding::Encode<PrimaryExecuteCommandRequest> for (T0, T1, T2, T3, T4, T5)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PrimaryExecuteCommandRequest>(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)?;
self.2.encode(encoder, offset + 24, depth)?;
self.3.encode(encoder, offset + 40, depth)?;
self.4.encode(encoder, offset + 56, depth)?;
self.5.encode(encoder, offset + 72, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for PrimaryExecuteCommandRequest {
#[inline(always)]
fn new_empty() -> Self {
Self {
context_id: fidl::new_empty!(u32),
resources: fidl::new_empty!(fidl::encoding::UnboundedVector<BufferRange>),
command_buffers: fidl::new_empty!(fidl::encoding::UnboundedVector<CommandBuffer>),
wait_semaphores: fidl::new_empty!(fidl::encoding::UnboundedVector<u64>),
signal_semaphores: fidl::new_empty!(fidl::encoding::UnboundedVector<u64>),
flags: fidl::new_empty!(CommandBufferFlags),
}
}
#[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!(u32, &mut self.context_id, decoder, offset + 0, _depth)?;
fidl::decode!(
fidl::encoding::UnboundedVector<BufferRange>,
&mut self.resources,
decoder,
offset + 8,
_depth
)?;
fidl::decode!(
fidl::encoding::UnboundedVector<CommandBuffer>,
&mut self.command_buffers,
decoder,
offset + 24,
_depth
)?;
fidl::decode!(
fidl::encoding::UnboundedVector<u64>,
&mut self.wait_semaphores,
decoder,
offset + 40,
_depth
)?;
fidl::decode!(
fidl::encoding::UnboundedVector<u64>,
&mut self.signal_semaphores,
decoder,
offset + 56,
_depth
)?;
fidl::decode!(CommandBufferFlags, &mut self.flags, decoder, offset + 72, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for PrimaryExecuteImmediateCommandsRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
40
}
}
impl fidl::encoding::ValueTypeMarker for PrimaryExecuteImmediateCommandsRequest {
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<PrimaryExecuteImmediateCommandsRequest>
for &PrimaryExecuteImmediateCommandsRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PrimaryExecuteImmediateCommandsRequest>(offset);
fidl::encoding::Encode::<PrimaryExecuteImmediateCommandsRequest>::encode(
(
<u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.context_id),
<fidl::encoding::Vector<u8, 2048> as fidl::encoding::ValueTypeMarker>::borrow(&self.command_data),
<fidl::encoding::UnboundedVector<u64> as fidl::encoding::ValueTypeMarker>::borrow(&self.semaphores),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<u32>,
T1: fidl::encoding::Encode<fidl::encoding::Vector<u8, 2048>>,
T2: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u64>>,
> fidl::encoding::Encode<PrimaryExecuteImmediateCommandsRequest> for (T0, T1, T2)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PrimaryExecuteImmediateCommandsRequest>(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)?;
self.2.encode(encoder, offset + 24, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for PrimaryExecuteImmediateCommandsRequest {
#[inline(always)]
fn new_empty() -> Self {
Self {
context_id: fidl::new_empty!(u32),
command_data: fidl::new_empty!(fidl::encoding::Vector<u8, 2048>),
semaphores: fidl::new_empty!(fidl::encoding::UnboundedVector<u64>),
}
}
#[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!(u32, &mut self.context_id, decoder, offset + 0, _depth)?;
fidl::decode!(fidl::encoding::Vector<u8, 2048>, &mut self.command_data, decoder, offset + 8, _depth)?;
fidl::decode!(
fidl::encoding::UnboundedVector<u64>,
&mut self.semaphores,
decoder,
offset + 24,
_depth
)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for PrimaryExecuteInlineCommandsRequest {
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 PrimaryExecuteInlineCommandsRequest {
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<PrimaryExecuteInlineCommandsRequest>
for &PrimaryExecuteInlineCommandsRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PrimaryExecuteInlineCommandsRequest>(offset);
fidl::encoding::Encode::<PrimaryExecuteInlineCommandsRequest>::encode(
(
<u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.context_id),
<fidl::encoding::UnboundedVector<InlineCommand> as fidl::encoding::ValueTypeMarker>::borrow(&self.commands),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<u32>,
T1: fidl::encoding::Encode<fidl::encoding::UnboundedVector<InlineCommand>>,
> fidl::encoding::Encode<PrimaryExecuteInlineCommandsRequest> 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::<PrimaryExecuteInlineCommandsRequest>(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 PrimaryExecuteInlineCommandsRequest {
#[inline(always)]
fn new_empty() -> Self {
Self {
context_id: fidl::new_empty!(u32),
commands: fidl::new_empty!(fidl::encoding::UnboundedVector<InlineCommand>),
}
}
#[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!(u32, &mut self.context_id, decoder, offset + 0, _depth)?;
fidl::decode!(
fidl::encoding::UnboundedVector<InlineCommand>,
&mut self.commands,
decoder,
offset + 8,
_depth
)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for PrimaryImportObject2Request {
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::ResourceTypeMarker for PrimaryImportObject2Request {
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<PrimaryImportObject2Request>
for &mut PrimaryImportObject2Request
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PrimaryImportObject2Request>(offset);
fidl::encoding::Encode::<PrimaryImportObject2Request>::encode(
(
<fidl::encoding::HandleType<
fidl::Handle,
{ fidl::ObjectType::NONE.into_raw() },
2147483648,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.object
),
<ObjectType as fidl::encoding::ValueTypeMarker>::borrow(&self.object_type),
<u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.object_id),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::HandleType<
fidl::Handle,
{ fidl::ObjectType::NONE.into_raw() },
2147483648,
>,
>,
T1: fidl::encoding::Encode<ObjectType>,
T2: fidl::encoding::Encode<u64>,
> fidl::encoding::Encode<PrimaryImportObject2Request> for (T0, T1, T2)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PrimaryImportObject2Request>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 4, depth)?;
self.2.encode(encoder, offset + 8, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for PrimaryImportObject2Request {
#[inline(always)]
fn new_empty() -> Self {
Self {
object: fidl::new_empty!(fidl::encoding::HandleType<fidl::Handle, { fidl::ObjectType::NONE.into_raw() }, 2147483648>),
object_type: fidl::new_empty!(ObjectType),
object_id: fidl::new_empty!(u64),
}
}
#[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::HandleType<fidl::Handle, { fidl::ObjectType::NONE.into_raw() }, 2147483648>, &mut self.object, decoder, offset + 0, _depth)?;
fidl::decode!(ObjectType, &mut self.object_type, decoder, offset + 4, _depth)?;
fidl::decode!(u64, &mut self.object_id, decoder, offset + 8, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for PrimaryIsPerformanceCounterAccessAllowedResponse {
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::ValueTypeMarker for PrimaryIsPerformanceCounterAccessAllowedResponse {
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<PrimaryIsPerformanceCounterAccessAllowedResponse>
for &PrimaryIsPerformanceCounterAccessAllowedResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PrimaryIsPerformanceCounterAccessAllowedResponse>(offset);
fidl::encoding::Encode::<PrimaryIsPerformanceCounterAccessAllowedResponse>::encode(
(<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.enabled),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<T0: fidl::encoding::Encode<bool>>
fidl::encoding::Encode<PrimaryIsPerformanceCounterAccessAllowedResponse> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PrimaryIsPerformanceCounterAccessAllowedResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for PrimaryIsPerformanceCounterAccessAllowedResponse {
#[inline(always)]
fn new_empty() -> Self {
Self { enabled: fidl::new_empty!(bool) }
}
#[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!(bool, &mut self.enabled, decoder, offset + 0, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for PrimaryOnNotifyMemoryImportedRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[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
}
}
impl fidl::encoding::ValueTypeMarker for PrimaryOnNotifyMemoryImportedRequest {
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<PrimaryOnNotifyMemoryImportedRequest>
for &PrimaryOnNotifyMemoryImportedRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PrimaryOnNotifyMemoryImportedRequest>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut PrimaryOnNotifyMemoryImportedRequest)
.write_unaligned((self as *const PrimaryOnNotifyMemoryImportedRequest).read());
}
Ok(())
}
}
unsafe impl<T0: fidl::encoding::Encode<u64>>
fidl::encoding::Encode<PrimaryOnNotifyMemoryImportedRequest> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PrimaryOnNotifyMemoryImportedRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for PrimaryOnNotifyMemoryImportedRequest {
#[inline(always)]
fn new_empty() -> Self {
Self { bytes: fidl::new_empty!(u64) }
}
#[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, 8);
}
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for PrimaryOnNotifyMessagesConsumedRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[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
}
}
impl fidl::encoding::ValueTypeMarker for PrimaryOnNotifyMessagesConsumedRequest {
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<PrimaryOnNotifyMessagesConsumedRequest>
for &PrimaryOnNotifyMessagesConsumedRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PrimaryOnNotifyMessagesConsumedRequest>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut PrimaryOnNotifyMessagesConsumedRequest).write_unaligned(
(self as *const PrimaryOnNotifyMessagesConsumedRequest).read(),
);
}
Ok(())
}
}
unsafe impl<T0: fidl::encoding::Encode<u64>>
fidl::encoding::Encode<PrimaryOnNotifyMessagesConsumedRequest> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PrimaryOnNotifyMessagesConsumedRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for PrimaryOnNotifyMessagesConsumedRequest {
#[inline(always)]
fn new_empty() -> Self {
Self { count: fidl::new_empty!(u64) }
}
#[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, 8);
}
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for PrimaryReleaseObjectRequest {
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 PrimaryReleaseObjectRequest {
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<PrimaryReleaseObjectRequest> for &PrimaryReleaseObjectRequest {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PrimaryReleaseObjectRequest>(offset);
fidl::encoding::Encode::<PrimaryReleaseObjectRequest>::encode(
(
<u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.object_id),
<ObjectType as fidl::encoding::ValueTypeMarker>::borrow(&self.object_type),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<T0: fidl::encoding::Encode<u64>, T1: fidl::encoding::Encode<ObjectType>>
fidl::encoding::Encode<PrimaryReleaseObjectRequest> 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::<PrimaryReleaseObjectRequest>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for PrimaryReleaseObjectRequest {
#[inline(always)]
fn new_empty() -> Self {
Self { object_id: fidl::new_empty!(u64), object_type: fidl::new_empty!(ObjectType) }
}
#[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(8) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffff00000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(u64, &mut self.object_id, decoder, offset + 0, _depth)?;
fidl::decode!(ObjectType, &mut self.object_type, decoder, offset + 8, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for PrimaryReleasePerformanceCounterBufferPoolRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[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
}
}
impl fidl::encoding::ValueTypeMarker for PrimaryReleasePerformanceCounterBufferPoolRequest {
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<PrimaryReleasePerformanceCounterBufferPoolRequest>
for &PrimaryReleasePerformanceCounterBufferPoolRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PrimaryReleasePerformanceCounterBufferPoolRequest>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut PrimaryReleasePerformanceCounterBufferPoolRequest)
.write_unaligned(
(self as *const PrimaryReleasePerformanceCounterBufferPoolRequest).read(),
);
}
Ok(())
}
}
unsafe impl<T0: fidl::encoding::Encode<u64>>
fidl::encoding::Encode<PrimaryReleasePerformanceCounterBufferPoolRequest> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PrimaryReleasePerformanceCounterBufferPoolRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for PrimaryReleasePerformanceCounterBufferPoolRequest {
#[inline(always)]
fn new_empty() -> Self {
Self { pool_id: fidl::new_empty!(u64) }
}
#[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, 8);
}
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for PrimaryRemovePerformanceCounterBufferFromPoolRequest {
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
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
impl fidl::encoding::ValueTypeMarker for PrimaryRemovePerformanceCounterBufferFromPoolRequest {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::