EDIT: Format strings are quite well-documented here
What would be the best place to put a formatting specifier / formatting string reference? Right now I’m not aware of a good cheatsheet, which sometimes leads to me just trying something to see if it works (e.g., I only learned yesterday that {x} works on slices, not just numbers).
zig.guide has an ok-ish list, but it doesn’t mention optionals, {any}, {t}, or bare {}, doesn’t mention that {x} can have precision specifiers, and IMO should be a table for easy reference. Also, it doesn’t seem to have anything past 0.15.2.
Reading the std/fmt.zig source helps, but it’s not exactly terse and it would be nice to have something in the documentation or here on ziggit. Would this be a reasonable PR? Or maybe a “docs” topic here?
Or maybe this just isn’t a problem other people have?
Although I will admit, just yesterday I forgot where this page was, going through std.fmt and std.debug.print before finally remembering it was in Writer.print. Re-found it before long, but it wasn’t in the first place I looked.
I had this exact question recently. It took me a while to find std.Io.Writer.print because usually I’m looking at std.mem.Allocator.print or some other print method docs.
Makes sense for it to be in std.Io.Writer.print though.
Definitely the std library docs will get a lot more love when things become more stable. Hard to focus on writing great docs when the underlying code changes so much, and also the code is quite readable. I often discover the docs for the thing I’m trying to do just by doing go to definition or grepping the std library source for the functions I’m using to see how the args should be composed.