What a great balance of convenience, respect for your users, and useful information. Well done.
I didn’t know about std.meta.declarations!
std.meta.declarations
const decls = std.meta.declarations(Features); for (decls) |decl| {
I was doing the more verbose
fn foo(someValue: anytype, comptime Target: type) Target { const ArgType = @TypeOf(someValue); switch (@typeInfo(ArgType)) { .Struct => |*strct| { // iterate over every field (at comptime) inline for (strct.fields) |field| {
std.meta has a few nifty shorthands that are used to keep in the tool belt like that!
std.meta
Agreed, very nice idea!
Wow, that’s a really great post!
The only change I’d do is using base64url variant for encoding (so that it uses only url safe characters) but this is a minor issue.
🇬🇧 The UK geoblock is lifted, hopefully permanently.
What a great balance of convenience, respect for your users, and useful information. Well done.
I didn’t know about
std.meta.declarations!I was doing the more verbose
std.metahas a few nifty shorthands that are used to keep in the tool belt like that!Agreed, very nice idea!
Wow, that’s a really great post!
The only change I’d do is using base64url variant for encoding (so that it uses only url safe characters) but this is a minor issue.