| // WARNING: This file is machine generated by fidlgen. |
| |
| // fidl_experiment = output_index_json |
| |
| #![warn(clippy::all)] |
| #![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)] |
| |
| use bitflags::bitflags; |
| use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect}; |
| use futures::future::{self, MaybeDone, TryFutureExt}; |
| use zx_status; |
| |
| pub const ANSWER: u16 = 42; |
| |
| pub const ANSWER_IN_BINARY: u16 = 42; |
| |
| pub const ANSWER_NARROWED: u8 = ANSWER as u8; |
| |
| pub const CONVERSION_FACTOR: f64 = 1.41421; |
| |
| pub const DIAMOND: u64 = 1746410393481133080; |
| |
| pub const ENABLED_FLAG: bool = true; |
| |
| pub const FUCHSIA: u64 = 4054509061583223046; |
| |
| pub const MIN_TEMP: f32 = -273.15; |
| |
| pub const OFFSET: i8 = -33; |
| |
| pub const POPULATION_USA_2018: u32 = 330000000; |
| |
| pub const USERNAME: &str = "\"squeenze\""; |
| |
| pub const ZX_CONST: u64 = zx_types::ZX_CHANNEL_MAX_MSG_BYTES as u64; |
| |
| pub const ZX_OBJ_VAL: fidl::ObjectType = fidl::ObjectType::CHANNEL; |
| |
| pub const ZX_RIGHTS_VAL: fidl::Rights = fidl::Rights::READ; |
| |
| pub const BITS_PRIMITIVE_TRUE: u32 = BitsType::TRUE_.bits() as u32; |
| |
| pub const BITS_PRIMITIVE_VAL: u32 = BitsType::VALUE.bits() as u32; |
| |
| pub const BITS_PRIMITIVE_VAL_NARROWED: u8 = BitsType::VALUE.bits() as u8; |
| |
| pub const BITS_TRUE: BitsType = BitsType::TRUE_; |
| |
| pub const BITS_VAL: BitsType = BitsType::VALUE; |
| |
| pub const ENUM_PRIMITIVE_TRUE: i32 = EnumType::True_.into_primitive() as i32; |
| |
| pub const ENUM_PRIMITIVE_VAL: i32 = EnumType::Value.into_primitive() as i32; |
| |
| pub const ENUM_PRIMITIVE_VAL_NARROWED: i8 = EnumType::Value.into_primitive() as i8; |
| |
| pub const ENUM_TRUE: EnumType = EnumType::True_; |
| |
| pub const ENUM_VAL: EnumType = EnumType::Value; |
| |
| bitflags! { |
| #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] |
| pub struct BitsType: u32 { |
| const VALUE = 1; |
| const TRUE_ = 2; |
| } |
| } |
| |
| impl BitsType {} |
| |
| #[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] |
| #[repr(i32)] |
| pub enum EnumType { |
| Value = 1, |
| True_ = 2, |
| } |
| |
| impl EnumType { |
| #[inline] |
| pub fn from_primitive(prim: i32) -> Option<Self> { |
| match prim { |
| 1 => Some(Self::Value), |
| 2 => Some(Self::True_), |
| _ => None, |
| } |
| } |
| |
| #[inline] |
| pub const fn into_primitive(self) -> i32 { |
| self as i32 |
| } |
| } |
| |
| mod internal { |
| use super::*; |
| unsafe impl fidl::encoding::TypeMarker for BitsType { |
| 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 BitsType { |
| 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 BitsType { |
| #[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); |
| if self.bits() & Self::all().bits() != self.bits() { |
| return Err(fidl::Error::InvalidBitsValue); |
| } |
| encoder.write_num(self.bits(), offset); |
| Ok(()) |
| } |
| } |
| |
| impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BitsType { |
| #[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(prim).ok_or(fidl::Error::InvalidBitsValue)?; |
| Ok(()) |
| } |
| } |
| unsafe impl fidl::encoding::TypeMarker for EnumType { |
| type Owned = Self; |
| |
| #[inline(always)] |
| fn inline_align(_context: fidl::encoding::Context) -> usize { |
| std::mem::align_of::<i32>() |
| } |
| |
| #[inline(always)] |
| fn inline_size(_context: fidl::encoding::Context) -> usize { |
| std::mem::size_of::<i32>() |
| } |
| |
| #[inline(always)] |
| fn encode_is_copy() -> bool { |
| true |
| } |
| |
| #[inline(always)] |
| fn decode_is_copy() -> bool { |
| false |
| } |
| } |
| |
| impl fidl::encoding::ValueTypeMarker for EnumType { |
| 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 EnumType { |
| #[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 EnumType { |
| #[inline(always)] |
| fn new_empty() -> Self { |
| Self::Value |
| } |
| |
| #[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::<i32>(offset); |
| |
| *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?; |
| Ok(()) |
| } |
| } |
| } |