Add .as_slice(), .as_mut_slice(), .as_str()
Vec and String now have these, so we do too to follow convention.
This commit is contained in:
@@ -152,6 +152,11 @@ impl<A: Array<Item=u8>> ArrayString<A> {
|
||||
debug_assert!(length <= self.capacity());
|
||||
self.len = Index::from(length);
|
||||
}
|
||||
|
||||
/// Return a string slice of the whole `ArrayString`.
|
||||
pub fn as_str(&self) -> &str {
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
impl<A: Array<Item=u8>> Deref for ArrayString<A> {
|
||||
|
||||
Reference in New Issue
Block a user