#[non_exhaustive]pub struct NumberConversionConfig {
pub enabled: bool,
pub currency: bool,
pub percent: bool,
pub basis_points: bool,
pub suffixes: bool,
pub fractions: bool,
pub radix: bool,
}Expand description
Configuration for numeric-string detection, used by TypeConversionConfig.
Plain integers/decimals, scientific notation, and thousands-separator cleanup
("1,234.56", "1.234,56", "1 234.56") are always-on “core” behavior whenever
enabled is true – no one asked to disable unambiguous number parsing. The
remaining sub-formats are individually toggleable because each is “opinionated”
(can reinterpret a string that wasn’t meant to be a number) in a way plain numeric
parsing isn’t.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.enabled: boolEnable numeric-string detection and conversion
currency: boolStrip currency symbols ($, etc.), 3-letter currency codes (USD, EUR,
… – only when followed by a space), and credit/debit suffixes (CR/DR).
Default: true.
percent: boolParse %, \u{2030} (permille), and \u{2031} (per-ten-thousand) suffixes.
Default: true.
basis_points: boolParse text basis-point suffixes: "25bp"/"25bps"/"25 bp"/"25 bps".
Default: true.
suffixes: boolParse K/M/B/T magnitude suffixes: "1K", "2.5M", "3B", "1T".
Default: true.
fractions: boolParse fractions: "1/2", "2 1/2". Default: true.
radix: boolParse hex/binary/octal literals: "0x1A2B", "0b1010", "0o777".
Default: true.
Implementations§
Source§impl NumberConversionConfig
impl NumberConversionConfig
Sourcepub fn currency(self, enabled: bool) -> Self
pub fn currency(self, enabled: bool) -> Self
Configure currency symbol/code/credit-debit-suffix stripping
Sourcepub fn percent(self, enabled: bool) -> Self
pub fn percent(self, enabled: bool) -> Self
Configure percent/permille/per-ten-thousand suffix parsing
Sourcepub fn basis_points(self, enabled: bool) -> Self
pub fn basis_points(self, enabled: bool) -> Self
Configure text basis-point suffix parsing
Trait Implementations§
Source§impl Clone for NumberConversionConfig
impl Clone for NumberConversionConfig
Source§fn clone(&self) -> NumberConversionConfig
fn clone(&self) -> NumberConversionConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for NumberConversionConfig
impl Debug for NumberConversionConfig
Source§impl Default for NumberConversionConfig
impl Default for NumberConversionConfig
Source§impl PartialEq for NumberConversionConfig
impl PartialEq for NumberConversionConfig
impl StructuralPartialEq for NumberConversionConfig
Auto Trait Implementations§
impl Freeze for NumberConversionConfig
impl RefUnwindSafe for NumberConversionConfig
impl Send for NumberConversionConfig
impl Sync for NumberConversionConfig
impl Unpin for NumberConversionConfig
impl UnsafeUnpin for NumberConversionConfig
impl UnwindSafe for NumberConversionConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more