pub struct Incomplete { /* private fields */ }
Expand description
Incomplete is used in a #[proc_macro]
to check that all tokens in the Input
have been parsed completely or otherwise provide a printable diagnostic-friendly
representation of remaining tokens.
ⓘ
let (ast, trailing) = match parse() {
Ok(ok) => ok,
Err(err) => panic!("error parsing in `my_example` macro: {:#?}", err),
};
if let Ok(diagnostic) = Incomplete::from_stream(trailing) {
panic!("unexpected tokens at end of input:\n\n{}", diagnostic);
}
Implementations§
Source§impl Incomplete
impl Incomplete
pub fn from_stream<I>(input: I) -> Option<Incomplete>
Trait Implementations§
Source§impl Debug for Incomplete
impl Debug for Incomplete
Auto Trait Implementations§
impl Freeze for Incomplete
impl RefUnwindSafe for Incomplete
impl !Send for Incomplete
impl !Sync for Incomplete
impl Unpin for Incomplete
impl UnwindSafe for Incomplete
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more