Type Alias CSSNumber

Source
pub type CSSNumber = f32;
Expand description

A CSS <number> value.

Numbers may be explicit or computed by calc(), but are always stored and serialized as their computed value.

Trait Implementations§

Source§

impl From<Calc<f32>> for CSSNumber

Source§

fn from(calc: Calc<CSSNumber>) -> CSSNumber

Converts to this type from the input type.
Source§

impl Into<Calc<f32>> for CSSNumber

Source§

fn into(self) -> Calc<CSSNumber>

Converts this type into the (usually inferred) input type.
Source§

impl Map for CSSNumber

Source§

fn map<F: FnOnce(f32) -> f32>(&self, op: F) -> Self

Returns the result of the operation.
Source§

impl Op for CSSNumber

Source§

fn op<F: FnOnce(f32, f32) -> f32>(&self, to: &Self, op: F) -> Self

Returns the result of the operation in the same type.
Source§

fn op_to<T, F: FnOnce(f32, f32) -> T>(&self, rhs: &Self, op: F) -> T

Returns the result of the operation in a different type.
Source§

impl<'i> Parse<'i> for CSSNumber

Source§

fn parse<'t>( input: &mut Parser<'i, 't>, ) -> Result<Self, ParseError<'i, ParserError<'i>>>

Parse a value of this type using an existing parser.
Source§

fn parse_string(input: &'i str) -> Result<Self, ParseError<'i, ParserError<'i>>>

Parse a value from a string. Read more
Source§

impl Sign for CSSNumber

Source§

fn sign(&self) -> f32

Returns the sign of the value.
Source§

fn is_sign_positive(&self) -> bool

Returns whether the value is positive.
Source§

fn is_sign_negative(&self) -> bool

Returns whether the value is negative.
Source§

impl ToCss for CSSNumber

Source§

fn to_css<W>( &self, dest: &mut Printer<'_, '_, '_, W>, ) -> Result<(), PrinterError>
where W: Write,

Serialize self in CSS syntax, writing to dest.
Source§

fn to_css_string( &self, options: PrinterOptions<'_>, ) -> Result<String, PrinterError>

Serialize self in CSS syntax and return a string. Read more
Source§

impl TryFrom<Angle> for CSSNumber

Source§

type Error = ()

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

fn try_from(_: Angle) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl Zero for CSSNumber

Source§

fn zero() -> Self

Returns the zero value.
Source§

fn is_zero(&self) -> bool

Returns whether the value is zero.