#![warn(clippy::all)]
#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
use bitflags::bitflags;
use fidl::client::QueryResponseFut;
use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
use fidl::endpoints::{ControlHandle as _, Responder as _};
use futures::future::{self, MaybeDone, TryFutureExt};
use zx_status;
#[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::*;
impl fidl::encoding::ValueTypeMarker for Peer {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Peer, D> for &Peer {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Peer>(offset);
fidl::encoding::Encode::<Peer, D>::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<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::Array<u8, 6>, D>,
T1: fidl::encoding::Encode<u16, D>,
T2: fidl::encoding::Encode<u16, D>,
T3: fidl::encoding::Encode<u16, D>,
T4: fidl::encoding::Encode<u16, D>,
T5: fidl::encoding::Encode<u64, D>,
T6: fidl::encoding::Encode<fidl::encoding::UnboundedVector<StatsEntry>, D>,
> fidl::encoding::Encode<Peer, D> for (T0, T1, T2, T3, T4, T5, T6)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
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<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Peer {
#[inline(always)]
fn new_empty() -> Self {
Self {
addr: fidl::new_empty!(fidl::encoding::Array<u8, 6>, D),
max_tp: fidl::new_empty!(u16, D),
max_probability: fidl::new_empty!(u16, D),
basic_highest: fidl::new_empty!(u16, D),
basic_max_probability: fidl::new_empty!(u16, D),
probes: fidl::new_empty!(u64, D),
entries: fidl::new_empty!(fidl::encoding::UnboundedVector<StatsEntry>, D),
}
}
#[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 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>, D, &mut self.addr, decoder, offset + 0, _depth)?;
fidl::decode!(u16, D, &mut self.max_tp, decoder, offset + 6, _depth)?;
fidl::decode!(u16, D, &mut self.max_probability, decoder, offset + 8, _depth)?;
fidl::decode!(u16, D, &mut self.basic_highest, decoder, offset + 10, _depth)?;
fidl::decode!(u16, D, &mut self.basic_max_probability, decoder, offset + 12, _depth)?;
fidl::decode!(u64, D, &mut self.probes, decoder, offset + 16, _depth)?;
fidl::decode!(
fidl::encoding::UnboundedVector<StatsEntry>,
D,
&mut self.entries,
decoder,
offset + 24,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for Peers {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Peers, D> for &Peers {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Peers>(offset);
fidl::encoding::Encode::<Peers, D>::encode(
(
<fidl::encoding::UnboundedVector<fidl::encoding::Array<u8, 6>> as fidl::encoding::ValueTypeMarker>::borrow(&self.addrs),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<
fidl::encoding::UnboundedVector<fidl::encoding::Array<u8, 6>>,
D,
>,
> fidl::encoding::Encode<Peers, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Peers>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Peers {
#[inline(always)]
fn new_empty() -> Self {
Self {
addrs: fidl::new_empty!(
fidl::encoding::UnboundedVector<fidl::encoding::Array<u8, 6>>,
D
),
}
}
#[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);
fidl::decode!(
fidl::encoding::UnboundedVector<fidl::encoding::Array<u8, 6>>,
D,
&mut self.addrs,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for StatsEntry {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<StatsEntry, D>
for &StatsEntry
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<StatsEntry>(offset);
fidl::encoding::Encode::<StatsEntry, D>::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<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<u16, D>,
T1: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
T2: fidl::encoding::Encode<u64, D>,
T3: fidl::encoding::Encode<u64, D>,
T4: fidl::encoding::Encode<f32, D>,
T5: fidl::encoding::Encode<f32, D>,
T6: fidl::encoding::Encode<u64, D>,
T7: fidl::encoding::Encode<u64, D>,
T8: fidl::encoding::Encode<u64, D>,
T9: fidl::encoding::Encode<u8, D>,
> fidl::encoding::Encode<StatsEntry, D> for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
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<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for StatsEntry {
#[inline(always)]
fn new_empty() -> Self {
Self {
tx_vector_idx: fidl::new_empty!(u16, D),
tx_vec_desc: fidl::new_empty!(fidl::encoding::UnboundedString, D),
success_cur: fidl::new_empty!(u64, D),
attempts_cur: fidl::new_empty!(u64, D),
probability: fidl::new_empty!(f32, D),
cur_tp: fidl::new_empty!(f32, D),
success_total: fidl::new_empty!(u64, D),
attempts_total: fidl::new_empty!(u64, D),
probes_total: fidl::new_empty!(u64, D),
probe_cycles_skipped: fidl::new_empty!(u8, D),
}
}
#[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 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, D, &mut self.tx_vector_idx, decoder, offset + 0, _depth)?;
fidl::decode!(
fidl::encoding::UnboundedString,
D,
&mut self.tx_vec_desc,
decoder,
offset + 8,
_depth
)?;
fidl::decode!(u64, D, &mut self.success_cur, decoder, offset + 24, _depth)?;
fidl::decode!(u64, D, &mut self.attempts_cur, decoder, offset + 32, _depth)?;
fidl::decode!(f32, D, &mut self.probability, decoder, offset + 40, _depth)?;
fidl::decode!(f32, D, &mut self.cur_tp, decoder, offset + 44, _depth)?;
fidl::decode!(u64, D, &mut self.success_total, decoder, offset + 48, _depth)?;
fidl::decode!(u64, D, &mut self.attempts_total, decoder, offset + 56, _depth)?;
fidl::decode!(u64, D, &mut self.probes_total, decoder, offset + 64, _depth)?;
fidl::decode!(u8, D, &mut self.probe_cycles_skipped, decoder, offset + 72, _depth)?;
Ok(())
}
}
}