pub struct StampValue(/* private fields */);Expand description
Leading zero bits of a 256-bit stamp product (the legacy integer value),
fractional stamp values and their fixed-point type. See
rns_crypto::stamp_value.
A stamp value in fixed point, in 1/256 steps.
Implementations§
Source§impl StampValue
impl StampValue
pub const ZERO: StampValue
Sourcepub const fn from_fp(fp: u32) -> StampValue
pub const fn from_fp(fp: u32) -> StampValue
Value from its fixed-point representation, clamped to the maximum.
Sourcepub const fn from_whole(value: u32) -> StampValue
pub const fn from_whole(value: u32) -> StampValue
Value of a whole number of bits, such as a legacy integer value.
Sourcepub fn from_f64(value: f64) -> StampValue
pub fn from_f64(value: f64) -> StampValue
Value read from a float, floored onto the grid. Values written by this implementation or upstream lie on the grid exactly; non-finite or negative input reads as zero.
Sourcepub const fn meets(self, cost: StampCost) -> bool
pub const fn meets(self, cost: StampCost) -> bool
Whether the value reaches cost, as upstream compares a reported
value with a required cost (value < get_link_cost()). Validity of
a stamp itself is decided against the target, see
StampCost::admits.
Trait Implementations§
Source§impl Clone for StampValue
impl Clone for StampValue
Source§fn clone(&self) -> StampValue
fn clone(&self) -> StampValue
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for StampValue
Source§impl Debug for StampValue
impl Debug for StampValue
Source§impl Default for StampValue
impl Default for StampValue
Source§fn default() -> StampValue
fn default() -> StampValue
Returns the “default value” for a type. Read more
Source§impl Display for StampValue
impl Display for StampValue
impl Eq for StampValue
Source§impl Hash for StampValue
impl Hash for StampValue
Source§impl Ord for StampValue
impl Ord for StampValue
Source§fn cmp(&self, other: &StampValue) -> Ordering
fn cmp(&self, other: &StampValue) -> Ordering
1.21.0 (const: unstable) · 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
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialEq for StampValue
impl PartialEq for StampValue
Source§impl PartialOrd for StampValue
impl PartialOrd for StampValue
impl StructuralPartialEq for StampValue
Auto Trait Implementations§
impl Forget for StampValue
impl Freeze for StampValue
impl RefUnwindSafe for StampValue
impl Send for StampValue
impl Sync for StampValue
impl Unpin for StampValue
impl UnsafeUnpin for StampValue
impl UnwindSafe for StampValue
Blanket Implementations§
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