struct Parser<'a> {
s: &'a str,
ix: usize,
}
Fields§
§s: &'a str
§ix: usize
Implementations§
Source§impl<'a> Parser<'a>
impl<'a> Parser<'a>
fn new(s: &'a str) -> Self
fn consume_comments(&mut self) -> Result<(), ParseError>
fn number(&mut self) -> Option<f64>
fn ident(&mut self) -> Option<&'a str>
fn ch(&mut self, ch: u8) -> bool
Sourcefn raw_ch(&mut self, ch: u8) -> bool
fn raw_ch(&mut self, ch: u8) -> bool
Attempt to read the exact ASCII character given, returning whether that character was read.
The parser proceeds to the next character if the character was successfully read.
fn ws_one(&mut self) -> bool
fn ws(&mut self) -> bool
fn value(&mut self) -> Option<Value<'a>>
Sourcefn scaled_component(
&mut self,
scale: f64,
pct_scale: f64,
) -> Result<Option<f64>, ParseError>
fn scaled_component( &mut self, scale: f64, pct_scale: f64, ) -> Result<Option<f64>, ParseError>
Parse a color component.
fn angle(&mut self) -> Result<Option<f64>, ParseError>
fn optional_comma(&mut self, comma: bool) -> Result<(), ParseError>
fn rgb(&mut self) -> Result<DynamicColor, ParseError>
Sourcefn alpha(&mut self, mode: Mode) -> Result<Option<f64>, ParseError>
fn alpha(&mut self, mode: Mode) -> Result<Option<f64>, ParseError>
Read a slash separator and an alpha value.
The value may be either number or a percentage.
The alpha value defaults to 1.0
if not present. The value will be clamped
to the range [0, 1].
If the value is "none"
, then Ok(None)
will be returned.
The separator will be a '/'
in modern mode and a ','
in legacy mode.
If no separator is present, then the default value will be returned.
Reference: § 4.2 of CSS Color 4 spec.
fn lab( &mut self, lmax: f64, c: f64, tag: ColorSpaceTag, ) -> Result<DynamicColor, ParseError>
fn lch( &mut self, lmax: f64, c: f64, tag: ColorSpaceTag, ) -> Result<DynamicColor, ParseError>
fn hsl(&mut self) -> Result<DynamicColor, ParseError>
fn hwb(&mut self) -> Result<DynamicColor, ParseError>
fn color(&mut self) -> Result<DynamicColor, ParseError>
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for Parser<'a>
impl<'a> RefUnwindSafe for Parser<'a>
impl<'a> Send for Parser<'a>
impl<'a> Sync for Parser<'a>
impl<'a> Unpin for Parser<'a>
impl<'a> UnwindSafe for Parser<'a>
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