```
pub struct Number {
value: CSSFloat,
calc_clamping_mode: Option<AllowedNumericType>,
}
```

## Expand description

A CSS `<number>`

specified value.

https://drafts.csswg.org/css-values-3/#number-value

## Fields§

§`value: CSSFloat`

The numeric value itself.

`calc_clamping_mode: Option<AllowedNumericType>`

If this number came from a calc() expression, this tells how clamping should be done on the value.

## Implementations§

source§### impl Number

### impl Number

source#### fn new_with_clamping_mode(
value: CSSFloat,
calc_clamping_mode: Option<AllowedNumericType>
) -> Self

#### fn new_with_clamping_mode( value: CSSFloat, calc_clamping_mode: Option<AllowedNumericType> ) -> Self

Returns a new number with the value `val`

.

source#### pub fn to_percentage(&self) -> Percentage

#### pub fn to_percentage(&self) -> Percentage

Returns this percentage as a number.

#### pub fn parse_non_negative<'i, 't>( context: &ParserContext<'_>, input: &mut Parser<'i, 't> ) -> Result<Number, ParseError<'i>>

#### pub fn parse_at_least_one<'i, 't>( context: &ParserContext<'_>, input: &mut Parser<'i, 't> ) -> Result<Number, ParseError<'i>>

source#### pub fn clamp_to_one(self) -> Self

#### pub fn clamp_to_one(self) -> Self

Clamp to 1.0 if the value is over 1.0.

## Trait Implementations§

source§### impl MallocSizeOf for Number

### impl MallocSizeOf for Number

source§#### fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize

#### fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize

Measure the heap usage of all descendant heap-allocated structures, but
not the space taken up by the value itself.

source§### impl Parse for Number

### impl Parse for Number

source§#### fn parse<'i, 't>(
context: &ParserContext<'_>,
input: &mut Parser<'i, 't>
) -> Result<Self, ParseError<'i>>

#### fn parse<'i, 't>( context: &ParserContext<'_>, input: &mut Parser<'i, 't> ) -> Result<Self, ParseError<'i>>

Parse a value of this type. Read more

source§### impl PartialEq<Number> for Number

### impl PartialEq<Number> for Number

source§### impl PartialOrd<Number> for Number

### impl PartialOrd<Number> for Number

1.0.0 · source§#### fn le(&self, other: &Rhs) -> bool

#### fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for

`self`

and `other`

) and is used by the `<=`

operator. Read moresource§### impl SpecifiedValueInfo for Number

### impl SpecifiedValueInfo for Number

source§#### const SUPPORTED_TYPES: u8 = 0u8

#### const SUPPORTED_TYPES: u8 = 0u8

Supported CssTypes by the given value type. Read more

source§### impl ToComputedValue for Number

### impl ToComputedValue for Number

§#### type ComputedValue = f32

#### type ComputedValue = f32

The computed value type we’re going to be converted to.

source§#### fn to_computed_value(&self, _: &Context<'_>) -> CSSFloat

#### fn to_computed_value(&self, _: &Context<'_>) -> CSSFloat

Convert a specified value to a computed value, using itself and the data
inside the

`Context`

.source§#### fn from_computed_value(computed: &CSSFloat) -> Self

#### fn from_computed_value(computed: &CSSFloat) -> Self

Convert a computed value to specified value form. Read more

### impl Copy for Number

## 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§

source§### impl<T> BorrowMut<T> for Twhere
T: ?Sized,

### impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§#### fn borrow_mut(&mut self) -> &mut T

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

Mutably borrows from an owned value. Read more

source§### impl<T> MaybeBoxed<Box<T, Global>> for T

### impl<T> MaybeBoxed<Box<T, Global>> for T

source§#### fn maybe_boxed(self) -> Box<T, Global>

#### fn maybe_boxed(self) -> Box<T, Global>

Convert

source§### impl<T> MaybeBoxed<T> for T

### impl<T> MaybeBoxed<T> for T

source§#### fn maybe_boxed(self) -> T

#### fn maybe_boxed(self) -> T

Convert