1# @ajax/mesh-jobs-wire
23The binary encoding the job table's ops, the job frames (F_JOB_*, F_LEASE, F_RESULT) and the job log
4are written in: little-endian `u8`, `u32`, `u64`; bytes as a `u32` length and the bytes; strings as
5their UTF-8 bytes the same way; item ranges as a `u32` count and `(start, end)` pairs. The reader
6keeps its first failure with jobs.rs's exact message (`job frame: short (3 of 8 bytes at 17)`,
7`job frame: not UTF-8`), and every read after it fails.
89## Ported from
1011[alpha-rust-mesh](https://github.com/rsafier/alpha-rust-mesh) (Richard Safier, MIT):
12`crates/mesh-host/src/jobs.rs`, the `W` writer and the `R` reader.
1314## Differences
1516A string read from the wire becomes a NUL-terminated C string, so one holding a NUL byte (valid UTF-8,
17legal in a Rust `String`) is cut at it. Nothing in the mesh writes such a name.
1819## Tests
2021`tests/wire.c`: the exact bytes, reads back, the short-read message and its stickiness, and the UTF-8
22checks (overlong, surrogate, truncated, past U+10FFFF).
2324## Licence
2526MIT. See the repository's LICENSE.