Add len and is_empty to Base58CkString
What changed, and why it matters
This commit adds two simple helper methods, len() and is_empty(), to a Rust type that holds a base58check-encoded string. It is a routine convenience/API improvement with no security relevance visible in the code or commit message.
No security action needed. Review as normal API addition if desired.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch exposes pub fn len(&self) -> usize and pub fn is_empty(&self) -> bool on Base58CkString by delegating to the existing as_bytes() slice. No unsafe code, no parsing changes, no input handling changes, and no cryptographic operations are introduced. The methods follow the standard Rust convention for container-like types.
Changed components
base58/src/lib.rsBase58CkStringInspect captured patch +6 / −0
diff --git a/base58/src/lib.rs b/base58/src/lib.rs
index 41928853..3c3704ae 100644
--- a/base58/src/lib.rs
+++ b/base58/src/lib.rs
@@ -229,6 +229,12 @@ impl Base58CkString {
Base58CkInner::Large(ref data) => data.slice(),
}
}
+
+ /// Returns the number of bytes/ASCII chars in the base58check-encoded string.
+ pub fn len(&self) -> usize { self.as_bytes().len() }
+
+ /// Returns true if the base58check-encoded string is empty.
+ pub fn is_empty(&self) -> bool { self.len() == 0 }
}
impl AsRef<str> for Base58CkString {
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.