core: Add to_bytes method to StrSlice trait
This commit is contained in:
parent
82f1b2cc9d
commit
38ac809cc7
1 changed files with 3 additions and 0 deletions
|
@ -2273,6 +2273,7 @@ pub trait StrSlice {
|
||||||
pure fn to_owned(&self) -> ~str;
|
pure fn to_owned(&self) -> ~str;
|
||||||
pure fn to_managed(&self) -> @str;
|
pure fn to_managed(&self) -> @str;
|
||||||
pure fn char_at(&self, i: uint) -> char;
|
pure fn char_at(&self, i: uint) -> char;
|
||||||
|
fn to_bytes(&self) -> ~[u8];
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Extension methods for strings
|
/// Extension methods for strings
|
||||||
|
@ -2416,6 +2417,8 @@ impl StrSlice for &self/str {
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pure fn char_at(&self, i: uint) -> char { char_at(*self, i) }
|
pure fn char_at(&self, i: uint) -> char { char_at(*self, i) }
|
||||||
|
|
||||||
|
fn to_bytes(&self) -> ~[u8] { to_bytes(*self) }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait OwnedStr {
|
pub trait OwnedStr {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue