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: StringTrue 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: StringTrue 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: StringTrue 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
impl DecimalFit
Sourcepub fn by_regular_expression(
precision: u8,
scale: u8,
matches: impl Fn(&str) -> String,
) -> Self
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.