pub struct TPCHDecimal(pub i64);Expand description
Represents a decimal with a scale of 2.
For example TPCHDecimal(1234) represents 12.34.
A ‘decimal’ column should be able to fit any values in the the range [-9_999_999_999.99, +9_999_999_999.99] in increments of 0.01.
Tuple Fields§
§0: i64Implementations§
Source§impl TPCHDecimal
impl TPCHDecimal
pub const ZERO: TPCHDecimal
Sourcepub fn new(value: i64) -> Self
pub fn new(value: i64) -> Self
Create a new decimal value.
§Example
use tpchgen::decimal::TPCHDecimal;
let decimal = TPCHDecimal::new(1234);
assert_eq!(decimal.to_string(), "12.34");Sourcepub const fn as_f64(&self) -> f64
pub const fn as_f64(&self) -> f64
Converts the decimal value to an f64.
This is a potentially lossy conversion.
Sourcepub const fn is_negative(&self) -> bool
pub const fn is_negative(&self) -> bool
Returns if this decimal is negative.
Sourcepub const fn int_digits(&self) -> i64
pub const fn int_digits(&self) -> i64
Returns the digits before the decimal point.
Sourcepub const fn decimal_digits(&self) -> i64
pub const fn decimal_digits(&self) -> i64
Returns the digits after the decimal point.
Sourcepub const fn into_inner(self) -> i64
pub const fn into_inner(self) -> i64
Return the inner i64 value.
Trait Implementations§
Source§impl Clone for TPCHDecimal
impl Clone for TPCHDecimal
Source§fn clone(&self) -> TPCHDecimal
fn clone(&self) -> TPCHDecimal
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TPCHDecimal
impl Debug for TPCHDecimal
Source§impl Display for TPCHDecimal
impl Display for TPCHDecimal
Source§impl Ord for TPCHDecimal
impl Ord for TPCHDecimal
Source§fn cmp(&self, other: &TPCHDecimal) -> Ordering
fn cmp(&self, other: &TPCHDecimal) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for TPCHDecimal
impl PartialEq for TPCHDecimal
Source§impl PartialOrd for TPCHDecimal
impl PartialOrd for TPCHDecimal
impl Copy for TPCHDecimal
impl Eq for TPCHDecimal
impl StructuralPartialEq for TPCHDecimal
Auto Trait Implementations§
impl Freeze for TPCHDecimal
impl RefUnwindSafe for TPCHDecimal
impl Send for TPCHDecimal
impl Sync for TPCHDecimal
impl Unpin for TPCHDecimal
impl UnwindSafe for TPCHDecimal
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
Mutably borrows from an owned value. Read more