#Standard Library
4 posts tagged Standard Library. All posts
Cow<str> in Rust: borrow when you can, allocate when you mustHow Rust's Cow<str> lets a function return its input untouched or a new String: a whitespace normaliser, into_owned, to_mut, Cow fields, and from_utf8_lossy.
Iterators in Go: range over functions and the iter packageWrite Go iterators with iter.Seq and Seq2: generators, tree walks, early break and the yield contract, slices.Collect and maps.Keys, and merging with iter.Pull.
Structured logging in Go with log/slogUse Go's log/slog: attributes, text and JSON handlers, levels with LevelVar, With and groups, LogValuer for redacting secrets, and a context-aware handler.
Go generics in practice: constraints, generic types and when to skip themGo 1.25 type parameters: constraints with ~ and unions, cmp.Ordered, a generic Set, Map and Filter helpers, slices and maps, and when an interface is simpler.
© 2026 David Li · Home · Blog · RSS ·Classic site · Built with Astro, Starlight and three.js · Logos:Font Awesome Free (CC BY 4.0)