-
-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
53 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
use proc_macro2::TokenStream; | ||
use quote::{ToTokens, TokenStreamExt}; | ||
use syn::parse::{Parse, ParseStream, Result}; | ||
use syn::{Attribute, Signature, Token, Visibility}; | ||
|
||
pub struct VerbatimFn { | ||
pub attrs: Vec<Attribute>, | ||
pub vis: Visibility, | ||
pub defaultness: Option<Token![default]>, | ||
pub sig: Signature, | ||
pub semi_token: Token![;], | ||
} | ||
|
||
impl Parse for VerbatimFn { | ||
fn parse(input: ParseStream) -> Result<Self> { | ||
Ok(VerbatimFn { | ||
attrs: input.call(Attribute::parse_outer)?, | ||
vis: input.parse()?, | ||
defaultness: input.parse()?, | ||
sig: input.parse()?, | ||
semi_token: input.parse()?, | ||
}) | ||
} | ||
} | ||
|
||
impl ToTokens for VerbatimFn { | ||
fn to_tokens(&self, tokens: &mut TokenStream) { | ||
tokens.append_all(&self.attrs); | ||
self.vis.to_tokens(tokens); | ||
self.defaultness.to_tokens(tokens); | ||
self.sig.to_tokens(tokens); | ||
self.semi_token.to_tokens(tokens); | ||
} | ||
} |