Skip to content

Commit 52888a7

Browse files
committed
auto merge of #19369 : seanmonstar/rust/cow-str, r=alexcrichton
This implementation existed on MaybeOwned, but has been lost in the transition to Cows. Let's put it back. @aturon r?
2 parents dfaad04 + 759032e commit 52888a7

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/libcollections/str.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -656,6 +656,13 @@ Section: CowString
656656
/// A clone-on-write string
657657
pub type CowString<'a> = Cow<'a, String, str>;
658658

659+
impl<'a> Str for CowString<'a> {
660+
#[inline]
661+
fn as_slice<'b>(&'b self) -> &'b str {
662+
(**self).as_slice()
663+
}
664+
}
665+
659666
/*
660667
Section: Trait implementations
661668
*/

0 commit comments

Comments
 (0)