Type Definition style::values::computed::length::NonNegativeLength
[−]
[src]
type NonNegativeLength = NonNegative<Length>;
A wrapper of Length, whose value must be >= 0.
Methods
impl NonNegativeLength[src]
pub fn new(px: CSSFloat) -> Self[src]
Create a NonNegativeLength.
pub fn zero() -> Self[src]
Return a zero value.
pub fn px(&self) -> CSSFloat[src]
Return the pixel value of |NonNegativeLength|.
pub fn clamp(self) -> Self[src]
Ensures it is non negative
pub fn scale_by(&self, factor: f32) -> Self[src]
Scale this NonNegativeLength. We scale NonNegativeLength by zero if the factor is negative because it doesn't make sense to scale a negative factor on a non-negative length.
Trait Implementations
impl ToAnimatedValue for ComputedNonNegativeLength[src]
type AnimatedValue = Self
The type of the animated value.
fn to_animated_value(self) -> Self[src]
Converts this value to an animated value.
fn from_animated_value(animated: Self::AnimatedValue) -> Self[src]
Converts back an animated value into a computed value.
impl From<NonNegativeLength> for NonNegativeLengthOrPercentage[src]
fn from(length: NonNegativeLength) -> Self[src]
Performs the conversion.
impl Add<NonNegativeLength> for NonNegativeLength[src]
type Output = Self
The resulting type after applying the + operator.
fn add(self, other: Self) -> Self[src]
Performs the + operation.
impl From<Length> for NonNegativeLength[src]
impl From<Au> for NonNegativeLength[src]
impl From<NonNegativeLength> for Au[src]
fn from(non_negative_len: NonNegativeLength) -> Self[src]
Performs the conversion.
impl From<NonNegativeLength> for SVGWidth[src]
fn from(length: NonNegativeLength) -> Self[src]
Performs the conversion.