Struct tor_netdir::RelayWeight
source · pub struct RelayWeight(_);Expand description
An opaque type representing the weight with which a relay or set of relays will be selected for a given role.
Most users should ignore this type, and just use pick_relay instead.
Implementations§
source§impl RelayWeight
impl RelayWeight
sourcepub fn checked_div(&self, rhs: RelayWeight) -> Option<f64>
pub fn checked_div(&self, rhs: RelayWeight) -> Option<f64>
Try to divide this weight by rhs.
Return a ratio on success, or None on division-by-zero.
sourcepub fn ratio(&self, frac: f64) -> Option<RelayWeight>
pub fn ratio(&self, frac: f64) -> Option<RelayWeight>
Compute a ratio frac of this weight.
Return None if frac is less than zero, since negative weights are impossible.
Trait Implementations§
source§impl Add<RelayWeight> for RelayWeight
impl Add<RelayWeight> for RelayWeight
§type Output = RelayWeight
type Output = RelayWeight
The resulting type after applying the
+ operator.source§fn add(self, rhs: RelayWeight) -> RelayWeight
fn add(self, rhs: RelayWeight) -> RelayWeight
Performs the
+ operation. Read moresource§impl AddAssign<RelayWeight> for RelayWeight
impl AddAssign<RelayWeight> for RelayWeight
source§fn add_assign(&mut self, rhs: RelayWeight)
fn add_assign(&mut self, rhs: RelayWeight)
Performs the
+= operation. Read moresource§impl Clone for RelayWeight
impl Clone for RelayWeight
source§fn clone(&self) -> RelayWeight
fn clone(&self) -> RelayWeight
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresource§impl Debug for RelayWeight
impl Debug for RelayWeight
source§impl From<u64> for RelayWeight
impl From<u64> for RelayWeight
source§impl Ord for RelayWeight
impl Ord for RelayWeight
source§fn cmp(&self, other: &RelayWeight) -> Ordering
fn cmp(&self, other: &RelayWeight) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl PartialEq<RelayWeight> for RelayWeight
impl PartialEq<RelayWeight> for RelayWeight
source§fn eq(&self, other: &RelayWeight) -> bool
fn eq(&self, other: &RelayWeight) -> bool
source§impl PartialOrd<RelayWeight> for RelayWeight
impl PartialOrd<RelayWeight> for RelayWeight
source§fn partial_cmp(&self, other: &RelayWeight) -> Option<Ordering>
fn partial_cmp(&self, other: &RelayWeight) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self and other) and is used by the <=
operator. Read more