Create USAGE.md to serve as a friendly guide for usage.
Move the libxev and zig-aio event loops to serve as an example of how to
implement a custom event loop in USAGE.md. Remove dependency on these
libraries and all associated examples and source code.
The motivation for this change is to provide a simpler library. The
power to create a custom event loop will always be kept, however the
support burden of maintaining three event loops is not where I want to
focus my energy. The code is small enough that it's easy enough to be
copy/pasted into a project or provided as a third-party library.
AFAIK zig lacks a way of overriding module dependencies of dependencies.
LoopWithModules lets you use aio backend with vaxis using aio and coro
modules that are not included by vaxis, when this function is used
`include_aio` is not neccessary.
Update to latest aio, which has minor changes such as the thread pool
argument and special aio.ReadTty operation.
In future the aio.ReadTty might have option to translate to vt escape
sequences, but for vaxis it will use the direct mode.
I was not really able to test the windows at all actually as wine did
not seem to play nice with any vaxis example, but it compiles and ...
runs?
This loop adds an xev.File wrapper called TtyWatcher which delivers
events to the users callback. Note that this implementation does not
handle any of the writes. Writes are always safe in the main thread, so
we let users decide how they will schedule those (buffered writers, xev
writes, etc)
- Added standard .gitattributes file for Zig projects.
- Reworked build.zig a little, hopefully it's a bit clearer. Also, now zig build will run all steps.
- outer: while in examples was redundant since there's only one loop to break from. switch expressions don't allow breaking from them, so breaking is only for loops, i.e. while and for.
- When returning a struct instance from a function, the compiler infers the return type from function signature, so instead of return MyType{...}; , it's more idiomatic to write return .{...};.
- Logging adds a new line by default, so you don't usually need to write \n like here: log.debug("event: {}\r\n", .{event});.