pub trait IParse: Sealed {
// Required methods
fn parse<T: Parse>(self) -> Result<T>;
fn parse_all<T: Parse>(self) -> Result<T>;
}Expand description
Extension trait for TokenIter that calls Parse::parse().
Required Methods§
Sourcefn parse<T: Parse>(self) -> Result<T>
fn parse<T: Parse>(self) -> Result<T>
Parse a value from the iterator. This is a convenience method that calls
Parse::parse().
Sourcefn parse_all<T: Parse>(self) -> Result<T>
fn parse_all<T: Parse>(self) -> Result<T>
Parse a value from the iterator. This is a convenience method that calls
Parse::parse_all().
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementors§
impl IParse for &mut TokenIter
Implements IParse for [&mut TokenIter]. This API is more convenient in cases where the
compiler can infer types because no turbofish notations are required.
§Example
struct MyStruct {
number: LiteralInteger,
name: Ident,
}
fn example() -> Result<MyStruct> {
let mut input = " 1234 name ".to_token_iter();
Ok(
MyStruct {
// types are inferred here
number: input.parse()?,
name: input.parse()?
}
)
}