about summary refs log tree commit diff
path: root/src/libstd/num
diff options
context:
space:
mode:
authorKevin Ballard <kevin@sb.org>2014-05-03 22:02:59 -0700
committerKevin Ballard <kevin@sb.org>2014-05-08 12:06:21 -0700
commit11613fc1c048f5bec4cf792397a15bdd17dfd797 (patch)
tree648ac5aafa8fabf5d3e74d67e705210039fd245e /src/libstd/num
parentbbc35eada991b3256812598a555b1ef442d29c15 (diff)
downloadrust-11613fc1c048f5bec4cf792397a15bdd17dfd797.tar.gz
rust-11613fc1c048f5bec4cf792397a15bdd17dfd797.zip
Handle fallout in std::ascii and std::strconv
API changes:

- OwnedAsciiCast returns Vec<Ascii> instead of ~[Ascii]
- OwnedAsciiCast is implemented on Vec<u8>
- AsciiStr.to_lower/upper() returns Vec<Ascii>
- IntoBytes::into_bytes() returns Vec<u8>
- float_to_str_bytes_common() returns (Vec<u8>, bool)
Diffstat (limited to 'src/libstd/num')
-rw-r--r--src/libstd/num/strconv.rs20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/libstd/num/strconv.rs b/src/libstd/num/strconv.rs
index 8861597bb4c..618449939ce 100644
--- a/src/libstd/num/strconv.rs
+++ b/src/libstd/num/strconv.rs
@@ -22,8 +22,8 @@ use option::{None, Option, Some};
 use slice::OwnedVector;
 use slice::{CloneableVector, ImmutableVector, MutableVector};
 use std::cmp::{Ord, Eq};
-use str::{StrSlice};
-use str;
+use str::{Str, StrSlice};
+use strbuf::StrBuf;
 use vec::Vec;
 
 /// A flag that specifies whether to use exponential (scientific) notation.
@@ -262,7 +262,7 @@ pub fn float_to_str_bytes_common<T:NumCast+Zero+One+Eq+Ord+Float+
                                   Div<T,T>+Neg<T>+Rem<T,T>+Mul<T,T>>(
         num: T, radix: uint, negative_zero: bool,
         sign: SignFormat, digits: SignificantDigits, exp_format: ExponentFormat, exp_upper: bool
-        ) -> (~[u8], bool) {
+        ) -> (Vec<u8>, bool) {
     assert!(2 <= radix && radix <= 36);
     match exp_format {
         ExpDec if radix >= DIGIT_E_RADIX       // decimal exponent 'e'
@@ -278,17 +278,17 @@ pub fn float_to_str_bytes_common<T:NumCast+Zero+One+Eq+Ord+Float+
     let _1: T = One::one();
 
     match num.classify() {
-        FPNaN => { return ("NaN".as_bytes().to_owned(), true); }
+        FPNaN => { return (Vec::from_slice("NaN".as_bytes()), true); }
         FPInfinite if num > _0 => {
             return match sign {
-                SignAll => ("+inf".as_bytes().to_owned(), true),
-                _       => ("inf".as_bytes().to_owned(), true)
+                SignAll => (Vec::from_slice("+inf".as_bytes()), true),
+                _       => (Vec::from_slice("inf".as_bytes()), true)
             };
         }
         FPInfinite if num < _0 => {
             return match sign {
-                SignNone => ("inf".as_bytes().to_owned(), true),
-                _        => ("-inf".as_bytes().to_owned(), true),
+                SignNone => (Vec::from_slice("inf".as_bytes()), true),
+                _        => (Vec::from_slice("-inf".as_bytes()), true),
             };
         }
         _ => {}
@@ -483,7 +483,7 @@ pub fn float_to_str_bytes_common<T:NumCast+Zero+One+Eq+Ord+Float+
         }
     }
 
-    (buf.move_iter().collect(), false)
+    (buf, false)
 }
 
 /**
@@ -498,7 +498,7 @@ pub fn float_to_str_common<T:NumCast+Zero+One+Eq+Ord+NumStrConv+Float+
         ) -> (~str, bool) {
     let (bytes, special) = float_to_str_bytes_common(num, radix,
                                negative_zero, sign, digits, exp_format, exp_capital);
-    (str::from_utf8_owned(bytes).unwrap(), special)
+    (StrBuf::from_utf8(bytes).unwrap().into_owned(), special)
 }
 
 // Some constants for from_str_bytes_common's input validation,