diff options
Diffstat (limited to 'tvix/nix-compat')
-rw-r--r-- | tvix/nix-compat/src/derivation/write.rs | 7 | ||||
-rw-r--r-- | tvix/nix-compat/src/wire/bytes/mod.rs | 11 |
2 files changed, 4 insertions, 14 deletions
diff --git a/tvix/nix-compat/src/derivation/write.rs b/tvix/nix-compat/src/derivation/write.rs index 735b781574e1..2ff68b6edba8 100644 --- a/tvix/nix-compat/src/derivation/write.rs +++ b/tvix/nix-compat/src/derivation/write.rs @@ -32,13 +32,6 @@ pub const QUOTE: char = '"'; /// the context a lot. pub(crate) trait AtermWriteable { fn aterm_write(&self, writer: &mut impl Write) -> std::io::Result<()>; - - fn aterm_bytes(&self) -> Vec<u8> { - let mut bytes = Vec::new(); - self.aterm_write(&mut bytes) - .expect("unexpected write errors to Vec"); - bytes - } } impl AtermWriteable for StorePathRef<'_> { diff --git a/tvix/nix-compat/src/wire/bytes/mod.rs b/tvix/nix-compat/src/wire/bytes/mod.rs index 2ed071e37985..47bfb5eabacf 100644 --- a/tvix/nix-compat/src/wire/bytes/mod.rs +++ b/tvix/nix-compat/src/wire/bytes/mod.rs @@ -33,12 +33,9 @@ const LEN_SIZE: usize = 8; /// /// This buffers the entire payload into memory, /// a streaming version is available at [crate::wire::bytes::BytesReader]. -pub async fn read_bytes<R: ?Sized>( - r: &mut R, - allowed_size: RangeInclusive<usize>, -) -> io::Result<Vec<u8>> +pub async fn read_bytes<R>(r: &mut R, allowed_size: RangeInclusive<usize>) -> io::Result<Vec<u8>> where - R: AsyncReadExt + Unpin, + R: AsyncReadExt + Unpin + ?Sized, { // read the length field let len = r.read_u64_le().await?; @@ -82,13 +79,13 @@ where Ok(buf) } -pub(crate) async fn read_bytes_buf<'a, const N: usize, R: ?Sized>( +pub(crate) async fn read_bytes_buf<'a, const N: usize, R>( reader: &mut R, buf: &'a mut [MaybeUninit<u8>; N], allowed_size: RangeInclusive<usize>, ) -> io::Result<&'a [u8]> where - R: AsyncReadExt + Unpin, + R: AsyncReadExt + Unpin + ?Sized, { assert_eq!(N % 8, 0); assert!(*allowed_size.end() <= N); |