chore: initial draft of proc macros
This commit is contained in:
9
python-utils-macros-impl/Cargo.toml
Normal file
9
python-utils-macros-impl/Cargo.toml
Normal file
@@ -0,0 +1,9 @@
|
||||
[package]
|
||||
name = "python-utils-macros-impl"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
proc-macro2 = "1.0.106"
|
||||
quote = "1.0.46"
|
||||
syn = "2.0.118"
|
||||
17
python-utils-macros-impl/src/lib.rs
Normal file
17
python-utils-macros-impl/src/lib.rs
Normal file
@@ -0,0 +1,17 @@
|
||||
use proc_macro2::TokenStream;
|
||||
use quote::quote;
|
||||
use syn::{DeriveInput, parse_macro_input};
|
||||
|
||||
pub fn py_from_str(input: TokenStream) -> TokenStream {
|
||||
let derive_input: DeriveInput = parse_macro_input!(input);
|
||||
|
||||
let (impl_generics, ty_generics, where_clause) = generics.split_for_impl();
|
||||
|
||||
let expanded = quote! {
|
||||
impl #impl_generics MyTrait for #name #ty_generics #where_clause {
|
||||
// ...
|
||||
}
|
||||
};
|
||||
|
||||
expanded
|
||||
}
|
||||
Reference in New Issue
Block a user