NonNegativeLength

Type Alias NonNegativeLength 

Source
pub type NonNegativeLength = NonNegative<Length>;
Expand description

A wrapper of Length, whose value must be >= 0.

Aliased Type§

#[repr(transparent)]
pub struct NonNegativeLength(pub CSSPixelLength);

Tuple Fields§

§0: CSSPixelLength

Implementations§

Source§

impl NonNegativeLength

Source

pub fn new(px: CSSFloat) -> Self

Create a NonNegativeLength.

Source

pub fn px(&self) -> CSSFloat

Return the pixel value of |NonNegativeLength|.

Source

pub fn clamp(self) -> Self

Ensures it is non negative

Trait Implementations§

Source§

impl From<Au> for NonNegativeLength

Source§

fn from(au: Au) -> Self

Converts to this type from the input type.
Source§

impl From<CSSPixelLength> for NonNegativeLength

Source§

fn from(len: Length) -> Self

Converts to this type from the input type.