#[repr(C, u8)]pub enum GenericLengthPercentageOrAuto<LengthPercent> {
LengthPercentage(LengthPercent),
Auto,
}
Expand description
A <length-percentage> | auto
value.
Variants§
Implementations§
source§impl GenericLengthPercentageOrAuto<LengthPercentage>
impl GenericLengthPercentageOrAuto<LengthPercentage>
sourcepub fn clamp_to_non_negative(self) -> Self
pub fn clamp_to_non_negative(self) -> Self
Clamps the value to a non-negative value.
sourcepub fn as_ref(&self) -> GenericLengthPercentageOrAuto<&LengthPercentage>
pub fn as_ref(&self) -> GenericLengthPercentageOrAuto<&LengthPercentage>
Convert to have a borrow inside the enum
sourcepub fn to_used_value(&self, percentage_basis: Au) -> Option<Au>
pub fn to_used_value(&self, percentage_basis: Au) -> Option<Au>
Returns the used value.
sourcepub fn is_definitely_zero(&self) -> bool
pub fn is_definitely_zero(&self) -> bool
Returns true if the computed value is absolute 0 or 0%.
source§impl GenericLengthPercentageOrAuto<&LengthPercentage>
impl GenericLengthPercentageOrAuto<&LengthPercentage>
sourcepub fn percentage_relative_to(&self, basis: Length) -> LengthOrAuto
pub fn percentage_relative_to(&self, basis: Length) -> LengthOrAuto
Resolves the percentage.
sourcepub fn maybe_percentage_relative_to(
&self,
basis: Option<Length>,
) -> LengthOrAuto
pub fn maybe_percentage_relative_to( &self, basis: Option<Length>, ) -> LengthOrAuto
Maybe resolves the percentage.
source§impl GenericLengthPercentageOrAuto<NonNegative<LengthPercentage>>
impl GenericLengthPercentageOrAuto<NonNegative<LengthPercentage>>
sourcepub fn to_used_value(&self, percentage_basis: Au) -> Option<Au>
pub fn to_used_value(&self, percentage_basis: Au) -> Option<Au>
Returns the used value.
sourcepub fn is_definitely_zero(&self) -> bool
pub fn is_definitely_zero(&self) -> bool
Returns true if the computed value is absolute 0 or 0%.
source§impl<LengthPercentage> LengthPercentageOrAuto<LengthPercentage>
impl<LengthPercentage> LengthPercentageOrAuto<LengthPercentage>
sourcepub fn parse_with<'i, 't>(
context: &ParserContext<'_>,
input: &mut Parser<'i, 't>,
parser: impl FnOnce(&ParserContext<'_>, &mut Parser<'i, 't>) -> Result<LengthPercentage, ParseError<'i>>,
) -> Result<Self, ParseError<'i>>
pub fn parse_with<'i, 't>( context: &ParserContext<'_>, input: &mut Parser<'i, 't>, parser: impl FnOnce(&ParserContext<'_>, &mut Parser<'i, 't>) -> Result<LengthPercentage, ParseError<'i>>, ) -> Result<Self, ParseError<'i>>
A helper function to parse this with quirks or not and so forth.
source§impl<T> LengthPercentageOrAuto<T>where
T: Clone,
impl<T> LengthPercentageOrAuto<T>where
T: Clone,
source§impl GenericLengthPercentageOrAuto<LengthPercentage>
impl GenericLengthPercentageOrAuto<LengthPercentage>
sourcepub fn zero_percent() -> Self
pub fn zero_percent() -> Self
Returns a value representing 0%
.
sourcepub fn parse_quirky<'i, 't>(
context: &ParserContext<'_>,
input: &mut Parser<'i, 't>,
allow_quirks: AllowQuirks,
) -> Result<Self, ParseError<'i>>
pub fn parse_quirky<'i, 't>( context: &ParserContext<'_>, input: &mut Parser<'i, 't>, allow_quirks: AllowQuirks, ) -> Result<Self, ParseError<'i>>
Parses a length or a percentage, allowing the unitless length quirk. https://quirks.spec.whatwg.org/#the-unitless-length-quirk
source§impl GenericLengthPercentageOrAuto<NonNegative<LengthPercentage>>
impl GenericLengthPercentageOrAuto<NonNegative<LengthPercentage>>
sourcepub fn zero_percent() -> Self
pub fn zero_percent() -> Self
Returns a value representing 0%
.
sourcepub fn parse_quirky<'i, 't>(
context: &ParserContext<'_>,
input: &mut Parser<'i, 't>,
allow_quirks: AllowQuirks,
) -> Result<Self, ParseError<'i>>
pub fn parse_quirky<'i, 't>( context: &ParserContext<'_>, input: &mut Parser<'i, 't>, allow_quirks: AllowQuirks, ) -> Result<Self, ParseError<'i>>
Parses a non-negative length-percentage, allowing the unitless length quirk.
source§impl GenericLengthPercentageOrAuto<Length>
impl GenericLengthPercentageOrAuto<Length>
sourcepub fn parse_quirky<'i, 't>(
context: &ParserContext<'_>,
input: &mut Parser<'i, 't>,
allow_quirks: AllowQuirks,
) -> Result<Self, ParseError<'i>>
pub fn parse_quirky<'i, 't>( context: &ParserContext<'_>, input: &mut Parser<'i, 't>, allow_quirks: AllowQuirks, ) -> Result<Self, ParseError<'i>>
Parses a length, allowing the unitless length quirk. https://quirks.spec.whatwg.org/#the-unitless-length-quirk
Trait Implementations§
source§impl<LengthPercent> Animate for GenericLengthPercentageOrAuto<LengthPercent>where
LengthPercent: Animate,
impl<LengthPercent> Animate for GenericLengthPercentageOrAuto<LengthPercent>where
LengthPercent: Animate,
source§impl<LengthPercent: Clone> Clone for GenericLengthPercentageOrAuto<LengthPercent>
impl<LengthPercent: Clone> Clone for GenericLengthPercentageOrAuto<LengthPercent>
source§fn clone(&self) -> GenericLengthPercentageOrAuto<LengthPercent>
fn clone(&self) -> GenericLengthPercentageOrAuto<LengthPercent>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl<LengthPercent> ComputeSquaredDistance for GenericLengthPercentageOrAuto<LengthPercent>where
LengthPercent: ComputeSquaredDistance,
impl<LengthPercent> ComputeSquaredDistance for GenericLengthPercentageOrAuto<LengthPercent>where
LengthPercent: ComputeSquaredDistance,
source§fn compute_squared_distance(&self, other: &Self) -> Result<SquaredDistance, ()>
fn compute_squared_distance(&self, other: &Self) -> Result<SquaredDistance, ()>
source§impl<LengthPercent: Debug> Debug for GenericLengthPercentageOrAuto<LengthPercent>
impl<LengthPercent: Debug> Debug for GenericLengthPercentageOrAuto<LengthPercent>
source§impl<'de, LengthPercent> Deserialize<'de> for GenericLengthPercentageOrAuto<LengthPercent>where
LengthPercent: Deserialize<'de>,
impl<'de, LengthPercent> Deserialize<'de> for GenericLengthPercentageOrAuto<LengthPercent>where
LengthPercent: Deserialize<'de>,
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>,
source§impl<LengthPercent> MallocSizeOf for GenericLengthPercentageOrAuto<LengthPercent>where
LengthPercent: MallocSizeOf,
impl<LengthPercent> MallocSizeOf for GenericLengthPercentageOrAuto<LengthPercent>where
LengthPercent: MallocSizeOf,
source§fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
source§impl<LengthPercentage: Parse> Parse for LengthPercentageOrAuto<LengthPercentage>
impl<LengthPercentage: Parse> Parse for LengthPercentageOrAuto<LengthPercentage>
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>>
source§impl<LengthPercent: PartialEq> PartialEq for GenericLengthPercentageOrAuto<LengthPercent>
impl<LengthPercent: PartialEq> PartialEq for GenericLengthPercentageOrAuto<LengthPercent>
source§fn eq(&self, other: &GenericLengthPercentageOrAuto<LengthPercent>) -> bool
fn eq(&self, other: &GenericLengthPercentageOrAuto<LengthPercent>) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl<LengthPercent> Serialize for GenericLengthPercentageOrAuto<LengthPercent>where
LengthPercent: Serialize,
impl<LengthPercent> Serialize for GenericLengthPercentageOrAuto<LengthPercent>where
LengthPercent: Serialize,
source§impl<LengthPercent> SpecifiedValueInfo for GenericLengthPercentageOrAuto<LengthPercent>where
LengthPercent: SpecifiedValueInfo,
impl<LengthPercent> SpecifiedValueInfo for GenericLengthPercentageOrAuto<LengthPercent>where
LengthPercent: SpecifiedValueInfo,
source§const SUPPORTED_TYPES: u8 = _
const SUPPORTED_TYPES: u8 = _
source§impl<LengthPercent> ToAnimatedValue for GenericLengthPercentageOrAuto<LengthPercent>where
LengthPercent: ToAnimatedValue,
impl<LengthPercent> ToAnimatedValue for GenericLengthPercentageOrAuto<LengthPercent>where
LengthPercent: ToAnimatedValue,
§type AnimatedValue = GenericLengthPercentageOrAuto<<LengthPercent as ToAnimatedValue>::AnimatedValue>
type AnimatedValue = GenericLengthPercentageOrAuto<<LengthPercent as ToAnimatedValue>::AnimatedValue>
source§fn from_animated_value(from: Self::AnimatedValue) -> Self
fn from_animated_value(from: Self::AnimatedValue) -> Self
source§fn to_animated_value(self, context: &Context<'_>) -> Self::AnimatedValue
fn to_animated_value(self, context: &Context<'_>) -> Self::AnimatedValue
source§impl<LengthPercent> ToAnimatedZero for GenericLengthPercentageOrAuto<LengthPercent>where
LengthPercent: ToAnimatedZero,
impl<LengthPercent> ToAnimatedZero for GenericLengthPercentageOrAuto<LengthPercent>where
LengthPercent: ToAnimatedZero,
source§fn to_animated_zero(&self) -> Result<Self, ()>
fn to_animated_zero(&self) -> Result<Self, ()>
source§impl<LengthPercent> ToComputedValue for GenericLengthPercentageOrAuto<LengthPercent>where
LengthPercent: ToComputedValue,
impl<LengthPercent> ToComputedValue for GenericLengthPercentageOrAuto<LengthPercent>where
LengthPercent: ToComputedValue,
§type ComputedValue = GenericLengthPercentageOrAuto<<LengthPercent as ToComputedValue>::ComputedValue>
type ComputedValue = GenericLengthPercentageOrAuto<<LengthPercent as ToComputedValue>::ComputedValue>
source§fn from_computed_value(from: &Self::ComputedValue) -> Self
fn from_computed_value(from: &Self::ComputedValue) -> Self
source§fn to_computed_value(&self, context: &Context<'_>) -> Self::ComputedValue
fn to_computed_value(&self, context: &Context<'_>) -> Self::ComputedValue
Context
.source§impl<LengthPercent> ToCss for GenericLengthPercentageOrAuto<LengthPercent>where
LengthPercent: ToCss,
impl<LengthPercent> ToCss for GenericLengthPercentageOrAuto<LengthPercent>where
LengthPercent: ToCss,
source§impl<LengthPercent> ToResolvedValue for GenericLengthPercentageOrAuto<LengthPercent>where
LengthPercent: ToResolvedValue,
impl<LengthPercent> ToResolvedValue for GenericLengthPercentageOrAuto<LengthPercent>where
LengthPercent: ToResolvedValue,
§type ResolvedValue = GenericLengthPercentageOrAuto<<LengthPercent as ToResolvedValue>::ResolvedValue>
type ResolvedValue = GenericLengthPercentageOrAuto<<LengthPercent as ToResolvedValue>::ResolvedValue>
source§fn from_resolved_value(from: Self::ResolvedValue) -> Self
fn from_resolved_value(from: Self::ResolvedValue) -> Self
source§fn to_resolved_value(self, context: &Context<'_>) -> Self::ResolvedValue
fn to_resolved_value(self, context: &Context<'_>) -> Self::ResolvedValue
source§impl<LengthPercent> ToShmem for GenericLengthPercentageOrAuto<LengthPercent>where
LengthPercent: ToShmem,
impl<LengthPercent> ToShmem for GenericLengthPercentageOrAuto<LengthPercent>where
LengthPercent: ToShmem,
source§impl<LengthPercentage: Zero> Zero for LengthPercentageOrAuto<LengthPercentage>
impl<LengthPercentage: Zero> Zero for LengthPercentageOrAuto<LengthPercentage>
impl<LengthPercent: Copy> Copy for GenericLengthPercentageOrAuto<LengthPercent>
impl<LengthPercent> StructuralPartialEq for GenericLengthPercentageOrAuto<LengthPercent>
Auto Trait Implementations§
impl<LengthPercent> Freeze for GenericLengthPercentageOrAuto<LengthPercent>where
LengthPercent: Freeze,
impl<LengthPercent> RefUnwindSafe for GenericLengthPercentageOrAuto<LengthPercent>where
LengthPercent: RefUnwindSafe,
impl<LengthPercent> Send for GenericLengthPercentageOrAuto<LengthPercent>where
LengthPercent: Send,
impl<LengthPercent> Sync for GenericLengthPercentageOrAuto<LengthPercent>where
LengthPercent: Sync,
impl<LengthPercent> Unpin for GenericLengthPercentageOrAuto<LengthPercent>where
LengthPercent: Unpin,
impl<LengthPercent> UnwindSafe for GenericLengthPercentageOrAuto<LengthPercent>where
LengthPercent: UnwindSafe,
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
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>
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>
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 more