#[repr(C)]pub struct Unsigned1616FixedPoint(_);
Expand description
A Q-format Q16.16
unsigned fixed point number, viz:-
- Integer component is unsigned and 16 bits (
u16
). - Fraction component is 16 bits.
See upstream library https://github.com/PetteriAimonen/libfixmath
for example code to implement trigonometric functions.
Implementations
sourceimpl Unsigned1616FixedPoint
impl Unsigned1616FixedPoint
sourcepub const InclusiveMinimum: Self = Self::new(Self::SmallestInteger, 0x0000)
pub const InclusiveMinimum: Self = Self::new(Self::SmallestInteger, 0x0000)
Inclusive minimum.
sourcepub const InclusiveMaximum: Self = Self::new(Self::LargestInteger, 0xFFFF)
pub const InclusiveMaximum: Self = Self::new(Self::LargestInteger, 0xFFFF)
Inclusive maximum.
sourcepub fn saturating_add(self, rhs: Self) -> Self
pub fn saturating_add(self, rhs: Self) -> Self
Saturating addition.
sourcepub fn saturating_sub(self, rhs: Self) -> Self
pub fn saturating_sub(self, rhs: Self) -> Self
Saturating subtraction.
sourcepub fn checked_add(self, rhs: Self) -> Option<Self>
pub fn checked_add(self, rhs: Self) -> Option<Self>
Checked addition.
sourcepub fn checked_sub(self, rhs: Self) -> Option<Self>
pub fn checked_sub(self, rhs: Self) -> Option<Self>
Checked subtraction.
sourcepub fn saturating_mul_by_scalar(self, scalar: u16) -> Self
pub fn saturating_mul_by_scalar(self, scalar: u16) -> Self
Saturating multiply by a scalar.
sourcepub fn checked_mul_by_scalar(self, scalar: u16) -> Option<Self>
pub fn checked_mul_by_scalar(self, scalar: u16) -> Option<Self>
Checked multiply by a scalar.
sourcepub fn checked_div_by_scalar(self, scalar: u16) -> Option<Self>
pub fn checked_div_by_scalar(self, scalar: u16) -> Option<Self>
Checked divide by a scalar.
Trait Implementations
sourceimpl AddAssign<Unsigned1616FixedPoint> for Unsigned1616FixedPoint
impl AddAssign<Unsigned1616FixedPoint> for Unsigned1616FixedPoint
sourcefn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
Performs the +=
operation. Read more
sourceimpl Clone for Unsigned1616FixedPoint
impl Clone for Unsigned1616FixedPoint
sourcefn clone(&self) -> Unsigned1616FixedPoint
fn clone(&self) -> Unsigned1616FixedPoint
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for Unsigned1616FixedPoint
impl Debug for Unsigned1616FixedPoint
sourceimpl Default for Unsigned1616FixedPoint
impl Default for Unsigned1616FixedPoint
sourcefn default() -> Unsigned1616FixedPoint
fn default() -> Unsigned1616FixedPoint
Returns the “default value” for a type. Read more
sourceimpl<'de> Deserialize<'de> for Unsigned1616FixedPoint
impl<'de> Deserialize<'de> for Unsigned1616FixedPoint
sourcefn 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
sourceimpl From<([u8; 2], [u8; 2])> for Unsigned1616FixedPoint
impl From<([u8; 2], [u8; 2])> for Unsigned1616FixedPoint
sourcefn from(value: (BigEndianU16, BigEndianU16)) -> Self
fn from(value: (BigEndianU16, BigEndianU16)) -> Self
Converts to this type from the input type.
sourceimpl From<u32> for Unsigned1616FixedPoint
impl From<u32> for Unsigned1616FixedPoint
sourceimpl Hash for Unsigned1616FixedPoint
impl Hash for Unsigned1616FixedPoint
sourceimpl Into<([u8; 2], [u8; 2])> for Unsigned1616FixedPoint
impl Into<([u8; 2], [u8; 2])> for Unsigned1616FixedPoint
sourcefn into(self) -> (BigEndianU16, BigEndianU16)
fn into(self) -> (BigEndianU16, BigEndianU16)
Converts this type into the (usually inferred) input type.
sourceimpl Into<u32> for Unsigned1616FixedPoint
impl Into<u32> for Unsigned1616FixedPoint
sourceimpl Ord for Unsigned1616FixedPoint
impl Ord for Unsigned1616FixedPoint
sourceimpl PartialOrd<Unsigned1616FixedPoint> for Unsigned1616FixedPoint
impl PartialOrd<Unsigned1616FixedPoint> for Unsigned1616FixedPoint
sourcefn partial_cmp(&self, rhs: &Self) -> Option<Ordering>
fn partial_cmp(&self, rhs: &Self) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl RemAssign<Unsigned1616FixedPoint> for Unsigned1616FixedPoint
impl RemAssign<Unsigned1616FixedPoint> for Unsigned1616FixedPoint
sourcefn rem_assign(&mut self, rhs: Self)
fn rem_assign(&mut self, rhs: Self)
Performs the %=
operation. Read more
sourceimpl Serialize for Unsigned1616FixedPoint
impl Serialize for Unsigned1616FixedPoint
sourceimpl SubAssign<Unsigned1616FixedPoint> for Unsigned1616FixedPoint
impl SubAssign<Unsigned1616FixedPoint> for Unsigned1616FixedPoint
sourcefn sub_assign(&mut self, rhs: Self)
fn sub_assign(&mut self, rhs: Self)
Performs the -=
operation. Read more
sourceimpl TryFrom<Signed1616FixedPoint> for Unsigned1616FixedPoint
impl TryFrom<Signed1616FixedPoint> for Unsigned1616FixedPoint
type Error = ParseNumberError
type Error = ParseNumberError
The type returned in the event of a conversion error.
sourcefn try_from(value: Signed1616FixedPoint) -> Result<Self, Self::Error>
fn try_from(value: Signed1616FixedPoint) -> Result<Self, Self::Error>
Performs the conversion.
sourceimpl TryFrom<Unsigned1616FixedPoint> for Signed1616FixedPoint
impl TryFrom<Unsigned1616FixedPoint> for Signed1616FixedPoint
type Error = ParseNumberError
type Error = ParseNumberError
The type returned in the event of a conversion error.
sourcefn try_from(value: Unsigned1616FixedPoint) -> Result<Self, Self::Error>
fn try_from(value: Unsigned1616FixedPoint) -> Result<Self, Self::Error>
Performs the conversion.
impl Copy for Unsigned1616FixedPoint
impl Eq for Unsigned1616FixedPoint
Auto Trait Implementations
impl RefUnwindSafe for Unsigned1616FixedPoint
impl Send for Unsigned1616FixedPoint
impl Sync for Unsigned1616FixedPoint
impl Unpin for Unsigned1616FixedPoint
impl UnwindSafe for Unsigned1616FixedPoint
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more