Module wire

Source
Expand description

Module parsing and emitting the wire format used by Nix, both in the nix-daemon protocol as well as in the NAR format.

Modules§

bytes 🔒
de
protocol_version 🔒
ser

Structs§

BytesReader
Reads a “bytes wire packet” from the underlying reader. The format is the same as in crate::wire::bytes::read_bytes, however this structure provides a AsyncRead interface, allowing to not having to pass around the entire payload in memory.
BytesWriter
Writes a “bytes wire packet” to the underlying writer. The format is the same as in crate::wire::bytes::write_bytes, however this structure provides a AsyncWrite interface, allowing to not having to pass around the entire payload in memory.
ProtocolVersion
Protocol versions are represented as a u16. The upper 8 bits are the major version, the lower bits the minor. This is not aware of any endianness. If you’re receiving over the Nix worker protocol, you need to read a little-endian encoded u64, and then use the try_from() impl to convert to this type.

Functions§

read_bytes
Read a “bytes wire packet” from the AsyncRead. Rejects reading more than allowed_size bytes of payload.
read_string
Read a “bytes wire packet” of from the AsyncRead and tries to parse as string. Internally uses read_bytes. Rejects reading more than allowed_size bytes of payload.
write_bytes
Writes a “bytes wire packet” to a (hopefully buffered) AsyncWriteExt.