deku
deku copied to clipboard
Request for Enhancement: Project-level Deku settings
Project-level settings that are set within main.rs
can help reduce boilerplate significantly.
Imagine a #[deku(endian = "little")]
for each & every struct
or enum
.
This will make a very noticable difference in readability when working on projects with hundreds of struct
s and enum
s.
Over time, project-level settings can be used for future enhancements whenever they come up.
As always, thanks for your time & effort to all the contributors of this very neat project.
Is this possible? I think there is no way to access such file level settings in a procedure macro.
Any further thoughts on this, @sharksforarms?
Perhaps a .conf
file with global settings?
Any further thoughts on this, @sharksforarms? Perhaps a
.conf
file with global settings?
This would be better suited in another library using deku. For example, another proc-macro crate which annotates struct/enum fields with deku attributes
Could you show me an example of such a crate/project please?
Could you show me an example of such a crate/project please?
The following is an example of using deku attributes in another proc-macro library. If that is what you are asking.
https://github.com/wcampbell0x2a/bintex
@constfold Any thoughts on https://github.com/sharksforarms/deku/issues/225#issuecomment-864578411 ? Does an attribute named ctx_nested
make sense?
Hi @sharksforarms & @wcampbell0x2a, check these out.
nom
's declarative parser seems to be catching up.
nom-derive-impl/src/config.rs Overriding the default endianness
This will cut my boilerplate noticeably.
I'm still not sure how I'd like to approach this, if at all. Have you considered writing your own proc-macro to accomplish this?
I'll try and give you an example when I have time to create one.
Thank you. As I had mentioned, I'm a noob at programming, barely capable of using this library. It'll take me a long long time to get comfortable enough to work on proc-macros.
The approach taken by nom-derive
seems straightforward (to a user), no?