mirror of
https://github.com/astral-sh/uv.git
synced 2025-07-07 13:25:00 +00:00
Add OptionsMetadata
macro to uv (#5063)
## Summary The bulk of the change is copied directly from Ruff: -dc8db1afb0/crates/ruff_workspace/src/options_base.rs
-dc8db1afb0/crates/ruff_macros/src/config.rs
This commit is contained in:
parent
c2ef825d7b
commit
8c0ad5b75e
9 changed files with 813 additions and 7 deletions
|
@ -1,7 +1,18 @@
|
|||
mod options_metadata;
|
||||
|
||||
use proc_macro::TokenStream;
|
||||
use quote::quote;
|
||||
use syn::{parse_macro_input, DeriveInput};
|
||||
|
||||
#[proc_macro_derive(OptionsMetadata, attributes(option, doc, option_group))]
|
||||
pub fn derive_options_metadata(input: TokenStream) -> TokenStream {
|
||||
let input = parse_macro_input!(input as DeriveInput);
|
||||
|
||||
options_metadata::derive_impl(input)
|
||||
.unwrap_or_else(syn::Error::into_compile_error)
|
||||
.into()
|
||||
}
|
||||
|
||||
#[proc_macro_derive(CombineOptions)]
|
||||
pub fn derive_combine(input: TokenStream) -> TokenStream {
|
||||
let input = parse_macro_input!(input as DeriveInput);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue