diff options
| author | Richo Healey <richo@psych0tik.net> | 2014-05-22 16:57:53 -0700 |
|---|---|---|
| committer | Richo Healey <richo@psych0tik.net> | 2014-05-24 21:48:10 -0700 |
| commit | 553074506ecd139eb961fb91eb33ad9fd0183acb (patch) | |
| tree | 01682cf8147183250713acf5e8a77265aab7153c /src/libnum | |
| parent | bbb70cdd9cd982922cf7390459d53bde409699ae (diff) | |
| download | rust-553074506ecd139eb961fb91eb33ad9fd0183acb.tar.gz rust-553074506ecd139eb961fb91eb33ad9fd0183acb.zip | |
core: rename strbuf::StrBuf to string::String
[breaking-change]
Diffstat (limited to 'src/libnum')
| -rw-r--r-- | src/libnum/bigint.rs | 12 | ||||
| -rw-r--r-- | src/libnum/complex.rs | 4 | ||||
| -rw-r--r-- | src/libnum/rational.rs | 10 |
3 files changed, 13 insertions, 13 deletions
diff --git a/src/libnum/bigint.rs b/src/libnum/bigint.rs index 9267aea01b4..88a4807184c 100644 --- a/src/libnum/bigint.rs +++ b/src/libnum/bigint.rs @@ -26,7 +26,7 @@ use std::num::CheckedDiv; use std::num::{Bitwise, ToPrimitive, FromPrimitive}; use std::num::{Zero, One, ToStrRadix, FromStrRadix}; use rand::Rng; -use std::strbuf::StrBuf; +use std::string::String; use std::uint; use std::{i64, u64}; @@ -604,7 +604,7 @@ impl_to_biguint!(u32, FromPrimitive::from_u32) impl_to_biguint!(u64, FromPrimitive::from_u64) impl ToStrRadix for BigUint { - fn to_str_radix(&self, radix: uint) -> StrBuf { + fn to_str_radix(&self, radix: uint) -> String { assert!(1 < radix && radix <= 16); let (base, max_len) = get_radix_base(radix); if base == BigDigit::base { @@ -627,11 +627,11 @@ impl ToStrRadix for BigUint { return result; } - fn fill_concat(v: &[BigDigit], radix: uint, l: uint) -> StrBuf { + fn fill_concat(v: &[BigDigit], radix: uint, l: uint) -> String { if v.is_empty() { return "0".to_strbuf() } - let mut s = StrBuf::with_capacity(v.len() * l); + let mut s = String::with_capacity(v.len() * l); for n in v.iter().rev() { let ss = (*n as uint).to_str_radix(radix); s.push_str("0".repeat(l - ss.len()).as_slice()); @@ -1211,7 +1211,7 @@ impl_to_bigint!(u64, FromPrimitive::from_u64) impl ToStrRadix for BigInt { #[inline] - fn to_str_radix(&self, radix: uint) -> StrBuf { + fn to_str_radix(&self, radix: uint) -> String { match self.sign { Plus => self.data.to_str_radix(radix), Zero => "0".to_strbuf(), @@ -2029,7 +2029,7 @@ mod biguint_tests { assert!(((one << 64) + one).is_odd()); } - fn to_str_pairs() -> Vec<(BigUint, Vec<(uint, StrBuf)>)> { + fn to_str_pairs() -> Vec<(BigUint, Vec<(uint, String)>)> { let bits = BigDigit::bits; vec!(( Zero::zero(), vec!( (2, "0".to_strbuf()), (3, "0".to_strbuf()) diff --git a/src/libnum/complex.rs b/src/libnum/complex.rs index 37d9453fabf..5ba67f3fccf 100644 --- a/src/libnum/complex.rs +++ b/src/libnum/complex.rs @@ -175,7 +175,7 @@ impl<T: fmt::Show + Num + Ord> fmt::Show for Complex<T> { } impl<T: ToStrRadix + Num + Ord> ToStrRadix for Complex<T> { - fn to_str_radix(&self, radix: uint) -> StrBuf { + fn to_str_radix(&self, radix: uint) -> String { if self.im < Zero::zero() { format_strbuf!("{}-{}i", self.re.to_str_radix(radix), @@ -348,7 +348,7 @@ mod test { #[test] fn test_to_str() { - fn test(c : Complex64, s: StrBuf) { + fn test(c : Complex64, s: String) { assert_eq!(c.to_str().to_strbuf(), s); } test(_0_0i, "0+0i".to_strbuf()); diff --git a/src/libnum/rational.rs b/src/libnum/rational.rs index 6191b93ff8f..a51d1d16905 100644 --- a/src/libnum/rational.rs +++ b/src/libnum/rational.rs @@ -281,7 +281,7 @@ impl<T: fmt::Show> fmt::Show for Ratio<T> { } impl<T: ToStrRadix> ToStrRadix for Ratio<T> { /// Renders as `numer/denom` where the numbers are in base `radix`. - fn to_str_radix(&self, radix: uint) -> StrBuf { + fn to_str_radix(&self, radix: uint) -> String { format_strbuf!("{}/{}", self.numer.to_str_radix(radix), self.denom.to_str_radix(radix)) @@ -557,7 +557,7 @@ mod test { #[test] fn test_to_from_str() { - fn test(r: Rational, s: StrBuf) { + fn test(r: Rational, s: String) { assert_eq!(FromStr::from_str(s.as_slice()), Some(r)); assert_eq!(r.to_str().to_strbuf(), s); } @@ -583,13 +583,13 @@ mod test { #[test] fn test_to_from_str_radix() { - fn test(r: Rational, s: StrBuf, n: uint) { + fn test(r: Rational, s: String, n: uint) { assert_eq!(FromStrRadix::from_str_radix(s.as_slice(), n), Some(r)); assert_eq!(r.to_str_radix(n).to_strbuf(), s); } - fn test3(r: Rational, s: StrBuf) { test(r, s, 3) } - fn test16(r: Rational, s: StrBuf) { test(r, s, 16) } + fn test3(r: Rational, s: String) { test(r, s, 3) } + fn test16(r: Rational, s: String) { test(r, s, 16) } test3(_1, "1/1".to_strbuf()); test3(_0, "0/1".to_strbuf()); |
