pub struct RelayWeight(/* private fields */);
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 for RelayWeight
impl Add for RelayWeight
Source§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 for RelayWeight
impl AddAssign 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 for RelayWeight
impl PartialEq for RelayWeight
Source§impl PartialOrd for RelayWeight
impl PartialOrd for RelayWeight
Source§impl Sum for RelayWeight
impl Sum for RelayWeight
impl Copy for RelayWeight
impl Eq for RelayWeight
impl StructuralPartialEq for RelayWeight
Auto Trait Implementations§
impl Freeze for RelayWeight
impl RefUnwindSafe for RelayWeight
impl Send for RelayWeight
impl Sync for RelayWeight
impl Unpin for RelayWeight
impl UnwindSafe for RelayWeight
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Converts
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
, which can then be
downcast
into Box<dyn ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Converts
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
, which can then be further
downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Converts
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Converts
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> DowncastSend for T
impl<T> DowncastSend for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more