[−][src]Struct signifix::binary::Signifix
Intermediate implementor type of this module's TryFrom
and Display
trait
implementations. Former tries to convert a given number into this type by
determining the appropriate binary prefix, the normalized significand, and
the decimal mark position while latter uses this type's fields to format the
number as a string of four significant figures inclusive the binary prefix
symbol.
Interpreted formatting parameters are
+
to prefix positive numbers with a plus sign,fill
,alignment
, andwidth
to pad or align numbers.
Methods
impl Signifix
[src]
pub fn significand(&self) -> f64
[src]
Signed significand normalized from ±1.000
over ±999.9
to ±1 023
.
pub fn numerator(&self) -> i32
[src]
Signed significand numerator from ±1 000
to ±9 999
.
pub fn denominator(&self) -> i32
[src]
Significand denominator of either 1
, 10
, 100
, or 1 000
.
pub fn exponent(&self) -> usize
[src]
Exponent of significand denominator of either 0
, 1
, 2
, or 3
.
pub fn integer(&self) -> i32
[src]
Signed integer part of significand from ±1
to ±1 023
.
pub fn fractional(&self) -> i32
[src]
Fractional part of significand from 0
to 999
.
pub fn parts(&self) -> (i32, i32)
[src]
Signed integer and fractional part at once, in given order.
pub fn prefix(&self) -> usize
[src]
Binary prefix as NAMES
, SYMBOLS
, and FACTORS
array index from 0
to 8
.
pub fn symbol(&self) -> Option<&str>
[src]
Symbol of binary prefix from Some("Ki")
to Some("Yi")
, or None
.
pub fn factor(&self) -> f64
[src]
Factor of binary prefix from 1 024 ^ 1
to 1 024 ^ 8
, or 1 024 ^ 0
.
pub fn fmt(
&self,
f: &mut Formatter,
decimal_mark: &str,
grouping_sep: &str
) -> Result
[src]
&self,
f: &mut Formatter,
decimal_mark: &str,
grouping_sep: &str
) -> Result
Format trait implementation allowing explicit localization.
Until there is a recommended and possibly implicit localization system
for Rust, explicit localization can be achieved by wrapping the
Signifix
type into a locale-sensitive newtype which implements the
Display
trait via this method. Used by this type's Display
trait
implementation with a decimal point as decimal_mark
and a whitespace
as grouping_sep
. Both the decimal_mark
and grouping_sep
must be of
a single character.
Trait Implementations
impl Clone for Signifix
[src]
impl Copy for Signifix
[src]
impl Debug for Signifix
[src]
impl Display for Signifix
[src]
impl Eq for Signifix
[src]
impl Ord for Signifix
[src]
fn cmp(&self, other: &Signifix) -> Ordering
[src]
#[must_use]fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn clamp(self, min: Self, max: Self) -> Self
[src]
impl PartialEq<Signifix> for Signifix
[src]
impl PartialOrd<Signifix> for Signifix
[src]
fn partial_cmp(&self, other: &Signifix) -> Option<Ordering>
[src]
fn lt(&self, other: &Signifix) -> bool
[src]
fn le(&self, other: &Signifix) -> bool
[src]
fn gt(&self, other: &Signifix) -> bool
[src]
fn ge(&self, other: &Signifix) -> bool
[src]
impl StructuralEq for Signifix
[src]
impl StructuralPartialEq for Signifix
[src]
impl TryFrom<f32> for Signifix
[src]
type Error = Error
The type returned in the event of a conversion error.
fn try_from(number: f32) -> Result<Self>
[src]
impl TryFrom<f64> for Signifix
[src]
type Error = Error
The type returned in the event of a conversion error.
fn try_from(number: f64) -> Result<Self>
[src]
impl TryFrom<i128> for Signifix
[src]
type Error = Error
The type returned in the event of a conversion error.
fn try_from(number: i128) -> Result<Self>
[src]
impl TryFrom<i16> for Signifix
[src]
type Error = Error
The type returned in the event of a conversion error.
fn try_from(number: i16) -> Result<Self>
[src]
impl TryFrom<i32> for Signifix
[src]
type Error = Error
The type returned in the event of a conversion error.
fn try_from(number: i32) -> Result<Self>
[src]
impl TryFrom<i64> for Signifix
[src]
type Error = Error
The type returned in the event of a conversion error.
fn try_from(number: i64) -> Result<Self>
[src]
impl TryFrom<i8> for Signifix
[src]
type Error = Error
The type returned in the event of a conversion error.
fn try_from(number: i8) -> Result<Self>
[src]
impl TryFrom<isize> for Signifix
[src]
type Error = Error
The type returned in the event of a conversion error.
fn try_from(number: isize) -> Result<Self>
[src]
impl TryFrom<u128> for Signifix
[src]
type Error = Error
The type returned in the event of a conversion error.
fn try_from(number: u128) -> Result<Self>
[src]
impl TryFrom<u16> for Signifix
[src]
type Error = Error
The type returned in the event of a conversion error.
fn try_from(number: u16) -> Result<Self>
[src]
impl TryFrom<u32> for Signifix
[src]
type Error = Error
The type returned in the event of a conversion error.
fn try_from(number: u32) -> Result<Self>
[src]
impl TryFrom<u64> for Signifix
[src]
type Error = Error
The type returned in the event of a conversion error.
fn try_from(number: u64) -> Result<Self>
[src]
impl TryFrom<u8> for Signifix
[src]
type Error = Error
The type returned in the event of a conversion error.
fn try_from(number: u8) -> Result<Self>
[src]
impl TryFrom<usize> for Signifix
[src]
Auto Trait Implementations
impl RefUnwindSafe for Signifix
impl Send for Signifix
impl Sync for Signifix
impl Unpin for Signifix
impl UnwindSafe for Signifix
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
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> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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>,