From 759032ee64f82443adc898d0ed5f21e3ae7a9d83 Mon Sep 17 00:00:00 2001 From: Sean McArthur Date: Thu, 27 Nov 2014 19:21:38 -0800 Subject: [PATCH] impl Str for CowString This implementation existed on MaybeOwned, but has been lost in the transition to Cows. Let's put it back. --- src/libcollections/str.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/libcollections/str.rs b/src/libcollections/str.rs index ebd30d758f2..c6fa1332186 100644 --- a/src/libcollections/str.rs +++ b/src/libcollections/str.rs @@ -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 */