From 0699ee4574eff3dd0d87216421ea397d12346dba Mon Sep 17 00:00:00 2001 From: Yuri Astrakhan Date: Wed, 8 Oct 2025 19:23:26 -0400 Subject: [PATCH] docs: use links and backticks makes clippy complain less too --- src/reader.rs | 10 +++++----- src/varint.rs | 6 +++--- src/writer.rs | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/reader.rs b/src/reader.rs index 0ed63ac..bcdce34 100644 --- a/src/reader.rs +++ b/src/reader.rs @@ -10,7 +10,7 @@ use tokio::io::{AsyncRead, AsyncReadExt}; #[cfg(feature = "futures_async")] use futures_util::{io::AsyncRead, io::AsyncReadExt}; -/// A trait for reading VarInts from any other `Reader`. +/// A trait for reading [`VarInts`] from any other `Reader`. /// /// It's recommended to use a buffered reader, as many small reads will happen. pub trait VarIntReader { @@ -19,7 +19,7 @@ pub trait VarIntReader { /// In general, this always reads a whole varint. If the encoded varint's value is bigger /// than the valid value range of `VI`, then the value is truncated. /// - /// On EOF, an io::Error with io::ErrorKind::UnexpectedEof is returned. + /// On EOF, an [`io::Error`] with [`io::ErrorKind::UnexpectedEof`] is returned. fn read_varint(&mut self) -> Result; } @@ -30,7 +30,7 @@ pub trait VarIntAsyncReader { async fn read_varint_async(&mut self) -> Result; } -/// VarIntProcessor encapsulates the logic for decoding a VarInt byte-by-byte. +/// `VarIntProcessor` encapsulates the logic for decoding a [`VarInt`] byte-by-byte. #[derive(Default)] pub struct VarIntProcessor { buf: [u8; 10], @@ -114,11 +114,11 @@ impl VarIntReader for R { } } -/// A trait for reading FixedInts from any other `Reader`. +/// A trait for reading [`FixedInts`] from any other `Reader`. pub trait FixedIntReader { /// Read a fixed integer from a reader. How many bytes are read depends on `FI`. /// - /// On EOF, an io::Error with io::ErrorKind::UnexpectedEof is returned. + /// On EOF, an [`io::Error`] with [`io::ErrorKind::UnexpectedEof`] is returned. fn read_fixedint(&mut self) -> Result; } diff --git a/src/varint.rs b/src/varint.rs index 61032d2..05753c1 100644 --- a/src/varint.rs +++ b/src/varint.rs @@ -6,7 +6,7 @@ pub const MSB: u8 = 0b1000_0000; /// bit using `&` (binary-and). const DROP_MSB: u8 = 0b0111_1111; -/// How many bytes an integer uses when being encoded as a VarInt. +/// How many bytes an integer uses when being encoded as a `VarInt`. #[inline] fn required_encoded_space_unsigned(mut v: u64) -> usize { if v == 0 { @@ -21,14 +21,14 @@ fn required_encoded_space_unsigned(mut v: u64) -> usize { logcounter } -/// How many bytes an integer uses when being encoded as a VarInt. +/// How many bytes an integer uses when being encoded as a [`VarInt`]. #[inline] fn required_encoded_space_signed(v: i64) -> usize { required_encoded_space_unsigned(zigzag_encode(v)) } /// Varint (variable length integer) encoding, as described in -/// https://developers.google.com/protocol-buffers/docs/encoding. +/// . /// /// Uses zigzag encoding (also described there) for signed integer representation. pub trait VarInt: Sized + Copy { diff --git a/src/writer.rs b/src/writer.rs index 3671980..b99e990 100644 --- a/src/writer.rs +++ b/src/writer.rs @@ -9,7 +9,7 @@ use tokio::io::{AsyncWrite, AsyncWriteExt}; #[cfg(feature = "futures_async")] use futures_util::{io::AsyncWrite, io::AsyncWriteExt}; -/// A trait for writing integers in VarInt encoding to any `Write` type. This packs encoding and +/// A trait for writing integers in [`VarInt`] encoding to any [`Write`] type. This packs encoding and /// writing into one step. pub trait VarIntWriter { fn write_varint(&mut self, n: VI) -> Result;