Closed behnam-oneschema closed 2 weeks ago
I've afraid this syntax is rejected by either syn or the Rust language itself (I'm not sure where the attribute value must be a literal
error comes from). Even if it's just syn
and can by bypassed with manual parsing, it'd still create problems for other derive macros on the same type (which won't even be able to get the attribute name) so I'd rather not do it.
SmartDefault
does have a workaround for this though:
#[default(20 * 1024)]
num_bytes: u32
Interesting! The workaround is perfect, then. Thanks!
Would be great to be able to use const expressions, even as simple as numeric operators, such as: