r/Zig•
gwillicoder

What are your favorite utility libraries?

Hey all, I’m looking for some common utility code or libraries you find yourself using often.

Do you have a repo with:

  • Common string functions
  • Code to deal with common file operations
  • A library that has basic functional style operations like map/fold/filter/take?
  • Code to translate read and write common file/config types
  • etc.

Feel free to share your favorite public repos, or create and share your own here.

Posted Feb 21, 2023, 8:04 PM UTC

215
kristoff-itVP of Community•

Common string functions

std.ascii, std.unicode, std.mem, and as sqeek mentioned, ziglyph

Code to deal with common file operations

std.fs

A library that has basic functional style operations like map/fold/filter/take?

for, while, if

Code to translate read and write common file/config types

std.json, there are community libs for yaml, potobuf, and a few more, no big collection that I know of so you will have to be more precise if you have any specific needs

12
cluster_•

A library that has basic functional style operations like map/fold/filter/take?

for, while, if

lmao

12
squeek502•
6
AliChraghi•

std

3
_lhp_•

Code to translate read and write common file/config types

Two years back I wrote a tokenizer for the INI format (at least one version of it, there are countless conflicting ideas of what an INI file actually is). It's among the first serious zig code I wrote and I haven't updated it since, so it's probably not perfect, but whenever I want to add a config or data file to some project, I just drop it into the repo and it works fine.

I have heard that on master branch the std lib has an INI tokenizer as well now, so maybe I can retire it now.

3