Struct style::values::specified::angle::Angle
[−]
[src]
pub struct Angle { /* fields omitted */ }
A specified angle.
Computed angles are essentially same as specified ones except for calc()
value serialization. Therefore we are storing a computed angle inside
to hold the actual value and its unit.
Methods
impl Angle
[src]
pub fn from_degrees(value: CSSFloat, was_calc: bool) -> Self
[src]
Creates an angle with the given value in degrees.
pub fn from_gradians(value: CSSFloat, was_calc: bool) -> Self
[src]
Creates an angle with the given value in gradians.
pub fn from_turns(value: CSSFloat, was_calc: bool) -> Self
[src]
Creates an angle with the given value in turns.
pub fn from_radians(value: CSSFloat, was_calc: bool) -> Self
[src]
Creates an angle with the given value in radians.
pub fn radians(self) -> f32
[src]
Returns the amount of radians this angle represents.
pub fn degrees(self) -> f32
[src]
Returns the amount of degrees this angle represents.
pub fn zero() -> Self
[src]
Returns 0deg
.
pub fn from_calc(radians: CSSFloat) -> Self
[src]
Returns an Angle
parsed from a calc()
expression.
impl Angle
[src]
pub fn parse_dimension(
value: CSSFloat,
unit: &str,
from_calc: bool
) -> Result<Angle, ()>
[src]
value: CSSFloat,
unit: &str,
from_calc: bool
) -> Result<Angle, ()>
Parse an <angle>
value given a value and an unit.
pub fn parse_with_unitless<'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 an <angle>
allowing unitless zero to represent a zero angle.
See the comment in AllowUnitlessZeroAngle
for why.
Trait Implementations
impl Clone for Angle
[src]
fn clone(&self) -> Angle
[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 Copy for Angle
[src]
impl Debug for Angle
[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl MallocSizeOf for Angle
[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 Angle
[src]
fn eq(&self, __arg_0: &Angle) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Angle) -> bool
[src]
This method tests for !=
.
impl ToCss for Angle
[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 ToComputedValue for Angle
[src]
type ComputedValue = ComputedAngle
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 AsRef<ComputedAngle> for Angle
[src]
fn as_ref(&self) -> &ComputedAngle
[src]
Performs the conversion.
impl Parse for Angle
[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>>
Parses an angle according to CSS-VALUES § 6.1.