pub struct Fixed(/* private fields */);Expand description
16.16 fixed-point number (16 bits integer, 16 bits fractional)
Implementations§
Source§impl Fixed
impl Fixed
Sourcepub const fn to_int_round(self) -> i32
pub const fn to_int_round(self) -> i32
Convert to integer (round to nearest)
Sourcepub fn from_f32(val: f32) -> Self
pub fn from_f32(val: f32) -> Self
Create from f32 (for testing/initialization only, not for runtime)
Sourcepub fn mul_checked(self, rhs: Fixed) -> Result<Fixed>
pub fn mul_checked(self, rhs: Fixed) -> Result<Fixed>
Multiply with checked overflow
Sourcepub fn div_checked(self, rhs: Fixed) -> Result<Fixed>
pub fn div_checked(self, rhs: Fixed) -> Result<Fixed>
Divide with checked division by zero
Trait Implementations§
Source§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
impl 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 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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