⚡ Zig Guide LiveUnofficial
✓ Zig 0.17.0-dev.1454+5faa79730On an older Zig?

Standard Library

26 chapters.

  • The Io InterfaceAnything that can block takes an Io; the caller picks how.
  • AllocatorsExplicit memory management, passed as a value.
  • ArrayListThe growable array, now unmanaged.
  • Hash MapsKey-value storage, and the getOrPut pattern.
  • StacksArrayList from one end, or no allocator at all.
  • PriorityQueueA binary heap where the comparator is part of the type.
  • MultiArrayListStruct of arrays, laid out for the cache.
  • Bit Sets and Enum CollectionsA set of small integers in a word, and containers keyed by enums.
  • StringsSearch, trim, split, join. All of it lives in std.mem.
  • UnicodeA string is bytes until you opt in to UTF-8.
  • FormattingFormat strings checked at compile time.
  • Advanced FormattingCustom format methods, and the specifiers that changed.
  • Parsing and EncodingText to numbers, and bytes to hex or base64.
  • Readers and WritersThe post-writergate I/O interfaces.
  • JSONParsing into real types, and back out again.
  • FilesystemEvery disk operation now takes an Io.
  • Command-Line ArgumentsReading argv and the environment through std.process.
  • SortingIn-place sorts with an explicit comparator.
  • IteratorsA convention, not an interface.
  • Random NumbersSeeded generators, passed explicitly.
  • CryptoHashes, MACs, and constant-time comparison.
  • TimeClocks behind the Io interface; constants and calendars in std.time.
  • LoggingOne log function, chosen at the root and known at compile time.
  • ThreadsReal OS threads, and why this page cannot run in your browser.
  • Concurrencyasync, Future, and Group, all through the Io interface.
  • TestingThe assertions past expect, and the allocator that catches leaks.