Add typed attribute keys: attrs! macro, Attr trait, and typed accessors

This commit is contained in:
Timon
2026-07-18 12:50:56 +00:00
committed by Keavon Chambers
parent 3d7e85c054
commit 58178fd48e
11 changed files with 496 additions and 4 deletions

View File

@@ -3,6 +3,7 @@ use proc_macro::TokenStream;
use proc_macro_error2::proc_macro_error;
use syn::GenericParam;
mod attrs;
mod buffer_struct;
mod codegen;
mod crate_ident;
@@ -33,6 +34,13 @@ pub fn derive_choice_type(input_item: TokenStream) -> TokenStream {
derive_choice_type::derive_choice_type_impl(input_item.into()).unwrap_or_else(|err| err.to_compile_error()).into()
}
/// Declares typed attribute keys implementing the `Attr` trait, plus a wire-name lookup for their
/// implicit defaults. See `core_types::attr` for the trait and syntax.
#[proc_macro]
pub fn attrs(input: TokenStream) -> TokenStream {
attrs::attrs_impl(input.into()).unwrap_or_else(|err| err.to_compile_error()).into()
}
/// Derive a struct to implement `ShaderStruct`, see that for docs.
#[proc_macro_derive(BufferStruct)]
pub fn derive_buffer_struct(input_item: TokenStream) -> TokenStream {