blob: 5bfd2b73bd9860fd7fd3db68dac12559e52720b0 [file] [log] [blame]
// WARNING: This file is machine generated by fidlgen.
#![allow(
unused_parens, // one-element-tuple-case is not a tuple
unused_mut, // not all args require mutation, but many do
nonstandard_style, // auto-caps does its best, but is not always successful
)]
#![recursion_limit = "512"]
#[cfg(target_os = "fuchsia")]
#[allow(unused_imports)]
use fuchsia_zircon as zx;
#[allow(unused_imports)]
use {
bitflags::bitflags,
fidl::{
client::{decode_transaction_body_fut, QueryResponseFut},
encoding::{Decodable as _, Encodable as _},
endpoints::{ControlHandle as _, Responder as _},
fidl_bits, fidl_empty_struct, fidl_enum, fidl_struct, fidl_struct_copy, fidl_table,
fidl_union, wrap_handle_metadata,
},
fuchsia_zircon_status as zx_status,
futures::future::{self, MaybeDone, TryFutureExt},
};
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(u32)]
pub enum ObjType {
None = 0,
Vmo = 3,
}
impl ObjType {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
0 => Some(Self::None),
3 => Some(Self::Vmo),
_ => None,
}
}
#[inline]
pub const fn into_primitive(self) -> u32 {
self as u32
}
#[deprecated = "Strict enums should not use `validate`"]
#[inline]
pub fn validate(self) -> std::result::Result<Self, u32> {
Ok(self)
}
#[deprecated = "Strict enums should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
fidl_enum! {
name: ObjType,
prim_ty: u32,
strict: true,
min_member: None,
}
#[derive(Debug, PartialEq)]
pub enum UnionWithHandle {
H(fidl::Vmo),
#[deprecated = "Use `UnionWithHandle::unknown()` to construct and `UnionWithHandleUnknown!()` to exhaustively match."]
#[doc(hidden)]
__Unknown {
ordinal: u64,
data: fidl::UnknownData,
},
}
/// Pattern that matches an unknown `UnionWithHandle` member.
#[macro_export]
macro_rules! UnionWithHandleUnknown {
() => {
_
};
}
impl UnionWithHandle {
#[inline]
pub fn unknown(ordinal: u64, data: fidl::UnknownData) -> Self {
#[allow(deprecated)]
Self::__Unknown { ordinal, data }
}
#[inline]
pub fn validate(self) -> std::result::Result<Self, (u64, fidl::UnknownData)> {
match self {
#[allow(deprecated)]
Self::__Unknown { ordinal, data } => Err((ordinal, data)),
_ => Ok(self),
}
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
#[allow(deprecated)]
Self::__Unknown { .. } => true,
_ => false,
}
}
}
fidl_union! {
name: UnionWithHandle,
members: [
H {
ty: fidl::Vmo,
ordinal: 1,
handle_metadata: {
handle_subtype: fidl::ObjectType::VMO,
handle_rights: fidl::Rights::from_bits_const(2147483648).unwrap(),
},
},
],
resource_unknown_member: __Unknown,
}
#[derive(Debug, PartialEq)]
pub struct HandlesInTypes {
pub normal_handle: fidl::Vmo,
pub handle_in_vec: Vec<fidl::Vmo>,
pub handle_in_array: [fidl::Vmo; 5],
pub handle_in_mixed_vec_array: Vec<[fidl::Vmo; 5]>,
pub table_with_handle: TableWithHandle,
pub union_with_handle: UnionWithHandle,
}
fidl_struct! {
name: HandlesInTypes,
members: [
normal_handle {
ty: fidl::Vmo,
offset_v1: 0,
offset_v2: 0,
handle_metadata: {
handle_subtype: fidl::ObjectType::VMO,
handle_rights: fidl::Rights::from_bits_const(2147483648).unwrap(),
},
},
handle_in_vec {
ty: Vec<fidl::Vmo>,
offset_v1: 8,
offset_v2: 8,
handle_metadata: {
handle_subtype: fidl::ObjectType::VMO,
handle_rights: fidl::Rights::from_bits_const(2147483648).unwrap(),
},
},
handle_in_array {
ty: [fidl::Vmo; 5],
offset_v1: 24,
offset_v2: 24,
handle_metadata: {
handle_subtype: fidl::ObjectType::VMO,
handle_rights: fidl::Rights::from_bits_const(2147483648).unwrap(),
},
},
handle_in_mixed_vec_array {
ty: Vec<[fidl::Vmo; 5]>,
offset_v1: 48,
offset_v2: 48,
handle_metadata: {
handle_subtype: fidl::ObjectType::VMO,
handle_rights: fidl::Rights::from_bits_const(2147483648).unwrap(),
},
},
table_with_handle {
ty: TableWithHandle,
offset_v1: 64,
offset_v2: 64,
},
union_with_handle {
ty: UnionWithHandle,
offset_v1: 80,
offset_v2: 80,
},
],
padding_v1: [
{
ty: u64,
offset: 0,
mask: 0xffffffff00000000u64,
},
{
ty: u64,
offset: 40,
mask: 0xffffffff00000000u64,
},],
padding_v2: [
{
ty: u64,
offset: 0,
mask: 0xffffffff00000000u64,
},
{
ty: u64,
offset: 40,
mask: 0xffffffff00000000u64,
},],
size_v1: 104,
size_v2: 96,
align_v1: 8,
align_v2: 8,
}
#[derive(Debug, PartialEq)]
pub struct TableWithHandle {
pub h: Option<fidl::Vmo>,
/// (FIDL-generated) Unknown fields encountered during decoding, stored as a
/// map from ordinals to raw data. The `Some` case is always nonempty.
pub unknown_data: Option<std::collections::BTreeMap<u64, fidl::UnknownData>>,
#[deprecated = "Use `..TableWithHandle::EMPTY` to construct and `..` to match."]
#[doc(hidden)]
pub __non_exhaustive: (),
}
impl TableWithHandle {
/// An empty table with every field set to `None`.
#[allow(deprecated)]
pub const EMPTY: Self = Self { h: None, unknown_data: None, __non_exhaustive: () };
}
fidl_table! {
name: TableWithHandle,
members: [
h {
ty: fidl::Vmo,
ordinal: 1,
handle_metadata: {
handle_subtype: fidl::ObjectType::VMO,
handle_rights: fidl::Rights::from_bits_const(2147483648).unwrap(),
},
},
],
resource_unknown_member: unknown_data,
}