pub struct NumberFormatBuilder { /* private fields */ }Expand description
Build number format from specifications.
Returns the format on calling build if it was able to compile the format, otherwise, returns None.
§Fields
digit_separator- Character to separate digits.mantissa_radix- Radix for mantissa digits.exponent_base- Base for the exponent.exponent_radix- Radix for the exponent digits.base_prefix- Optional character for the base prefix.base_suffix- Optional character for the base suffix.required_integer_digits- If digits are required before the decimal point.required_fraction_digits- If digits are required after the decimal point.required_exponent_digits- If digits are required after the exponent character.required_mantissa_digits- If at least 1 significant digit is required.no_positive_mantissa_sign- If positive sign before the mantissa is not allowed.required_mantissa_sign- If positive sign before the mantissa is required.no_exponent_notation- If exponent notation is not allowed.no_positive_exponent_sign- If positive sign before the exponent is not allowed.required_exponent_sign- If sign before the exponent is required.no_exponent_without_fraction- If exponent without fraction is not allowed.no_special- If special (non-finite) values are not allowed.case_sensitive_special- If special (non-finite) values are case-sensitive.no_integer_leading_zeros- If leading zeros before an integer are not allowed.no_float_leading_zeros- If leading zeros before a float are not allowed.required_exponent_notation- If exponent notation is required.case_sensitive_exponent- If exponent characters are case-sensitive.case_sensitive_base_prefix- If base prefixes are case-sensitive.case_sensitive_base_suffix- If base suffixes are case-sensitive.integer_internal_digit_separator- If digit separators are allowed between integer digits.fraction_internal_digit_separator- If digit separators are allowed between fraction digits.exponent_internal_digit_separator- If digit separators are allowed between exponent digits.integer_leading_digit_separator- If a digit separator is allowed before any integer digits.fraction_leading_digit_separator- If a digit separator is allowed before any fraction digits.exponent_leading_digit_separator- If a digit separator is allowed before any exponent digits.integer_trailing_digit_separator- If a digit separator is allowed after any integer digits.fraction_trailing_digit_separator- If a digit separator is allowed after any fraction digits.exponent_trailing_digit_separator- If a digit separator is allowed after any exponent digits.integer_consecutive_digit_separator- If multiple consecutive integer digit separators are allowed.fraction_consecutive_digit_separator- If multiple consecutive fraction digit separators are allowed.special_digit_separator- If any digit separators are allowed in special (non-finite) values.
§Write Integer Fields
No fields are used for writing integers.
§Parse Integer Fields
These fields are used for parsing integers:
digit_separatormantissa_radixbase_prefixbase_suffixno_positive_mantissa_signrequired_mantissa_signno_integer_leading_zerosinteger_internal_digit_separatorinteger_leading_digit_separatorinteger_trailing_digit_separatorinteger_consecutive_digit_separator
§Write Float Fields
These fields are used for writing floats:
mantissa_radixexponent_baseexponent_radixno_positive_mantissa_signrequired_mantissa_signno_exponent_notationno_positive_exponent_signrequired_exponent_signrequired_exponent_notation
§Parse Float Fields
These fields are used for parsing floats:
digit_separatormantissa_radixexponent_baseexponent_radixbase_prefixbase_suffixrequired_integer_digitsrequired_fraction_digitsrequired_exponent_digitsno_positive_mantissa_signrequired_mantissa_signno_exponent_notationno_positive_exponent_signrequired_exponent_signno_exponent_without_fractionno_specialcase_sensitive_specialno_integer_leading_zerosno_float_leading_zerosrequired_exponent_notationcase_sensitive_exponentcase_sensitive_base_prefixcase_sensitive_base_suffixinteger_internal_digit_separatorfraction_internal_digit_separatorexponent_internal_digit_separatorinteger_leading_digit_separatorfraction_leading_digit_separatorexponent_leading_digit_separatorinteger_trailing_digit_separatorfraction_trailing_digit_separatorexponent_trailing_digit_separatorinteger_consecutive_digit_separatorfraction_consecutive_digit_separatorspecial_digit_separator
Implementations§
Source§impl NumberFormatBuilder
impl NumberFormatBuilder
Sourcepub const fn get_digit_separator(&self) -> OptionU8
pub const fn get_digit_separator(&self) -> OptionU8
Get the digit separator for the number format.
Sourcepub const fn get_mantissa_radix(&self) -> u8
pub const fn get_mantissa_radix(&self) -> u8
Get the radix for mantissa digits.
Sourcepub const fn get_exponent_base(&self) -> OptionU8
pub const fn get_exponent_base(&self) -> OptionU8
Get the radix for the exponent.
Sourcepub const fn get_exponent_radix(&self) -> OptionU8
pub const fn get_exponent_radix(&self) -> OptionU8
Get the radix for exponent digits.
Sourcepub const fn get_base_prefix(&self) -> OptionU8
pub const fn get_base_prefix(&self) -> OptionU8
Get the optional character for the base prefix.
Sourcepub const fn get_base_suffix(&self) -> OptionU8
pub const fn get_base_suffix(&self) -> OptionU8
Get the optional character for the base suffix.
Sourcepub const fn get_required_integer_digits(&self) -> bool
pub const fn get_required_integer_digits(&self) -> bool
Get if digits are required before the decimal point.
Sourcepub const fn get_required_fraction_digits(&self) -> bool
pub const fn get_required_fraction_digits(&self) -> bool
Get if digits are required after the decimal point.
Sourcepub const fn get_required_exponent_digits(&self) -> bool
pub const fn get_required_exponent_digits(&self) -> bool
Get if digits are required after the exponent character.
Sourcepub const fn get_required_mantissa_digits(&self) -> bool
pub const fn get_required_mantissa_digits(&self) -> bool
Get if at least 1 significant digit is required.
Sourcepub const fn get_no_positive_mantissa_sign(&self) -> bool
pub const fn get_no_positive_mantissa_sign(&self) -> bool
Get if a positive sign before the mantissa is not allowed.
Sourcepub const fn get_required_mantissa_sign(&self) -> bool
pub const fn get_required_mantissa_sign(&self) -> bool
Get if a sign symbol before the mantissa is required.
Sourcepub const fn get_no_exponent_notation(&self) -> bool
pub const fn get_no_exponent_notation(&self) -> bool
Get if exponent notation is not allowed.
Sourcepub const fn get_no_positive_exponent_sign(&self) -> bool
pub const fn get_no_positive_exponent_sign(&self) -> bool
Get if a positive sign before the exponent is not allowed.
Sourcepub const fn get_required_exponent_sign(&self) -> bool
pub const fn get_required_exponent_sign(&self) -> bool
Get if a sign symbol before the exponent is required.
Sourcepub const fn get_no_exponent_without_fraction(&self) -> bool
pub const fn get_no_exponent_without_fraction(&self) -> bool
Get if an exponent without fraction is not allowed.
Sourcepub const fn get_no_special(&self) -> bool
pub const fn get_no_special(&self) -> bool
Get if special (non-finite) values are not allowed.
Sourcepub const fn get_case_sensitive_special(&self) -> bool
pub const fn get_case_sensitive_special(&self) -> bool
Get if special (non-finite) values are case-sensitive.
Sourcepub const fn get_no_integer_leading_zeros(&self) -> bool
pub const fn get_no_integer_leading_zeros(&self) -> bool
Get if leading zeros before an integer are not allowed.
Sourcepub const fn get_no_float_leading_zeros(&self) -> bool
pub const fn get_no_float_leading_zeros(&self) -> bool
Get if leading zeros before a float are not allowed.
Sourcepub const fn get_required_exponent_notation(&self) -> bool
pub const fn get_required_exponent_notation(&self) -> bool
Get if exponent notation is required.
Sourcepub const fn get_case_sensitive_exponent(&self) -> bool
pub const fn get_case_sensitive_exponent(&self) -> bool
Get if exponent characters are case-sensitive.
Sourcepub const fn get_case_sensitive_base_prefix(&self) -> bool
pub const fn get_case_sensitive_base_prefix(&self) -> bool
Get if base prefixes are case-sensitive.
Sourcepub const fn get_case_sensitive_base_suffix(&self) -> bool
pub const fn get_case_sensitive_base_suffix(&self) -> bool
Get if base suffixes are case-sensitive.
Sourcepub const fn get_integer_internal_digit_separator(&self) -> bool
pub const fn get_integer_internal_digit_separator(&self) -> bool
Get if digit separators are allowed between integer digits.
Sourcepub const fn get_fraction_internal_digit_separator(&self) -> bool
pub const fn get_fraction_internal_digit_separator(&self) -> bool
Get if digit separators are allowed between fraction digits.
Sourcepub const fn get_exponent_internal_digit_separator(&self) -> bool
pub const fn get_exponent_internal_digit_separator(&self) -> bool
Get if digit separators are allowed between exponent digits.
Sourcepub const fn get_integer_leading_digit_separator(&self) -> bool
pub const fn get_integer_leading_digit_separator(&self) -> bool
Get if a digit separator is allowed before any integer digits.
Sourcepub const fn get_fraction_leading_digit_separator(&self) -> bool
pub const fn get_fraction_leading_digit_separator(&self) -> bool
Get if a digit separator is allowed before any fraction digits.
Sourcepub const fn get_exponent_leading_digit_separator(&self) -> bool
pub const fn get_exponent_leading_digit_separator(&self) -> bool
Get if a digit separator is allowed before any exponent digits.
Sourcepub const fn get_integer_trailing_digit_separator(&self) -> bool
pub const fn get_integer_trailing_digit_separator(&self) -> bool
Get if a digit separator is allowed after any integer digits.
Sourcepub const fn get_fraction_trailing_digit_separator(&self) -> bool
pub const fn get_fraction_trailing_digit_separator(&self) -> bool
Get if a digit separator is allowed after any fraction digits.
Sourcepub const fn get_exponent_trailing_digit_separator(&self) -> bool
pub const fn get_exponent_trailing_digit_separator(&self) -> bool
Get if a digit separator is allowed after any exponent digits.
Sourcepub const fn get_integer_consecutive_digit_separator(&self) -> bool
pub const fn get_integer_consecutive_digit_separator(&self) -> bool
Get if multiple consecutive integer digit separators are allowed.
Sourcepub const fn get_fraction_consecutive_digit_separator(&self) -> bool
pub const fn get_fraction_consecutive_digit_separator(&self) -> bool
Get if multiple consecutive fraction digit separators are allowed.
Sourcepub const fn get_exponent_consecutive_digit_separator(&self) -> bool
pub const fn get_exponent_consecutive_digit_separator(&self) -> bool
Get if multiple consecutive exponent digit separators are allowed.
Sourcepub const fn get_special_digit_separator(&self) -> bool
pub const fn get_special_digit_separator(&self) -> bool
Get if any digit separators are allowed in special (non-finite) values.
Sourcepub const fn digit_separator(self, character: OptionU8) -> Self
pub const fn digit_separator(self, character: OptionU8) -> Self
Set the digit separator for the number format.
Sourcepub const fn required_integer_digits(self, flag: bool) -> Self
pub const fn required_integer_digits(self, flag: bool) -> Self
Set if digits are required before the decimal point.
Sourcepub const fn required_fraction_digits(self, flag: bool) -> Self
pub const fn required_fraction_digits(self, flag: bool) -> Self
Set if digits are required after the decimal point.
Sourcepub const fn required_exponent_digits(self, flag: bool) -> Self
pub const fn required_exponent_digits(self, flag: bool) -> Self
Set if digits are required after the exponent character.
Sourcepub const fn required_mantissa_digits(self, flag: bool) -> Self
pub const fn required_mantissa_digits(self, flag: bool) -> Self
Set if at least 1 significant digit is required.
Sourcepub const fn required_digits(self, flag: bool) -> Self
pub const fn required_digits(self, flag: bool) -> Self
Set if digits are required for all float components.
Sourcepub const fn no_positive_mantissa_sign(self, flag: bool) -> Self
pub const fn no_positive_mantissa_sign(self, flag: bool) -> Self
Set if a positive sign before the mantissa is not allowed.
Sourcepub const fn required_mantissa_sign(self, flag: bool) -> Self
pub const fn required_mantissa_sign(self, flag: bool) -> Self
Set if a sign symbol before the mantissa is required.
Sourcepub const fn no_exponent_notation(self, flag: bool) -> Self
pub const fn no_exponent_notation(self, flag: bool) -> Self
Set if exponent notation is not allowed.
Sourcepub const fn no_positive_exponent_sign(self, flag: bool) -> Self
pub const fn no_positive_exponent_sign(self, flag: bool) -> Self
Set if a positive sign before the exponent is not allowed.
Sourcepub const fn required_exponent_sign(self, flag: bool) -> Self
pub const fn required_exponent_sign(self, flag: bool) -> Self
Set if a sign symbol before the exponent is required.
Sourcepub const fn no_exponent_without_fraction(self, flag: bool) -> Self
pub const fn no_exponent_without_fraction(self, flag: bool) -> Self
Set if an exponent without fraction is not allowed.
Sourcepub const fn no_special(self, flag: bool) -> Self
pub const fn no_special(self, flag: bool) -> Self
Set if special (non-finite) values are not allowed.
Sourcepub const fn case_sensitive_special(self, flag: bool) -> Self
pub const fn case_sensitive_special(self, flag: bool) -> Self
Set if special (non-finite) values are case-sensitive.
Sourcepub const fn no_integer_leading_zeros(self, flag: bool) -> Self
pub const fn no_integer_leading_zeros(self, flag: bool) -> Self
Set if leading zeros before an integer are not allowed.
Sourcepub const fn no_float_leading_zeros(self, flag: bool) -> Self
pub const fn no_float_leading_zeros(self, flag: bool) -> Self
Set if leading zeros before a float are not allowed.
Sourcepub const fn required_exponent_notation(self, flag: bool) -> Self
pub const fn required_exponent_notation(self, flag: bool) -> Self
Set if exponent notation is required.
Sourcepub const fn case_sensitive_exponent(self, flag: bool) -> Self
pub const fn case_sensitive_exponent(self, flag: bool) -> Self
Set if exponent characters are case-sensitive.
Sourcepub const fn integer_internal_digit_separator(self, flag: bool) -> Self
pub const fn integer_internal_digit_separator(self, flag: bool) -> Self
Set if digit separators are allowed between integer digits.
Sourcepub const fn fraction_internal_digit_separator(self, flag: bool) -> Self
pub const fn fraction_internal_digit_separator(self, flag: bool) -> Self
Set if digit separators are allowed between fraction digits.
Sourcepub const fn exponent_internal_digit_separator(self, flag: bool) -> Self
pub const fn exponent_internal_digit_separator(self, flag: bool) -> Self
Set if digit separators are allowed between exponent digits.
Sourcepub const fn internal_digit_separator(self, flag: bool) -> Self
pub const fn internal_digit_separator(self, flag: bool) -> Self
Set all internal digit separator flags.
Sourcepub const fn integer_leading_digit_separator(self, flag: bool) -> Self
pub const fn integer_leading_digit_separator(self, flag: bool) -> Self
Set if a digit separator is allowed before any integer digits.
Sourcepub const fn fraction_leading_digit_separator(self, flag: bool) -> Self
pub const fn fraction_leading_digit_separator(self, flag: bool) -> Self
Set if a digit separator is allowed before any fraction digits.
Sourcepub const fn exponent_leading_digit_separator(self, flag: bool) -> Self
pub const fn exponent_leading_digit_separator(self, flag: bool) -> Self
Set if a digit separator is allowed before any exponent digits.
Sourcepub const fn leading_digit_separator(self, flag: bool) -> Self
pub const fn leading_digit_separator(self, flag: bool) -> Self
Set all leading digit separator flags.
Sourcepub const fn integer_trailing_digit_separator(self, flag: bool) -> Self
pub const fn integer_trailing_digit_separator(self, flag: bool) -> Self
Set if a digit separator is allowed after any integer digits.
Sourcepub const fn fraction_trailing_digit_separator(self, flag: bool) -> Self
pub const fn fraction_trailing_digit_separator(self, flag: bool) -> Self
Set if a digit separator is allowed after any fraction digits.
Sourcepub const fn exponent_trailing_digit_separator(self, flag: bool) -> Self
pub const fn exponent_trailing_digit_separator(self, flag: bool) -> Self
Set if a digit separator is allowed after any exponent digits.
Sourcepub const fn trailing_digit_separator(self, flag: bool) -> Self
pub const fn trailing_digit_separator(self, flag: bool) -> Self
Set all trailing digit separator flags.
Sourcepub const fn integer_consecutive_digit_separator(self, flag: bool) -> Self
pub const fn integer_consecutive_digit_separator(self, flag: bool) -> Self
Set if multiple consecutive integer digit separators are allowed.
Sourcepub const fn fraction_consecutive_digit_separator(self, flag: bool) -> Self
pub const fn fraction_consecutive_digit_separator(self, flag: bool) -> Self
Set if multiple consecutive fraction digit separators are allowed.
Sourcepub const fn exponent_consecutive_digit_separator(self, flag: bool) -> Self
pub const fn exponent_consecutive_digit_separator(self, flag: bool) -> Self
Set if multiple consecutive exponent digit separators are allowed.
Sourcepub const fn consecutive_digit_separator(self, flag: bool) -> Self
pub const fn consecutive_digit_separator(self, flag: bool) -> Self
Set all consecutive digit separator flags.
Sourcepub const fn special_digit_separator(self, flag: bool) -> Self
pub const fn special_digit_separator(self, flag: bool) -> Self
Set if any digit separators are allowed in special (non-finite) values.
Sourcepub const fn digit_separator_flags(self, flag: bool) -> Self
pub const fn digit_separator_flags(self, flag: bool) -> Self
Set all digit separator flag masks.
Sourcepub const fn integer_digit_separator_flags(self, flag: bool) -> Self
pub const fn integer_digit_separator_flags(self, flag: bool) -> Self
Set all integer digit separator flag masks.
Sourcepub const fn fraction_digit_separator_flags(self, flag: bool) -> Self
pub const fn fraction_digit_separator_flags(self, flag: bool) -> Self
Set all fraction digit separator flag masks.
Sourcepub const fn exponent_digit_separator_flags(self, flag: bool) -> Self
pub const fn exponent_digit_separator_flags(self, flag: bool) -> Self
Set all exponent digit separator flag masks.
Sourcepub const fn build(&self) -> u128
pub const fn build(&self) -> u128
Create 128-bit, packed number format struct from builder options.
NOTE: This function will never fail, due to issues with panicking
(and therefore unwrapping Errors/Options) in const fns. It is
therefore up to you to ensure the format is valid, called via the
is_valid function on NumberFormat.