pub trait Parse: Sized {
// Required method
fn parse(input: &mut MacroStream) -> Result<Self, MacrosError>;
}
Expand description
Parse a MacroStream
into a Self
.
§Example
use macros_utils::{Parse, MacroStream};
#[derive(Debug, Clone)]
struct MyStruct {
pub a: Token,
pub b: Token,
}
impl Parse for MyStruct {
fn parse(input: &mut MacroStream) -> Result<Self, MacrosError> {
let a = input.pop_or_err()?;
let b = input.pop_or_err()?;
Ok(Self { a, b })
}
}
Required Methods§
fn parse(input: &mut MacroStream) -> Result<Self, MacrosError>
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.