diff options
author | Florian Klink <flokli@flokli.de> | 2024-04-08T14·59+0300 |
---|---|---|
committer | flokli <flokli@flokli.de> | 2024-04-13T10·09+0000 |
commit | eeca2d92e236f092b4b26512c40362a791a6b307 (patch) | |
tree | 5066ef9f5d1048e418e446d929d008dc5a98655d /tvix/nix-compat/src/wire/bytes_writer.rs | |
parent | 82cf89ee6e22ec206140aa6b64b7347bdb44d130 (diff) |
feat(tvix/nix-compat): add BytesReader r/7894
This adds AsyncRead counterpart for read_bytes. Change-Id: I751da9944984c7a523abee305f8f8a050e705f04 Reviewed-on: https://cl.tvl.fyi/c/depot/+/11385 Tested-by: BuildkiteCI Reviewed-by: raitobezarius <tvl@lahfa.xyz> Reviewed-by: Brian Olsen <me@griff.name> Autosubmit: flokli <flokli@flokli.de>
Diffstat (limited to 'tvix/nix-compat/src/wire/bytes_writer.rs')
-rw-r--r-- | tvix/nix-compat/src/wire/bytes_writer.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/tvix/nix-compat/src/wire/bytes_writer.rs b/tvix/nix-compat/src/wire/bytes_writer.rs index 933b0e6efa6c..8bd0a2d00ef6 100644 --- a/tvix/nix-compat/src/wire/bytes_writer.rs +++ b/tvix/nix-compat/src/wire/bytes_writer.rs @@ -6,7 +6,7 @@ use tokio::io::AsyncWrite; use super::bytes::EMPTY_BYTES; /// The length of the size field, in bytes is always 8. -const LEN_SIZE: usize = 8; +pub(crate) const LEN_SIZE: usize = 8; pin_project! { /// Writes a "bytes wire packet" to the underlying writer. @@ -52,6 +52,8 @@ pin_project! { /// move to the beginning of the next one: /// - Size(LEN_SIZE) must be expressed as Payload(0) /// - Payload(self.payload_len) must be expressed as Padding(0) +/// There's one exception - Size(LEN_SIZE) in the reader represents a failure +/// state we enter in case the allowed size doesn't match the allowed range. /// /// Padding(padding_len) means we're at the end of the bytes wire packet. #[derive(Clone, Debug, PartialEq, Eq)] |