pub struct Fixed {
pub raw: i64,
}Expand description
Fixed-point type: i64 with 18 decimal places of precision Stored as raw i64, divided by 10^18 for actual value This ensures deterministic simulation across platforms
Fields§
§raw: i64Raw value scaled by 10^18
Implementations§
Source§impl Fixed
impl Fixed
pub const ZERO: Fixed
pub const ONE: Fixed
pub fn from_num<T: TryInto<i128>>(n: T) -> Self
pub fn from_raw(raw: i64) -> Self
pub fn to_f64(self) -> f64
pub fn saturating_add(self, other: Fixed) -> Fixed
pub fn saturating_sub(self, other: Fixed) -> Fixed
pub fn clamp(self, min: Fixed, max: Fixed) -> Fixed
Trait Implementations§
Source§impl AddAssign for Fixed
impl AddAssign for Fixed
Source§fn add_assign(&mut self, other: Fixed)
fn add_assign(&mut self, other: Fixed)
Performs the
+= operation. Read moreSource§impl<'de> Deserialize<'de> for Fixed
impl<'de> Deserialize<'de> for Fixed
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Ord for Fixed
impl Ord for Fixed
Source§impl PartialOrd for Fixed
impl PartialOrd for Fixed
Source§impl SubAssign for Fixed
impl SubAssign for Fixed
Source§fn sub_assign(&mut self, other: Fixed)
fn sub_assign(&mut self, other: Fixed)
Performs the
-= operation. Read moreimpl Copy for Fixed
impl Eq for Fixed
impl StructuralPartialEq for Fixed
Auto Trait Implementations§
impl Freeze for Fixed
impl RefUnwindSafe for Fixed
impl Send for Fixed
impl Sync for Fixed
impl Unpin for Fixed
impl UnsafeUnpin for Fixed
impl UnwindSafe for Fixed
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