libcore: use unboxed closures in float_to_str_bytes_common
This commit is contained in:
parent
5579692ce7
commit
c7b6eb38ff
@ -20,6 +20,7 @@ use fmt;
|
||||
use iter::{range, DoubleEndedIteratorExt};
|
||||
use num::{Float, FPNaN, FPInfinite, ToPrimitive};
|
||||
use num::cast;
|
||||
use ops::FnOnce;
|
||||
use result::Result::Ok;
|
||||
use slice::{mod, SlicePrelude};
|
||||
use str::StrPrelude;
|
||||
@ -84,7 +85,7 @@ static DIGIT_E_RADIX: uint = ('e' as uint) - ('a' as uint) + 11u;
|
||||
/// between digit and exponent sign `'e'`.
|
||||
/// - Panics if `radix` > 25 and `exp_format` is `ExpBin` due to conflict
|
||||
/// between digit and exponent sign `'p'`.
|
||||
pub fn float_to_str_bytes_common<T: Float, U>(
|
||||
pub fn float_to_str_bytes_common<T: Float, U, F>(
|
||||
num: T,
|
||||
radix: uint,
|
||||
negative_zero: bool,
|
||||
@ -92,8 +93,10 @@ pub fn float_to_str_bytes_common<T: Float, U>(
|
||||
digits: SignificantDigits,
|
||||
exp_format: ExponentFormat,
|
||||
exp_upper: bool,
|
||||
f: |&[u8]| -> U
|
||||
) -> U {
|
||||
f: F
|
||||
) -> U where
|
||||
F: FnOnce(&[u8]) -> U,
|
||||
{
|
||||
assert!(2 <= radix && radix <= 36);
|
||||
match exp_format {
|
||||
ExpDec if radix >= DIGIT_E_RADIX // decimal exponent 'e'
|
||||
|
Loading…
Reference in New Issue
Block a user