diff options
author | Vova Kryachko <v.kryachko@gmail.com> | 2024-11-08T15·44-0500 |
---|---|---|
committer | Vladimir Kryachko <v.kryachko@gmail.com> | 2024-11-12T02·15+0000 |
commit | b564ed9d43f17c620439815b86d2940be197bd47 (patch) | |
tree | a828f081e0b9f3568366534b800c12d88d5cfff7 /tvix/nix-compat/src/wire/ser | |
parent | 72bc4e0270891d72213989096ff1180adc07a578 (diff) |
feat(nix-daemon): Implement client handler. r/8907
This change includes only the basic nix handshake protocol handling and sets up a client session. The only supported operation at this point is SetOptions. Additional operations will be implemented in subsequent cls. Change-Id: I3eccd9e0ceb270c3865929543c702f1491768852 Reviewed-on: https://cl.tvl.fyi/c/depot/+/12743 Autosubmit: Vladimir Kryachko <v.kryachko@gmail.com> Tested-by: BuildkiteCI Reviewed-by: flokli <flokli@flokli.de> Reviewed-by: edef <edef@edef.eu> Reviewed-by: Brian Olsen <me@griff.name>
Diffstat (limited to 'tvix/nix-compat/src/wire/ser')
-rw-r--r-- | tvix/nix-compat/src/wire/ser/bytes.rs | 9 | ||||
-rw-r--r-- | tvix/nix-compat/src/wire/ser/mod.rs | 10 |
2 files changed, 19 insertions, 0 deletions
diff --git a/tvix/nix-compat/src/wire/ser/bytes.rs b/tvix/nix-compat/src/wire/ser/bytes.rs index 4338d3f8761e..737edb059b5b 100644 --- a/tvix/nix-compat/src/wire/ser/bytes.rs +++ b/tvix/nix-compat/src/wire/ser/bytes.rs @@ -38,6 +38,15 @@ impl NixSerialize for str { } } +impl NixSerialize for &str { + async fn serialize<W>(&self, writer: &mut W) -> Result<(), W::Error> + where + W: NixWrite, + { + writer.write_slice(self.as_bytes()).await + } +} + #[cfg(test)] mod test { use hex_literal::hex; diff --git a/tvix/nix-compat/src/wire/ser/mod.rs b/tvix/nix-compat/src/wire/ser/mod.rs index 5860226f39eb..ef3c6e2e372f 100644 --- a/tvix/nix-compat/src/wire/ser/mod.rs +++ b/tvix/nix-compat/src/wire/ser/mod.rs @@ -122,3 +122,13 @@ pub trait NixSerialize { where W: NixWrite; } + +// Noop +impl NixSerialize for () { + async fn serialize<W>(&self, _writer: &mut W) -> Result<(), W::Error> + where + W: NixWrite, + { + Ok(()) + } +} |