Struct rsass::value::Number[][src]

pub struct Number { /* fields omitted */ }

The actual number part of a numeric sass or css value.

Only the actual numeric value is included, not any unit. Internally, a number is represented as either a rational or a floating-point value as needed.

Implementations

impl Number[src]

pub fn rational(num: i64, denom: i64) -> Self[src]

Create a rational number.

pub fn as_ratio(&self) -> Result<Rational, Error>[src]

Get this number as a rational number.

If the value is bignum rational or floating point, it is approximated as long as it is withing range, otherwises an error is returned.

pub fn ceil(&self) -> Self[src]

Get a copy of this number, rounded away from zero.

pub fn floor(&self) -> Self[src]

Get a copy of this number, rounded towards zero.

pub fn round(&self) -> Self[src]

Get a copy of this number, rounded to nearest integer.

pub fn abs(self) -> Self[src]

Computes the absolute value of the number, retaining the flags.

pub fn is_integer(&self) -> bool[src]

👎 Deprecated

Returns true if the number is an integer.

pub fn into_integer(self) -> Result<i64, Self>[src]

Returns true if the number is an integer.

pub fn to_integer(&self) -> Option<i64>[src]

Converts to an integer, rounding towards zero.

An integer that is too big to fit in an i64 returns None.

pub fn powi(self, p: i32) -> Self[src]

Computes self^p.

pub fn format(&self, format: Format) -> Formatted<'_, Self>[src]

Get a reference to this Value bound to an output format.

Trait Implementations

impl Add<Number> for Number[src]

type Output = Number

The resulting type after applying the + operator.

impl Clone for Number[src]

impl Debug for Number[src]

impl<'a> Div<&'a Number> for &'a Number[src]

type Output = Number

The resulting type after applying the / operator.

impl Div<Number> for Number[src]

type Output = Self

The resulting type after applying the / operator.

impl Div<i64> for Number[src]

type Output = Self

The resulting type after applying the / operator.

impl Eq for Number[src]

impl From<Ratio<BigInt>> for Number[src]

impl From<Ratio<i64>> for Number[src]

impl From<f64> for Number[src]

impl From<i32> for Number[src]

impl From<i64> for Number[src]

impl From<usize> for Number[src]

impl Mul<&'_ Number> for &Number[src]

type Output = Number

The resulting type after applying the * operator.

impl Mul<&'_ Ratio<i64>> for &Number[src]

type Output = Number

The resulting type after applying the * operator.

impl Mul<Number> for Number[src]

type Output = Number

The resulting type after applying the * operator.

impl Mul<Ratio<i64>> for Number[src]

type Output = Self

The resulting type after applying the * operator.

impl Mul<i64> for Number[src]

type Output = Self

The resulting type after applying the * operator.

impl Neg for Number[src]

type Output = Self

The resulting type after applying the - operator.

impl Neg for &Number[src]

type Output = Number

The resulting type after applying the - operator.

impl One for Number[src]

impl PartialEq<Number> for Number[src]

impl PartialOrd<Number> for Number[src]

impl Rem<&'_ Number> for &Number[src]

type Output = Number

The resulting type after applying the % operator.

impl StructuralEq for Number[src]

impl StructuralPartialEq for Number[src]

impl Sub<&'_ Number> for &Number[src]

type Output = Number

The resulting type after applying the - operator.

impl Zero for Number[src]

Auto Trait Implementations

impl RefUnwindSafe for Number

impl Send for Number

impl Sync for Number

impl Unpin for Number

impl UnwindSafe for Number

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Conv for T

impl<T> Conv for T

impl<T> FmtForward for T

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pipe for T where
    T: ?Sized

impl<T> Pipe for T

impl<T> PipeAsRef for T

impl<T> PipeBorrow for T

impl<T> PipeDeref for T

impl<T> PipeRef for T

impl<T> Tap for T

impl<T> Tap for T

impl<T, U> TapAsRef<U> for T where
    U: ?Sized

impl<T, U> TapBorrow<U> for T where
    U: ?Sized

impl<T> TapDeref for T

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> TryConv for T

impl<T> TryConv for T

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,