From f6651428544957f689bc3a43641c8154e625d40c Mon Sep 17 00:00:00 2001 From: bluss Date: Wed, 9 Oct 2019 10:32:14 +0200 Subject: [PATCH] FEAT: Add ArrayString::len This method is no new feature, but it saves us from going through deref to str to fetch the length. --- src/array_string.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/array_string.rs b/src/array_string.rs index c1154c3..523c58f 100644 --- a/src/array_string.rs +++ b/src/array_string.rs @@ -67,6 +67,10 @@ impl ArrayString } } + /// Return the length of the string. + #[inline] + pub fn len(&self) -> usize { self.len.to_usize() } + /// Create a new `ArrayString` from a `str`. /// /// Capacity is inferred from the type parameter.