#![warn(clippy::all)]
#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
use bitflags::bitflags;
use fidl::client::QueryResponseFut;
use fidl::endpoints::{ControlHandle as _, Responder as _};
use fuchsia_zircon_status as zx_status;
use futures::future::{self, MaybeDone, TryFutureExt};
#[cfg(target_os = "fuchsia")]
use fuchsia_zircon as zx;
#[derive(Clone, Debug, PartialEq, PartialOrd)]
pub struct Peer {
pub addr: [u8; 6],
pub max_tp: u16,
pub max_probability: u16,
pub basic_highest: u16,
pub basic_max_probability: u16,
pub probes: u64,
pub entries: Vec<StatsEntry>,
}
impl fidl::Persistable for Peer {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct Peers {
pub addrs: Vec<[u8; 6]>,
}
impl fidl::Persistable for Peers {}
#[derive(Clone, Debug, PartialEq, PartialOrd)]
pub struct StatsEntry {
pub tx_vector_idx: u16,
pub tx_vec_desc: String,
pub success_cur: u64,
pub attempts_cur: u64,
pub probability: f32,
pub cur_tp: f32,
pub success_total: u64,
pub attempts_total: u64,
pub probes_total: u64,
pub probe_cycles_skipped: u8,
}
impl fidl::Persistable for StatsEntry {}
mod internal {
use super::*;
unsafe impl fidl::encoding::TypeMarker for Peer {
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 Peer {
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<Peer> for &Peer {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Peer>(offset);
fidl::encoding::Encode::<Peer>::encode(
(
<fidl::encoding::Array<u8, 6> as fidl::encoding::ValueTypeMarker>::borrow(&self.addr),
<u16 as fidl::encoding::ValueTypeMarker>::borrow(&self.max_tp),
<u16 as fidl::encoding::ValueTypeMarker>::borrow(&self.max_probability),
<u16 as fidl::encoding::ValueTypeMarker>::borrow(&self.basic_highest),
<u16 as fidl::encoding::ValueTypeMarker>::borrow(&self.basic_max_probability),
<u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.probes),
<fidl::encoding::UnboundedVector<StatsEntry> as fidl::encoding::ValueTypeMarker>::borrow(&self.entries),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<fidl::encoding::Array<u8, 6>>,
T1: fidl::encoding::Encode<u16>,
T2: fidl::encoding::Encode<u16>,
T3: fidl::encoding::Encode<u16>,
T4: fidl::encoding::Encode<u16>,
T5: fidl::encoding::Encode<u64>,
T6: fidl::encoding::Encode<fidl::encoding::UnboundedVector<StatsEntry>>,
> fidl::encoding::Encode<Peer> for (T0, T1, T2, T3, T4, T5, T6)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Peer>(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 + 6, depth)?;
self.2.encode(encoder, offset + 8, depth)?;
self.3.encode(encoder, offset + 10, depth)?;
self.4.encode(encoder, offset + 12, depth)?;
self.5.encode(encoder, offset + 16, depth)?;
self.6.encode(encoder, offset + 24, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for Peer {
#[inline(always)]
fn new_empty() -> Self {
Self {
addr: fidl::new_empty!(fidl::encoding::Array<u8, 6>),
max_tp: fidl::new_empty!(u16),
max_probability: fidl::new_empty!(u16),
basic_highest: fidl::new_empty!(u16),
basic_max_probability: fidl::new_empty!(u16),
probes: fidl::new_empty!(u64),
entries: fidl::new_empty!(fidl::encoding::UnboundedVector<StatsEntry>),
}
}
#[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(8) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffff000000000000u64;
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!(fidl::encoding::Array<u8, 6>, &mut self.addr, decoder, offset + 0, _depth)?;
fidl::decode!(u16, &mut self.max_tp, decoder, offset + 6, _depth)?;
fidl::decode!(u16, &mut self.max_probability, decoder, offset + 8, _depth)?;
fidl::decode!(u16, &mut self.basic_highest, decoder, offset + 10, _depth)?;
fidl::decode!(u16, &mut self.basic_max_probability, decoder, offset + 12, _depth)?;
fidl::decode!(u64, &mut self.probes, decoder, offset + 16, _depth)?;
fidl::decode!(
fidl::encoding::UnboundedVector<StatsEntry>,
&mut self.entries,
decoder,
offset + 24,
_depth
)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for Peers {
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 Peers {
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<Peers> for &Peers {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Peers>(offset);
fidl::encoding::Encode::<Peers>::encode(
(
<fidl::encoding::UnboundedVector<fidl::encoding::Array<u8, 6>> as fidl::encoding::ValueTypeMarker>::borrow(&self.addrs),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<fidl::encoding::Array<u8, 6>>>,
> fidl::encoding::Encode<Peers> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Peers>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for Peers {
#[inline(always)]
fn new_empty() -> Self {
Self {
addrs: fidl::new_empty!(
fidl::encoding::UnboundedVector<fidl::encoding::Array<u8, 6>>
),
}
}
#[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::UnboundedVector<fidl::encoding::Array<u8, 6>>,
&mut self.addrs,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for StatsEntry {
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
}
}
impl fidl::encoding::ValueTypeMarker for StatsEntry {
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<StatsEntry> for &StatsEntry {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<StatsEntry>(offset);
fidl::encoding::Encode::<StatsEntry>::encode(
(
<u16 as fidl::encoding::ValueTypeMarker>::borrow(&self.tx_vector_idx),
<fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
&self.tx_vec_desc,
),
<u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.success_cur),
<u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.attempts_cur),
<f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.probability),
<f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.cur_tp),
<u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.success_total),
<u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.attempts_total),
<u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.probes_total),
<u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.probe_cycles_skipped),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<u16>,
T1: fidl::encoding::Encode<fidl::encoding::UnboundedString>,
T2: fidl::encoding::Encode<u64>,
T3: fidl::encoding::Encode<u64>,
T4: fidl::encoding::Encode<f32>,
T5: fidl::encoding::Encode<f32>,
T6: fidl::encoding::Encode<u64>,
T7: fidl::encoding::Encode<u64>,
T8: fidl::encoding::Encode<u64>,
T9: fidl::encoding::Encode<u8>,
> fidl::encoding::Encode<StatsEntry> for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<StatsEntry>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
(ptr as *mut u64).write_unaligned(0);
}
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(72);
(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 + 32, depth)?;
self.4.encode(encoder, offset + 40, depth)?;
self.5.encode(encoder, offset + 44, depth)?;
self.6.encode(encoder, offset + 48, depth)?;
self.7.encode(encoder, offset + 56, depth)?;
self.8.encode(encoder, offset + 64, depth)?;
self.9.encode(encoder, offset + 72, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for StatsEntry {
#[inline(always)]
fn new_empty() -> Self {
Self {
tx_vector_idx: fidl::new_empty!(u16),
tx_vec_desc: fidl::new_empty!(fidl::encoding::UnboundedString),
success_cur: fidl::new_empty!(u64),
attempts_cur: fidl::new_empty!(u64),
probability: fidl::new_empty!(f32),
cur_tp: fidl::new_empty!(f32),
success_total: fidl::new_empty!(u64),
attempts_total: fidl::new_empty!(u64),
probes_total: fidl::new_empty!(u64),
probe_cycles_skipped: 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);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).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,
});
}
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(72) };
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 + 72 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(u16, &mut self.tx_vector_idx, decoder, offset + 0, _depth)?;
fidl::decode!(
fidl::encoding::UnboundedString,
&mut self.tx_vec_desc,
decoder,
offset + 8,
_depth
)?;
fidl::decode!(u64, &mut self.success_cur, decoder, offset + 24, _depth)?;
fidl::decode!(u64, &mut self.attempts_cur, decoder, offset + 32, _depth)?;
fidl::decode!(f32, &mut self.probability, decoder, offset + 40, _depth)?;
fidl::decode!(f32, &mut self.cur_tp, decoder, offset + 44, _depth)?;
fidl::decode!(u64, &mut self.success_total, decoder, offset + 48, _depth)?;
fidl::decode!(u64, &mut self.attempts_total, decoder, offset + 56, _depth)?;
fidl::decode!(u64, &mut self.probes_total, decoder, offset + 64, _depth)?;
fidl::decode!(u8, &mut self.probe_cycles_skipped, decoder, offset + 72, _depth)?;
Ok(())
}
}
}