pub struct DeterministicScore(/* private fields */);Expand description
Fixed-point score wrapping an i64 scaled by 2^32.
Implementations§
Source§impl DeterministicScore
impl DeterministicScore
Sourcepub const MAX: DeterministicScore
pub const MAX: DeterministicScore
Highest representable score (i64::MAX); maps to +Infinity in float conversion.
Sourcepub const MIN: DeterministicScore
pub const MIN: DeterministicScore
Reserved sentinel at i64::MIN; never produced by arithmetic or float conversion.
Sourcepub const NEG_INF: DeterministicScore
pub const NEG_INF: DeterministicScore
Lowest reachable runtime score (i64::MIN + 1); underflow and -Infinity clamp here.
Sourcepub const ZERO: DeterministicScore
pub const ZERO: DeterministicScore
Score of exactly zero.
Sourcepub const fn from_raw(raw: i64) -> DeterministicScore
pub const fn from_raw(raw: i64) -> DeterministicScore
Construct from a raw i64 without validation. Passing i64::MIN creates the reserved sentinel.
Sourcepub const fn from_raw_saturating(raw: i64) -> DeterministicScore
pub const fn from_raw_saturating(raw: i64) -> DeterministicScore
Construct from a raw i64, mapping i64::MIN to NEG_INF.
Sourcepub const fn from_raw_checked(raw: i64) -> Option<DeterministicScore>
pub const fn from_raw_checked(raw: i64) -> Option<DeterministicScore>
Construct from a raw i64, returning None if raw == i64::MIN.
Sourcepub fn from_f64(val: f64) -> DeterministicScore
pub fn from_f64(val: f64) -> DeterministicScore
Convert an f64 to a DeterministicScore (NaN → ZERO, ±Inf → MAX/NEG_INF).
Sourcepub fn from_f32(val: f32) -> DeterministicScore
pub fn from_f32(val: f32) -> DeterministicScore
Convert an f32 to a DeterministicScore via from_f64.
Sourcepub const fn is_infinite(self) -> bool
pub const fn is_infinite(self) -> bool
Return true if the score is the MAX or NEG_INF sentinel.
Trait Implementations§
Source§impl Add for DeterministicScore
impl Add for DeterministicScore
Source§type Output = DeterministicScore
type Output = DeterministicScore
The resulting type after applying the
+ operator.Source§fn add(self, rhs: DeterministicScore) -> <DeterministicScore as Add>::Output
fn add(self, rhs: DeterministicScore) -> <DeterministicScore as Add>::Output
Performs the
+ operation. Read moreSource§impl Clone for DeterministicScore
impl Clone for DeterministicScore
Source§fn clone(&self) -> DeterministicScore
fn clone(&self) -> DeterministicScore
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 DeterministicScore
Source§impl Debug for DeterministicScore
impl Debug for DeterministicScore
Source§impl Default for DeterministicScore
impl Default for DeterministicScore
Source§fn default() -> DeterministicScore
fn default() -> DeterministicScore
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for DeterministicScore
Available on crate feature serde only.
impl<'de> Deserialize<'de> for DeterministicScore
Available on crate feature
serde only.Source§fn deserialize<D>(
deserializer: D,
) -> Result<DeterministicScore, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<DeterministicScore, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for DeterministicScore
impl Display for DeterministicScore
Source§impl Div<i64> for DeterministicScore
impl Div<i64> for DeterministicScore
impl Eq for DeterministicScore
Source§impl From<f32> for DeterministicScore
impl From<f32> for DeterministicScore
Source§fn from(val: f32) -> DeterministicScore
fn from(val: f32) -> DeterministicScore
Converts to this type from the input type.
Source§impl From<f64> for DeterministicScore
impl From<f64> for DeterministicScore
Source§fn from(val: f64) -> DeterministicScore
fn from(val: f64) -> DeterministicScore
Converts to this type from the input type.
Source§impl Hash for DeterministicScore
impl Hash for DeterministicScore
Source§impl Mul<f64> for DeterministicScore
impl Mul<f64> for DeterministicScore
Source§impl Mul<i64> for DeterministicScore
impl Mul<i64> for DeterministicScore
Source§impl Ord for DeterministicScore
impl Ord for DeterministicScore
Source§fn cmp(&self, other: &DeterministicScore) -> Ordering
fn cmp(&self, other: &DeterministicScore) -> 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
Source§impl PartialEq for DeterministicScore
impl PartialEq for DeterministicScore
Source§fn eq(&self, other: &DeterministicScore) -> bool
fn eq(&self, other: &DeterministicScore) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl PartialOrd for DeterministicScore
impl PartialOrd for DeterministicScore
Source§impl Serialize for DeterministicScore
impl Serialize for DeterministicScore
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl StructuralPartialEq for DeterministicScore
Source§impl Sub for DeterministicScore
impl Sub for DeterministicScore
Source§type Output = DeterministicScore
type Output = DeterministicScore
The resulting type after applying the
- operator.Source§fn sub(self, rhs: DeterministicScore) -> <DeterministicScore as Sub>::Output
fn sub(self, rhs: DeterministicScore) -> <DeterministicScore as Sub>::Output
Performs the
- operation. Read moreAuto Trait Implementations§
impl Freeze for DeterministicScore
impl RefUnwindSafe for DeterministicScore
impl Send for DeterministicScore
impl Sync for DeterministicScore
impl Unpin for DeterministicScore
impl UnsafeUnpin for DeterministicScore
impl UnwindSafe for DeterministicScore
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