| // WARNING: This file is machine generated by fidlgen. |
| |
| // fidl_experiment = no_optional_structs |
| // fidl_experiment = output_index_json |
| // fidl_experiment = unknown_interactions |
| // fidl_experiment = unknown_interactions_mandate |
| |
| #![warn(clippy::all)] |
| #![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)] |
| |
| use { |
| bitflags::bitflags, |
| fidl::{ |
| client::QueryResponseFut, |
| endpoints::{ControlHandle as _, Responder as _}, |
| }, |
| fuchsia_zircon_status as zx_status, |
| futures::future::{self, MaybeDone, TryFutureExt}, |
| }; |
| |
| #[cfg(target_os = "fuchsia")] |
| use fuchsia_zircon as zx; |
| |
| pub const ANSWER: u16 = 42; |
| |
| pub const ANSWER_IN_BINARY: u16 = 42; |
| |
| 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 = fidl_zx::CHANNEL_MAX_MSG_BYTES; |
| |
| pub const ZX_OBJ_VAL: fidl_zx::ObjType = fidl_zx::ObjType::Channel; |
| |
| pub const ZX_RIGHTS_VAL: fidl_zx::Rights = fidl_zx::Rights::READ; |
| |
| pub const BITS_PRIMITIVE_TRUE: u32 = BitsType::TRUE_.bits(); |
| |
| pub const BITS_PRIMITIVE_VAL: u32 = BitsType::VALUE.bits(); |
| |
| pub const BITS_TRUE: BitsType = BitsType::TRUE_; |
| |
| pub const BITS_VAL: BitsType = BitsType::VALUE; |
| |
| pub const ENUM_PRIMITIVE_TRUE: i32 = EnumType::True_.into_primitive(); |
| |
| pub const ENUM_PRIMITIVE_VAL: i32 = EnumType::Value.into_primitive(); |
| |
| pub const ENUM_TRUE: EnumType = EnumType::True_; |
| |
| pub const ENUM_VAL: EnumType = EnumType::Value; |
| |
| bitflags! { |
| #[derive(Default)] |
| pub struct BitsType: u32 { |
| const VALUE = 1; |
| const TRUE_ = 2; |
| } |
| } |
| |
| impl BitsType { |
| #[deprecated = "Strict bits should not use `has_unknown_bits`"] |
| #[inline(always)] |
| pub fn has_unknown_bits(&self) -> bool { |
| false |
| } |
| |
| #[deprecated = "Strict bits should not use `get_unknown_bits`"] |
| #[inline(always)] |
| pub fn get_unknown_bits(&self) -> u32 { |
| 0 |
| } |
| } |
| |
| #[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 |
| } |
| |
| #[deprecated = "Strict enums should not use `is_unknown`"] |
| #[inline] |
| pub fn is_unknown(&self) -> bool { |
| false |
| } |
| } |
| |
| 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<'a>( |
| value: &'a <Self as fidl::encoding::TypeMarker>::Owned, |
| ) -> Self::Borrowed<'a> { |
| *value |
| } |
| } |
| |
| unsafe impl fidl::encoding::Encode<Self> for BitsType { |
| #[inline] |
| unsafe fn encode( |
| self, |
| encoder: &mut fidl::encoding::Encoder<'_>, |
| 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 fidl::encoding::Decode<Self> for BitsType { |
| #[inline(always)] |
| fn new_empty() -> Self { |
| Self::empty() |
| } |
| |
| #[inline] |
| unsafe fn decode( |
| &mut self, |
| decoder: &mut fidl::encoding::Decoder<'_>, |
| offset: usize, |
| _depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| decoder.debug_check_bounds::<Self>(offset); |
| let prim = decoder.read_num::<u32>(offset); |
| *self = Self::from_bits(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<'a>( |
| value: &'a <Self as fidl::encoding::TypeMarker>::Owned, |
| ) -> Self::Borrowed<'a> { |
| *value |
| } |
| } |
| |
| unsafe impl fidl::encoding::Encode<Self> for EnumType { |
| #[inline] |
| unsafe fn encode( |
| self, |
| encoder: &mut fidl::encoding::Encoder<'_>, |
| offset: usize, |
| _depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| encoder.debug_check_bounds::<Self>(offset); |
| encoder.write_num(self.into_primitive(), offset); |
| Ok(()) |
| } |
| } |
| |
| impl fidl::encoding::Decode<Self> for EnumType { |
| #[inline(always)] |
| fn new_empty() -> Self { |
| Self::Value |
| } |
| |
| #[inline] |
| unsafe fn decode( |
| &mut self, |
| decoder: &mut fidl::encoding::Decoder<'_>, |
| offset: usize, |
| _depth: fidl::encoding::Depth, |
| ) -> fidl::Result<()> { |
| decoder.debug_check_bounds::<Self>(offset); |
| let prim = decoder.read_num::<i32>(offset); |
| |
| *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?; |
| Ok(()) |
| } |
| } |
| } |