pub type NonNegativeLength = NonNegative<Length>;
Expand description

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

Aliased Type§

struct NonNegativeLength(pub CSSPixelLength);

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.
source§

impl ToAnimatedValue for NonNegativeLength

§

type AnimatedValue = CSSPixelLength

The type of the animated value.
source§

fn to_animated_value(self) -> Self::AnimatedValue

Converts this value to an animated value.
source§

fn from_animated_value(animated: Self::AnimatedValue) -> Self

Converts back an animated value into a computed value.