Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upMacros 1.1 custom derives #1183
Conversation
kvark
force-pushed the
kvark:macros
branch
from
8aecaf1
to
276f054
Feb 10, 2017
homu
added a commit
that referenced
this pull request
Feb 10, 2017
kvark
referenced this pull request
Feb 21, 2017
Open
DescriptorInit error on unaligned shader uniforms #1197
kvark
added some commits
Feb 10, 2017
kvark
force-pushed the
kvark:macros
branch
from
276f054
to
01c96c4
Mar 7, 2017
This comment has been minimized.
This comment has been minimized.
|
r? anyone |
Bastacyclop
reviewed
Mar 7, 2017
src/macros/src/lib.rs
Outdated
| use proc_macro::TokenStream; | ||
|
|
||
|
|
||
| #[proc_macro_derive(GfxVertexFormat)] |
This comment has been minimized.
This comment has been minimized.
Bastacyclop
Mar 7, 2017
Member
is the Gfx prefix necessary ? (I hope there is a way to rename a macro on the user side if he has clashes)
Bastacyclop
reviewed
Mar 7, 2017
| let name = &ast.ident; | ||
| let fields = match ast.body { | ||
| syn::Body::Struct(syn::VariantData::Struct(ref fields)) => fields, | ||
| _ => panic!("`GfxStruct` can only be derived for structs"), |
This comment has been minimized.
This comment has been minimized.
Bastacyclop
Mar 7, 2017
Member
We are not really deriving GfxStruct, I think rustc already wraps the derive panics inside a pretty message with the derive name and location.
This comment has been minimized.
This comment has been minimized.
kvark
force-pushed the
kvark:macros
branch
from
7c4a503
to
71019a8
Mar 7, 2017
This comment has been minimized.
This comment has been minimized.
|
Thanks @Bastacyclop ! Fixed now, merging in an hour. |
kvark
merged commit f751dfd
into
gfx-rs:master
Mar 7, 2017
kvark
deleted the
kvark:macros
branch
Mar 7, 2017
kvark
changed the title
[WIP] Macros 1.1
Macros 1.1 custom derives
Mar 7, 2017
This comment has been minimized.
This comment has been minimized.
|
This is fantastic! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
kvark commentedFeb 10, 2017
•
edited
This PR introduces custom derive macros
VertexDataandConstantBuffer. It is an alternative to macro-generatedgfx_vertex_structandgfx_constant_struct, aimed at better flexibility.Current limitations:
gfxnamespace has to be visibleNew features:
Eq) at willPublished crate: https://crates.io/crates/gfx_macros/0.2.0
Example: