Skip to content

Commit

Permalink
accept doc comments when deriving ShaderType (#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
mockersf authored May 9, 2023
1 parent 2dfa542 commit 0b6d6b4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions derive/impl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,9 @@ pub fn derive_shader_type(input: DeriveInput, root: &Path) -> TokenStream {
align: None,
};
for attr in &field.attrs {
if !(attr.meta.path().is_ident("size") || attr.meta.path().is_ident("align")) {
continue;
}
match attr.meta.require_list() {
Ok(meta_list) => {
let span = meta_list.tokens.span();
Expand Down
6 changes: 6 additions & 0 deletions tests/pass/attributes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,9 @@ struct TestRtArray {
#[size(runtime)]
b: Vec<u32>,
}

#[derive(ShaderType)]
struct TestDocComment {
/// This is an unsigned integer
a: u32,
}

0 comments on commit 0b6d6b4

Please sign in to comment.