feat(tvix/nix-compat/wire): introduce BytesWriter
This deals with writing byte packets of larger sizes to an underlying AsyncWrite. Its constructor receives the expected size. It also deals with writing padding if flush/shutdown is called after writing all the payload. Change-Id: I8acbf992467f3862ffb8c7d669e8c0c8eced14c1 Reviewed-on: https://cl.tvl.fyi/c/depot/+/11355 Reviewed-by: picnoir picnoir <picnoir@alternativebit.fr> Autosubmit: flokli <flokli@flokli.de> Reviewed-by: Brian Olsen <me@griff.name> Tested-by: BuildkiteCI
This commit is contained in:
parent
39276dc5b4
commit
f3d8c633f2
7 changed files with 555 additions and 7 deletions
|
|
@ -6,7 +6,7 @@ edition = "2021"
|
|||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[features]
|
||||
async = ["futures-util", "tokio"]
|
||||
async = ["futures-util", "tokio", "pin-project-lite"]
|
||||
|
||||
[dependencies]
|
||||
bitflags = "2.4.1"
|
||||
|
|
@ -29,6 +29,10 @@ optional = true
|
|||
version = "1.32.0"
|
||||
features = ["io-util", "macros"]
|
||||
|
||||
[dependencies.pin-project-lite]
|
||||
optional = true
|
||||
version = "0.2.13"
|
||||
|
||||
[dev-dependencies]
|
||||
futures = { version = "0.3.30", default-features = false, features = ["executor"] }
|
||||
lazy_static = "1.4.0"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue