Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

accept doc comments when deriving ShaderType #42

Merged
merged 2 commits into from
May 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,
}