#![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 MAX_HISTOGRAMS_PER_TYPE: u8 = 8;
pub const MAX_NOISE_FLOOR_SAMPLES: u8 = 255;
pub const MAX_RSSI_SAMPLES: u8 = 255;
pub const MAX_RX_RATE_INDEX_SAMPLES: u8 = 196;
pub const MAX_SNR_SAMPLES: u16 = 256;
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(u8)]
pub enum AntennaFreq {
Antenna2G = 1,
Antenna5G = 2,
}
impl AntennaFreq {
#[inline]
pub fn from_primitive(prim: u8) -> Option<Self> {
match prim {
1 => Some(Self::Antenna2G),
2 => Some(Self::Antenna5G),
_ => None,
}
}
#[inline]
pub const fn into_primitive(self) -> u8 {
self as u8
}
#[deprecated = "Strict enums should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(u8)]
pub enum HistScope {
Station = 1,
PerAntenna = 2,
}
impl HistScope {
#[inline]
pub fn from_primitive(prim: u8) -> Option<Self> {
match prim {
1 => Some(Self::Station),
2 => Some(Self::PerAntenna),
_ => None,
}
}
#[inline]
pub const fn into_primitive(self) -> u8 {
self as u8
}
#[deprecated = "Strict enums should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct AntennaId {
pub freq: AntennaFreq,
pub index: u8,
}
impl fidl::Persistable for AntennaId {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct HistBucket {
pub bucket_index: u16,
pub num_samples: u64,
}
impl fidl::Persistable for HistBucket {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct IfaceCounterStats {
pub rx_unicast_total: u64,
pub rx_unicast_drop: u64,
pub rx_multicast: u64,
pub tx_total: u64,
pub tx_drop: u64,
}
impl fidl::Persistable for IfaceCounterStats {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct IfaceHistogramStats {
pub noise_floor_histograms: Vec<NoiseFloorHistogram>,
pub rssi_histograms: Vec<RssiHistogram>,
pub rx_rate_index_histograms: Vec<RxRateIndexHistogram>,
pub snr_histograms: Vec<SnrHistogram>,
}
impl fidl::Persistable for IfaceHistogramStats {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct NoiseFloorHistogram {
pub hist_scope: HistScope,
pub antenna_id: Option<Box<AntennaId>>,
pub noise_floor_samples: Vec<HistBucket>,
pub invalid_samples: u64,
}
impl fidl::Persistable for NoiseFloorHistogram {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct RssiHistogram {
pub hist_scope: HistScope,
pub antenna_id: Option<Box<AntennaId>>,
pub rssi_samples: Vec<HistBucket>,
pub invalid_samples: u64,
}
impl fidl::Persistable for RssiHistogram {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct RxRateIndexHistogram {
pub hist_scope: HistScope,
pub antenna_id: Option<Box<AntennaId>>,
pub rx_rate_index_samples: Vec<HistBucket>,
pub invalid_samples: u64,
}
impl fidl::Persistable for RxRateIndexHistogram {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct SnrHistogram {
pub hist_scope: HistScope,
pub antenna_id: Option<Box<AntennaId>>,
pub snr_samples: Vec<HistBucket>,
pub invalid_samples: u64,
}
impl fidl::Persistable for SnrHistogram {}
mod internal {
use super::*;
unsafe impl fidl::encoding::TypeMarker for AntennaFreq {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
std::mem::align_of::<u8>()
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
std::mem::size_of::<u8>()
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for AntennaFreq {
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 AntennaFreq {
#[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 AntennaFreq {
#[inline(always)]
fn new_empty() -> Self {
Self::Antenna2G
}
#[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::<u8>(offset);
*self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for HistScope {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
std::mem::align_of::<u8>()
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
std::mem::size_of::<u8>()
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for HistScope {
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 HistScope {
#[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 HistScope {
#[inline(always)]
fn new_empty() -> Self {
Self::Station
}
#[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::<u8>(offset);
*self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for AntennaId {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
1
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
2
}
}
impl fidl::encoding::ValueTypeMarker for AntennaId {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<AntennaId> for &AntennaId {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AntennaId>(offset);
fidl::encoding::Encode::<AntennaId>::encode(
(
<AntennaFreq as fidl::encoding::ValueTypeMarker>::borrow(&self.freq),
<u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.index),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<T0: fidl::encoding::Encode<AntennaFreq>, T1: fidl::encoding::Encode<u8>>
fidl::encoding::Encode<AntennaId> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AntennaId>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 1, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for AntennaId {
#[inline(always)]
fn new_empty() -> Self {
Self { freq: fidl::new_empty!(AntennaFreq), index: fidl::new_empty!(u8) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(AntennaFreq, &mut self.freq, decoder, offset + 0, _depth)?;
fidl::decode!(u8, &mut self.index, decoder, offset + 1, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for HistBucket {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
impl fidl::encoding::ValueTypeMarker for HistBucket {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<HistBucket> for &HistBucket {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HistBucket>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut HistBucket).write_unaligned((self as *const HistBucket).read());
let padding_ptr = buf_ptr.offset(0) as *mut u64;
let padding_mask = 0xffffffffffff0000u64;
padding_ptr.write_unaligned(padding_ptr.read_unaligned() & !padding_mask);
}
Ok(())
}
}
unsafe impl<T0: fidl::encoding::Encode<u16>, T1: fidl::encoding::Encode<u64>>
fidl::encoding::Encode<HistBucket> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HistBucket>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for HistBucket {
#[inline(always)]
fn new_empty() -> Self {
Self { bucket_index: fidl::new_empty!(u16), num_samples: fidl::new_empty!(u64) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
let ptr = unsafe { buf_ptr.offset(0) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffffffff0000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
}
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for IfaceCounterStats {
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
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
impl fidl::encoding::ValueTypeMarker for IfaceCounterStats {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<IfaceCounterStats> for &IfaceCounterStats {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<IfaceCounterStats>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut IfaceCounterStats)
.write_unaligned((self as *const IfaceCounterStats).read());
}
Ok(())
}
}
unsafe impl<
T0: fidl::encoding::Encode<u64>,
T1: fidl::encoding::Encode<u64>,
T2: fidl::encoding::Encode<u64>,
T3: fidl::encoding::Encode<u64>,
T4: fidl::encoding::Encode<u64>,
> fidl::encoding::Encode<IfaceCounterStats> for (T0, T1, T2, T3, T4)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<IfaceCounterStats>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
self.2.encode(encoder, offset + 16, depth)?;
self.3.encode(encoder, offset + 24, depth)?;
self.4.encode(encoder, offset + 32, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for IfaceCounterStats {
#[inline(always)]
fn new_empty() -> Self {
Self {
rx_unicast_total: fidl::new_empty!(u64),
rx_unicast_drop: fidl::new_empty!(u64),
rx_multicast: fidl::new_empty!(u64),
tx_total: fidl::new_empty!(u64),
tx_drop: fidl::new_empty!(u64),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 40);
}
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for IfaceHistogramStats {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
64
}
}
impl fidl::encoding::ValueTypeMarker for IfaceHistogramStats {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<IfaceHistogramStats> for &IfaceHistogramStats {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<IfaceHistogramStats>(offset);
fidl::encoding::Encode::<IfaceHistogramStats>::encode(
(
<fidl::encoding::Vector<NoiseFloorHistogram, 8> as fidl::encoding::ValueTypeMarker>::borrow(&self.noise_floor_histograms),
<fidl::encoding::Vector<RssiHistogram, 8> as fidl::encoding::ValueTypeMarker>::borrow(&self.rssi_histograms),
<fidl::encoding::Vector<RxRateIndexHistogram, 8> as fidl::encoding::ValueTypeMarker>::borrow(&self.rx_rate_index_histograms),
<fidl::encoding::Vector<SnrHistogram, 8> as fidl::encoding::ValueTypeMarker>::borrow(&self.snr_histograms),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<fidl::encoding::Vector<NoiseFloorHistogram, 8>>,
T1: fidl::encoding::Encode<fidl::encoding::Vector<RssiHistogram, 8>>,
T2: fidl::encoding::Encode<fidl::encoding::Vector<RxRateIndexHistogram, 8>>,
T3: fidl::encoding::Encode<fidl::encoding::Vector<SnrHistogram, 8>>,
> fidl::encoding::Encode<IfaceHistogramStats> for (T0, T1, T2, T3)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<IfaceHistogramStats>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
self.2.encode(encoder, offset + 32, depth)?;
self.3.encode(encoder, offset + 48, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for IfaceHistogramStats {
#[inline(always)]
fn new_empty() -> Self {
Self {
noise_floor_histograms: fidl::new_empty!(fidl::encoding::Vector<NoiseFloorHistogram, 8>),
rssi_histograms: fidl::new_empty!(fidl::encoding::Vector<RssiHistogram, 8>),
rx_rate_index_histograms: fidl::new_empty!(fidl::encoding::Vector<RxRateIndexHistogram, 8>),
snr_histograms: fidl::new_empty!(fidl::encoding::Vector<SnrHistogram, 8>),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(fidl::encoding::Vector<NoiseFloorHistogram, 8>, &mut self.noise_floor_histograms, decoder, offset + 0, _depth)?;
fidl::decode!(fidl::encoding::Vector<RssiHistogram, 8>, &mut self.rssi_histograms, decoder, offset + 16, _depth)?;
fidl::decode!(fidl::encoding::Vector<RxRateIndexHistogram, 8>, &mut self.rx_rate_index_histograms, decoder, offset + 32, _depth)?;
fidl::decode!(fidl::encoding::Vector<SnrHistogram, 8>, &mut self.snr_histograms, decoder, offset + 48, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for NoiseFloorHistogram {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
40
}
}
impl fidl::encoding::ValueTypeMarker for NoiseFloorHistogram {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<NoiseFloorHistogram> for &NoiseFloorHistogram {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<NoiseFloorHistogram>(offset);
fidl::encoding::Encode::<NoiseFloorHistogram>::encode(
(
<HistScope as fidl::encoding::ValueTypeMarker>::borrow(&self.hist_scope),
<fidl::encoding::Boxed<AntennaId> as fidl::encoding::ValueTypeMarker>::borrow(&self.antenna_id),
<fidl::encoding::Vector<HistBucket, 255> as fidl::encoding::ValueTypeMarker>::borrow(&self.noise_floor_samples),
<u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.invalid_samples),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<HistScope>,
T1: fidl::encoding::Encode<fidl::encoding::Boxed<AntennaId>>,
T2: fidl::encoding::Encode<fidl::encoding::Vector<HistBucket, 255>>,
T3: fidl::encoding::Encode<u64>,
> fidl::encoding::Encode<NoiseFloorHistogram> for (T0, T1, T2, T3)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<NoiseFloorHistogram>(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 + 16, depth)?;
self.3.encode(encoder, offset + 32, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for NoiseFloorHistogram {
#[inline(always)]
fn new_empty() -> Self {
Self {
hist_scope: fidl::new_empty!(HistScope),
antenna_id: fidl::new_empty!(fidl::encoding::Boxed<AntennaId>),
noise_floor_samples: fidl::new_empty!(fidl::encoding::Vector<HistBucket, 255>),
invalid_samples: fidl::new_empty!(u64),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffffffffff00u64;
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!(HistScope, &mut self.hist_scope, decoder, offset + 0, _depth)?;
fidl::decode!(
fidl::encoding::Boxed<AntennaId>,
&mut self.antenna_id,
decoder,
offset + 8,
_depth
)?;
fidl::decode!(fidl::encoding::Vector<HistBucket, 255>, &mut self.noise_floor_samples, decoder, offset + 16, _depth)?;
fidl::decode!(u64, &mut self.invalid_samples, decoder, offset + 32, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for RssiHistogram {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
40
}
}
impl fidl::encoding::ValueTypeMarker for RssiHistogram {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<RssiHistogram> for &RssiHistogram {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RssiHistogram>(offset);
fidl::encoding::Encode::<RssiHistogram>::encode(
(
<HistScope as fidl::encoding::ValueTypeMarker>::borrow(&self.hist_scope),
<fidl::encoding::Boxed<AntennaId> as fidl::encoding::ValueTypeMarker>::borrow(&self.antenna_id),
<fidl::encoding::Vector<HistBucket, 255> as fidl::encoding::ValueTypeMarker>::borrow(&self.rssi_samples),
<u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.invalid_samples),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<HistScope>,
T1: fidl::encoding::Encode<fidl::encoding::Boxed<AntennaId>>,
T2: fidl::encoding::Encode<fidl::encoding::Vector<HistBucket, 255>>,
T3: fidl::encoding::Encode<u64>,
> fidl::encoding::Encode<RssiHistogram> for (T0, T1, T2, T3)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RssiHistogram>(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 + 16, depth)?;
self.3.encode(encoder, offset + 32, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for RssiHistogram {
#[inline(always)]
fn new_empty() -> Self {
Self {
hist_scope: fidl::new_empty!(HistScope),
antenna_id: fidl::new_empty!(fidl::encoding::Boxed<AntennaId>),
rssi_samples: fidl::new_empty!(fidl::encoding::Vector<HistBucket, 255>),
invalid_samples: fidl::new_empty!(u64),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffffffffff00u64;
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!(HistScope, &mut self.hist_scope, decoder, offset + 0, _depth)?;
fidl::decode!(
fidl::encoding::Boxed<AntennaId>,
&mut self.antenna_id,
decoder,
offset + 8,
_depth
)?;
fidl::decode!(fidl::encoding::Vector<HistBucket, 255>, &mut self.rssi_samples, decoder, offset + 16, _depth)?;
fidl::decode!(u64, &mut self.invalid_samples, decoder, offset + 32, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for RxRateIndexHistogram {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
40
}
}
impl fidl::encoding::ValueTypeMarker for RxRateIndexHistogram {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<RxRateIndexHistogram> for &RxRateIndexHistogram {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RxRateIndexHistogram>(offset);
fidl::encoding::Encode::<RxRateIndexHistogram>::encode(
(
<HistScope as fidl::encoding::ValueTypeMarker>::borrow(&self.hist_scope),
<fidl::encoding::Boxed<AntennaId> as fidl::encoding::ValueTypeMarker>::borrow(&self.antenna_id),
<fidl::encoding::Vector<HistBucket, 196> as fidl::encoding::ValueTypeMarker>::borrow(&self.rx_rate_index_samples),
<u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.invalid_samples),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<HistScope>,
T1: fidl::encoding::Encode<fidl::encoding::Boxed<AntennaId>>,
T2: fidl::encoding::Encode<fidl::encoding::Vector<HistBucket, 196>>,
T3: fidl::encoding::Encode<u64>,
> fidl::encoding::Encode<RxRateIndexHistogram> for (T0, T1, T2, T3)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RxRateIndexHistogram>(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 + 16, depth)?;
self.3.encode(encoder, offset + 32, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for RxRateIndexHistogram {
#[inline(always)]
fn new_empty() -> Self {
Self {
hist_scope: fidl::new_empty!(HistScope),
antenna_id: fidl::new_empty!(fidl::encoding::Boxed<AntennaId>),
rx_rate_index_samples: fidl::new_empty!(fidl::encoding::Vector<HistBucket, 196>),
invalid_samples: fidl::new_empty!(u64),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffffffffff00u64;
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!(HistScope, &mut self.hist_scope, decoder, offset + 0, _depth)?;
fidl::decode!(
fidl::encoding::Boxed<AntennaId>,
&mut self.antenna_id,
decoder,
offset + 8,
_depth
)?;
fidl::decode!(fidl::encoding::Vector<HistBucket, 196>, &mut self.rx_rate_index_samples, decoder, offset + 16, _depth)?;
fidl::decode!(u64, &mut self.invalid_samples, decoder, offset + 32, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for SnrHistogram {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
40
}
}
impl fidl::encoding::ValueTypeMarker for SnrHistogram {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<SnrHistogram> for &SnrHistogram {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<SnrHistogram>(offset);
fidl::encoding::Encode::<SnrHistogram>::encode(
(
<HistScope as fidl::encoding::ValueTypeMarker>::borrow(&self.hist_scope),
<fidl::encoding::Boxed<AntennaId> as fidl::encoding::ValueTypeMarker>::borrow(&self.antenna_id),
<fidl::encoding::Vector<HistBucket, 256> as fidl::encoding::ValueTypeMarker>::borrow(&self.snr_samples),
<u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.invalid_samples),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<HistScope>,
T1: fidl::encoding::Encode<fidl::encoding::Boxed<AntennaId>>,
T2: fidl::encoding::Encode<fidl::encoding::Vector<HistBucket, 256>>,
T3: fidl::encoding::Encode<u64>,
> fidl::encoding::Encode<SnrHistogram> for (T0, T1, T2, T3)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<SnrHistogram>(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 + 16, depth)?;
self.3.encode(encoder, offset + 32, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for SnrHistogram {
#[inline(always)]
fn new_empty() -> Self {
Self {
hist_scope: fidl::new_empty!(HistScope),
antenna_id: fidl::new_empty!(fidl::encoding::Boxed<AntennaId>),
snr_samples: fidl::new_empty!(fidl::encoding::Vector<HistBucket, 256>),
invalid_samples: fidl::new_empty!(u64),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffffffffff00u64;
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!(HistScope, &mut self.hist_scope, decoder, offset + 0, _depth)?;
fidl::decode!(
fidl::encoding::Boxed<AntennaId>,
&mut self.antenna_id,
decoder,
offset + 8,
_depth
)?;
fidl::decode!(fidl::encoding::Vector<HistBucket, 256>, &mut self.snr_samples, decoder, offset + 16, _depth)?;
fidl::decode!(u64, &mut self.invalid_samples, decoder, offset + 32, _depth)?;
Ok(())
}
}
}