Constdef on steroids: need nested things? I gotcha!


Get the source code here↗, get the crate here↗ and read the docs here↗ The missing piece(s) When the Constdef macro, as a part of the derived crate was released – there was a major drawback: tuples, nested arrays and nested tuples weren’t supported. That was majorly because I didn’t need them at the time, but from the discussion on a Reddit post – it was clear that the community needs these things.…
Read more ⟶

Constant, compile-time `default` implementations in Rust


You can find the source code here↗, the crate here↗ and the docs here↗. The problem You must have come across the Default trait several times while writing code in Rust, and it’s a great convenience for many. In case you haven’t, it lets us get a default value for a given type. This can be extremely useful in cases where, say if a value is not provided – you can default to a value appropriate for that type.…
Read more ⟶

derived: Automating the boring stuff


Background There are structs. Then there are huge structs. And then there are enormous structs. Last week, I was working on simplifying some structures at Skytable when I was really annoyed with a struct. No, let me not leave you there. It looked like this (module shown for a reason): mod cfgset { struct ConfigKeys { tls_cert: String, tls_key: String, tls_passin_stream: String, // ... some large number of other fields .…
Read more ⟶