Skip to main content

NumValue

Enum NumValue 

Source
pub enum NumValue {
    NaN,
    Infinity(bool),
    Finite {
        neg: bool,
        digits: Vec<u8>,
        pt: i32,
    },
}
Expand description

書式にする値(数・10 進の文字列・BigInt を正確に持つ。仕様の「数学的な値」)。

Variants§

§

NaN

§

Infinity(bool)

符号(負なら true)。

§

Finite

絶対値 0.d1d2… × 10^pt(digits の先頭と末尾に 0 は無い。空なら 0)と符号。

Fields

§neg: bool
§digits: Vec<u8>
§pt: i32

Implementations§

Source§

impl NumValue

Source

pub fn from_f64(x: f64) -> Self

Source

fn finite(neg: bool, digits: Vec<u8>, pt: i32) -> Self

Source

pub fn from_int_str(s: &str) -> Self

整数の 10 進表記(BigInt の文字列。先頭に - があってよい)。

Source

pub fn parse_str(s: &str) -> Self

文字列の数(StringNumericLiteral)を正確に読む。読めなければ NaN。

Source

pub fn is_nan(&self) -> bool

Source

pub fn is_neg(&self) -> bool

負の値か(-0 を含む)。

Source

pub fn is_zero(&self) -> bool

Source

pub fn cmp_value(&self, other: &NumValue) -> Ordering

大小の比較(NaN を含まない前提)。

Source

pub fn to_f64(&self) -> f64

f64 にする(近似)。

Trait Implementations§

Source§

impl Clone for NumValue

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for NumValue

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.