pub trait Parse<'i>: Sized {
// Required method
fn parse<'t>(
input: &mut Parser<'i, 't>,
) -> Result<Self, ParseError<'i, ParserError<'i>>>;
// Provided method
fn parse_string(
input: &'i str,
) -> Result<Self, ParseError<'i, ParserError<'i>>> { ... }
}
Expand description
Trait for things that can be parsed from CSS syntax.
Required Methods§
Sourcefn parse<'t>(
input: &mut Parser<'i, 't>,
) -> Result<Self, ParseError<'i, ParserError<'i>>>
fn parse<'t>( input: &mut Parser<'i, 't>, ) -> Result<Self, ParseError<'i, ParserError<'i>>>
Parse a value of this type using an existing parser.
Provided Methods§
Sourcefn parse_string(input: &'i str) -> Result<Self, ParseError<'i, ParserError<'i>>>
fn parse_string(input: &'i str) -> Result<Self, ParseError<'i, ParserError<'i>>>
Parse a value from a string.
(This is a convenience wrapper for parse
and probably should not be overridden.)
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.