[−][src]Struct fixed_unsigned::FixedUnsigned
A fixed point unsigned integer
This is a num_bigint::BigUint
with a fixed scale.
The fixed scale is determined by the generic S
which implements FixedScale
and
provides the constant FixedScale::SCALE
.
Methods
impl<S> FixedUnsigned<S> where
S: FixedScale,
[src]
S: FixedScale,
pub fn int_part(&self) -> BigUint
[src]
Returns the integer part as BigUint
(i.e. the part before the decimal point)
pub fn frac_part(&self) -> BigUint
[src]
pub fn scale(&self) -> u64
[src]
Returns the scale of the FixedUnsigned
as u64.
Note that the scale is fixed by type, so for a FixedUnsigned<S>
you can also get it as
constant by S::Scale
. This function is only for convenience.
pub fn from_bytes_be(bytes: &[u8]) -> Self
[src]
pub fn from_bytes_le(bytes: &[u8]) -> Self
[src]
pub fn to_bytes_be(&self) -> Vec<u8>
[src]
pub fn to_bytes_le(&self) -> Vec<u8>
[src]
pub fn to_radix_string(&self, radix: u8, uppercase: bool) -> String
[src]
Converts the FixedUnsigned
to a string representation in base radix
.
Panics
This function will panic if the radix is 0 or greater than 36.
pub fn from_radix_string(string: &str, radix: u8) -> Result<Self, ParseError>
[src]
Converts a string representation to a FixedUnsigned
with base radix
.
NOTE: This function always rounds down.
Panics
This function will panic if the radix is 0 or greater than 36.
pub fn into_biguint(self) -> BigUint
[src]
Converts to a BigUint losing the decimal places
NOTE: This is not implemented as a Into
/From
trait to make the loss of precision implicit
pub fn into_biguint_without_scale(self) -> BigUint
[src]
pub fn bits(&self) -> usize
[src]
pub fn bytes(&self) -> usize
[src]
pub fn into_scale<T: FixedScale, R: RoundingMode>(self) -> FixedUnsigned<T>
[src]
Convert from scale S
to scale T
.
Trait Implementations
impl<S> From<BigUint> for FixedUnsigned<S> where
S: FixedScale,
[src]
S: FixedScale,
impl<S: FixedScale> From<u64> for FixedUnsigned<S>
[src]
impl<S: FixedScale> From<u32> for FixedUnsigned<S>
[src]
impl<S: FixedScale> From<u16> for FixedUnsigned<S>
[src]
impl<S: FixedScale> From<u8> for FixedUnsigned<S>
[src]
impl<S: FixedScale> From<f64> for FixedUnsigned<S>
[src]
Converts a f64
to a FixedUnsigned
impl<S: Clone> Clone for FixedUnsigned<S> where
S: FixedScale,
[src]
S: FixedScale,
fn clone(&self) -> FixedUnsigned<S>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<S> Default for FixedUnsigned<S> where
S: FixedScale,
[src]
S: FixedScale,
impl<S> Eq for FixedUnsigned<S> where
S: FixedScale,
[src]
S: FixedScale,
impl<S> Ord for FixedUnsigned<S> where
S: FixedScale,
[src]
S: FixedScale,
fn cmp(&self, other: &Self) -> Ordering
[src]
fn max(self, other: Self) -> Self
1.21.0[src]
fn min(self, other: Self) -> Self
1.21.0[src]
fn clamp(self, min: Self, max: Self) -> Self
[src]
impl<S> PartialEq<FixedUnsigned<S>> for FixedUnsigned<S> where
S: FixedScale,
[src]
S: FixedScale,
impl<S> PartialOrd<FixedUnsigned<S>> for FixedUnsigned<S> where
S: FixedScale,
[src]
S: FixedScale,
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
[src]
#[must_use]
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl<S> Display for FixedUnsigned<S> where
S: FixedScale,
[src]
S: FixedScale,
impl<S> Debug for FixedUnsigned<S> where
S: FixedScale,
[src]
S: FixedScale,
impl<S> Div<FixedUnsigned<S>> for FixedUnsigned<S> where
S: FixedScale,
[src]
S: FixedScale,
type Output = Self
The resulting type after applying the /
operator.
fn div(self, rhs: FixedUnsigned<S>) -> Self::Output
[src]
impl<'a, 'b, S> Div<&'b FixedUnsigned<S>> for &'a FixedUnsigned<S> where
S: FixedScale,
[src]
S: FixedScale,
type Output = FixedUnsigned<S>
The resulting type after applying the /
operator.
fn div(self, rhs: &'b FixedUnsigned<S>) -> FixedUnsigned<S>
[src]
impl<S> Sub<FixedUnsigned<S>> for FixedUnsigned<S> where
S: FixedScale,
[src]
S: FixedScale,
type Output = Self
The resulting type after applying the -
operator.
fn sub(self, rhs: FixedUnsigned<S>) -> Self::Output
[src]
impl<'a, 'b, S> Sub<&'b FixedUnsigned<S>> for &'a FixedUnsigned<S> where
S: FixedScale,
[src]
S: FixedScale,
type Output = FixedUnsigned<S>
The resulting type after applying the -
operator.
fn sub(self, rhs: &'b FixedUnsigned<S>) -> FixedUnsigned<S>
[src]
impl<S> FromStr for FixedUnsigned<S> where
S: FixedScale,
[src]
S: FixedScale,
type Err = ParseError
The associated error which can be returned from parsing.
fn from_str(s: &str) -> Result<Self, Self::Err>
[src]
impl<S> Add<FixedUnsigned<S>> for FixedUnsigned<S> where
S: FixedScale,
[src]
S: FixedScale,
type Output = Self
The resulting type after applying the +
operator.
fn add(self, rhs: FixedUnsigned<S>) -> Self::Output
[src]
impl<'a, 'b, S> Add<&'b FixedUnsigned<S>> for &'a FixedUnsigned<S> where
S: FixedScale,
[src]
S: FixedScale,
type Output = FixedUnsigned<S>
The resulting type after applying the +
operator.
fn add(self, rhs: &'b FixedUnsigned<S>) -> FixedUnsigned<S>
[src]
impl<S> Mul<FixedUnsigned<S>> for FixedUnsigned<S> where
S: FixedScale,
[src]
S: FixedScale,
type Output = Self
The resulting type after applying the *
operator.
fn mul(self, rhs: FixedUnsigned<S>) -> Self::Output
[src]
impl<'a, 'b, S> Mul<&'b FixedUnsigned<S>> for &'a FixedUnsigned<S> where
S: FixedScale,
[src]
S: FixedScale,
type Output = FixedUnsigned<S>
The resulting type after applying the *
operator.
fn mul(self, rhs: &'b FixedUnsigned<S>) -> FixedUnsigned<S>
[src]
impl<S> AddAssign<FixedUnsigned<S>> for FixedUnsigned<S> where
S: FixedScale,
[src]
S: FixedScale,
fn add_assign(&mut self, rhs: Self)
[src]
impl<S> SubAssign<FixedUnsigned<S>> for FixedUnsigned<S> where
S: FixedScale,
[src]
S: FixedScale,
fn sub_assign(&mut self, rhs: Self)
[src]
impl<S> MulAssign<FixedUnsigned<S>> for FixedUnsigned<S> where
S: FixedScale,
[src]
S: FixedScale,
fn mul_assign(&mut self, rhs: Self)
[src]
impl<S> DivAssign<FixedUnsigned<S>> for FixedUnsigned<S> where
S: FixedScale,
[src]
S: FixedScale,
fn div_assign(&mut self, rhs: Self)
[src]
impl<S> Hash for FixedUnsigned<S> where
S: FixedScale,
[src]
S: FixedScale,
fn hash<H: Hasher>(&self, state: &mut H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<S> One for FixedUnsigned<S> where
S: FixedScale,
[src]
S: FixedScale,
fn one() -> Self
[src]
fn set_one(&mut self)
[src]
fn is_one(&self) -> bool where
Self: PartialEq<Self>,
[src]
Self: PartialEq<Self>,
impl<S> Zero for FixedUnsigned<S> where
S: FixedScale,
[src]
S: FixedScale,
Auto Trait Implementations
impl<S> Send for FixedUnsigned<S> where
S: Send,
S: Send,
impl<S> Sync for FixedUnsigned<S> where
S: Sync,
S: Sync,
impl<S> Unpin for FixedUnsigned<S> where
S: Unpin,
S: Unpin,
impl<S> UnwindSafe for FixedUnsigned<S> where
S: UnwindSafe,
S: UnwindSafe,
impl<S> RefUnwindSafe for FixedUnsigned<S> where
S: RefUnwindSafe,
S: RefUnwindSafe,
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,