diff options
author | Florian Klink <flokli@flokli.de> | 2024-03-14T13·21+0200 |
---|---|---|
committer | clbot <clbot@tvl.fyi> | 2024-03-15T10·23+0000 |
commit | c364c0b4de92698dae2d3822821f23c48e8b2ccc (patch) | |
tree | ff61d48db1751c2e8e4d7bcc96357adf9a0492f2 /tvix/nix-compat/src/wire/primitive.rs | |
parent | 907ecff999e9f5e8cffbc1b6ab0edc97e672c833 (diff) |
docs(nix-compat/wire): update docstrings r/7696
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 <flokli@flokli.de> Reviewed-by: picnoir picnoir <picnoir@alternativebit.fr>
Diffstat (limited to 'tvix/nix-compat/src/wire/primitive.rs')
-rw-r--r-- | tvix/nix-compat/src/wire/primitive.rs | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/tvix/nix-compat/src/wire/primitive.rs b/tvix/nix-compat/src/wire/primitive.rs index 54f00b15a0c0..ee0f5fc4279d 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: AsyncReadExt + Unpin>(r: &mut R) -> std::io::Result<u64> { 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: AsyncWrite + Unpin>(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: AsyncRead + Unpin>(r: &mut R) -> std::io::Result<bool> { 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: AsyncWrite + Unpin>(w: &mut W, v: bool) -> std::io::Result<()> { write_u64(w, if v { 1u64 } else { 0u64 }).await } |