pub trait Parse: Sized {
fn parse<B>(source: B) -> ParseResult<Self>
where
B: AsRef<[u8]>;
fn parse_str<S>(source: S) -> ParseResult<Self>
where
S: AsRef<str>,
{ ... }
}
Expand description
Class of types that can be parsed.
This trait exposes two methods:
Parse::parse
, that runs on bytes.Parse::parse_str
, a convenient function that runs on strings.
If you want to implement Parse
, only Parse::parse
is mandatory – Parse::parse_str
has a default implementation using Parse::parse
.
The methods from this trait are the standard way to parse data into GLSL ASTs.
Required Methods§
sourcefn parse<B>(source: B) -> ParseResult<Self>where
B: AsRef<[u8]>,
fn parse<B>(source: B) -> ParseResult<Self>where
B: AsRef<[u8]>,
Parse from a byte slice.
Provided Methods§
sourcefn parse_str<S>(source: S) -> ParseResult<Self>where
S: AsRef<str>,
fn parse_str<S>(source: S) -> ParseResult<Self>where
S: AsRef<str>,
Parse from a string.