pub struct RustExpr<T: FromMacro>(pub T, pub ExprSep);
Expand description
Extracts an expression according to Rust’s rule.
Ends when encountering ,
, ;
, =>
or end of stream.
§Example:
let mut iter = quote!(Red=Green.Blue,Yellow=>brown==orange;purple).into_iter();
let RustExpr(Stringify(next), _) = iter.extract()?;
assert_eq!(next, "Red = Green . Blue");
let RustExpr(Stringify(next), _) = iter.extract()?;
assert_eq!(next, "Yellow");
let RustExpr(Stringify(next), _) = iter.extract()?;
assert_eq!(next, "brown = =orange");
let RustExpr(Stringify(next), _) = iter.extract()?;
assert_eq!(next, "purple");
let EndOfStream = iter.extract()?;
Tuple Fields§
§0: T
§1: ExprSep
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for RustExpr<T>where
T: Freeze,
impl<T> RefUnwindSafe for RustExpr<T>where
T: RefUnwindSafe,
impl<T> Send for RustExpr<T>where
T: Send,
impl<T> Sync for RustExpr<T>where
T: Sync,
impl<T> Unpin for RustExpr<T>where
T: Unpin,
impl<T> UnwindSafe for RustExpr<T>where
T: UnwindSafe,
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