Skip to main content

ItemCost

Trait ItemCost 

pub trait ItemCost<I> {
    // Required method
    fn cost_of(&self, item: &I) -> u64;
}
Available on crate feature std only.
Expand description

Prices the items sent through a PacedSink.

The default coster () uses the item’s own DatagramCost; CostFn uses a closure instead.

Required Methods§

fn cost_of(&self, item: &I) -> u64

The cost of the given item, in rate units.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

§

impl<I> ItemCost<I> for ()
where I: DatagramCost,

§

fn cost_of(&self, item: &I) -> u64

Implementors§

§

impl<I, F> ItemCost<I> for CostFn<F>
where F: Fn(&I) -> u64,