about summary refs log tree commit diff
path: root/tvix/nix-compat/src/wire
diff options
context:
space:
mode:
Diffstat (limited to 'tvix/nix-compat/src/wire')
-rw-r--r--tvix/nix-compat/src/wire/ser/bytes.rs9
-rw-r--r--tvix/nix-compat/src/wire/ser/mod.rs10
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(())
+    }
+}