Struct style::color::parsing::ComponentParser
source · pub struct ComponentParser<'a, 'b: 'a> {
pub context: &'a ParserContext<'b>,
pub origin_color: Option<AbsoluteColor>,
}
Expand description
Used to parse the components of a color.
Fields§
§context: &'a ParserContext<'b>
Parser context used for parsing the colors.
origin_color: Option<AbsoluteColor>
The origin color that will be used to resolve relative components.
Implementations§
source§impl<'a, 'b: 'a> ComponentParser<'a, 'b>
impl<'a, 'b: 'a> ComponentParser<'a, 'b>
sourcepub fn new(context: &'a ParserContext<'b>) -> Self
pub fn new(context: &'a ParserContext<'b>) -> Self
Create a new [ColorParser] with the given context.
sourcefn parse_number_or_angle<'i, 't>(
&self,
input: &mut Parser<'i, 't>,
allow_none: bool,
) -> Result<ColorComponent<NumberOrAngle>, ParseError<'i>>
fn parse_number_or_angle<'i, 't>( &self, input: &mut Parser<'i, 't>, allow_none: bool, ) -> Result<ColorComponent<NumberOrAngle>, ParseError<'i>>
Parse an <number>
or <angle>
value.
sourcefn parse_percentage<'i, 't>(
&self,
input: &mut Parser<'i, 't>,
allow_none: bool,
) -> Result<ColorComponent<f32>, ParseError<'i>>
fn parse_percentage<'i, 't>( &self, input: &mut Parser<'i, 't>, allow_none: bool, ) -> Result<ColorComponent<f32>, ParseError<'i>>
Parse a <percentage>
value.
sourcefn parse_number<'i, 't>(
&self,
input: &mut Parser<'i, 't>,
allow_none: bool,
) -> Result<ColorComponent<f32>, ParseError<'i>>
fn parse_number<'i, 't>( &self, input: &mut Parser<'i, 't>, allow_none: bool, ) -> Result<ColorComponent<f32>, ParseError<'i>>
Parse a <number>
value.
sourcefn parse_number_or_percentage<'i, 't>(
&self,
input: &mut Parser<'i, 't>,
allow_none: bool,
) -> Result<ColorComponent<NumberOrPercentage>, ParseError<'i>>
fn parse_number_or_percentage<'i, 't>( &self, input: &mut Parser<'i, 't>, allow_none: bool, ) -> Result<ColorComponent<NumberOrPercentage>, ParseError<'i>>
Parse a <number>
or <percentage>
value.
fn parse_legacy_alpha<'i, 't>( &self, arguments: &mut Parser<'i, 't>, ) -> Result<ColorComponent<NumberOrPercentage>, ParseError<'i>>
fn parse_modern_alpha<'i, 't>( &self, arguments: &mut Parser<'i, 't>, ) -> Result<ColorComponent<NumberOrPercentage>, ParseError<'i>>
Auto Trait Implementations§
impl<'a, 'b> Freeze for ComponentParser<'a, 'b>
impl<'a, 'b> !RefUnwindSafe for ComponentParser<'a, 'b>
impl<'a, 'b> !Send for ComponentParser<'a, 'b>
impl<'a, 'b> !Sync for ComponentParser<'a, 'b>
impl<'a, 'b> Unpin for ComponentParser<'a, 'b>
impl<'a, 'b> !UnwindSafe for ComponentParser<'a, 'b>
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> 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