From f4dd84641f5499abee06570e65272698c05a7fb6 Mon Sep 17 00:00:00 2001 From: Mason Reed Date: Tue, 25 Feb 2025 13:06:19 -0500 Subject: Fix BnString usage of `as_ref` instead of `as_str` Fixes `BnString::len` and `BnString::is_empty` incorrectly reporting 1 and true on empty null terminated string. --- rust/src/string.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'rust/src/string.rs') diff --git a/rust/src/string.rs b/rust/src/string.rs index c0d6daba..3bda6a81 100644 --- a/rust/src/string.rs +++ b/rust/src/string.rs @@ -101,11 +101,11 @@ impl BnString { } pub fn len(&self) -> usize { - self.as_ref().len() + self.as_str().len() } pub fn is_empty(&self) -> bool { - self.as_ref().is_empty() + self.as_str().is_empty() } } -- cgit v1.3.1