Skip to content

Commit

Permalink
FEAT: Add ArrayString::len
Browse files Browse the repository at this point in the history
This method is no new feature, but it saves us from going through deref
to str to fetch the length.
  • Loading branch information
bluss committed Oct 9, 2019
1 parent 05667bb commit f665142
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/array_string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ impl<A> ArrayString<A>
}
}

/// 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.
Expand Down

0 comments on commit f665142

Please sign in to comment.