zig build run shows a terminal-based animation using the maze generator (requires a modern terminal like Kitty, Ghostty or WezTerm) - the library itself is obviously rendering agnostic and just needs a buffer for the maze paths.
If a library mixes up CPU only stuff with I/O per se ((like libpq, or libmodbus, or libhiredis, hundreds of them…) - it’s not a good general purpose (“calculative”) library. Well, you can use such a library in a, perhaps, multi-threaded app, but if an app uses some more sophisticated I/O strategy, I/O hardcoded into a library inevitably will became a pain in the ass.
FCGI_Accept() from libfcgi - reads request and parses it
PQconnectdb from libpq - constructs messages, send messages, reads messages, parses messages. Decomposition, pg connector state machine.
a lot more…
Of course, using such fat functions is ok for a simple one-shot program or for a multi-threaded program, but for a single-threaded program with event driven I/O and fine grained concurrency it’s better to have only “CPU+MEM” API in a library and let an application itself control all I/O within chosen strategy.