feat(nix-compat/wire): add read_bytes[_unchecked]

This introduces a version reading sized byte packets. Both read_bytes,
accepting a range of allowed sizes, as well as read_bytes_unchecked,
which doesn't care, are added, including tests.

Co-Authored-By: picnoir <picnoir@alternativebit.fr>
Change-Id: I9fc1c61eb561105e649eecca832af28badfdaaa8
Reviewed-on: https://cl.tvl.fyi/c/depot/+/11150
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: picnoir picnoir <picnoir@alternativebit.fr>
Tested-by: BuildkiteCI
This commit is contained in:
Florian Klink 2024-03-14 17:03:38 +02:00 committed by clbot
parent c364c0b4de
commit 5fccbe5939
2 changed files with 133 additions and 0 deletions

View file

@ -1,5 +1,8 @@
//! Module parsing and emitting the wire format used by Nix, both in the
//! nix-daemon protocol as well as in the NAR format.
#[cfg(feature = "async")]
pub mod bytes;
#[cfg(feature = "async")]
pub mod primitive;