about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorErick Tryzelaar <erick.tryzelaar@gmail.com>2013-07-23 16:56:17 -0700
committerErick Tryzelaar <erick.tryzelaar@gmail.com>2013-07-23 16:56:17 -0700
commit9ad815e063e8c7785cc10ea1afac55a19ea4e51a (patch)
tree8028c4e7bd736965f09e2c7f245a3a936681c546 /src/libstd
parent7434080dd7c0cd072d7e51fbb1e174e954bdc011 (diff)
downloadrust-9ad815e063e8c7785cc10ea1afac55a19ea4e51a.tar.gz
rust-9ad815e063e8c7785cc10ea1afac55a19ea4e51a.zip
std: rename str.as_bytes_with_null_consume to str.to_bytes_with_null
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/str.rs13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/libstd/str.rs b/src/libstd/str.rs
index 125df156ed0..3987f260065 100644
--- a/src/libstd/str.rs
+++ b/src/libstd/str.rs
@@ -2073,8 +2073,7 @@ pub trait OwnedStr {
     fn reserve(&mut self, n: uint);
     fn reserve_at_least(&mut self, n: uint);
     fn capacity(&self) -> uint;
-
-    fn as_bytes_with_null_consume(self) -> ~[u8];
+    fn to_bytes_with_null(self) -> ~[u8];
 }
 
 impl OwnedStr for ~str {
@@ -2263,7 +2262,7 @@ impl OwnedStr for ~str {
     /// Convert to a vector of bytes. This does not allocate a new
     /// string, and includes the null terminator.
     #[inline]
-    fn as_bytes_with_null_consume(self) -> ~[u8] {
+    fn to_bytes_with_null(self) -> ~[u8] {
         unsafe { ::cast::transmute(self) }
     }
 }
@@ -3065,17 +3064,17 @@ mod tests {
     }
 
     #[test]
-    fn test_as_bytes_with_null_consume() {
+    fn test_to_bytes_with_null() {
         let s = ~"ศไทย中华Việt Nam";
         let v = ~[
             224, 184, 168, 224, 185, 132, 224, 184, 151, 224, 184, 162, 228,
             184, 173, 229, 141, 142, 86, 105, 225, 187, 135, 116, 32, 78, 97,
             109, 0
         ];
-        assert_eq!((~"").as_bytes_with_null_consume(), ~[0]);
-        assert_eq!((~"abc").as_bytes_with_null_consume(),
+        assert_eq!((~"").to_bytes_with_null(), ~[0]);
+        assert_eq!((~"abc").to_bytes_with_null(),
                    ~['a' as u8, 'b' as u8, 'c' as u8, 0]);
-        assert_eq!(s.as_bytes_with_null_consume(), v);
+        assert_eq!(s.to_bytes_with_null(), v);
     }
 
     #[test]