1. 23
    1. 3

      What a great balance of convenience, respect for your users, and useful information. Well done.

      1. 3

        I didn’t know about 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| {
        
        1. 2

          std.meta has a few nifty shorthands that are used to keep in the tool belt like that!

        2. 2

          Agreed, very nice idea!

          1. 2

            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.