pub trait SurbFlowEstimator {
// Required methods
fn estimate_surbs_consumed(&self) -> u64;
fn estimate_surbs_produced(&self) -> u64;
// Provided methods
fn saturating_diff(&self) -> u64 { ... }
fn estimated_surb_buffer_change<E: SurbFlowEstimator>(
&self,
earlier: &E,
) -> Option<i64> { ... }
}Expand description
Allows estimating the flow of SURBs in a Session (production or consumption).
Required Methods§
Sourcefn estimate_surbs_consumed(&self) -> u64
fn estimate_surbs_consumed(&self) -> u64
Estimates the number of SURBs consumed.
Value returned on each call must be equal or greater to the value returned by a previous call.
Sourcefn estimate_surbs_produced(&self) -> u64
fn estimate_surbs_produced(&self) -> u64
Estimates the number of SURBs produced or received.
Value returned on each call must be equal or greater to the value returned by a previous call.
Provided Methods§
Sourcefn saturating_diff(&self) -> u64
fn saturating_diff(&self) -> u64
Subtracts SURBs consumed from SURBs produced, saturating at zero.
Sourcefn estimated_surb_buffer_change<E: SurbFlowEstimator>(
&self,
earlier: &E,
) -> Option<i64>
fn estimated_surb_buffer_change<E: SurbFlowEstimator>( &self, earlier: &E, ) -> Option<i64>
Computes the estimated change in SURB buffer.
This is done by computing the change in produced and consumed SURBs since the earlier
state and then taking their difference.
A positive result is a surplus number of SURBs added to the buffer, a negative result is a loss of SURBs
from the buffer.
Returns None if earlier had more SURBs produced/consumed than this instance (overflow).
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.