Skip to main content

PacketMetricStorage

Trait PacketMetricStorage 

Source
pub trait PacketMetricStorage {
    type Metric: Copy;

    // Required methods
    fn capacity(&self) -> NonZeroUsize;
    fn len(&self) -> usize;
    fn append(&mut self, packet_hash: PacketHash, metric: Self::Metric);
    fn replace(
        &mut self,
        slot: usize,
        packet_hash: PacketHash,
        metric: Self::Metric,
    );
    fn get(&self, packet_hash: PacketHash) -> Option<Self::Metric>;

    // Provided method
    fn is_empty(&self) -> bool { ... }
}

Required Associated Types§

Required Methods§

Source

fn capacity(&self) -> NonZeroUsize

Source

fn len(&self) -> usize

Source

fn append(&mut self, packet_hash: PacketHash, metric: Self::Metric)

Source

fn replace( &mut self, slot: usize, packet_hash: PacketHash, metric: Self::Metric, )

Source

fn get(&self, packet_hash: PacketHash) -> Option<Self::Metric>

Provided Methods§

Source

fn is_empty(&self) -> bool

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<Metric: Copy, const CAPACITY: usize, const BUCKETS: usize> PacketMetricStorage for FixedPacketMetricStorage<Metric, CAPACITY, BUCKETS>

Source§

type Metric = Metric

Source§

impl<Metric: Copy, const CAPACITY: usize> PacketMetricStorage for HeapPacketMetricStorage<Metric, CAPACITY>

Source§

type Metric = Metric