Enum style::values::specified::length::Length
[−]
[src]
pub enum Length {
NoCalc(NoCalcLength),
Calc(Box<CalcLengthOrPercentage>),
}An extension to NoCalcLength to parse calc expressions.
This is commonly used for the <length> values.
Variants
NoCalc(NoCalcLength)The internal length type that cannot parse calc
Calc(Box<CalcLengthOrPercentage>)A calc expression.
Methods
impl Length[src]
pub fn zero() -> Length[src]
Returns a zero length.
pub fn parse_dimension(
context: &ParserContext,
value: CSSFloat,
unit: &str
) -> Result<Length, ()>[src]
context: &ParserContext,
value: CSSFloat,
unit: &str
) -> Result<Length, ()>
Parse a given absolute or relative dimension.
pub fn parse_non_negative<'i, 't>(
context: &ParserContext,
input: &mut Parser<'i, 't>
) -> Result<Length, ParseError<'i>>[src]
context: &ParserContext,
input: &mut Parser<'i, 't>
) -> Result<Length, ParseError<'i>>
Parse a non-negative length
pub fn parse_non_negative_quirky<'i, 't>(
context: &ParserContext,
input: &mut Parser<'i, 't>,
allow_quirks: AllowQuirks
) -> Result<Length, ParseError<'i>>[src]
context: &ParserContext,
input: &mut Parser<'i, 't>,
allow_quirks: AllowQuirks
) -> Result<Length, ParseError<'i>>
Parse a non-negative length, allowing quirks.
pub fn from_px(px_value: CSSFloat) -> Length[src]
Get an absolute length from a px value.
pub fn take(&mut self) -> Self[src]
Extract inner length without a clone, replacing it with a 0 Au
Use when you need to move out of a length array without cloning
impl Length[src]
pub fn parse_quirky<'i, 't>(
context: &ParserContext,
input: &mut Parser<'i, 't>,
allow_quirks: AllowQuirks
) -> Result<Self, ParseError<'i>>[src]
context: &ParserContext,
input: &mut Parser<'i, 't>,
allow_quirks: AllowQuirks
) -> Result<Self, ParseError<'i>>
Parses a length, with quirks.
Trait Implementations
impl ToComputedValue for Length[src]
type ComputedValue = CSSPixelLength
The computed value type we're going to be converted to.
fn to_computed_value(&self, context: &Context) -> Self::ComputedValue[src]
Convert a specified value to a computed value, using itself and the data inside the Context. Read more
fn from_computed_value(computed: &Self::ComputedValue) -> Self[src]
Convert a computed value to specified value form. Read more
impl ToAbsoluteLength for SpecifiedLength[src]
fn to_pixel_length(&self, _containing_len: Option<Au>) -> Result<CSSFloat, ()>[src]
Returns the absolute length as pixel value.
impl Clone for Length[src]
fn clone(&self) -> Length[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0[src]
Performs copy-assignment from source. Read more
impl Debug for Length[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result[src]
Formats the value using the given formatter. Read more
impl MallocSizeOf for Length[src]
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize[src]
Measure the heap usage of all descendant heap-allocated structures, but not the space taken up by the value itself. Read more
impl PartialEq for Length[src]
fn eq(&self, __arg_0: &Length) -> bool[src]
This method tests for self and other values to be equal, and is used by ==. Read more
fn ne(&self, __arg_0: &Length) -> bool[src]
This method tests for !=.
impl ToCss for Length[src]
fn to_css<W>(&self, dest: &mut W) -> Result where
W: Write, [src]
W: Write,
Serialize self in CSS syntax, writing to dest.
fn to_css_string(&self) -> String[src]
Serialize self in CSS syntax and return a string. Read more
impl From<NoCalcLength> for Length[src]
fn from(len: NoCalcLength) -> Self[src]
Performs the conversion.
impl Mul<CSSFloat> for Length[src]
type Output = Length
The resulting type after applying the * operator.
fn mul(self, scalar: CSSFloat) -> Length[src]
Performs the * operation.
impl Parse for Length[src]
fn parse<'i, 't>(
context: &ParserContext,
input: &mut Parser<'i, 't>
) -> Result<Self, ParseError<'i>>[src]
context: &ParserContext,
input: &mut Parser<'i, 't>
) -> Result<Self, ParseError<'i>>
Parse a value of this type. Read more
impl From<Length> for NonNegativeLength[src]
impl From<Length> for LengthOrPercentage[src]
fn from(len: Length) -> LengthOrPercentage[src]
Performs the conversion.