/linux/rust/macros/ |
H A D | pin_data.rs | 4 use proc_macro::{Group, Punct, Spacing, TokenStream, TokenTree}; 28 .skip_while(|tt| !matches!(tt, TokenTree::Ident(i) if i.to_string() == "struct")) in pin_data() 31 TokenTree::Ident(_) => { in pin_data() 37 res.push(TokenTree::Punct(Punct::new(':', Spacing::Joint))); in pin_data() 38 res.push(TokenTree::Punct(Punct::new(':', Spacing::Alone))); in pin_data() 39 res.push(TokenTree::Punct(Punct::new('<', Spacing::Alone))); in pin_data() 41 res.push(TokenTree::Punct(Punct::new('>', Spacing::Alone))); in pin_data() 65 if matches!(&tt, TokenTree::Ident(i) if i.to_string() == "struct") { in pin_data() 92 struct_name: &Vec<TokenTree>, in replace_self_and_deny_type_defs() argument 93 tt: TokenTree, in replace_self_and_deny_type_defs() argument [all …]
|
H A D | paste.rs | 3 use proc_macro::{Delimiter, Group, Ident, Spacing, Span, TokenTree}; 5 fn concat_helper(tokens: &[TokenTree]) -> Vec<(String, Span)> { in concat() argument 12 Some(TokenTree::Literal(lit)) => { in concat() 21 Some(TokenTree::Ident(ident)) => { in concat() 28 Some(TokenTree::Punct(p)) if p.as_char() == ':' => { in concat() 29 let Some(TokenTree::Ident(ident)) = tokens.next() else { in concat() 49 Some(TokenTree::Group(group)) if group.delimiter() == Delimiter::None => { in concat() 50 let tokens = group.stream().into_iter().collect::<Vec<TokenTree>>(); in concat() 60 fn concat(tokens: &[TokenTree], group_span: Span) -> TokenTree { in expand() 57 expand(tokens: &mut Vec<TokenTree>) expand() argument [all...] |
H A D | helpers.rs | 3 use proc_macro::{token_stream, Group, TokenStream, TokenTree}; 6 if let Some(TokenTree::Ident(ident)) = it.next() { in try_ident() 14 if let Some(TokenTree::Literal(literal)) = it.next() { in try_literal() 42 if let TokenTree::Punct(punct) = it.next().expect("Reached end of token stream for Punct") { in expect_punct() 60 if let TokenTree::Group(group) = it.next().expect("Reached end of token stream for Group") { in expect_group() 98 pub(crate) decl_generics: Vec<TokenTree>, 102 pub(crate) impl_generics: Vec<TokenTree>, 107 pub(crate) ty_generics: Vec<TokenTree>, 113 pub(crate) fn parse_generics(input: TokenStream) -> (Generics, Vec<TokenTree>) { in parse_generics() argument 129 if nesting == 1 && matches!(&tt, TokenTree::Punct(p) if p.as_char() == '>') { in parse_generics() [all …]
|
H A D | quote.rs | 3 use proc_macro::{TokenStream, TokenTree}; 19 tokens.extend([TokenTree::from(self.clone())]); in to_tokens() 23 impl ToTokens for TokenTree { implementation 70 $v.push(::proc_macro::TokenTree::Group(::proc_macro::Group::new( 79 $v.push(::proc_macro::TokenTree::Group(::proc_macro::Group::new( 88 $v.push(::proc_macro::TokenTree::Group(::proc_macro::Group::new( 95 $v.push(::proc_macro::TokenTree::Punct( 98 $v.push(::proc_macro::TokenTree::Punct( 104 $v.push(::proc_macro::TokenTree::Punct( 110 $v.push(::proc_macro::TokenTree::Punct( [all …]
|
H A D | vtable.rs | 3 use proc_macro::{Delimiter, Group, TokenStream, TokenTree}; 14 TokenTree::Ident(ident) => match ident.to_string().as_str() { in vtable() 25 Some(TokenTree::Group(group)) if group.delimiter() == Delimiter::Brace => group, in vtable() 34 TokenTree::Ident(ident) if ident.to_string() == "fn" => { in vtable() 36 Some(TokenTree::Ident(ident)) => ident.to_string(), in vtable() 42 TokenTree::Ident(ident) if ident.to_string() == "const" => { in vtable() 44 Some(TokenTree::Ident(ident)) => ident.to_string(), in vtable() 94 tokens.push(TokenTree::Group(Group::new(Delimiter::Brace, new_body))); in vtable()
|
H A D | pinned_drop.rs | 3 use proc_macro::{TokenStream, TokenTree}; 9 assert!(matches!(&toks[0], TokenTree::Ident(i) if i.to_string() == "impl")); in pinned_drop() 15 TokenTree::Punct(p) if p.as_char() == '<' => { in pinned_drop() 18 TokenTree::Punct(p) if p.as_char() == '>' => { in pinned_drop() 27 matches!(tt, TokenTree::Ident(i) if i.to_string() == "PinnedDrop"), in pinned_drop() 40 if let Some(TokenTree::Group(last)) = toks.pop() { in pinned_drop()
|
H A D | zeroable.rs | 4 use proc_macro::{TokenStream, TokenTree}; 28 TokenTree::Punct(p) if nested == 0 && p.as_char() == ',' => { in derive() 37 TokenTree::Punct(p) if nested == 0 && p.as_char() == '\'' => { in derive() 41 TokenTree::Punct(p) if nested == 0 && p.as_char() == ':' => { in derive() 48 TokenTree::Punct(p) if p.as_char() == '<' => { in derive() 52 TokenTree::Punct(p) if p.as_char() == '>' => { in derive()
|
H A D | concat_idents.rs | 3 use proc_macro::{token_stream, Ident, TokenStream, TokenTree}; 8 if let Some(TokenTree::Ident(ident)) = it.next() { in expect_ident() 22 TokenStream::from_iter([TokenTree::Ident(res)]) in concat_idents()
|
H A D | module.rs | 4 use proc_macro::{token_stream, Delimiter, Literal, TokenStream, TokenTree}; 17 Some(TokenTree::Punct(punct)) => assert_eq!(punct.as_char(), ','), in expect_string_array() 121 Some(TokenTree::Ident(ident)) => ident.to_string(), in parse()
|