From 785ff80c8b8adad22927eee3a0c9c7aaa60072b3 Mon Sep 17 00:00:00 2001 From: edef Date: Sun, 19 Nov 2023 06:24:50 +0000 Subject: fix(nix-compat/nar/reader): require BufRead We rely on being able to make small reads cheaply, so this was already an implicit practical requirement. Requiring it explicitly removes a performance footgun, and makes further optimisations possible. Change-Id: I7f65880a41b1d6b5e6bf2e52dfe47d4c49b34bcd Reviewed-on: https://cl.tvl.fyi/c/depot/+/10088 Tested-by: BuildkiteCI Reviewed-by: flokli --- tvix/nix-compat/src/nar/reader/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tvix/nix-compat/src/nar') diff --git a/tvix/nix-compat/src/nar/reader/mod.rs b/tvix/nix-compat/src/nar/reader/mod.rs index 09af41866508..4958a67de304 100644 --- a/tvix/nix-compat/src/nar/reader/mod.rs +++ b/tvix/nix-compat/src/nar/reader/mod.rs @@ -5,7 +5,7 @@ //! and transferring store paths between Nix stores. use std::io::{ - self, + self, BufRead, ErrorKind::{InvalidData, UnexpectedEof}, Read, }; @@ -17,7 +17,7 @@ mod read; #[cfg(test)] mod test; -pub type Reader<'a> = dyn Read + Send + 'a; +pub type Reader<'a> = dyn BufRead + Send + 'a; /// Start reading a NAR file from `reader`. pub fn open<'a, 'r>(reader: &'a mut Reader<'r>) -> io::Result> { -- cgit 1.4.1