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;
/// 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,
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'