NumberParserSettings

Struct NumberParserSettings 

Source
pub struct NumberParserSettings {
    pub permit_underscores: bool,
    pub permit_hexadecimal: bool,
    pub permit_octal: bool,
    pub permit_binary: bool,
    pub permit_plus: bool,
    pub hexadecimal_indicator: Vec<char>,
    pub octal_indicator: Vec<char>,
    pub binary_indicator: Vec<char>,
    pub decimal_only_floats: bool,
    pub permit_empty_whole: bool,
    pub permit_empty_fraction: bool,
    pub permit_leading_zero: bool,
}
Expand description

Provide the number parser configuration. You will seldom use this directly. Instead, reference the current settings through a NumberParser instance.

Fields§

§permit_underscores: bool

Allow underscores in numbers. If this is true, then arbitrary underscores can occur in numbers, and these are dropped during parsing. If false, then underscores are not permitted.

§permit_hexadecimal: bool

If true, methods that do not explicitly specify a radix will try to detect and parse hexadecimal numbers.

§permit_octal: bool

If true, methods that do not explicitly specify a radix will try to detect and parse octal numbers.

§permit_binary: bool

If true, methods that do not explicitly specify a radix will try to detect and parse binary numbers.

§permit_plus: bool

If true, allow a number to start with a plus sign.

§hexadecimal_indicator: Vec<char>

Specify the characters that indicate a hexadecimal value.

§octal_indicator: Vec<char>

Specify the characters that indicate an octal value.

§binary_indicator: Vec<char>

Specify the characters that indicate a binary value.

§decimal_only_floats: bool

If true, floating point numbers can be in non-decimal radix.

§permit_empty_whole: bool

If true, permit an empty whole part. That is, .15 is legal.

§permit_empty_fraction: bool

If true, permit an empty fractional part. That is, 15. is legal.

§permit_leading_zero: bool

If true, permit a leading zero for a non-zero whole. That is, 01.5 is legal.

NB: This only applies to decimal numbers, as leading zeros are common and expected in other bases.

Implementations§

Source§

impl NumberParserSettings

Source

pub fn new() -> Self

Make a new instance. The parsing rules are maximally permissive.

Trait Implementations§

Source§

impl Clone for NumberParserSettings

Source§

fn clone(&self) -> NumberParserSettings

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for NumberParserSettings

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for NumberParserSettings

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.