convert to tabs
This commit is contained in:
parent
faca9fb6a8
commit
e2c681b511
36
src/lib.rs
36
src/lib.rs
@ -6,25 +6,25 @@ use syn::{parse_macro_input, DeriveInput};
|
||||
|
||||
#[proc_macro_derive(Id)]
|
||||
pub fn id_derive(input: TokenStream) -> TokenStream {
|
||||
// Parse the input tokens into a syntax tree
|
||||
let ast = parse_macro_input!(input as DeriveInput);
|
||||
let name = &ast.ident;
|
||||
// Parse the input tokens into a syntax tree
|
||||
let ast = parse_macro_input!(input as DeriveInput);
|
||||
let name = &ast.ident;
|
||||
|
||||
// Generate the code for the implementation
|
||||
let expanded = quote! {
|
||||
impl #name {
|
||||
#[inline]
|
||||
pub const fn new(id: u32) -> Self {
|
||||
Self(id)
|
||||
}
|
||||
// Generate the code for the implementation
|
||||
let expanded = quote! {
|
||||
impl #name {
|
||||
#[inline]
|
||||
pub const fn new(id: u32) -> Self {
|
||||
Self(id)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub const fn get(self) -> u32 {
|
||||
self.0
|
||||
}
|
||||
}
|
||||
};
|
||||
#[inline]
|
||||
pub const fn get(self) -> u32 {
|
||||
self.0
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Convert the generated code into a token stream and return it
|
||||
TokenStream::from(expanded)
|
||||
// Convert the generated code into a token stream and return it
|
||||
TokenStream::from(expanded)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user