consensus_encoding: Slightly improve docs on macros
What changed, and why it matters
This commit only changes documentation comments for two Rust macros. It rewrites the docstrings to be clearer and adds a cross-reference between related macros. No code logic, behavior, or security properties were modified.
No security action needed. This is a documentation-only change.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff updates doc comments for encoder_newtype! and encoder_newtype_exact! macros in consensus_encoding/src/encode/mod.rs. It splits single-line descriptions into summary/body form and adds a reference to crate::encoder_newtype_exact. No macro expansion logic, trait bounds, generated code, or public API signatures changed.
Changed components
consensus_encoding/src/encode/mod.rs documentation commentsInspect captured patch +7 / −4
diff --git a/consensus_encoding/src/encode/mod.rs b/consensus_encoding/src/encode/mod.rs
index 3e403037..a9e1c12b 100644
--- a/consensus_encoding/src/encode/mod.rs
+++ b/consensus_encoding/src/encode/mod.rs
@@ -43,8 +43,10 @@ pub trait Encoder {
fn advance(&mut self) -> bool;
}
-/// Implements a newtype around an encoder which implements the
-/// [`Encoder`] trait by forwarding to the wrapped encoder.
+/// Implements a newtype around an encoder.
+///
+/// The new type will implement the [`Encoder`] trait by forwarding to the wrapped encoder. If your
+/// type has a known size consider using [`crate::encoder_newtype_exact`] instead.
#[macro_export]
macro_rules! encoder_newtype{
(
@@ -71,8 +73,9 @@ macro_rules! encoder_newtype{
}
}
-/// Implements a newtype around an exact-size encoder which
-/// implements the [`Encoder`] and [`ExactSizeEncoder`] traits
+/// Implements a newtype around an exact-size encoder.
+///
+/// The new type will implement both the [`Encoder`] and [`ExactSizeEncoder`] traits
/// by forwarding to the wrapped encoder.
#[macro_export]
macro_rules! encoder_newtype_exact{
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.