pub type Ratio = Ratio<NonNegativeNumber>;
Expand description
A specified
Aliased Type§
struct Ratio(pub NonNegative<Number>, pub NonNegative<Number>);
Fields§
§0: NonNegative<Number>
§1: NonNegative<Number>
Implementations
Source§impl<N> Ratio<N>
impl<N> Ratio<N>
Sourcepub fn is_degenerate(&self) -> bool
pub fn is_degenerate(&self) -> bool
Returns true if this is a degenerate ratio. https://drafts.csswg.org/css-values/#degenerate-ratio
Sourcepub fn used_value(self) -> Self
pub fn used_value(self) -> Self
Returns the used value. A ratio of 0/0 behaves as the ratio 1/0. https://drafts.csswg.org/css-values-4/#ratios
Trait Implementations§
Source§impl Parse for Ratio
impl Parse for Ratio
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>>
Parse a value of this type. Read more
Source§impl<N> MallocSizeOf for Ratio<N>where
N: MallocSizeOf,
impl<N> MallocSizeOf for Ratio<N>where
N: MallocSizeOf,
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<N> SpecifiedValueInfo for Ratio<N>where
N: SpecifiedValueInfo,
impl<N> SpecifiedValueInfo for Ratio<N>where
N: SpecifiedValueInfo,
Source§const SUPPORTED_TYPES: u8
const SUPPORTED_TYPES: u8
Supported CssTypes by the given value type. Read more
Source§impl<N> ToAnimatedValue for Ratio<N>where
N: ToAnimatedValue,
impl<N> ToAnimatedValue for Ratio<N>where
N: ToAnimatedValue,
Source§type AnimatedValue = Ratio<<N as ToAnimatedValue>::AnimatedValue>
type AnimatedValue = Ratio<<N as ToAnimatedValue>::AnimatedValue>
The type of the animated value.
Source§fn from_animated_value(from: Self::AnimatedValue) -> Self
fn from_animated_value(from: Self::AnimatedValue) -> Self
Converts back an animated value into a computed value.
Source§fn to_animated_value(self, context: &Context<'_>) -> Self::AnimatedValue
fn to_animated_value(self, context: &Context<'_>) -> Self::AnimatedValue
Converts this value to an animated value.
Source§impl<N> ToComputedValue for Ratio<N>where
N: ToComputedValue,
impl<N> ToComputedValue for Ratio<N>where
N: ToComputedValue,
Source§type ComputedValue = Ratio<<N as ToComputedValue>::ComputedValue>
type ComputedValue = Ratio<<N as ToComputedValue>::ComputedValue>
The computed value type we’re going to be converted to.
Source§fn from_computed_value(from: &Self::ComputedValue) -> Self
fn from_computed_value(from: &Self::ComputedValue) -> Self
Convert a computed value to specified value form. Read more
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§impl<N> ToResolvedValue for Ratio<N>where
N: ToResolvedValue,
impl<N> ToResolvedValue for Ratio<N>where
N: ToResolvedValue,
Source§type ResolvedValue = Ratio<<N as ToResolvedValue>::ResolvedValue>
type ResolvedValue = Ratio<<N as ToResolvedValue>::ResolvedValue>
The resolved value type we’re going to be converted to.
Source§fn from_resolved_value(from: Self::ResolvedValue) -> Self
fn from_resolved_value(from: Self::ResolvedValue) -> Self
Convert a resolved value to resolved value form.
Source§fn to_resolved_value(self, context: &Context<'_>) -> Self::ResolvedValue
fn to_resolved_value(self, context: &Context<'_>) -> Self::ResolvedValue
Convert a resolved value to a resolved value.