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:
Florian Klink 2024-04-04 19:03:44 +03:00 committed by clbot
parent 39276dc5b4
commit f3d8c633f2
7 changed files with 555 additions and 7 deletions

View file

@ -5769,6 +5769,11 @@ rec {
name = "num-traits";
packageId = "num-traits";
}
{
name = "pin-project-lite";
packageId = "pin-project-lite";
optional = true;
}
{
name = "serde";
packageId = "serde";
@ -5839,11 +5844,12 @@ rec {
}
];
features = {
"async" = [ "futures-util" "tokio" ];
"async" = [ "futures-util" "tokio" "pin-project-lite" ];
"futures-util" = [ "dep:futures-util" ];
"pin-project-lite" = [ "dep:pin-project-lite" ];
"tokio" = [ "dep:tokio" ];
};
resolvedDefaultFeatures = [ "async" "futures-util" "tokio" ];
resolvedDefaultFeatures = [ "async" "futures-util" "pin-project-lite" "tokio" ];
};
"nom" = rec {
crateName = "nom";