From 38ac809cc7f0d4da8cc16951f8a9852f4b052c1f Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Thu, 14 Mar 2013 18:08:20 -0700 Subject: [PATCH] core: Add to_bytes method to StrSlice trait --- src/libcore/str.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/libcore/str.rs b/src/libcore/str.rs index 4163679a98d74..430ed2d9e3833 100644 --- a/src/libcore/str.rs +++ b/src/libcore/str.rs @@ -2273,6 +2273,7 @@ pub trait StrSlice { pure fn to_owned(&self) -> ~str; pure fn to_managed(&self) -> @str; pure fn char_at(&self, i: uint) -> char; + fn to_bytes(&self) -> ~[u8]; } /// Extension methods for strings @@ -2416,6 +2417,8 @@ impl StrSlice for &self/str { #[inline] pure fn char_at(&self, i: uint) -> char { char_at(*self, i) } + + fn to_bytes(&self) -> ~[u8] { to_bytes(*self) } } pub trait OwnedStr {