Skip to content

Commit f665142

Browse files
committed
FEAT: Add ArrayString::len
This method is no new feature, but it saves us from going through deref to str to fetch the length.
1 parent 05667bb commit f665142

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/array_string.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ impl<A> ArrayString<A>
6767
}
6868
}
6969

70+
/// Return the length of the string.
71+
#[inline]
72+
pub fn len(&self) -> usize { self.len.to_usize() }
73+
7074
/// Create a new `ArrayString` from a `str`.
7175
///
7276
/// Capacity is inferred from the type parameter.

0 commit comments

Comments
 (0)