Skip to main content

DecimalFit

Struct DecimalFit 

Source
pub struct DecimalFit {
    pub plain: String,
    pub past_room: String,
    pub past_scale: String,
}
Expand description

Three questions a load asks of a number written as text, each a condition over the value, for a column declared decimal(precision, scale) (ExpressionRenderer::render_decimal_fit).

Fields§

§plain: String

True of a value written as a plain number: digits, at most one point, and at most one sign, ahead of them. It may be true of a value with no digits at all, such as the empty text or a lone point.

§past_room: String

True where a digit other than 0 stands more places before the point than the column leaves room for, precision - scale, counted from the point (or from the end, where there is none). Asked of any text; false of every plain number that fits.

§past_scale: String

True where a digit other than 0 stands more places after the point than scale. Asked of any text; false of every plain number that fits.

Implementations§

Source§

impl DecimalFit

Source

pub fn by_regular_expression( precision: u8, scale: u8, matches: impl Fn(&str) -> String, ) -> Self

The three questions as regular expressions, each pattern handed to matches to be written as the engine matches one somewhere in the value (text ~ 'pattern', regexp_matches(text, 'pattern')): a plain number is an optional sign, digits and at most one point; a digit other than 0 followed by the column’s room in digits, before any point, is too large; one past the scale after the point is a place the column does not keep. The patterns hold no backslash and no quote, so they read the same under every string-literal setting.

Trait Implementations§

Source§

impl Clone for DecimalFit

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for DecimalFit

Source§

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

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

impl Eq for DecimalFit

Source§

impl PartialEq for DecimalFit

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for DecimalFit

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.