Skip to content

Commit ba1574c

Browse files
committed
Add NumberFormatBuilder::none() method.
1 parent 47a090d commit ba1574c

File tree

1 file changed

+56
-1
lines changed

1 file changed

+56
-1
lines changed

lexical-util/src/format_builder.rs

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ const fn unwrap_or_zero(option: OptionU8) -> u8 {
350350
[`required_exponent_notation`]: https://github.com/Alexhuszagh/rust-lexical/blob/c6c5052/lexical-util/src/format_builder.rs#L757\n
351351
[`required_integer_digits_with_exponent`]: https://github.com/Alexhuszagh/rust-lexical/blob/0cad692/lexical-util/src/format_builder.rs#L1129\n
352352
[`required_fraction_digits_with_exponent`]: https://github.com/Alexhuszagh/rust-lexical/blob/0cad692/lexical-util/src/format_builder.rs#L1149\n
353-
[`required_mantissa_digits_with_exponent`]: TODO\n
353+
[`required_mantissa_digits_with_exponent`]: https://github.com/Alexhuszagh/rust-lexical/blob/47a090d/lexical-util/src/format_builder.rs#L1233\n
354354
[`supports_parsing_integers`]: https://github.com/Alexhuszagh/rust-lexical/blob/f53fae0/lexical-util/src/format_builder.rs#L1181\n
355355
[`supports_parsing_floats`]: https://github.com/Alexhuszagh/rust-lexical/blob/f53fae0/lexical-util/src/format_builder.rs#L1191\n
356356
[`supports_writing_integers`]: https://github.com/Alexhuszagh/rust-lexical/blob/f53fae0/lexical-util/src/format_builder.rs#L1201\n
@@ -562,6 +562,61 @@ impl NumberFormatBuilder {
562562
}
563563
}
564564

565+
/// Create new [`NumberFormatBuilder`] without any flags set.
566+
///
567+
/// This only sets the default radix to 10.
568+
#[inline(always)]
569+
pub const fn none() -> Self {
570+
Self {
571+
digit_separator: None,
572+
base_prefix: None,
573+
base_suffix: None,
574+
mantissa_radix: 10,
575+
exponent_base: None,
576+
exponent_radix: None,
577+
required_integer_digits: false,
578+
required_fraction_digits: false,
579+
required_exponent_digits: false,
580+
required_mantissa_digits: false,
581+
no_positive_mantissa_sign: false,
582+
required_mantissa_sign: false,
583+
no_exponent_notation: false,
584+
no_positive_exponent_sign: false,
585+
required_exponent_sign: false,
586+
no_exponent_without_fraction: false,
587+
no_special: false,
588+
case_sensitive_special: false,
589+
no_integer_leading_zeros: false,
590+
no_float_leading_zeros: false,
591+
required_exponent_notation: false,
592+
case_sensitive_exponent: false,
593+
case_sensitive_base_prefix: false,
594+
case_sensitive_base_suffix: false,
595+
required_integer_digits_with_exponent: false,
596+
required_fraction_digits_with_exponent: false,
597+
required_mantissa_digits_with_exponent: false,
598+
supports_parsing_integers: false,
599+
supports_parsing_floats: false,
600+
supports_writing_integers: false,
601+
supports_writing_floats: false,
602+
required_base_prefix: false,
603+
required_base_suffix: false,
604+
integer_internal_digit_separator: false,
605+
fraction_internal_digit_separator: false,
606+
exponent_internal_digit_separator: false,
607+
integer_leading_digit_separator: false,
608+
fraction_leading_digit_separator: false,
609+
exponent_leading_digit_separator: false,
610+
integer_trailing_digit_separator: false,
611+
fraction_trailing_digit_separator: false,
612+
exponent_trailing_digit_separator: false,
613+
integer_consecutive_digit_separator: false,
614+
fraction_consecutive_digit_separator: false,
615+
exponent_consecutive_digit_separator: false,
616+
special_digit_separator: false,
617+
}
618+
}
619+
565620
/// Create number format for standard, binary number.
566621
#[cfg(feature = "power-of-two")]
567622
pub const fn binary() -> u128 {

0 commit comments

Comments
 (0)