Struct style::color::parsing::ColorParser
source · pub struct ColorParser<'a, 'b: 'a> {
pub context: &'a ParserContext<'b>,
pub origin_color: Option<&'a 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<&'a AbsoluteColor>
A parsed origin color if one is available.
Implementations§
source§impl<'a, 'b: 'a> ColorParser<'a, 'b>
impl<'a, 'b: 'a> ColorParser<'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.
Trait Implementations§
source§impl<'a, 'b: 'a> Clone for ColorParser<'a, 'b>
impl<'a, 'b: 'a> Clone for ColorParser<'a, 'b>
source§fn clone(&self) -> ColorParser<'a, 'b>
fn clone(&self) -> ColorParser<'a, 'b>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl<'a, 'b> !RefUnwindSafe for ColorParser<'a, 'b>
impl<'a, 'b> !Send for ColorParser<'a, 'b>
impl<'a, 'b> !Sync for ColorParser<'a, 'b>
impl<'a, 'b> Unpin for ColorParser<'a, 'b>
impl<'a, 'b> !UnwindSafe for ColorParser<'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>where
F: FnOnce(&Self) -> bool,
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>where F: FnOnce(&Self) -> bool,
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, Global>> for T
impl<T> MaybeBoxed<Box<T, Global>> for T
source§fn maybe_boxed(self) -> Box<T, Global>
fn maybe_boxed(self) -> Box<T, Global>
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