From 75519752a0d7c98d4aa960abeaa80a001af30f69 Mon Sep 17 00:00:00 2001 From: Leynos Date: Fri, 4 Jul 2025 02:07:48 +0100 Subject: [PATCH] Clarify preamble error docs --- src/preamble.rs | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/src/preamble.rs b/src/preamble.rs index 4f2bda14..c812d193 100644 --- a/src/preamble.rs +++ b/src/preamble.rs @@ -52,31 +52,26 @@ where Ok(()) } -/// Read and decode a connection preamble using bincode. +/// Asynchronously read and decode a connection preamble using bincode. /// /// This helper reads the exact number of bytes required by `T`, as /// indicated by [`DecodeError::UnexpectedEnd`]. Additional bytes are -/// requested from the reader until decoding succeeds or fails for some +/// requested from `reader` until decoding succeeds or fails for some /// other reason. /// -/// # Errors -/// -/// Returns a [`DecodeError`] if decoding the preamble fails or an -/// Asynchronously reads and decodes a preamble of type `T` from an async reader using bincode. -/// -/// Attempts to decode a value of type `T` from the beginning of the byte stream, reading more bytes -/// as needed until decoding succeeds or an error occurs. Any bytes remaining after the decoded -/// value are returned as leftovers. +/// Attempts to decode a value of type `T` from the beginning of the +/// byte stream, reading more bytes as needed until decoding succeeds or +/// an error occurs. Any bytes remaining after the decoded value are +/// returned as leftovers. /// /// # Returns /// -/// A tuple containing the decoded value and a vector of leftover bytes following the decoded -/// preamble. +/// A tuple containing the decoded value and any leftover bytes. /// /// # Errors /// -/// Returns a `DecodeError` if decoding fails or if an I/O error occurs while reading from the -/// reader. +/// Returns a [`DecodeError`] if decoding fails or if an I/O error occurs +/// while reading from `reader`. /// /// # Examples ///