pub struct Angle {
value: AngleDimension,
was_calc: bool,
}
Expand description
A specified Angle value, which is just the angle dimension, plus whether it
was specified as calc()
or not.
Fields§
§value: AngleDimension
§was_calc: bool
Implementations§
source§impl Angle
impl Angle
sourcepub fn from_degrees(value: CSSFloat, was_calc: bool) -> Self
pub fn from_degrees(value: CSSFloat, was_calc: bool) -> Self
Creates an angle with the given value in degrees.
sourcepub fn from_radians(value: CSSFloat) -> Self
pub fn from_radians(value: CSSFloat) -> Self
Creates an angle with the given value in radians.
source§impl Angle
impl Angle
sourcepub fn parse_dimension(
value: CSSFloat,
unit: &str,
was_calc: bool,
) -> Result<Angle, ()>
pub fn parse_dimension( value: CSSFloat, unit: &str, was_calc: bool, ) -> Result<Angle, ()>
Parse an <angle>
value given a value and an unit.
sourcepub fn parse_with_unitless<'i, 't>(
context: &ParserContext<'_>,
input: &mut Parser<'i, 't>,
) -> Result<Self, ParseError<'i>>
pub fn parse_with_unitless<'i, 't>( 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.
pub(super) fn parse_internal<'i, 't>( context: &ParserContext<'_>, input: &mut Parser<'i, 't>, allow_unitless_zero: AllowUnitlessZeroAngle, ) -> Result<Self, ParseError<'i>>
Trait Implementations§
source§impl<'de> Deserialize<'de> for Angle
impl<'de> Deserialize<'de> for Angle
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl MallocSizeOf for Angle
impl MallocSizeOf for Angle
source§fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
Measure the heap usage of all descendant heap-allocated structures, but
not the space taken up by the value itself.
source§impl Parse for Angle
impl Parse for Angle
source§fn parse<'i, 't>(
context: &ParserContext<'_>,
input: &mut Parser<'i, 't>,
) -> Result<Self, ParseError<'i>>
fn parse<'i, 't>( context: &ParserContext<'_>, input: &mut Parser<'i, 't>, ) -> Result<Self, ParseError<'i>>
Parses an angle according to CSS-VALUES § 6.1.
source§impl SpecifiedValueInfo for Angle
impl SpecifiedValueInfo for Angle
source§const SUPPORTED_TYPES: u8 = 0u8
const SUPPORTED_TYPES: u8 = 0u8
Supported CssTypes by the given value type. Read more
source§impl ToComputedValue for Angle
impl ToComputedValue for Angle
source§type ComputedValue = Angle
type ComputedValue = Angle
The computed value type we’re going to be converted to.
source§fn to_computed_value(&self, _context: &Context<'_>) -> Self::ComputedValue
fn to_computed_value(&self, _context: &Context<'_>) -> Self::ComputedValue
Convert a specified value to a computed value, using itself and the data
inside the
Context
.source§fn from_computed_value(computed: &Self::ComputedValue) -> Self
fn from_computed_value(computed: &Self::ComputedValue) -> Self
Convert a computed value to specified value form. Read more
impl Copy for Angle
impl StructuralPartialEq for Angle
Auto Trait Implementations§
impl Freeze for Angle
impl RefUnwindSafe for Angle
impl Send for Angle
impl Sync for Angle
impl Unpin for Angle
impl UnwindSafe for Angle
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§impl<T> MaybeBoxed<Box<T>> for T
impl<T> MaybeBoxed<Box<T>> for T
source§fn maybe_boxed(self) -> Box<T>
fn maybe_boxed(self) -> Box<T>
Convert
source§impl<T> MaybeBoxed<T> for T
impl<T> MaybeBoxed<T> for T
source§fn maybe_boxed(self) -> T
fn maybe_boxed(self) -> T
Convert