Struct fpa::Q
[−]
[src]
pub struct Q<BITS, FRAC> { /* fields omitted */ }
Fixed point number
BITS
is the integer primitive used to stored the numberFRAC
is the number of bits used for the fractional part of the number
Methods
impl<FRAC> Q<i8, FRAC> where
FRAC: Cmp<U0, Output = Greater> + Cmp<U8, Output = Less> + Unsigned,
[src]
FRAC: Cmp<U0, Output = Greater> + Cmp<U8, Output = Less> + Unsigned,
fn from_bits(bits: i8) -> Self
Creates a fixed point number from the bit pattern $bits
impl<FRAC> Q<i8, FRAC>
[src]
fn abs(self) -> Self
Returns the absolute value of self
fn into_bits(self) -> i8
Returns the bit pattern that represents self
impl<FRAC> Q<i16, FRAC> where
FRAC: Cmp<U0, Output = Greater> + Cmp<U16, Output = Less> + Unsigned,
[src]
FRAC: Cmp<U0, Output = Greater> + Cmp<U16, Output = Less> + Unsigned,
fn from_bits(bits: i16) -> Self
Creates a fixed point number from the bit pattern $bits
impl<FRAC> Q<i16, FRAC>
[src]
fn abs(self) -> Self
Returns the absolute value of self
fn into_bits(self) -> i16
Returns the bit pattern that represents self
impl<FRAC> Q<i32, FRAC> where
FRAC: Cmp<U0, Output = Greater> + Cmp<U32, Output = Less> + Unsigned,
[src]
FRAC: Cmp<U0, Output = Greater> + Cmp<U32, Output = Less> + Unsigned,
fn from_bits(bits: i32) -> Self
Creates a fixed point number from the bit pattern $bits
impl<FRAC> Q<i32, FRAC>
[src]
fn abs(self) -> Self
Returns the absolute value of self
fn into_bits(self) -> i32
Returns the bit pattern that represents self
Trait Implementations
impl<BITS, FRAC> Clone for Q<BITS, FRAC> where
BITS: Clone,
[src]
BITS: Clone,
fn clone(&self) -> Self
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl<BITS, FRAC> Copy for Q<BITS, FRAC> where
BITS: Copy,
[src]
BITS: Copy,
impl<BITS, FRAC> Eq for Q<BITS, FRAC> where
BITS: Eq,
[src]
BITS: Eq,
impl<BITS, FRAC> Ord for Q<BITS, FRAC> where
BITS: Ord,
[src]
BITS: Ord,
fn cmp(&self, rhs: &Self) -> Ordering
This method returns an Ordering
between self
and other
. Read more
impl<BITS, FRAC> PartialEq for Q<BITS, FRAC> where
BITS: PartialEq,
[src]
BITS: PartialEq,
fn eq(&self, rhs: &Self) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0
This method tests for !=
.
impl<BITS, FRAC> PartialOrd for Q<BITS, FRAC> where
BITS: PartialOrd,
[src]
BITS: PartialOrd,
fn partial_cmp(&self, rhs: &Self) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, other: &Rhs) -> bool
1.0.0
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, other: &Rhs) -> bool
1.0.0
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, other: &Rhs) -> bool
1.0.0
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, other: &Rhs) -> bool
1.0.0
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl<FRAC> From<f32> for Q<i8, FRAC> where
FRAC: Cmp<U0, Output = Greater> + Cmp<U8, Output = Less> + Unsigned,
[src]
FRAC: Cmp<U0, Output = Greater> + Cmp<U8, Output = Less> + Unsigned,
type Output = Result<Self, Error>
The result of the cast operation: either Self
or Result<Self, Error>
fn cast(x: f32) -> Self::Output
Checked cast from Src
to Self
impl<FRAC> From<f64> for Q<i8, FRAC> where
FRAC: Cmp<U0, Output = Greater> + Cmp<U8, Output = Less> + Unsigned,
[src]
FRAC: Cmp<U0, Output = Greater> + Cmp<U8, Output = Less> + Unsigned,
type Output = Result<Self, Error>
The result of the cast operation: either Self
or Result<Self, Error>
fn cast(x: f64) -> Self::Output
Checked cast from Src
to Self
impl<FRAC> From<Q<i8, FRAC>> for Q<i8, FRAC>
[src]
type Output = Self
The result of the cast operation: either Self
or Result<Self, Error>
fn cast(x: Q<i8, FRAC>) -> Self::Output
Checked cast from Src
to Self
impl<FRAC> Debug for Q<i8, FRAC>
[src]
impl<FRAC> Display for Q<i8, FRAC> where
FRAC: Unsigned,
[src]
FRAC: Unsigned,
impl<FRAC> Add for Q<i8, FRAC> where
FRAC: Unsigned,
[src]
FRAC: Unsigned,
type Output = Self
The resulting type after applying the +
operator
fn add(self, rhs: Self) -> Self
The method for the +
operator
impl<FRAC> Add<i8> for Q<i8, FRAC> where
FRAC: Unsigned,
[src]
FRAC: Unsigned,
type Output = Self
The resulting type after applying the +
operator
fn add(self, rhs: i8) -> Self
The method for the +
operator
impl<FRAC> AddAssign for Q<i8, FRAC> where
FRAC: Unsigned,
[src]
FRAC: Unsigned,
fn add_assign(&mut self, rhs: Self)
The method for the +=
operator
impl<FRAC> AddAssign<i8> for Q<i8, FRAC> where
FRAC: Unsigned,
[src]
FRAC: Unsigned,
fn add_assign(&mut self, rhs: i8)
The method for the +=
operator
impl<FRAC> Div for Q<i8, FRAC> where
FRAC: Unsigned,
[src]
FRAC: Unsigned,
type Output = Self
The resulting type after applying the /
operator
fn div(self, rhs: Self) -> Self
The method for the /
operator
impl<FRAC> Div<i8> for Q<i8, FRAC> where
FRAC: Unsigned,
[src]
FRAC: Unsigned,
type Output = Self
The resulting type after applying the /
operator
fn div(self, rhs: i8) -> Self
The method for the /
operator
impl<FRAC> DivAssign for Q<i8, FRAC> where
FRAC: Unsigned,
[src]
FRAC: Unsigned,
fn div_assign(&mut self, rhs: Self)
The method for the /=
operator
impl<FRAC> DivAssign<i8> for Q<i8, FRAC> where
FRAC: Unsigned,
[src]
FRAC: Unsigned,
fn div_assign(&mut self, rhs: i8)
The method for the /=
operator
impl<FRAC> Mul for Q<i8, FRAC> where
FRAC: Unsigned,
[src]
FRAC: Unsigned,
type Output = Self
The resulting type after applying the *
operator
fn mul(self, rhs: Self) -> Self
The method for the *
operator
impl<FRAC> Mul<i8> for Q<i8, FRAC> where
FRAC: Unsigned,
[src]
FRAC: Unsigned,
type Output = Self
The resulting type after applying the *
operator
fn mul(self, rhs: i8) -> Self
The method for the *
operator
impl<FRAC> MulAssign for Q<i8, FRAC> where
FRAC: Unsigned,
[src]
FRAC: Unsigned,
fn mul_assign(&mut self, rhs: Self)
The method for the *=
operator
impl<FRAC> MulAssign<i8> for Q<i8, FRAC> where
FRAC: Unsigned,
[src]
FRAC: Unsigned,
fn mul_assign(&mut self, rhs: i8)
The method for the *=
operator
impl<FRAC> Neg for Q<i8, FRAC> where
FRAC: Unsigned,
[src]
FRAC: Unsigned,
type Output = Self
The resulting type after applying the -
operator
fn neg(self) -> Self
The method for the unary -
operator
impl<FRAC> Shl<u8> for Q<i8, FRAC> where
FRAC: Unsigned,
[src]
FRAC: Unsigned,
type Output = Self
The resulting type after applying the <<
operator
fn shl(self, rhs: u8) -> Self
The method for the <<
operator
impl<FRAC> Shr<u8> for Q<i8, FRAC> where
FRAC: Unsigned,
[src]
FRAC: Unsigned,
type Output = Self
The resulting type after applying the >>
operator
fn shr(self, rhs: u8) -> Self
The method for the >>
operator
impl<FRAC> Sub for Q<i8, FRAC> where
FRAC: Unsigned,
[src]
FRAC: Unsigned,
type Output = Self
The resulting type after applying the -
operator
fn sub(self, rhs: Self) -> Self
The method for the -
operator
impl<FRAC> Sub<i8> for Q<i8, FRAC> where
FRAC: Unsigned,
[src]
FRAC: Unsigned,
type Output = Self
The resulting type after applying the -
operator
fn sub(self, rhs: i8) -> Self
The method for the -
operator
impl<FRAC> SubAssign for Q<i8, FRAC> where
FRAC: Unsigned,
[src]
FRAC: Unsigned,
fn sub_assign(&mut self, rhs: Self)
The method for the -=
operator
impl<FRAC> SubAssign<i8> for Q<i8, FRAC> where
FRAC: Unsigned,
[src]
FRAC: Unsigned,
fn sub_assign(&mut self, rhs: i8)
The method for the -=
operator
impl<FRAC> From<f32> for Q<i16, FRAC> where
FRAC: Cmp<U0, Output = Greater> + Cmp<U16, Output = Less> + Unsigned,
[src]
FRAC: Cmp<U0, Output = Greater> + Cmp<U16, Output = Less> + Unsigned,
type Output = Result<Self, Error>
The result of the cast operation: either Self
or Result<Self, Error>
fn cast(x: f32) -> Self::Output
Checked cast from Src
to Self
impl<FRAC> From<f64> for Q<i16, FRAC> where
FRAC: Cmp<U0, Output = Greater> + Cmp<U16, Output = Less> + Unsigned,
[src]
FRAC: Cmp<U0, Output = Greater> + Cmp<U16, Output = Less> + Unsigned,
type Output = Result<Self, Error>
The result of the cast operation: either Self
or Result<Self, Error>
fn cast(x: f64) -> Self::Output
Checked cast from Src
to Self
impl<FRAC> From<Q<i16, FRAC>> for Q<i16, FRAC>
[src]
type Output = Self
The result of the cast operation: either Self
or Result<Self, Error>
fn cast(x: Q<i16, FRAC>) -> Self::Output
Checked cast from Src
to Self
impl<FRAC> Debug for Q<i16, FRAC>
[src]
impl<FRAC> Display for Q<i16, FRAC> where
FRAC: Unsigned,
[src]
FRAC: Unsigned,
impl<FRAC> Add for Q<i16, FRAC> where
FRAC: Unsigned,
[src]
FRAC: Unsigned,
type Output = Self
The resulting type after applying the +
operator
fn add(self, rhs: Self) -> Self
The method for the +
operator
impl<FRAC> Add<i16> for Q<i16, FRAC> where
FRAC: Unsigned,
[src]
FRAC: Unsigned,
type Output = Self
The resulting type after applying the +
operator
fn add(self, rhs: i16) -> Self
The method for the +
operator
impl<FRAC> AddAssign for Q<i16, FRAC> where
FRAC: Unsigned,
[src]
FRAC: Unsigned,
fn add_assign(&mut self, rhs: Self)
The method for the +=
operator
impl<FRAC> AddAssign<i16> for Q<i16, FRAC> where
FRAC: Unsigned,
[src]
FRAC: Unsigned,
fn add_assign(&mut self, rhs: i16)
The method for the +=
operator
impl<FRAC> Div for Q<i16, FRAC> where
FRAC: Unsigned,
[src]
FRAC: Unsigned,
type Output = Self
The resulting type after applying the /
operator
fn div(self, rhs: Self) -> Self
The method for the /
operator
impl<FRAC> Div<i16> for Q<i16, FRAC> where
FRAC: Unsigned,
[src]
FRAC: Unsigned,
type Output = Self
The resulting type after applying the /
operator
fn div(self, rhs: i16) -> Self
The method for the /
operator
impl<FRAC> DivAssign for Q<i16, FRAC> where
FRAC: Unsigned,
[src]
FRAC: Unsigned,
fn div_assign(&mut self, rhs: Self)
The method for the /=
operator
impl<FRAC> DivAssign<i16> for Q<i16, FRAC> where
FRAC: Unsigned,
[src]
FRAC: Unsigned,
fn div_assign(&mut self, rhs: i16)
The method for the /=
operator
impl<FRAC> Mul for Q<i16, FRAC> where
FRAC: Unsigned,
[src]
FRAC: Unsigned,
type Output = Self
The resulting type after applying the *
operator
fn mul(self, rhs: Self) -> Self
The method for the *
operator
impl<FRAC> Mul<i16> for Q<i16, FRAC> where
FRAC: Unsigned,
[src]
FRAC: Unsigned,
type Output = Self
The resulting type after applying the *
operator
fn mul(self, rhs: i16) -> Self
The method for the *
operator
impl<FRAC> MulAssign for Q<i16, FRAC> where
FRAC: Unsigned,
[src]
FRAC: Unsigned,
fn mul_assign(&mut self, rhs: Self)
The method for the *=
operator
impl<FRAC> MulAssign<i16> for Q<i16, FRAC> where
FRAC: Unsigned,
[src]
FRAC: Unsigned,
fn mul_assign(&mut self, rhs: i16)
The method for the *=
operator
impl<FRAC> Neg for Q<i16, FRAC> where
FRAC: Unsigned,
[src]
FRAC: Unsigned,
type Output = Self
The resulting type after applying the -
operator
fn neg(self) -> Self
The method for the unary -
operator
impl<FRAC> Shl<u8> for Q<i16, FRAC> where
FRAC: Unsigned,
[src]
FRAC: Unsigned,
type Output = Self
The resulting type after applying the <<
operator
fn shl(self, rhs: u8) -> Self
The method for the <<
operator
impl<FRAC> Shr<u8> for Q<i16, FRAC> where
FRAC: Unsigned,
[src]
FRAC: Unsigned,
type Output = Self
The resulting type after applying the >>
operator
fn shr(self, rhs: u8) -> Self
The method for the >>
operator
impl<FRAC> Sub for Q<i16, FRAC> where
FRAC: Unsigned,
[src]
FRAC: Unsigned,
type Output = Self
The resulting type after applying the -
operator
fn sub(self, rhs: Self) -> Self
The method for the -
operator
impl<FRAC> Sub<i16> for Q<i16, FRAC> where
FRAC: Unsigned,
[src]
FRAC: Unsigned,
type Output = Self
The resulting type after applying the -
operator
fn sub(self, rhs: i16) -> Self
The method for the -
operator
impl<FRAC> SubAssign for Q<i16, FRAC> where
FRAC: Unsigned,
[src]
FRAC: Unsigned,
fn sub_assign(&mut self, rhs: Self)
The method for the -=
operator
impl<FRAC> SubAssign<i16> for Q<i16, FRAC> where
FRAC: Unsigned,
[src]
FRAC: Unsigned,
fn sub_assign(&mut self, rhs: i16)
The method for the -=
operator
impl<FRAC> From<f32> for Q<i32, FRAC> where
FRAC: Cmp<U0, Output = Greater> + Cmp<U32, Output = Less> + Unsigned,
[src]
FRAC: Cmp<U0, Output = Greater> + Cmp<U32, Output = Less> + Unsigned,
type Output = Result<Self, Error>
The result of the cast operation: either Self
or Result<Self, Error>
fn cast(x: f32) -> Self::Output
Checked cast from Src
to Self
impl<FRAC> From<f64> for Q<i32, FRAC> where
FRAC: Cmp<U0, Output = Greater> + Cmp<U32, Output = Less> + Unsigned,
[src]
FRAC: Cmp<U0, Output = Greater> + Cmp<U32, Output = Less> + Unsigned,
type Output = Result<Self, Error>
The result of the cast operation: either Self
or Result<Self, Error>
fn cast(x: f64) -> Self::Output
Checked cast from Src
to Self
impl<FRAC> From<Q<i32, FRAC>> for Q<i32, FRAC>
[src]
type Output = Self
The result of the cast operation: either Self
or Result<Self, Error>
fn cast(x: Q<i32, FRAC>) -> Self::Output
Checked cast from Src
to Self
impl<FRAC> Debug for Q<i32, FRAC>
[src]
impl<FRAC> Display for Q<i32, FRAC> where
FRAC: Unsigned,
[src]
FRAC: Unsigned,
impl<FRAC> Add for Q<i32, FRAC> where
FRAC: Unsigned,
[src]
FRAC: Unsigned,
type Output = Self
The resulting type after applying the +
operator
fn add(self, rhs: Self) -> Self
The method for the +
operator
impl<FRAC> Add<i32> for Q<i32, FRAC> where
FRAC: Unsigned,
[src]
FRAC: Unsigned,
type Output = Self
The resulting type after applying the +
operator
fn add(self, rhs: i32) -> Self
The method for the +
operator
impl<FRAC> AddAssign for Q<i32, FRAC> where
FRAC: Unsigned,
[src]
FRAC: Unsigned,
fn add_assign(&mut self, rhs: Self)
The method for the +=
operator
impl<FRAC> AddAssign<i32> for Q<i32, FRAC> where
FRAC: Unsigned,
[src]
FRAC: Unsigned,
fn add_assign(&mut self, rhs: i32)
The method for the +=
operator
impl<FRAC> Div for Q<i32, FRAC> where
FRAC: Unsigned,
[src]
FRAC: Unsigned,
type Output = Self
The resulting type after applying the /
operator
fn div(self, rhs: Self) -> Self
The method for the /
operator
impl<FRAC> Div<i32> for Q<i32, FRAC> where
FRAC: Unsigned,
[src]
FRAC: Unsigned,
type Output = Self
The resulting type after applying the /
operator
fn div(self, rhs: i32) -> Self
The method for the /
operator
impl<FRAC> DivAssign for Q<i32, FRAC> where
FRAC: Unsigned,
[src]
FRAC: Unsigned,
fn div_assign(&mut self, rhs: Self)
The method for the /=
operator
impl<FRAC> DivAssign<i32> for Q<i32, FRAC> where
FRAC: Unsigned,
[src]
FRAC: Unsigned,
fn div_assign(&mut self, rhs: i32)
The method for the /=
operator
impl<FRAC> Mul for Q<i32, FRAC> where
FRAC: Unsigned,
[src]
FRAC: Unsigned,
type Output = Self
The resulting type after applying the *
operator
fn mul(self, rhs: Self) -> Self
The method for the *
operator
impl<FRAC> Mul<i32> for Q<i32, FRAC> where
FRAC: Unsigned,
[src]
FRAC: Unsigned,
type Output = Self
The resulting type after applying the *
operator
fn mul(self, rhs: i32) -> Self
The method for the *
operator
impl<FRAC> MulAssign for Q<i32, FRAC> where
FRAC: Unsigned,
[src]
FRAC: Unsigned,
fn mul_assign(&mut self, rhs: Self)
The method for the *=
operator
impl<FRAC> MulAssign<i32> for Q<i32, FRAC> where
FRAC: Unsigned,
[src]
FRAC: Unsigned,
fn mul_assign(&mut self, rhs: i32)
The method for the *=
operator
impl<FRAC> Neg for Q<i32, FRAC> where
FRAC: Unsigned,
[src]
FRAC: Unsigned,
type Output = Self
The resulting type after applying the -
operator
fn neg(self) -> Self
The method for the unary -
operator
impl<FRAC> Shl<u8> for Q<i32, FRAC> where
FRAC: Unsigned,
[src]
FRAC: Unsigned,
type Output = Self
The resulting type after applying the <<
operator
fn shl(self, rhs: u8) -> Self
The method for the <<
operator
impl<FRAC> Shr<u8> for Q<i32, FRAC> where
FRAC: Unsigned,
[src]
FRAC: Unsigned,
type Output = Self
The resulting type after applying the >>
operator
fn shr(self, rhs: u8) -> Self
The method for the >>
operator
impl<FRAC> Sub for Q<i32, FRAC> where
FRAC: Unsigned,
[src]
FRAC: Unsigned,
type Output = Self
The resulting type after applying the -
operator
fn sub(self, rhs: Self) -> Self
The method for the -
operator
impl<FRAC> Sub<i32> for Q<i32, FRAC> where
FRAC: Unsigned,
[src]
FRAC: Unsigned,
type Output = Self
The resulting type after applying the -
operator
fn sub(self, rhs: i32) -> Self
The method for the -
operator
impl<FRAC> SubAssign for Q<i32, FRAC> where
FRAC: Unsigned,
[src]
FRAC: Unsigned,
fn sub_assign(&mut self, rhs: Self)
The method for the -=
operator
impl<FRAC> SubAssign<i32> for Q<i32, FRAC> where
FRAC: Unsigned,
[src]
FRAC: Unsigned,
fn sub_assign(&mut self, rhs: i32)
The method for the -=
operator