pub struct Decimal256 { /* private fields */ }
Expand description
Represents a decimal value with precision and scale. The decimal value could be represented by a signed 256-bit integer.
Implementations
sourceimpl Decimal256
impl Decimal256
sourcepub fn from_big_int(
num: &BigInt,
precision: usize,
scale: usize
) -> Result<Decimal256>
pub fn from_big_int(
num: &BigInt,
precision: usize,
scale: usize
) -> Result<Decimal256>
Constructs a Decimal256
value from a BigInt
.
Trait Implementations
sourceimpl BasicDecimal for Decimal256
impl BasicDecimal for Decimal256
sourceconst MAX_PRECISION: usize = 76usize
const MAX_PRECISION: usize = 76usize
The maximum precision.
sourcefn new(precision: usize, scale: usize, bytes: &[u8]) -> Self
fn new(precision: usize, scale: usize, bytes: &[u8]) -> Self
Creates a decimal value from precision, scale, and bytes. Read more
sourcefn raw_value(&self) -> &[u8]ⓘNotable traits for &mut [u8]impl Write for &mut [u8]impl Read for &[u8]
fn raw_value(&self) -> &[u8]ⓘNotable traits for &mut [u8]impl Write for &mut [u8]impl Read for &[u8]
Returns the raw bytes of the integer representation of the decimal.
sourcefn try_new_from_bytes(
precision: usize,
scale: usize,
bytes: &[u8]
) -> Result<Self> where
Self: Sized,
fn try_new_from_bytes(
precision: usize,
scale: usize,
bytes: &[u8]
) -> Result<Self> where
Self: Sized,
Tries to create a decimal value from precision, scale and bytes. If the length of bytes isn’t same as the bit width of this decimal, returning an error. The bytes should be stored in little-endian order. Read more
sourceimpl BasicDecimalArray<Decimal256, Decimal256Array> for Decimal256Array
impl BasicDecimalArray<Decimal256, Decimal256Array> for Decimal256Array
const VALUE_LENGTH: i32 = 32i32
const DEFAULT_TYPE: DataType = _
const MAX_PRECISION: usize = 76usize
const MAX_SCALE: usize = 76usize
fn data(&self) -> &ArrayData
sourcefn precision(&self) -> usize
fn precision(&self) -> usize
Return the precision (total digits) that can be stored by this array
sourcefn scale(&self) -> usize
fn scale(&self) -> usize
Return the scale (digits after the decimal) that can be stored by this array
sourcefn validate_decimal_precision(&self, precision: usize) -> Result<()>
fn validate_decimal_precision(&self, precision: usize) -> Result<()>
Validates decimal values in this array can be properly interpreted with the specified precision. Read more
sourceunsafe fn value_unchecked(&self, i: usize) -> T
unsafe fn value_unchecked(&self, i: usize) -> T
Returns the element at index i
. Read more
sourcefn value_offset(&self, i: usize) -> i32
fn value_offset(&self, i: usize) -> i32
Returns the offset for the element at index i
. Read more
sourcefn value_length(&self) -> i32
fn value_length(&self) -> i32
Returns the length for an element. Read more
sourcefn value_data(&self) -> Buffer
fn value_data(&self) -> Buffer
Returns a clone of the value data buffer
fn value_offset_at(&self, i: usize) -> i32
fn value_as_string(&self, row: usize) -> String
sourcefn from_fixed_size_binary_array(
v: FixedSizeBinaryArray,
precision: usize,
scale: usize
) -> U
fn from_fixed_size_binary_array(
v: FixedSizeBinaryArray,
precision: usize,
scale: usize
) -> U
Build a decimal array from FixedSizeBinaryArray
. Read more
sourcefn from_fixed_size_list_array(
v: FixedSizeListArray,
precision: usize,
scale: usize
) -> U
fn from_fixed_size_list_array(
v: FixedSizeListArray,
precision: usize,
scale: usize
) -> U
please use from_fixed_size_binary_array
instead
Build a decimal array from FixedSizeListArray
. Read more
sourcefn default_type() -> DataType
fn default_type() -> DataType
The default precision and scale used when not specified.
sourceimpl Debug for Decimal256
impl Debug for Decimal256
sourceimpl From<BigInt> for Decimal256
impl From<BigInt> for Decimal256
sourceimpl Ord for Decimal256
impl Ord for Decimal256
1.21.0 · sourcefn max(self, other: Self) -> Self
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
1.21.0 · sourcefn min(self, other: Self) -> Self
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
1.50.0 · sourcefn clamp(self, min: Self, max: Self) -> Self where
Self: PartialOrd<Self>,
fn clamp(self, min: Self, max: Self) -> Self where
Self: PartialOrd<Self>,
Restrict a value to a certain interval. Read more
sourceimpl PartialEq<Decimal256> for Decimal256
impl PartialEq<Decimal256> for Decimal256
sourceimpl PartialOrd<Decimal256> for Decimal256
impl PartialOrd<Decimal256> for Decimal256
sourcefn partial_cmp(&self, other: &Self) -> Option<Ordering>
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl Eq for Decimal256
Auto Trait Implementations
impl RefUnwindSafe for Decimal256
impl Send for Decimal256
impl Sync for Decimal256
impl Unpin for Decimal256
impl UnwindSafe for Decimal256
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to key
and return true
if they are equal.