#![warn(clippy::all)]
#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
use bitflags::bitflags;
use fidl::client::QueryResponseFut;
use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
use fidl::endpoints::{ControlHandle as _, Responder as _};
use futures::future::{self, MaybeDone, TryFutureExt};
use zx_status;
pub 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(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct CommandBufferFlags: u64 {
const VENDOR_FLAG_0 = 65536;
}
}
impl CommandBufferFlags {
#[inline(always)]
pub fn from_bits_allow_unknown(bits: u64) -> Self {
Self::from_bits_retain(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(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
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 {
Self::from_bits_retain(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(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct ImportFlags: u64 {
const SEMAPHORE_ONE_SHOT = 1;
}
}
impl ImportFlags {
#[inline(always)]
pub fn from_bits_allow_unknown(bits: u64) -> Self {
Self::from_bits_retain(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(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
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 {
Self::from_bits_retain(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(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct ResultFlags: u32 {
const DISCONTINUITY = 1;
}
}
impl ResultFlags {
#[inline(always)]
pub fn from_bits_allow_unknown(bits: u32) -> Self {
Self::from_bits_retain(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 PowerGoalType {
OnReadyForWork,
HighPerformance,
SustainedPerformance,
#[doc(hidden)]
__SourceBreaking { unknown_ordinal: u64 },
}
#[macro_export]
macro_rules! PowerGoalTypeUnknown {
() => {
_
};
}
impl PowerGoalType {
#[inline]
pub fn from_primitive(prim: u64) -> Option<Self> {
match prim {
1 => Some(Self::OnReadyForWork),
2 => Some(Self::HighPerformance),
3 => Some(Self::SustainedPerformance),
_ => None,
}
}
#[inline]
pub fn from_primitive_allow_unknown(prim: u64) -> Self {
match prim {
1 => Self::OnReadyForWork,
2 => Self::HighPerformance,
3 => Self::SustainedPerformance,
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::OnReadyForWork => 1,
Self::HighPerformance => 2,
Self::SustainedPerformance => 3,
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<fidl::encoding::DefaultFuchsiaResourceDialect>
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<fidl::encoding::DefaultFuchsiaResourceDialect> 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<fidl::encoding::DefaultFuchsiaResourceDialect>
for PerformanceCounterAccessGetPerformanceCountTokenResponse
{
}
#[derive(Debug, PartialEq)]
pub struct PowerElementProviderGetPowerGoalsResponse {
pub goals: Vec<PowerGoal>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for PowerElementProviderGetPowerGoalsResponse
{
}
#[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<fidl::encoding::DefaultFuchsiaResourceDialect>
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<fidl::encoding::DefaultFuchsiaResourceDialect>
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<fidl::encoding::DefaultFuchsiaResourceDialect>
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(Clone, Debug, Default, PartialEq)]
pub struct PowerElementProviderGetClockSpeedLevelRequest {
pub hz: Option<u64>,
pub allow_max: Option<bool>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for PowerElementProviderGetClockSpeedLevelRequest {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct PowerElementProviderSetClockLimitRequest {
pub hz: Option<u64>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for PowerElementProviderSetClockLimitRequest {}
#[derive(Debug, Default, PartialEq)]
pub struct PowerElementProviderGetClockSpeedLevelResponse {
pub token: Option<fidl::Event>,
pub level: Option<u8>,
pub actual_hz: Option<u64>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for PowerElementProviderGetClockSpeedLevelResponse
{
}
#[derive(Debug, Default, PartialEq)]
pub struct PowerElementProviderSetClockLimitResponse {
pub handle: Option<fidl::EventPair>,
pub actual_hz: Option<u64>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for PowerElementProviderSetClockLimitResponse
{
}
#[derive(Debug, Default, PartialEq)]
pub struct PowerGoal {
pub type_: Option<PowerGoalType>,
pub token: Option<fidl::Event>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for PowerGoal {}
#[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<fidl::encoding::DefaultFuchsiaResourceDialect>
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<fidl::encoding::DefaultFuchsiaResourceDialect> 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<fidl::encoding::DefaultFuchsiaResourceDialect> 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::MonotonicInstant,
) -> Result<CombinedDeviceEvent, fidl::Error> {
CombinedDeviceEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#query(
&self,
mut query_id: QueryId,
___deadline: zx::MonotonicInstant,
) -> 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::MonotonicInstant,
) -> 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<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
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,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
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>, fidl::encoding::DefaultFuchsiaResourceDialect>
{
CombinedDeviceProxyInterface::r#get_icd_list(self)
}
}
impl CombinedDeviceProxyInterface for CombinedDeviceProxy {
type QueryResponseFut = fidl::client::QueryResponseFut<
DeviceQueryResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#query(&self, mut query_id: QueryId) -> Self::QueryResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<DeviceQueryResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<DeviceQueryResponse, i32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
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>, fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#get_icd_list(&self) -> Self::GetIcdListResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<Vec<IcdInfo>, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
IcdLoaderDeviceGetIcdListResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
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<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
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::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::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<fidl::encoding::DefaultFuchsiaResourceDialect>>,
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<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
{
(self.inner, self.is_terminated)
}
fn from_inner(
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for 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::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
e.into(),
))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x627d4c6093b078e7 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
DeviceQueryRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::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::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::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::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::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::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::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<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
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(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
#[cfg(target_os = "fuchsia")]
fn signal_peer(
&self,
clear_mask: zx::Signals,
set_mask: zx::Signals,
) -> Result<(), zx_status::Status> {
use fidl::Peered;
self.inner.channel().signal_peer(clear_mask, set_mask)
}
}
impl 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::MonotonicInstant,
) -> 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<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
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<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
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::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::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<fidl::encoding::DefaultFuchsiaResourceDialect>>,
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<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
{
(self.inner, self.is_terminated)
}
fn from_inner(
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for 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::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
e.into(),
))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x5ef0be960d4b0f4c => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(DependencyInjectionSetMemoryPressureProviderRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::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<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
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(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
#[cfg(target_os = "fuchsia")]
fn signal_peer(
&self,
clear_mask: zx::Signals,
set_mask: zx::Signals,
) -> Result<(), zx_status::Status> {
use fidl::Peered;
self.inner.channel().signal_peer(clear_mask, set_mask)
}
}
impl 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::MonotonicInstant,
) -> Result<DeviceEvent, fidl::Error> {
DeviceEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#query(
&self,
mut query_id: QueryId,
___deadline: zx::MonotonicInstant,
) -> 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<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
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,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
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,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#query(&self, mut query_id: QueryId) -> Self::QueryResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<DeviceQueryResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<DeviceQueryResponse, i32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
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<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
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::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::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<fidl::encoding::DefaultFuchsiaResourceDialect>>,
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<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
{
(self.inner, self.is_terminated)
}
fn from_inner(
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for 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::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
e.into(),
))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x627d4c6093b078e7 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
DeviceQueryRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::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::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::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<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
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(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
#[cfg(target_os = "fuchsia")]
fn signal_peer(
&self,
clear_mask: zx::Signals,
set_mask: zx::Signals,
) -> Result<(), zx_status::Status> {
use fidl::Peered;
self.inner.channel().signal_peer(clear_mask, set_mask)
}
}
impl 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::MonotonicInstant,
) -> 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<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
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<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
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::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::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<fidl::encoding::DefaultFuchsiaResourceDialect>>,
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<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
{
(self.inner, self.is_terminated)
}
fn from_inner(
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for 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::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
e.into(),
))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x5420df493d4fa915 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
DiagnosticDeviceDumpStateRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::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<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
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(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
#[cfg(target_os = "fuchsia")]
fn signal_peer(
&self,
clear_mask: zx::Signals,
set_mask: zx::Signals,
) -> Result<(), zx_status::Status> {
use fidl::Peered;
self.inner.channel().signal_peer(clear_mask, set_mask)
}
}
impl 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::MonotonicInstant,
) -> Result<IcdLoaderDeviceEvent, fidl::Error> {
IcdLoaderDeviceEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#get_icd_list(
&self,
___deadline: zx::MonotonicInstant,
) -> 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<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
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>, fidl::encoding::DefaultFuchsiaResourceDialect>
{
IcdLoaderDeviceProxyInterface::r#get_icd_list(self)
}
}
impl IcdLoaderDeviceProxyInterface for IcdLoaderDeviceProxy {
type GetIcdListResponseFut =
fidl::client::QueryResponseFut<Vec<IcdInfo>, fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#get_icd_list(&self) -> Self::GetIcdListResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<Vec<IcdInfo>, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
IcdLoaderDeviceGetIcdListResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
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<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
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::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::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<fidl::encoding::DefaultFuchsiaResourceDialect>>,
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<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
{
(self.inner, self.is_terminated)
}
fn from_inner(
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for 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::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
e.into(),
))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x7673e76395008257 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
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<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
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(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
#[cfg(target_os = "fuchsia")]
fn signal_peer(
&self,
clear_mask: zx::Signals,
set_mask: zx::Signals,
) -> Result<(), zx_status::Status> {
use fidl::Peered;
self.inner.channel().signal_peer(clear_mask, set_mask)
}
}
impl 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::MonotonicInstant,
) -> Result<NotificationEvent, fidl::Error> {
NotificationEvent::decode(self.client.wait_for_event(deadline)?)
}
}
#[derive(Debug, Clone)]
pub struct NotificationProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
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<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
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::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::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<fidl::encoding::DefaultFuchsiaResourceDialect>>,
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<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
{
(self.inner, self.is_terminated)
}
fn from_inner(
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for 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::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
e.into(),
))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
_ => 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<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
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(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
#[cfg(target_os = "fuchsia")]
fn signal_peer(
&self,
clear_mask: zx::Signals,
set_mask: zx::Signals,
) -> Result<(), zx_status::Status> {
use fidl::Peered;
self.inner.channel().signal_peer(clear_mask, set_mask)
}
}
impl 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::MonotonicInstant,
) -> Result<PerformanceCounterAccessEvent, fidl::Error> {
PerformanceCounterAccessEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#get_performance_count_token(
&self,
___deadline: zx::MonotonicInstant,
) -> 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<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
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, fidl::encoding::DefaultFuchsiaResourceDialect>
{
PerformanceCounterAccessProxyInterface::r#get_performance_count_token(self)
}
}
impl PerformanceCounterAccessProxyInterface for PerformanceCounterAccessProxy {
type GetPerformanceCountTokenResponseFut =
fidl::client::QueryResponseFut<fidl::Event, fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#get_performance_count_token(&self) -> Self::GetPerformanceCountTokenResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<fidl::Event, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
PerformanceCounterAccessGetPerformanceCountTokenResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
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<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
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::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::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<fidl::encoding::DefaultFuchsiaResourceDialect>>,
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<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
{
(self.inner, self.is_terminated)
}
fn from_inner(
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for 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::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
e.into(),
))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x48410470c5f00f92 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle = 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<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
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(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
#[cfg(target_os = "fuchsia")]
fn signal_peer(
&self,
clear_mask: zx::Signals,
set_mask: zx::Signals,
) -> Result<(), zx_status::Status> {
use fidl::Peered;
self.inner.channel().signal_peer(clear_mask, set_mask)
}
}
impl 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::MonotonicInstant,
) -> Result<PerformanceCounterEventsEvent, fidl::Error> {
PerformanceCounterEventsEvent::decode(self.client.wait_for_event(deadline)?)
}
}
#[derive(Debug, Clone)]
pub struct PerformanceCounterEventsProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
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<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
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::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::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::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::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<fidl::encoding::DefaultFuchsiaResourceDialect>>,
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<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
{
(self.inner, self.is_terminated)
}
fn from_inner(
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for 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::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
e.into(),
))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
_ => 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<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
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(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
#[cfg(target_os = "fuchsia")]
fn signal_peer(
&self,
clear_mask: zx::Signals,
set_mask: zx::Signals,
) -> Result<(), zx_status::Status> {
use fidl::Peered;
self.inner.channel().signal_peer(clear_mask, set_mask)
}
}
impl 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 PowerElementProviderMarker;
impl fidl::endpoints::ProtocolMarker for PowerElementProviderMarker {
type Proxy = PowerElementProviderProxy;
type RequestStream = PowerElementProviderRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = PowerElementProviderSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) PowerElementProvider";
}
pub type PowerElementProviderGetClockSpeedLevelResult =
Result<PowerElementProviderGetClockSpeedLevelResponse, i32>;
pub type PowerElementProviderSetClockLimitResult =
Result<PowerElementProviderSetClockLimitResponse, i32>;
pub trait PowerElementProviderProxyInterface: Send + Sync {
type GetPowerGoalsResponseFut: std::future::Future<Output = Result<Vec<PowerGoal>, fidl::Error>>
+ Send;
fn r#get_power_goals(&self) -> Self::GetPowerGoalsResponseFut;
type GetClockSpeedLevelResponseFut: std::future::Future<
Output = Result<PowerElementProviderGetClockSpeedLevelResult, fidl::Error>,
> + Send;
fn r#get_clock_speed_level(
&self,
payload: &PowerElementProviderGetClockSpeedLevelRequest,
) -> Self::GetClockSpeedLevelResponseFut;
type SetClockLimitResponseFut: std::future::Future<Output = Result<PowerElementProviderSetClockLimitResult, fidl::Error>>
+ Send;
fn r#set_clock_limit(
&self,
payload: &PowerElementProviderSetClockLimitRequest,
) -> Self::SetClockLimitResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct PowerElementProviderSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for PowerElementProviderSynchronousProxy {
type Proxy = PowerElementProviderProxy;
type Protocol = PowerElementProviderMarker;
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 PowerElementProviderSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name =
<PowerElementProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
}
pub fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
pub fn wait_for_event(
&self,
deadline: zx::MonotonicInstant,
) -> Result<PowerElementProviderEvent, fidl::Error> {
PowerElementProviderEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#get_power_goals(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<Vec<PowerGoal>, fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
fidl::encoding::FlexibleType<PowerElementProviderGetPowerGoalsResponse>,
>(
(),
0x2ff49ddffb0e07c0,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<PowerElementProviderMarker>("get_power_goals")?;
Ok(_response.goals)
}
pub fn r#get_clock_speed_level(
&self,
mut payload: &PowerElementProviderGetClockSpeedLevelRequest,
___deadline: zx::MonotonicInstant,
) -> Result<PowerElementProviderGetClockSpeedLevelResult, fidl::Error> {
let _response = self.client.send_query::<
PowerElementProviderGetClockSpeedLevelRequest,
fidl::encoding::FlexibleResultType<PowerElementProviderGetClockSpeedLevelResponse, i32>,
>(
payload,
0x5315a9bc44a9c53c,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<PowerElementProviderMarker>("get_clock_speed_level")?;
Ok(_response.map(|x| x))
}
pub fn r#set_clock_limit(
&self,
mut payload: &PowerElementProviderSetClockLimitRequest,
___deadline: zx::MonotonicInstant,
) -> Result<PowerElementProviderSetClockLimitResult, fidl::Error> {
let _response = self.client.send_query::<
PowerElementProviderSetClockLimitRequest,
fidl::encoding::FlexibleResultType<PowerElementProviderSetClockLimitResponse, i32>,
>(
payload,
0x614bf25c3a1571b4,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<PowerElementProviderMarker>("set_clock_limit")?;
Ok(_response.map(|x| x))
}
}
#[derive(Debug, Clone)]
pub struct PowerElementProviderProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for PowerElementProviderProxy {
type Protocol = PowerElementProviderMarker;
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 PowerElementProviderProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name =
<PowerElementProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> PowerElementProviderEventStream {
PowerElementProviderEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#get_power_goals(
&self,
) -> fidl::client::QueryResponseFut<Vec<PowerGoal>, fidl::encoding::DefaultFuchsiaResourceDialect>
{
PowerElementProviderProxyInterface::r#get_power_goals(self)
}
pub fn r#get_clock_speed_level(
&self,
mut payload: &PowerElementProviderGetClockSpeedLevelRequest,
) -> fidl::client::QueryResponseFut<
PowerElementProviderGetClockSpeedLevelResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
PowerElementProviderProxyInterface::r#get_clock_speed_level(self, payload)
}
pub fn r#set_clock_limit(
&self,
mut payload: &PowerElementProviderSetClockLimitRequest,
) -> fidl::client::QueryResponseFut<
PowerElementProviderSetClockLimitResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
PowerElementProviderProxyInterface::r#set_clock_limit(self, payload)
}
}
impl PowerElementProviderProxyInterface for PowerElementProviderProxy {
type GetPowerGoalsResponseFut = fidl::client::QueryResponseFut<
Vec<PowerGoal>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#get_power_goals(&self) -> Self::GetPowerGoalsResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<Vec<PowerGoal>, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleType<PowerElementProviderGetPowerGoalsResponse>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x2ff49ddffb0e07c0,
>(_buf?)?
.into_result::<PowerElementProviderMarker>("get_power_goals")?;
Ok(_response.goals)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<PowerGoal>>(
(),
0x2ff49ddffb0e07c0,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
type GetClockSpeedLevelResponseFut = fidl::client::QueryResponseFut<
PowerElementProviderGetClockSpeedLevelResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#get_clock_speed_level(
&self,
mut payload: &PowerElementProviderGetClockSpeedLevelRequest,
) -> Self::GetClockSpeedLevelResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<PowerElementProviderGetClockSpeedLevelResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleResultType<
PowerElementProviderGetClockSpeedLevelResponse,
i32,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x5315a9bc44a9c53c,
>(_buf?)?
.into_result::<PowerElementProviderMarker>("get_clock_speed_level")?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
PowerElementProviderGetClockSpeedLevelRequest,
PowerElementProviderGetClockSpeedLevelResult,
>(
payload,
0x5315a9bc44a9c53c,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
type SetClockLimitResponseFut = fidl::client::QueryResponseFut<
PowerElementProviderSetClockLimitResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#set_clock_limit(
&self,
mut payload: &PowerElementProviderSetClockLimitRequest,
) -> Self::SetClockLimitResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<PowerElementProviderSetClockLimitResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleResultType<PowerElementProviderSetClockLimitResponse, i32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x614bf25c3a1571b4,
>(_buf?)?
.into_result::<PowerElementProviderMarker>("set_clock_limit")?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
PowerElementProviderSetClockLimitRequest,
PowerElementProviderSetClockLimitResult,
>(
payload,
0x614bf25c3a1571b4,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
}
pub struct PowerElementProviderEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for PowerElementProviderEventStream {}
impl futures::stream::FusedStream for PowerElementProviderEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for PowerElementProviderEventStream {
type Item = Result<PowerElementProviderEvent, 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(PowerElementProviderEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum PowerElementProviderEvent {
#[non_exhaustive]
_UnknownEvent {
ordinal: u64,
},
}
impl PowerElementProviderEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<PowerElementProviderEvent, 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 {
_ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
Ok(PowerElementProviderEvent::_UnknownEvent { ordinal: tx_header.ordinal })
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name:
<PowerElementProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct PowerElementProviderRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for PowerElementProviderRequestStream {}
impl futures::stream::FusedStream for PowerElementProviderRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for PowerElementProviderRequestStream {
type Protocol = PowerElementProviderMarker;
type ControlHandle = PowerElementProviderControlHandle;
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 {
PowerElementProviderControlHandle { inner: self.inner.clone() }
}
fn into_inner(
self,
) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
{
(self.inner, self.is_terminated)
}
fn from_inner(
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for PowerElementProviderRequestStream {
type Item = Result<PowerElementProviderRequest, 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 PowerElementProviderRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
e.into(),
))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x2ff49ddffb0e07c0 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle = PowerElementProviderControlHandle {
inner: this.inner.clone(),
};
Ok(PowerElementProviderRequest::GetPowerGoals {
responder: PowerElementProviderGetPowerGoalsResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x5315a9bc44a9c53c => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(PowerElementProviderGetClockSpeedLevelRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PowerElementProviderGetClockSpeedLevelRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = PowerElementProviderControlHandle {
inner: this.inner.clone(),
};
Ok(PowerElementProviderRequest::GetClockSpeedLevel {payload: req,
responder: PowerElementProviderGetClockSpeedLevelResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x614bf25c3a1571b4 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(PowerElementProviderSetClockLimitRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PowerElementProviderSetClockLimitRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = PowerElementProviderControlHandle {
inner: this.inner.clone(),
};
Ok(PowerElementProviderRequest::SetClockLimit {payload: req,
responder: PowerElementProviderSetClockLimitResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ if header.tx_id == 0 && header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
Ok(PowerElementProviderRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: PowerElementProviderControlHandle { inner: this.inner.clone() },
method_type: fidl::MethodType::OneWay,
})
}
_ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
this.inner.send_framework_err(
fidl::encoding::FrameworkErr::UnknownMethod,
header.tx_id,
header.ordinal,
header.dynamic_flags(),
(bytes, handles),
)?;
Ok(PowerElementProviderRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: PowerElementProviderControlHandle { inner: this.inner.clone() },
method_type: fidl::MethodType::TwoWay,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <PowerElementProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum PowerElementProviderRequest {
GetPowerGoals { responder: PowerElementProviderGetPowerGoalsResponder },
GetClockSpeedLevel {
payload: PowerElementProviderGetClockSpeedLevelRequest,
responder: PowerElementProviderGetClockSpeedLevelResponder,
},
SetClockLimit {
payload: PowerElementProviderSetClockLimitRequest,
responder: PowerElementProviderSetClockLimitResponder,
},
#[non_exhaustive]
_UnknownMethod {
ordinal: u64,
control_handle: PowerElementProviderControlHandle,
method_type: fidl::MethodType,
},
}
impl PowerElementProviderRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_get_power_goals(self) -> Option<(PowerElementProviderGetPowerGoalsResponder)> {
if let PowerElementProviderRequest::GetPowerGoals { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_get_clock_speed_level(
self,
) -> Option<(
PowerElementProviderGetClockSpeedLevelRequest,
PowerElementProviderGetClockSpeedLevelResponder,
)> {
if let PowerElementProviderRequest::GetClockSpeedLevel { payload, responder } = self {
Some((payload, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_set_clock_limit(
self,
) -> Option<(
PowerElementProviderSetClockLimitRequest,
PowerElementProviderSetClockLimitResponder,
)> {
if let PowerElementProviderRequest::SetClockLimit { payload, responder } = self {
Some((payload, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
PowerElementProviderRequest::GetPowerGoals { .. } => "get_power_goals",
PowerElementProviderRequest::GetClockSpeedLevel { .. } => "get_clock_speed_level",
PowerElementProviderRequest::SetClockLimit { .. } => "set_clock_limit",
PowerElementProviderRequest::_UnknownMethod {
method_type: fidl::MethodType::OneWay,
..
} => "unknown one-way method",
PowerElementProviderRequest::_UnknownMethod {
method_type: fidl::MethodType::TwoWay,
..
} => "unknown two-way method",
}
}
}
#[derive(Debug, Clone)]
pub struct PowerElementProviderControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for PowerElementProviderControlHandle {
fn shutdown(&self) {
self.inner.shutdown()
}
fn shutdown_with_epitaph(&self, status: zx_status::Status) {
self.inner.shutdown_with_epitaph(status)
}
fn is_closed(&self) -> bool {
self.inner.channel().is_closed()
}
fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
#[cfg(target_os = "fuchsia")]
fn signal_peer(
&self,
clear_mask: zx::Signals,
set_mask: zx::Signals,
) -> Result<(), zx_status::Status> {
use fidl::Peered;
self.inner.channel().signal_peer(clear_mask, set_mask)
}
}
impl PowerElementProviderControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct PowerElementProviderGetPowerGoalsResponder {
control_handle: std::mem::ManuallyDrop<PowerElementProviderControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for PowerElementProviderGetPowerGoalsResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for PowerElementProviderGetPowerGoalsResponder {
type ControlHandle = PowerElementProviderControlHandle;
fn control_handle(&self) -> &PowerElementProviderControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl PowerElementProviderGetPowerGoalsResponder {
pub fn send(self, mut goals: Vec<PowerGoal>) -> Result<(), fidl::Error> {
let _result = self.send_raw(goals);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut goals: Vec<PowerGoal>) -> Result<(), fidl::Error> {
let _result = self.send_raw(goals);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut goals: Vec<PowerGoal>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleType<
PowerElementProviderGetPowerGoalsResponse,
>>(
fidl::encoding::Flexible::new((goals.as_mut(),)),
self.tx_id,
0x2ff49ddffb0e07c0,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct PowerElementProviderGetClockSpeedLevelResponder {
control_handle: std::mem::ManuallyDrop<PowerElementProviderControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for PowerElementProviderGetClockSpeedLevelResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for PowerElementProviderGetClockSpeedLevelResponder {
type ControlHandle = PowerElementProviderControlHandle;
fn control_handle(&self) -> &PowerElementProviderControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl PowerElementProviderGetClockSpeedLevelResponder {
pub fn send(
self,
mut result: Result<PowerElementProviderGetClockSpeedLevelResponse, 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<PowerElementProviderGetClockSpeedLevelResponse, i32>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut result: Result<PowerElementProviderGetClockSpeedLevelResponse, i32>,
) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
PowerElementProviderGetClockSpeedLevelResponse,
i32,
>>(
fidl::encoding::FlexibleResult::new(result.as_mut().map_err(|e| *e)),
self.tx_id,
0x5315a9bc44a9c53c,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct PowerElementProviderSetClockLimitResponder {
control_handle: std::mem::ManuallyDrop<PowerElementProviderControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for PowerElementProviderSetClockLimitResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for PowerElementProviderSetClockLimitResponder {
type ControlHandle = PowerElementProviderControlHandle;
fn control_handle(&self) -> &PowerElementProviderControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl PowerElementProviderSetClockLimitResponder {
pub fn send(
self,
mut result: Result<PowerElementProviderSetClockLimitResponse, 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<PowerElementProviderSetClockLimitResponse, i32>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut result: Result<PowerElementProviderSetClockLimitResponse, i32>,
) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
PowerElementProviderSetClockLimitResponse,
i32,
>>(
fidl::encoding::FlexibleResult::new(result.as_mut().map_err(|e| *e)),
self.tx_id,
0x614bf25c3a1571b4,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[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::MonotonicInstant,
) -> 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::MonotonicInstant) -> 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::MonotonicInstant,
) -> 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<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
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<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
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, fidl::encoding::DefaultFuchsiaResourceDialect> {
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<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#flush(&self) -> Self::FlushResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<(), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect,
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, fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#is_performance_counter_access_allowed(
&self,
) -> Self::IsPerformanceCounterAccessAllowedResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<bool, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
PrimaryIsPerformanceCounterAccessAllowedResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
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<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
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::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::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::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::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::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::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<fidl::encoding::DefaultFuchsiaResourceDialect>>,
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<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
{
(self.inner, self.is_terminated)
}
fn from_inner(
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for 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::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
e.into(),
))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x774ef4bc434f6b40 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
PrimaryImportObject2Request,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::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::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::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::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::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::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::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::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::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::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::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::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::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::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::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::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::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::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::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::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::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::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::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::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::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::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::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::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::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::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::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::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::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::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::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::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::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::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::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::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::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::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::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<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
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(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
#[cfg(target_os = "fuchsia")]
fn signal_peer(
&self,
clear_mask: zx::Signals,
set_mask: zx::Signals,
) -> Result<(), zx_status::Status> {
use fidl::Peered;
self.inner.channel().signal_peer(clear_mask, set_mask)
}
}
impl 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::MonotonicInstant,
) -> Result<TestDeviceEvent, fidl::Error> {
TestDeviceEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#query(
&self,
mut query_id: QueryId,
___deadline: zx::MonotonicInstant,
) -> 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::MonotonicInstant,
) -> 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::MonotonicInstant,
) -> 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<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
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,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
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>, fidl::encoding::DefaultFuchsiaResourceDialect>
{
TestDeviceProxyInterface::r#get_icd_list(self)
}
pub fn r#get_unit_test_status(
&self,
) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
TestDeviceProxyInterface::r#get_unit_test_status(self)
}
}
impl TestDeviceProxyInterface for TestDeviceProxy {
type QueryResponseFut = fidl::client::QueryResponseFut<
DeviceQueryResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#query(&self, mut query_id: QueryId) -> Self::QueryResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<DeviceQueryResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<DeviceQueryResponse, i32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
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>, fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#get_icd_list(&self) -> Self::GetIcdListResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<Vec<IcdInfo>, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
IcdLoaderDeviceGetIcdListResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
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, fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#get_unit_test_status(&self) -> Self::GetUnitTestStatusResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<i32, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
TestDeviceGetUnitTestStatusResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
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<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
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::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::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<fidl::encoding::DefaultFuchsiaResourceDialect>>,
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<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
{
(self.inner, self.is_terminated)
}
fn from_inner(
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for 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::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
e.into(),
))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x627d4c6093b078e7 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
DeviceQueryRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::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::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::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::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::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::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::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::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::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<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
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(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
#[cfg(target_os = "fuchsia")]
fn signal_peer(
&self,
clear_mask: zx::Signals,
set_mask: zx::Signals,
) -> Result<(), zx_status::Status> {
use fidl::Peered;
self.inner.channel().signal_peer(clear_mask, set_mask)
}
}
impl 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(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct ServiceMarker;
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::ServiceMarker for ServiceMarker {
type Proxy = ServiceProxy;
type Request = ServiceRequest;
const SERVICE_NAME: &'static str = "fuchsia.gpu.magma.Service";
}
#[cfg(target_os = "fuchsia")]
pub enum ServiceRequest {
Device(DeviceRequestStream),
PowerElementProvider(PowerElementProviderRequestStream),
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::ServiceRequest for ServiceRequest {
type Service = ServiceMarker;
fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
match name {
"device" => Self::Device(
<DeviceRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
),
"power_element_provider" => Self::PowerElementProvider(
<PowerElementProviderRequestStream as fidl::endpoints::RequestStream>::from_channel(
_channel,
),
),
_ => panic!("no such member protocol name for service Service"),
}
}
fn member_names() -> &'static [&'static str] {
&["device", "power_element_provider"]
}
}
#[cfg(target_os = "fuchsia")]
pub struct ServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::ServiceProxy for ServiceProxy {
type Service = ServiceMarker;
fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
Self(opener)
}
}
#[cfg(target_os = "fuchsia")]
impl ServiceProxy {
pub fn connect_to_device(&self) -> Result<DeviceProxy, fidl::Error> {
let (proxy, server_end) = fidl::endpoints::create_proxy::<DeviceMarker>();
self.connect_channel_to_device(server_end)?;
Ok(proxy)
}
pub fn connect_to_device_sync(&self) -> Result<DeviceSynchronousProxy, fidl::Error> {
let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<DeviceMarker>();
self.connect_channel_to_device(server_end)?;
Ok(proxy)
}
pub fn connect_channel_to_device(
&self,
server_end: fidl::endpoints::ServerEnd<DeviceMarker>,
) -> Result<(), fidl::Error> {
self.0.open_member("device", server_end.into_channel())
}
pub fn connect_to_power_element_provider(
&self,
) -> Result<PowerElementProviderProxy, fidl::Error> {
let (proxy, server_end) = fidl::endpoints::create_proxy::<PowerElementProviderMarker>();
self.connect_channel_to_power_element_provider(server_end)?;
Ok(proxy)
}
pub fn connect_to_power_element_provider_sync(
&self,
) -> Result<PowerElementProviderSynchronousProxy, fidl::Error> {
let (proxy, server_end) =
fidl::endpoints::create_sync_proxy::<PowerElementProviderMarker>();
self.connect_channel_to_power_element_provider(server_end)?;
Ok(proxy)
}
pub fn connect_channel_to_power_element_provider(
&self,
server_end: fidl::endpoints::ServerEnd<PowerElementProviderMarker>,
) -> Result<(), fidl::Error> {
self.0.open_member("power_element_provider", server_end.into_channel())
}
}
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(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
*value
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
for CommandBufferFlags
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.bits(), offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CommandBufferFlags {
#[inline(always)]
fn new_empty() -> Self {
Self::empty()
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<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(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
*value
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for IcdFlags {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.bits(), offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for IcdFlags {
#[inline(always)]
fn new_empty() -> Self {
Self::empty()
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u32>(offset);
*self = Self::from_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(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
*value
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for ImportFlags {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.bits(), offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ImportFlags {
#[inline(always)]
fn new_empty() -> Self {
Self::empty()
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<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(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
*value
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for MapFlags {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.bits(), offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for MapFlags {
#[inline(always)]
fn new_empty() -> Self {
Self::empty()
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<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(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
*value
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for ResultFlags {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.bits(), offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ResultFlags {
#[inline(always)]
fn new_empty() -> Self {
Self::empty()
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u32>(offset);
*self = Self::from_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(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
*value
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for BufferOp {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BufferOp {
#[inline(always)]
fn new_empty() -> Self {
Self::unknown()
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u32>(offset);
*self = Self::from_primitive_allow_unknown(prim);
Ok(())
}
}
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(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
*value
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for ObjectType {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ObjectType {
#[inline(always)]
fn new_empty() -> Self {
Self::unknown()
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u32>(offset);
*self = Self::from_primitive_allow_unknown(prim);
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for PowerGoalType {
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 PowerGoalType {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
*value
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for PowerGoalType {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PowerGoalType {
#[inline(always)]
fn new_empty() -> Self {
Self::unknown()
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u64>(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(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
*value
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for QueryId {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for QueryId {
#[inline(always)]
fn new_empty() -> Self {
Self::unknown()
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u64>(offset);
*self = Self::from_primitive_allow_unknown(prim);
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for BufferRange {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<BufferRange, D>
for &BufferRange
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
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<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<u64, D>,
T1: fidl::encoding::Encode<u64, D>,
T2: fidl::encoding::Encode<u64, D>,
> fidl::encoding::Encode<BufferRange, D> for (T0, T1, T2)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
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<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BufferRange {
#[inline(always)]
fn new_empty() -> Self {
Self {
buffer_id: fidl::new_empty!(u64, D),
offset: fidl::new_empty!(u64, D),
size: fidl::new_empty!(u64, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
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(())
}
}
impl fidl::encoding::ValueTypeMarker for CommandBuffer {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<CommandBuffer, D>
for &CommandBuffer
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
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<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<u32, D>,
T1: fidl::encoding::Encode<u64, D>,
> fidl::encoding::Encode<CommandBuffer, D> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<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<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CommandBuffer {
#[inline(always)]
fn new_empty() -> Self {
Self {
resource_index: fidl::new_empty!(u32, D),
start_offset: fidl::new_empty!(u64, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
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(())
}
}
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::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
}
}
unsafe impl
fidl::encoding::Encode<
DependencyInjectionSetMemoryPressureProviderRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut DependencyInjectionSetMemoryPressureProviderRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder
.debug_check_bounds::<DependencyInjectionSetMemoryPressureProviderRequest>(offset);
fidl::encoding::Encode::<
DependencyInjectionSetMemoryPressureProviderRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::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::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
DependencyInjectionSetMemoryPressureProviderRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder
.debug_check_bounds::<DependencyInjectionSetMemoryPressureProviderRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for DependencyInjectionSetMemoryPressureProviderRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
provider: fidl::new_empty!(
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_memorypressure::ProviderMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_memorypressure::ProviderMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.provider,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
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::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
}
}
unsafe impl
fidl::encoding::Encode<DeviceConnect2Request, fidl::encoding::DefaultFuchsiaResourceDialect>
for &mut DeviceConnect2Request
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceConnect2Request>(offset);
fidl::encoding::Encode::<DeviceConnect2Request, fidl::encoding::DefaultFuchsiaResourceDialect>::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, fidl::encoding::DefaultFuchsiaResourceDialect>,
T1: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PrimaryMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T2: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<NotificationMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<DeviceConnect2Request, fidl::encoding::DefaultFuchsiaResourceDialect>
for (T0, T1, T2)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<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, fidl::encoding::DefaultFuchsiaResourceDialect>
for DeviceConnect2Request
{
#[inline(always)]
fn new_empty() -> Self {
Self {
client_id: fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect),
primary_channel: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PrimaryMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
notification_channel: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<NotificationMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
u64,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.client_id,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PrimaryMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.primary_channel,
decoder,
offset + 8,
_depth
)?;
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<NotificationMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.notification_channel,
decoder,
offset + 12,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for DeviceQueryRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DeviceQueryRequest, D>
for &DeviceQueryRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceQueryRequest>(offset);
fidl::encoding::Encode::<DeviceQueryRequest, D>::encode(
(<QueryId as fidl::encoding::ValueTypeMarker>::borrow(&self.query_id),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<QueryId, D>>
fidl::encoding::Encode<DeviceQueryRequest, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceQueryRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DeviceQueryRequest {
#[inline(always)]
fn new_empty() -> Self {
Self { query_id: fidl::new_empty!(QueryId, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(QueryId, D, &mut self.query_id, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for DiagnosticDeviceDumpStateRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<DiagnosticDeviceDumpStateRequest, D>
for &DiagnosticDeviceDumpStateRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
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<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
fidl::encoding::Encode<DiagnosticDeviceDumpStateRequest, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DiagnosticDeviceDumpStateRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for DiagnosticDeviceDumpStateRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { dump_type: fidl::new_empty!(u32, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for IcdLoaderDeviceGetIcdListResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<IcdLoaderDeviceGetIcdListResponse, D>
for &IcdLoaderDeviceGetIcdListResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<IcdLoaderDeviceGetIcdListResponse>(offset);
fidl::encoding::Encode::<IcdLoaderDeviceGetIcdListResponse, D>::encode(
(<fidl::encoding::Vector<IcdInfo, 8> as fidl::encoding::ValueTypeMarker>::borrow(
&self.icd_list,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::Vector<IcdInfo, 8>, D>,
> fidl::encoding::Encode<IcdLoaderDeviceGetIcdListResponse, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<IcdLoaderDeviceGetIcdListResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for IcdLoaderDeviceGetIcdListResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { icd_list: fidl::new_empty!(fidl::encoding::Vector<IcdInfo, 8>, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(fidl::encoding::Vector<IcdInfo, 8>, D, &mut self.icd_list, decoder, offset + 0, _depth)?;
Ok(())
}
}
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::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
}
}
unsafe impl
fidl::encoding::Encode<
PerformanceCounterAccessGetPerformanceCountTokenResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut PerformanceCounterAccessGetPerformanceCountTokenResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PerformanceCounterAccessGetPerformanceCountTokenResponse>(
offset,
);
fidl::encoding::Encode::<
PerformanceCounterAccessGetPerformanceCountTokenResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::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::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
PerformanceCounterAccessGetPerformanceCountTokenResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PerformanceCounterAccessGetPerformanceCountTokenResponse>(
offset,
);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
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>, fidl::encoding::DefaultFuchsiaResourceDialect),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.access_token, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for PowerElementProviderGetPowerGoalsResponse {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for PowerElementProviderGetPowerGoalsResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl
fidl::encoding::Encode<
PowerElementProviderGetPowerGoalsResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut PowerElementProviderGetPowerGoalsResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PowerElementProviderGetPowerGoalsResponse>(offset);
fidl::encoding::Encode::<PowerElementProviderGetPowerGoalsResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<fidl::encoding::UnboundedVector<PowerGoal> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.goals),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::UnboundedVector<PowerGoal>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
PowerElementProviderGetPowerGoalsResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PowerElementProviderGetPowerGoalsResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for PowerElementProviderGetPowerGoalsResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self {
goals: fidl::new_empty!(
fidl::encoding::UnboundedVector<PowerGoal>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::UnboundedVector<PowerGoal>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.goals,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for PrimaryAddPerformanceCounterBufferOffsetsToPoolRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<PrimaryAddPerformanceCounterBufferOffsetsToPoolRequest, D>
for &PrimaryAddPerformanceCounterBufferOffsetsToPoolRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PrimaryAddPerformanceCounterBufferOffsetsToPoolRequest>(
offset,
);
fidl::encoding::Encode::<PrimaryAddPerformanceCounterBufferOffsetsToPoolRequest, D>::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<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<u64, D>,
T1: fidl::encoding::Encode<fidl::encoding::Vector<BufferRange, 64>, D>,
> fidl::encoding::Encode<PrimaryAddPerformanceCounterBufferOffsetsToPoolRequest, D>
for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PrimaryAddPerformanceCounterBufferOffsetsToPoolRequest>(
offset,
);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for PrimaryAddPerformanceCounterBufferOffsetsToPoolRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
pool_id: fidl::new_empty!(u64, D),
offsets: fidl::new_empty!(fidl::encoding::Vector<BufferRange, 64>, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(u64, D, &mut self.pool_id, decoder, offset + 0, _depth)?;
fidl::decode!(fidl::encoding::Vector<BufferRange, 64>, D, &mut self.offsets, decoder, offset + 8, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for PrimaryBufferRangeOp2Request {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<PrimaryBufferRangeOp2Request, D> for &PrimaryBufferRangeOp2Request
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PrimaryBufferRangeOp2Request>(offset);
fidl::encoding::Encode::<PrimaryBufferRangeOp2Request, D>::encode(
(
<BufferOp as fidl::encoding::ValueTypeMarker>::borrow(&self.op),
<BufferRange as fidl::encoding::ValueTypeMarker>::borrow(&self.range),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<BufferOp, D>,
T1: fidl::encoding::Encode<BufferRange, D>,
> fidl::encoding::Encode<PrimaryBufferRangeOp2Request, D> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<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<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for PrimaryBufferRangeOp2Request
{
#[inline(always)]
fn new_empty() -> Self {
Self { op: fidl::new_empty!(BufferOp, D), range: fidl::new_empty!(BufferRange, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffff00000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(BufferOp, D, &mut self.op, decoder, offset + 0, _depth)?;
fidl::decode!(BufferRange, D, &mut self.range, decoder, offset + 8, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for PrimaryClearPerformanceCountersRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<PrimaryClearPerformanceCountersRequest, D>
for &PrimaryClearPerformanceCountersRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PrimaryClearPerformanceCountersRequest>(offset);
fidl::encoding::Encode::<PrimaryClearPerformanceCountersRequest, D>::encode(
(<fidl::encoding::Vector<u64, 64> as fidl::encoding::ValueTypeMarker>::borrow(
&self.counters,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::Vector<u64, 64>, D>,
> fidl::encoding::Encode<PrimaryClearPerformanceCountersRequest, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PrimaryClearPerformanceCountersRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for PrimaryClearPerformanceCountersRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { counters: fidl::new_empty!(fidl::encoding::Vector<u64, 64>, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(fidl::encoding::Vector<u64, 64>, D, &mut self.counters, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for PrimaryCreateContextRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<PrimaryCreateContextRequest, D> for &PrimaryCreateContextRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
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<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
fidl::encoding::Encode<PrimaryCreateContextRequest, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PrimaryCreateContextRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for PrimaryCreateContextRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { context_id: fidl::new_empty!(u32, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
}
Ok(())
}
}
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::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
}
}
unsafe impl
fidl::encoding::Encode<
PrimaryCreatePerformanceCounterBufferPoolRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut PrimaryCreatePerformanceCounterBufferPoolRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PrimaryCreatePerformanceCounterBufferPoolRequest>(offset);
fidl::encoding::Encode::<
PrimaryCreatePerformanceCounterBufferPoolRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::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, fidl::encoding::DefaultFuchsiaResourceDialect>,
T1: fidl::encoding::Encode<
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<PerformanceCounterEventsMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
PrimaryCreatePerformanceCounterBufferPoolRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<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, fidl::encoding::DefaultFuchsiaResourceDialect>
for PrimaryCreatePerformanceCounterBufferPoolRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
pool_id: fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect),
event_channel: fidl::new_empty!(
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<PerformanceCounterEventsMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
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,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.pool_id,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<PerformanceCounterEventsMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.event_channel,
decoder,
offset + 8,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for PrimaryDestroyContextRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<PrimaryDestroyContextRequest, D> for &PrimaryDestroyContextRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
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<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
fidl::encoding::Encode<PrimaryDestroyContextRequest, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PrimaryDestroyContextRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for PrimaryDestroyContextRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { context_id: fidl::new_empty!(u32, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for PrimaryDumpPerformanceCountersRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<PrimaryDumpPerformanceCountersRequest, D>
for &PrimaryDumpPerformanceCountersRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
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<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<u64, D>,
T1: fidl::encoding::Encode<u32, D>,
> fidl::encoding::Encode<PrimaryDumpPerformanceCountersRequest, D> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<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<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for PrimaryDumpPerformanceCountersRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { pool_id: fidl::new_empty!(u64, D), trigger_id: fidl::new_empty!(u32, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
let ptr = unsafe { buf_ptr.offset(8) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffff00000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
}
Ok(())
}
}
impl 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::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
}
}
unsafe impl
fidl::encoding::Encode<
PrimaryEnablePerformanceCounterAccessRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut PrimaryEnablePerformanceCounterAccessRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PrimaryEnablePerformanceCounterAccessRequest>(offset);
fidl::encoding::Encode::<
PrimaryEnablePerformanceCounterAccessRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::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::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
PrimaryEnablePerformanceCounterAccessRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PrimaryEnablePerformanceCounterAccessRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
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>, fidl::encoding::DefaultFuchsiaResourceDialect),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.access_token, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for PrimaryEnablePerformanceCountersRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<PrimaryEnablePerformanceCountersRequest, D>
for &PrimaryEnablePerformanceCountersRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PrimaryEnablePerformanceCountersRequest>(offset);
fidl::encoding::Encode::<PrimaryEnablePerformanceCountersRequest, D>::encode(
(<fidl::encoding::Vector<u64, 64> as fidl::encoding::ValueTypeMarker>::borrow(
&self.counters,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::Vector<u64, 64>, D>,
> fidl::encoding::Encode<PrimaryEnablePerformanceCountersRequest, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PrimaryEnablePerformanceCountersRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for PrimaryEnablePerformanceCountersRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { counters: fidl::new_empty!(fidl::encoding::Vector<u64, 64>, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(fidl::encoding::Vector<u64, 64>, D, &mut self.counters, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for PrimaryExecuteCommandRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<PrimaryExecuteCommandRequest, D> for &PrimaryExecuteCommandRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PrimaryExecuteCommandRequest>(offset);
fidl::encoding::Encode::<PrimaryExecuteCommandRequest, D>::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<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<u32, D>,
T1: fidl::encoding::Encode<fidl::encoding::UnboundedVector<BufferRange>, D>,
T2: fidl::encoding::Encode<fidl::encoding::UnboundedVector<CommandBuffer>, D>,
T3: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u64>, D>,
T4: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u64>, D>,
T5: fidl::encoding::Encode<CommandBufferFlags, D>,
> fidl::encoding::Encode<PrimaryExecuteCommandRequest, D> for (T0, T1, T2, T3, T4, T5)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<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<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for PrimaryExecuteCommandRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
context_id: fidl::new_empty!(u32, D),
resources: fidl::new_empty!(fidl::encoding::UnboundedVector<BufferRange>, D),
command_buffers: fidl::new_empty!(
fidl::encoding::UnboundedVector<CommandBuffer>,
D
),
wait_semaphores: fidl::new_empty!(fidl::encoding::UnboundedVector<u64>, D),
signal_semaphores: fidl::new_empty!(fidl::encoding::UnboundedVector<u64>, D),
flags: fidl::new_empty!(CommandBufferFlags, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffff00000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(u32, D, &mut self.context_id, decoder, offset + 0, _depth)?;
fidl::decode!(
fidl::encoding::UnboundedVector<BufferRange>,
D,
&mut self.resources,
decoder,
offset + 8,
_depth
)?;
fidl::decode!(
fidl::encoding::UnboundedVector<CommandBuffer>,
D,
&mut self.command_buffers,
decoder,
offset + 24,
_depth
)?;
fidl::decode!(
fidl::encoding::UnboundedVector<u64>,
D,
&mut self.wait_semaphores,
decoder,
offset + 40,
_depth
)?;
fidl::decode!(
fidl::encoding::UnboundedVector<u64>,
D,
&mut self.signal_semaphores,
decoder,
offset + 56,
_depth
)?;
fidl::decode!(CommandBufferFlags, D, &mut self.flags, decoder, offset + 72, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for PrimaryExecuteImmediateCommandsRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<PrimaryExecuteImmediateCommandsRequest, D>
for &PrimaryExecuteImmediateCommandsRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PrimaryExecuteImmediateCommandsRequest>(offset);
fidl::encoding::Encode::<PrimaryExecuteImmediateCommandsRequest, D>::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<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<u32, D>,
T1: fidl::encoding::Encode<fidl::encoding::Vector<u8, 2048>, D>,
T2: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u64>, D>,
> fidl::encoding::Encode<PrimaryExecuteImmediateCommandsRequest, D> for (T0, T1, T2)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
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<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for PrimaryExecuteImmediateCommandsRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
context_id: fidl::new_empty!(u32, D),
command_data: fidl::new_empty!(fidl::encoding::Vector<u8, 2048>, D),
semaphores: fidl::new_empty!(fidl::encoding::UnboundedVector<u64>, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
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, D, &mut self.context_id, decoder, offset + 0, _depth)?;
fidl::decode!(fidl::encoding::Vector<u8, 2048>, D, &mut self.command_data, decoder, offset + 8, _depth)?;
fidl::decode!(
fidl::encoding::UnboundedVector<u64>,
D,
&mut self.semaphores,
decoder,
offset + 24,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for PrimaryExecuteInlineCommandsRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<PrimaryExecuteInlineCommandsRequest, D>
for &PrimaryExecuteInlineCommandsRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PrimaryExecuteInlineCommandsRequest>(offset);
fidl::encoding::Encode::<PrimaryExecuteInlineCommandsRequest, D>::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<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<u32, D>,
T1: fidl::encoding::Encode<fidl::encoding::UnboundedVector<InlineCommand>, D>,
> fidl::encoding::Encode<PrimaryExecuteInlineCommandsRequest, D> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<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<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for PrimaryExecuteInlineCommandsRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
context_id: fidl::new_empty!(u32, D),
commands: fidl::new_empty!(fidl::encoding::UnboundedVector<InlineCommand>, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffff00000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(u32, D, &mut self.context_id, decoder, offset + 0, _depth)?;
fidl::decode!(
fidl::encoding::UnboundedVector<InlineCommand>,
D,
&mut self.commands,
decoder,
offset + 8,
_depth
)?;
Ok(())
}
}
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::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
}
}
unsafe impl
fidl::encoding::Encode<
PrimaryImportObject2Request,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut PrimaryImportObject2Request
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PrimaryImportObject2Request>(offset);
fidl::encoding::Encode::<
PrimaryImportObject2Request,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::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,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T1: fidl::encoding::Encode<ObjectType, fidl::encoding::DefaultFuchsiaResourceDialect>,
T2: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
>
fidl::encoding::Encode<
PrimaryImportObject2Request,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0, T1, T2)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<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, fidl::encoding::DefaultFuchsiaResourceDialect>
for PrimaryImportObject2Request
{
#[inline(always)]
fn new_empty() -> Self {
Self {
object: fidl::new_empty!(fidl::encoding::HandleType<fidl::Handle, { fidl::ObjectType::NONE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
object_type: fidl::new_empty!(
ObjectType,
fidl::encoding::DefaultFuchsiaResourceDialect
),
object_id: fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(fidl::encoding::HandleType<fidl::Handle, { fidl::ObjectType::NONE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.object, decoder, offset + 0, _depth)?;
fidl::decode!(
ObjectType,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.object_type,
decoder,
offset + 4,
_depth
)?;
fidl::decode!(
u64,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.object_id,
decoder,
offset + 8,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for PrimaryIsPerformanceCounterAccessAllowedResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<PrimaryIsPerformanceCounterAccessAllowedResponse, D>
for &PrimaryIsPerformanceCounterAccessAllowedResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PrimaryIsPerformanceCounterAccessAllowedResponse>(offset);
fidl::encoding::Encode::<PrimaryIsPerformanceCounterAccessAllowedResponse, D>::encode(
(<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.enabled),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
fidl::encoding::Encode<PrimaryIsPerformanceCounterAccessAllowedResponse, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PrimaryIsPerformanceCounterAccessAllowedResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for PrimaryIsPerformanceCounterAccessAllowedResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { enabled: fidl::new_empty!(bool, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(bool, D, &mut self.enabled, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for PrimaryOnNotifyMemoryImportedRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<PrimaryOnNotifyMemoryImportedRequest, D>
for &PrimaryOnNotifyMemoryImportedRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
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<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
fidl::encoding::Encode<PrimaryOnNotifyMemoryImportedRequest, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PrimaryOnNotifyMemoryImportedRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for PrimaryOnNotifyMemoryImportedRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { bytes: fidl::new_empty!(u64, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for PrimaryOnNotifyMessagesConsumedRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<PrimaryOnNotifyMessagesConsumedRequest, D>
for &PrimaryOnNotifyMessagesConsumedRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
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<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
fidl::encoding::Encode<PrimaryOnNotifyMessagesConsumedRequest, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PrimaryOnNotifyMessagesConsumedRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for PrimaryOnNotifyMessagesConsumedRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { count: fidl::new_empty!(u64, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for PrimaryReleaseObjectRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<PrimaryReleaseObjectRequest, D> for &PrimaryReleaseObjectRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PrimaryReleaseObjectRequest>(offset);
fidl::encoding::Encode::<PrimaryReleaseObjectRequest, D>::encode(
(
<u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.object_id),
<ObjectType as fidl::encoding::ValueTypeMarker>::borrow(&self.object_type),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<u64, D>,
T1: fidl::encoding::Encode<ObjectType, D>,
> fidl::encoding::Encode<PrimaryReleaseObjectRequest, D> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<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<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for PrimaryReleaseObjectRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
object_id: fidl::new_empty!(u64, D),
object_type: fidl::new_empty!(ObjectType, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(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, D, &mut self.object_id, decoder, offset + 0, _depth)?;
fidl::decode!(ObjectType, D, &mut self.object_type, decoder, offset + 8, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for PrimaryReleasePerformanceCounterBufferPoolRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<PrimaryReleasePerformanceCounterBufferPoolRequest, D>
for &PrimaryReleasePerformanceCounterBufferPoolRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
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<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
fidl::encoding::Encode<PrimaryReleasePerformanceCounterBufferPoolRequest, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PrimaryReleasePerformanceCounterBufferPoolRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for PrimaryReleasePerformanceCounterBufferPoolRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { pool_id: fidl::new_empty!(u64, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for PrimaryRemovePerformanceCounterBufferFromPoolRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<PrimaryRemovePerformanceCounterBufferFromPoolRequest, D>
for &PrimaryRemovePerformanceCounterBufferFromPoolRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder
.debug_check_bounds::<PrimaryRemovePerformanceCounterBufferFromPoolRequest>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut PrimaryRemovePerformanceCounterBufferFromPoolRequest)
.write_unaligned(
(self as *const PrimaryRemovePerformanceCounterBufferFromPoolRequest)
.read(),
);
}
Ok(())
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<u64, D>,
T1: fidl::encoding::Encode<u64, D>,
> fidl::encoding::Encode<PrimaryRemovePerformanceCounterBufferFromPoolRequest, D>
for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder
.debug_check_bounds::<PrimaryRemovePerformanceCounterBufferFromPoolRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for PrimaryRemovePerformanceCounterBufferFromPoolRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { pool_id: fidl::new_empty!(u64, D), buffer_id: fidl::new_empty!(u64, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for TestDeviceGetUnitTestStatusResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for TestDeviceGetUnitTestStatusResponse {
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<TestDeviceGetUnitTestStatusResponse, D>
for &TestDeviceGetUnitTestStatusResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<TestDeviceGetUnitTestStatusResponse>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut TestDeviceGetUnitTestStatusResponse)
.write_unaligned((self as *const TestDeviceGetUnitTestStatusResponse).read());
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i32, D>>
fidl::encoding::Encode<TestDeviceGetUnitTestStatusResponse, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<TestDeviceGetUnitTestStatusResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for TestDeviceGetUnitTestStatusResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { status: fidl::new_empty!(i32, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
}
Ok(())
}
}
impl IcdInfo {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.flags {
return 2;
}
if let Some(_) = self.component_url {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for IcdInfo {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for IcdInfo {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<IcdInfo, D> for &IcdInfo {
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<IcdInfo>(offset);
let max_ordinal: u64 = self.max_ordinal_present();
encoder.write_num(max_ordinal, offset);
encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
if max_ordinal == 0 {
return Ok(());
}
depth.increment()?;
let envelope_size = 8;
let bytes_len = max_ordinal as usize * envelope_size;
#[allow(unused_variables)]
let offset = encoder.out_of_line_offset(bytes_len);
let mut _prev_end_offset: usize = 0;
if 1 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (1 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<4096>, D>(
self.component_url.as_ref().map(<fidl::encoding::BoundedString<4096> as fidl::encoding::ValueTypeMarker>::borrow),
encoder, offset + cur_offset, depth
)?;
_prev_end_offset = cur_offset + envelope_size;
if 2 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (2 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<IcdFlags, D>(
self.flags.as_ref().map(<IcdFlags as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for IcdInfo {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
if len == 0 {
return Ok(());
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 1 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size = <fidl::encoding::BoundedString<4096> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.component_url.get_or_insert_with(|| {
fidl::new_empty!(fidl::encoding::BoundedString<4096>, D)
});
fidl::decode!(
fidl::encoding::BoundedString<4096>,
D,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 2 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<IcdFlags as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.flags.get_or_insert_with(|| fidl::new_empty!(IcdFlags, D));
fidl::decode!(IcdFlags, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
while next_offset < end_offset {
_next_ordinal_to_read += 1;
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
next_offset += envelope_size;
}
Ok(())
}
}
impl InlineCommand {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.semaphores {
return 2;
}
if let Some(_) = self.data {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for InlineCommand {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for InlineCommand {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<InlineCommand, D>
for &InlineCommand
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<InlineCommand>(offset);
let max_ordinal: u64 = self.max_ordinal_present();
encoder.write_num(max_ordinal, offset);
encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
if max_ordinal == 0 {
return Ok(());
}
depth.increment()?;
let envelope_size = 8;
let bytes_len = max_ordinal as usize * envelope_size;
#[allow(unused_variables)]
let offset = encoder.out_of_line_offset(bytes_len);
let mut _prev_end_offset: usize = 0;
if 1 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (1 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<u8>, D>(
self.data.as_ref().map(<fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow),
encoder, offset + cur_offset, depth
)?;
_prev_end_offset = cur_offset + envelope_size;
if 2 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (2 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<u64>, D>(
self.semaphores.as_ref().map(<fidl::encoding::UnboundedVector<u64> as fidl::encoding::ValueTypeMarker>::borrow),
encoder, offset + cur_offset, depth
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for InlineCommand {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
if len == 0 {
return Ok(());
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 1 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size = <fidl::encoding::UnboundedVector<u8> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.data.get_or_insert_with(|| {
fidl::new_empty!(fidl::encoding::UnboundedVector<u8>, D)
});
fidl::decode!(
fidl::encoding::UnboundedVector<u8>,
D,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 2 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size = <fidl::encoding::UnboundedVector<u64> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.semaphores.get_or_insert_with(|| {
fidl::new_empty!(fidl::encoding::UnboundedVector<u64>, D)
});
fidl::decode!(
fidl::encoding::UnboundedVector<u64>,
D,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
while next_offset < end_offset {
_next_ordinal_to_read += 1;
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
next_offset += envelope_size;
}
Ok(())
}
}
impl PerformanceCounterEventsOnPerformanceCounterReadCompletedRequest {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.flags {
return 5;
}
if let Some(_) = self.timestamp {
return 4;
}
if let Some(_) = self.buffer_offset {
return 3;
}
if let Some(_) = self.buffer_id {
return 2;
}
if let Some(_) = self.trigger_id {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker
for PerformanceCounterEventsOnPerformanceCounterReadCompletedRequest
{
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker
for PerformanceCounterEventsOnPerformanceCounterReadCompletedRequest
{
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<PerformanceCounterEventsOnPerformanceCounterReadCompletedRequest, D>
for &PerformanceCounterEventsOnPerformanceCounterReadCompletedRequest
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PerformanceCounterEventsOnPerformanceCounterReadCompletedRequest>(offset);
let max_ordinal: u64 = self.max_ordinal_present();
encoder.write_num(max_ordinal, offset);
encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
if max_ordinal == 0 {
return Ok(());
}
depth.increment()?;
let envelope_size = 8;
let bytes_len = max_ordinal as usize * envelope_size;
#[allow(unused_variables)]
let offset = encoder.out_of_line_offset(bytes_len);
let mut _prev_end_offset: usize = 0;
if 1 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (1 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<u32, D>(
self.trigger_id.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 2 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (2 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<u64, D>(
self.buffer_id.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 3 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (3 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<u32, D>(
self.buffer_offset.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 4 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (4 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<i64, D>(
self.timestamp.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 5 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (5 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<ResultFlags, D>(
self.flags.as_ref().map(<ResultFlags as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for PerformanceCounterEventsOnPerformanceCounterReadCompletedRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
if len == 0 {
return Ok(());
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 1 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.trigger_id.get_or_insert_with(|| fidl::new_empty!(u32, D));
fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 2 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.buffer_id.get_or_insert_with(|| fidl::new_empty!(u64, D));
fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 3 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.buffer_offset.get_or_insert_with(|| fidl::new_empty!(u32, D));
fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 4 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.timestamp.get_or_insert_with(|| fidl::new_empty!(i64, D));
fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 5 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<ResultFlags as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.flags.get_or_insert_with(|| fidl::new_empty!(ResultFlags, D));
fidl::decode!(ResultFlags, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
while next_offset < end_offset {
_next_ordinal_to_read += 1;
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
next_offset += envelope_size;
}
Ok(())
}
}
impl PowerElementProviderGetClockSpeedLevelRequest {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.allow_max {
return 2;
}
if let Some(_) = self.hz {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for PowerElementProviderGetClockSpeedLevelRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for PowerElementProviderGetClockSpeedLevelRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<PowerElementProviderGetClockSpeedLevelRequest, D>
for &PowerElementProviderGetClockSpeedLevelRequest
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PowerElementProviderGetClockSpeedLevelRequest>(offset);
let max_ordinal: u64 = self.max_ordinal_present();
encoder.write_num(max_ordinal, offset);
encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
if max_ordinal == 0 {
return Ok(());
}
depth.increment()?;
let envelope_size = 8;
let bytes_len = max_ordinal as usize * envelope_size;
#[allow(unused_variables)]
let offset = encoder.out_of_line_offset(bytes_len);
let mut _prev_end_offset: usize = 0;
if 1 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (1 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<u64, D>(
self.hz.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 2 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (2 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<bool, D>(
self.allow_max.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for PowerElementProviderGetClockSpeedLevelRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
if len == 0 {
return Ok(());
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 1 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.hz.get_or_insert_with(|| fidl::new_empty!(u64, D));
fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 2 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.allow_max.get_or_insert_with(|| fidl::new_empty!(bool, D));
fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
while next_offset < end_offset {
_next_ordinal_to_read += 1;
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
next_offset += envelope_size;
}
Ok(())
}
}
impl PowerElementProviderSetClockLimitRequest {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.hz {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for PowerElementProviderSetClockLimitRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for PowerElementProviderSetClockLimitRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<PowerElementProviderSetClockLimitRequest, D>
for &PowerElementProviderSetClockLimitRequest
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PowerElementProviderSetClockLimitRequest>(offset);
let max_ordinal: u64 = self.max_ordinal_present();
encoder.write_num(max_ordinal, offset);
encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
if max_ordinal == 0 {
return Ok(());
}
depth.increment()?;
let envelope_size = 8;
let bytes_len = max_ordinal as usize * envelope_size;
#[allow(unused_variables)]
let offset = encoder.out_of_line_offset(bytes_len);
let mut _prev_end_offset: usize = 0;
if 1 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (1 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<u64, D>(
self.hz.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for PowerElementProviderSetClockLimitRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
if len == 0 {
return Ok(());
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 1 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.hz.get_or_insert_with(|| fidl::new_empty!(u64, D));
fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
while next_offset < end_offset {
_next_ordinal_to_read += 1;
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
next_offset += envelope_size;
}
Ok(())
}
}
impl PowerElementProviderGetClockSpeedLevelResponse {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.actual_hz {
return 3;
}
if let Some(_) = self.level {
return 2;
}
if let Some(_) = self.token {
return 1;
}
0
}
}
impl fidl::encoding::ResourceTypeMarker for PowerElementProviderGetClockSpeedLevelResponse {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for PowerElementProviderGetClockSpeedLevelResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl
fidl::encoding::Encode<
PowerElementProviderGetClockSpeedLevelResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut PowerElementProviderGetClockSpeedLevelResponse
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PowerElementProviderGetClockSpeedLevelResponse>(offset);
let max_ordinal: u64 = self.max_ordinal_present();
encoder.write_num(max_ordinal, offset);
encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
if max_ordinal == 0 {
return Ok(());
}
depth.increment()?;
let envelope_size = 8;
let bytes_len = max_ordinal as usize * envelope_size;
#[allow(unused_variables)]
let offset = encoder.out_of_line_offset(bytes_len);
let mut _prev_end_offset: usize = 0;
if 1 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (1 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<
fidl::encoding::HandleType<
fidl::Event,
{ fidl::ObjectType::EVENT.into_raw() },
2147483648,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
self.token.as_mut().map(
<fidl::encoding::HandleType<
fidl::Event,
{ fidl::ObjectType::EVENT.into_raw() },
2147483648,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 2 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (2 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<
u8,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
self.level.as_ref().map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 3 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (3 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<
u64,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
self.actual_hz.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for PowerElementProviderGetClockSpeedLevelResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
if len == 0 {
return Ok(());
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 1 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size = <fidl::encoding::HandleType<
fidl::Event,
{ fidl::ObjectType::EVENT.into_raw() },
2147483648,
> as fidl::encoding::TypeMarker>::inline_size(
decoder.context
);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref =
self.token.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 2 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.level.get_or_insert_with(|| {
fidl::new_empty!(u8, fidl::encoding::DefaultFuchsiaResourceDialect)
});
fidl::decode!(
u8,
fidl::encoding::DefaultFuchsiaResourceDialect,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 3 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.actual_hz.get_or_insert_with(|| {
fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
});
fidl::decode!(
u64,
fidl::encoding::DefaultFuchsiaResourceDialect,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
while next_offset < end_offset {
_next_ordinal_to_read += 1;
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
next_offset += envelope_size;
}
Ok(())
}
}
impl PowerElementProviderSetClockLimitResponse {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.actual_hz {
return 2;
}
if let Some(_) = self.handle {
return 1;
}
0
}
}
impl fidl::encoding::ResourceTypeMarker for PowerElementProviderSetClockLimitResponse {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for PowerElementProviderSetClockLimitResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl
fidl::encoding::Encode<
PowerElementProviderSetClockLimitResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut PowerElementProviderSetClockLimitResponse
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PowerElementProviderSetClockLimitResponse>(offset);
let max_ordinal: u64 = self.max_ordinal_present();
encoder.write_num(max_ordinal, offset);
encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
if max_ordinal == 0 {
return Ok(());
}
depth.increment()?;
let envelope_size = 8;
let bytes_len = max_ordinal as usize * envelope_size;
#[allow(unused_variables)]
let offset = encoder.out_of_line_offset(bytes_len);
let mut _prev_end_offset: usize = 0;
if 1 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (1 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<
fidl::encoding::HandleType<
fidl::EventPair,
{ fidl::ObjectType::EVENTPAIR.into_raw() },
2147483648,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
self.handle.as_mut().map(
<fidl::encoding::HandleType<
fidl::EventPair,
{ fidl::ObjectType::EVENTPAIR.into_raw() },
2147483648,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 2 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (2 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<
u64,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
self.actual_hz.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for PowerElementProviderSetClockLimitResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
if len == 0 {
return Ok(());
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 1 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size = <fidl::encoding::HandleType<
fidl::EventPair,
{ fidl::ObjectType::EVENTPAIR.into_raw() },
2147483648,
> as fidl::encoding::TypeMarker>::inline_size(
decoder.context
);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref =
self.handle.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 2 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.actual_hz.get_or_insert_with(|| {
fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
});
fidl::decode!(
u64,
fidl::encoding::DefaultFuchsiaResourceDialect,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
while next_offset < end_offset {
_next_ordinal_to_read += 1;
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
next_offset += envelope_size;
}
Ok(())
}
}
impl PowerGoal {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.token {
return 2;
}
if let Some(_) = self.type_ {
return 1;
}
0
}
}
impl fidl::encoding::ResourceTypeMarker for PowerGoal {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for PowerGoal {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl fidl::encoding::Encode<PowerGoal, fidl::encoding::DefaultFuchsiaResourceDialect>
for &mut PowerGoal
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PowerGoal>(offset);
let max_ordinal: u64 = self.max_ordinal_present();
encoder.write_num(max_ordinal, offset);
encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
if max_ordinal == 0 {
return Ok(());
}
depth.increment()?;
let envelope_size = 8;
let bytes_len = max_ordinal as usize * envelope_size;
#[allow(unused_variables)]
let offset = encoder.out_of_line_offset(bytes_len);
let mut _prev_end_offset: usize = 0;
if 1 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (1 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<
PowerGoalType,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
self.type_.as_ref().map(<PowerGoalType as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 2 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (2 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<
fidl::encoding::HandleType<
fidl::Event,
{ fidl::ObjectType::EVENT.into_raw() },
2147483648,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
self.token.as_mut().map(
<fidl::encoding::HandleType<
fidl::Event,
{ fidl::ObjectType::EVENT.into_raw() },
2147483648,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for PowerGoal {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
if len == 0 {
return Ok(());
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 1 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<PowerGoalType as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.type_.get_or_insert_with(|| {
fidl::new_empty!(PowerGoalType, fidl::encoding::DefaultFuchsiaResourceDialect)
});
fidl::decode!(
PowerGoalType,
fidl::encoding::DefaultFuchsiaResourceDialect,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 2 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size = <fidl::encoding::HandleType<
fidl::Event,
{ fidl::ObjectType::EVENT.into_raw() },
2147483648,
> as fidl::encoding::TypeMarker>::inline_size(
decoder.context
);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref =
self.token.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
while next_offset < end_offset {
_next_ordinal_to_read += 1;
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
next_offset += envelope_size;
}
Ok(())
}
}
impl PrimaryImportObjectRequest {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.flags {
return 4;
}
if let Some(_) = self.object_id {
return 3;
}
if let Some(_) = self.object_type {
return 2;
}
if let Some(_) = self.object {
return 1;
}
0
}
}
impl fidl::encoding::ResourceTypeMarker for PrimaryImportObjectRequest {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for PrimaryImportObjectRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl
fidl::encoding::Encode<
PrimaryImportObjectRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut PrimaryImportObjectRequest
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PrimaryImportObjectRequest>(offset);
let max_ordinal: u64 = self.max_ordinal_present();
encoder.write_num(max_ordinal, offset);
encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
if max_ordinal == 0 {
return Ok(());
}
depth.increment()?;
let envelope_size = 8;
let bytes_len = max_ordinal as usize * envelope_size;
#[allow(unused_variables)]
let offset = encoder.out_of_line_offset(bytes_len);
let mut _prev_end_offset: usize = 0;
if 1 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (1 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<
Object,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
self.object
.as_mut()
.map(<Object as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 2 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (2 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<
ObjectType,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
self.object_type
.as_ref()
.map(<ObjectType as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 3 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (3 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<
u64,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
self.object_id.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 4 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (4 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<
ImportFlags,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
self.flags.as_ref().map(<ImportFlags as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for PrimaryImportObjectRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
if len == 0 {
return Ok(());
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 1 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<Object as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.object.get_or_insert_with(|| {
fidl::new_empty!(Object, fidl::encoding::DefaultFuchsiaResourceDialect)
});
fidl::decode!(
Object,
fidl::encoding::DefaultFuchsiaResourceDialect,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 2 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<ObjectType as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.object_type.get_or_insert_with(|| {
fidl::new_empty!(ObjectType, fidl::encoding::DefaultFuchsiaResourceDialect)
});
fidl::decode!(
ObjectType,
fidl::encoding::DefaultFuchsiaResourceDialect,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 3 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.object_id.get_or_insert_with(|| {
fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
});
fidl::decode!(
u64,
fidl::encoding::DefaultFuchsiaResourceDialect,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 4 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<ImportFlags as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.flags.get_or_insert_with(|| {
fidl::new_empty!(ImportFlags, fidl::encoding::DefaultFuchsiaResourceDialect)
});
fidl::decode!(
ImportFlags,
fidl::encoding::DefaultFuchsiaResourceDialect,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
while next_offset < end_offset {
_next_ordinal_to_read += 1;
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
next_offset += envelope_size;
}
Ok(())
}
}
impl PrimaryMapBufferRequest {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.flags {
return 3;
}
if let Some(_) = self.range {
return 2;
}
if let Some(_) = self.hw_va {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for PrimaryMapBufferRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for PrimaryMapBufferRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<PrimaryMapBufferRequest, D> for &PrimaryMapBufferRequest
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PrimaryMapBufferRequest>(offset);
let max_ordinal: u64 = self.max_ordinal_present();
encoder.write_num(max_ordinal, offset);
encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
if max_ordinal == 0 {
return Ok(());
}
depth.increment()?;
let envelope_size = 8;
let bytes_len = max_ordinal as usize * envelope_size;
#[allow(unused_variables)]
let offset = encoder.out_of_line_offset(bytes_len);
let mut _prev_end_offset: usize = 0;
if 1 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (1 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<u64, D>(
self.hw_va.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 2 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (2 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<BufferRange, D>(
self.range.as_ref().map(<BufferRange as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 3 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (3 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<MapFlags, D>(
self.flags.as_ref().map(<MapFlags as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for PrimaryMapBufferRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
if len == 0 {
return Ok(());
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 1 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.hw_va.get_or_insert_with(|| fidl::new_empty!(u64, D));
fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 2 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<BufferRange as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.range.get_or_insert_with(|| fidl::new_empty!(BufferRange, D));
fidl::decode!(BufferRange, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 3 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<MapFlags as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.flags.get_or_insert_with(|| fidl::new_empty!(MapFlags, D));
fidl::decode!(MapFlags, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
while next_offset < end_offset {
_next_ordinal_to_read += 1;
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
next_offset += envelope_size;
}
Ok(())
}
}
impl PrimaryUnmapBufferRequest {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.buffer_id {
return 2;
}
if let Some(_) = self.hw_va {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for PrimaryUnmapBufferRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for PrimaryUnmapBufferRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<PrimaryUnmapBufferRequest, D> for &PrimaryUnmapBufferRequest
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PrimaryUnmapBufferRequest>(offset);
let max_ordinal: u64 = self.max_ordinal_present();
encoder.write_num(max_ordinal, offset);
encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
if max_ordinal == 0 {
return Ok(());
}
depth.increment()?;
let envelope_size = 8;
let bytes_len = max_ordinal as usize * envelope_size;
#[allow(unused_variables)]
let offset = encoder.out_of_line_offset(bytes_len);
let mut _prev_end_offset: usize = 0;
if 1 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (1 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<u64, D>(
self.hw_va.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 2 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (2 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<u64, D>(
self.buffer_id.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for PrimaryUnmapBufferRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
if len == 0 {
return Ok(());
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 1 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.hw_va.get_or_insert_with(|| fidl::new_empty!(u64, D));
fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 2 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.buffer_id.get_or_insert_with(|| fidl::new_empty!(u64, D));
fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
while next_offset < end_offset {
_next_ordinal_to_read += 1;
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
next_offset += envelope_size;
}
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for DeviceQueryResponse {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for DeviceQueryResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl
fidl::encoding::Encode<DeviceQueryResponse, fidl::encoding::DefaultFuchsiaResourceDialect>
for &mut DeviceQueryResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceQueryResponse>(offset);
encoder.write_num::<u64>(self.ordinal(), offset);
match self {
DeviceQueryResponse::SimpleResult(ref val) => fidl::encoding::encode_in_envelope::<
u64,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
<u64 as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
),
DeviceQueryResponse::BufferResult(ref mut val) => {
fidl::encoding::encode_in_envelope::<
fidl::encoding::HandleType<
fidl::Vmo,
{ fidl::ObjectType::VMO.into_raw() },
2147483648,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
<fidl::encoding::HandleType<
fidl::Vmo,
{ fidl::ObjectType::VMO.into_raw() },
2147483648,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
val
),
encoder,
offset + 8,
_depth,
)
}
}
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for DeviceQueryResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self::SimpleResult(fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect))
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
#[allow(unused_variables)]
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
let (ordinal, inlined, num_bytes, num_handles) =
fidl::encoding::decode_union_inline_portion(decoder, offset)?;
let member_inline_size = match ordinal {
1 => <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2 => <fidl::encoding::HandleType<
fidl::Vmo,
{ fidl::ObjectType::VMO.into_raw() },
2147483648,
> as fidl::encoding::TypeMarker>::inline_size(decoder.context),
_ => return Err(fidl::Error::UnknownUnionTag),
};
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let _inner_offset;
if inlined {
decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
_inner_offset = offset + 8;
} else {
depth.increment()?;
_inner_offset = decoder.out_of_line_offset(member_inline_size)?;
}
match ordinal {
1 => {
#[allow(irrefutable_let_patterns)]
if let DeviceQueryResponse::SimpleResult(_) = self {
} else {
*self = DeviceQueryResponse::SimpleResult(fidl::new_empty!(
u64,
fidl::encoding::DefaultFuchsiaResourceDialect
));
}
#[allow(irrefutable_let_patterns)]
if let DeviceQueryResponse::SimpleResult(ref mut val) = self {
fidl::decode!(
u64,
fidl::encoding::DefaultFuchsiaResourceDialect,
val,
decoder,
_inner_offset,
depth
)?;
} else {
unreachable!()
}
}
2 => {
#[allow(irrefutable_let_patterns)]
if let DeviceQueryResponse::BufferResult(_) = self {
} else {
*self = DeviceQueryResponse::BufferResult(
fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
);
}
#[allow(irrefutable_let_patterns)]
if let DeviceQueryResponse::BufferResult(ref mut val) = self {
fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
ordinal => panic!("unexpected ordinal {:?}", ordinal),
}
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for Object {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for Object {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl fidl::encoding::Encode<Object, fidl::encoding::DefaultFuchsiaResourceDialect>
for &mut Object
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Object>(offset);
encoder.write_num::<u64>(self.ordinal(), offset);
match self {
Object::Semaphore(ref mut val) => fidl::encoding::encode_in_envelope::<
fidl::encoding::HandleType<
fidl::Event,
{ fidl::ObjectType::EVENT.into_raw() },
2147483648,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
<fidl::encoding::HandleType<
fidl::Event,
{ fidl::ObjectType::EVENT.into_raw() },
2147483648,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
val
),
encoder,
offset + 8,
_depth,
),
Object::Buffer(ref mut val) => fidl::encoding::encode_in_envelope::<
fidl::encoding::HandleType<
fidl::Vmo,
{ fidl::ObjectType::VMO.into_raw() },
2147483648,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
<fidl::encoding::HandleType<
fidl::Vmo,
{ fidl::ObjectType::VMO.into_raw() },
2147483648,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
val
),
encoder,
offset + 8,
_depth,
),
Object::VmoSemaphore(ref mut val) => fidl::encoding::encode_in_envelope::<
fidl::encoding::HandleType<
fidl::Vmo,
{ fidl::ObjectType::VMO.into_raw() },
2147483648,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
<fidl::encoding::HandleType<
fidl::Vmo,
{ fidl::ObjectType::VMO.into_raw() },
2147483648,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
val
),
encoder,
offset + 8,
_depth,
),
Object::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
}
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for Object {
#[inline(always)]
fn new_empty() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0 }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
#[allow(unused_variables)]
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
let (ordinal, inlined, num_bytes, num_handles) =
fidl::encoding::decode_union_inline_portion(decoder, offset)?;
let member_inline_size = match ordinal {
1 => <fidl::encoding::HandleType<
fidl::Event,
{ fidl::ObjectType::EVENT.into_raw() },
2147483648,
> as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2 => <fidl::encoding::HandleType<
fidl::Vmo,
{ fidl::ObjectType::VMO.into_raw() },
2147483648,
> as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3 => <fidl::encoding::HandleType<
fidl::Vmo,
{ fidl::ObjectType::VMO.into_raw() },
2147483648,
> as fidl::encoding::TypeMarker>::inline_size(decoder.context),
0 => return Err(fidl::Error::UnknownUnionTag),
_ => num_bytes as usize,
};
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let _inner_offset;
if inlined {
decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
_inner_offset = offset + 8;
} else {
depth.increment()?;
_inner_offset = decoder.out_of_line_offset(member_inline_size)?;
}
match ordinal {
1 => {
#[allow(irrefutable_let_patterns)]
if let Object::Semaphore(_) = self {
} else {
*self = Object::Semaphore(
fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
);
}
#[allow(irrefutable_let_patterns)]
if let Object::Semaphore(ref mut val) = self {
fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
2 => {
#[allow(irrefutable_let_patterns)]
if let Object::Buffer(_) = self {
} else {
*self = Object::Buffer(
fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
);
}
#[allow(irrefutable_let_patterns)]
if let Object::Buffer(ref mut val) = self {
fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
3 => {
#[allow(irrefutable_let_patterns)]
if let Object::VmoSemaphore(_) = self {
} else {
*self = Object::VmoSemaphore(
fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
);
}
#[allow(irrefutable_let_patterns)]
if let Object::VmoSemaphore(ref mut val) = self {
fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
#[allow(deprecated)]
ordinal => {
for _ in 0..num_handles {
decoder.drop_next_handle()?;
}
*self = Object::__SourceBreaking { unknown_ordinal: ordinal };
}
}
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
Ok(())
}
}
}