From c364c0b4de92698dae2d3822821f23c48e8b2ccc Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Thu, 14 Mar 2024 15:21:38 +0200 Subject: docs(nix-compat/wire): update docstrings These are not streams, but AsyncRead and AsyncWrite. Change-Id: I7d988fa0490800b72862f4f0fcac3dceac70ec26 Reviewed-on: https://cl.tvl.fyi/c/depot/+/11149 Tested-by: BuildkiteCI Autosubmit: flokli Reviewed-by: picnoir picnoir --- tvix/nix-compat/src/wire/primitive.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'tvix/nix-compat') diff --git a/tvix/nix-compat/src/wire/primitive.rs b/tvix/nix-compat/src/wire/primitive.rs index 54f00b15a0..ee0f5fc427 100644 --- a/tvix/nix-compat/src/wire/primitive.rs +++ b/tvix/nix-compat/src/wire/primitive.rs @@ -5,25 +5,24 @@ use tokio::io::{AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt}; #[allow(dead_code)] -/// Read a u64 from the stream (little endian). +/// Read a u64 from the AsyncRead (little endian). pub async fn read_u64(r: &mut R) -> std::io::Result { r.read_u64_le().await } -#[allow(dead_code)] -/// Write a u64 from the stream (little endian). +/// Write a u64 to the AsyncWrite (little endian). pub async fn write_u64(w: &mut W, v: u64) -> std::io::Result<()> { w.write_u64_le(v).await } #[allow(dead_code)] -/// Read a boolean from the stream, encoded as u64 (>0 is true). +/// Read a boolean from the AsyncRead, encoded as u64 (>0 is true). pub async fn read_bool(r: &mut R) -> std::io::Result { Ok(read_u64(r).await? > 0) } #[allow(dead_code)] -/// Write a boolean to the stream, encoded as u64 (>0 is true). +/// Write a boolean to the AsyncWrite, encoded as u64 (>0 is true). pub async fn write_bool(w: &mut W, v: bool) -> std::io::Result<()> { write_u64(w, if v { 1u64 } else { 0u64 }).await } -- cgit 1.4.1