impl Str for CowString

This implementation existed on MaybeOwned, but has been lost in the
transition to Cows. Let's put it back.
This commit is contained in:
Sean McArthur 2014-11-27 19:21:38 -08:00
parent 82fc1aa875
commit 759032ee64
1 changed files with 7 additions and 0 deletions

View File

@ -656,6 +656,13 @@ Section: CowString
/// A clone-on-write string
pub type CowString<'a> = Cow<'a, String, str>;
impl<'a> Str for CowString<'a> {
#[inline]
fn as_slice<'b>(&'b self) -> &'b str {
(**self).as_slice()
}
}
/*
Section: Trait implementations
*/