Skip to content

Commit

Permalink
impl Str for CowString
Browse files Browse the repository at this point in the history
This implementation existed on MaybeOwned, but has been lost in the
transition to Cows. Let's put it back.
  • Loading branch information
seanmonstar committed Nov 28, 2014
1 parent 82fc1aa commit 759032e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/libcollections/str.rs
Expand Up @@ -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
*/
Expand Down

5 comments on commit 759032e

@bors
Copy link
Contributor

@bors bors commented on 759032e Nov 30, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from alexcrichton
at seanmonstar@759032e

@bors
Copy link
Contributor

@bors bors commented on 759032e Nov 30, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging seanmonstar/rust/cow-str = 759032e into auto

@bors
Copy link
Contributor

@bors bors commented on 759032e Nov 30, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seanmonstar/rust/cow-str = 759032e merged ok, testing candidate = 52888a7

@bors
Copy link
Contributor

@bors bors commented on 759032e Nov 30, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors
Copy link
Contributor

@bors bors commented on 759032e Nov 30, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = 52888a7

Please sign in to comment.