2021-01-15 22:57:26 +01:00
|
|
|
use proc_macro::{token_stream::IntoIter, TokenTree};
|
|
|
|
use std::iter::Peekable;
|
2020-12-24 16:24:04 +01:00
|
|
|
|
2021-01-15 22:57:26 +01:00
|
|
|
pub fn skip_pub(mut it: Peekable<IntoIter>) -> Peekable<IntoIter> {
|
2020-12-24 16:24:04 +01:00
|
|
|
if let Some(TokenTree::Ident(ident)) = it.next() {
|
|
|
|
if ident.to_string().as_str() != "pub" {
|
|
|
|
panic!("Expect to find keyword pub but was found {:?}", ident)
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
panic!("Expect to find keyword pub but nothing was found")
|
|
|
|
}
|
2021-01-15 22:57:26 +01:00
|
|
|
it
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn skip_struct(mut it: Peekable<IntoIter>) -> Peekable<IntoIter> {
|
2020-12-24 16:24:04 +01:00
|
|
|
if let Some(TokenTree::Ident(ident)) = it.next() {
|
|
|
|
if ident.to_string().as_str() != "struct" {
|
|
|
|
panic!("Expect to find keyword struct but was found {:?}", ident)
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
panic!("Expect to find keyword struct but nothing was found")
|
|
|
|
}
|
2021-01-15 22:57:26 +01:00
|
|
|
it
|
2020-12-24 16:24:04 +01:00
|
|
|
}
|