syn
syn copied to clipboard
`TokenMarker` is unexported
I believe that TokenMarker has been accidentally been left unexported. It's pub while other non-exported items are pub(crate).
pub enum TokenMarker {}
https://github.com/dtolnay/syn/blob/master/src/lookahead.rs#L157
I ran into this when trying to make part of my code more generic, and wanted to map my types to types and items in syn, like this.:
impl InputVariant for MyIdent {
const TOKEN: fn(syn::lookahead::TokenMarker) -> proc_macro2::Ident = syn::Ident
}
Can you go into more detail what "map my types to types and items in syn" entails? How is the user of the API that you pasted expected to use that API?
For the purpose of making something that can be used from generic code, I think I would prefer to have peek be an associated function, instead of const TOKEN:
impl InputVariant for MyIdent {
fn peek(input: ParseStream) -> bool {
input.peek(syn::Ident)
}
}