Struct VariantDecimal16
pub struct VariantDecimal16 {
integer: i128,
scale: u8,
}Expand description
Represents an 16-byte decimal value in the Variant format.
This struct stores a decimal number using a 128-bit signed integer for the coefficient and an 8-bit unsigned integer for the scale (number of decimal places). Its precision is between 19 and 38 digits.
For valid precision and scale values, see the Variant specification:
§Example: Create a VariantDecimal16
// Create a value representing the decimal 12345678901234567.890
let decimal = VariantDecimal16::try_new(12345678901234567890, 3).unwrap();Fields§
§integer: i128§scale: u8Implementations§
§impl VariantDecimal16
impl VariantDecimal16
pub const MAX_PRECISION: u8 = 38u8
pub const MAX_PRECISION: u8 = 38u8
Maximum number of significant digits (38 for 16-byte decimals)
§impl VariantDecimal16
impl VariantDecimal16
pub fn try_new(integer: i128, scale: u8) -> Result<VariantDecimal16, ArrowError>
pub fn try_new(integer: i128, scale: u8) -> Result<VariantDecimal16, ArrowError>
Attempts to create a new instance of this decimal type, failing if the value is too wide or the scale is too large.
Trait Implementations§
§impl Clone for VariantDecimal16
impl Clone for VariantDecimal16
§fn clone(&self) -> VariantDecimal16
fn clone(&self) -> VariantDecimal16
Returns a duplicate 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 more§impl Debug for VariantDecimal16
impl Debug for VariantDecimal16
§impl Display for VariantDecimal16
impl Display for VariantDecimal16
§impl From<VariantDecimal16> for Variant<'_, '_>
impl From<VariantDecimal16> for Variant<'_, '_>
§fn from(value: VariantDecimal16) -> Variant<'_, '_>
fn from(value: VariantDecimal16) -> Variant<'_, '_>
Converts to this type from the input type.
§impl From<VariantDecimal4> for VariantDecimal16
impl From<VariantDecimal4> for VariantDecimal16
§fn from(decimal: VariantDecimal4) -> VariantDecimal16
fn from(decimal: VariantDecimal4) -> VariantDecimal16
Converts to this type from the input type.
§impl From<VariantDecimal8> for VariantDecimal16
impl From<VariantDecimal8> for VariantDecimal16
§fn from(decimal: VariantDecimal8) -> VariantDecimal16
fn from(decimal: VariantDecimal8) -> VariantDecimal16
Converts to this type from the input type.
§impl PartialEq for VariantDecimal16
impl PartialEq for VariantDecimal16
§impl TryFrom<VariantDecimal16> for VariantDecimal4
impl TryFrom<VariantDecimal16> for VariantDecimal4
§fn try_from(decimal: VariantDecimal16) -> Result<VariantDecimal4, ArrowError>
fn try_from(decimal: VariantDecimal16) -> Result<VariantDecimal4, ArrowError>
Performs the conversion.
§impl TryFrom<VariantDecimal16> for VariantDecimal8
impl TryFrom<VariantDecimal16> for VariantDecimal8
§fn try_from(decimal: VariantDecimal16) -> Result<VariantDecimal8, ArrowError>
fn try_from(decimal: VariantDecimal16) -> Result<VariantDecimal8, ArrowError>
Performs the conversion.
§impl TryFrom<i128> for VariantDecimal16
impl TryFrom<i128> for VariantDecimal16
§impl VariantDecimalType for VariantDecimal16
impl VariantDecimalType for VariantDecimal16
§const MAX_PRECISION: u8 = 38u8
const MAX_PRECISION: u8 = 38u8
Maximum number of significant digits this decimal type can represent (9, 18, or 38)
§const MAX_UNSCALED_VALUE: i128 = 99_999_999_999_999_999_999_999_999_999_999_999_999i128
const MAX_UNSCALED_VALUE: i128 = 99_999_999_999_999_999_999_999_999_999_999_999_999i128
The largest positive unscaled value that fits in
Self::MAX_PRECISION digits.§fn try_new(integer: i128, scale: u8) -> Result<VariantDecimal16, ArrowError>
fn try_new(integer: i128, scale: u8) -> Result<VariantDecimal16, ArrowError>
Creates a new decimal value from the given unscaled integer and scale, failing if the
integer’s width, or the requested scale, exceeds
MAX_PRECISION. Read more§fn try_new_with_signed_scale(
integer: i128,
scale: i8,
) -> Result<VariantDecimal16, ArrowError>
fn try_new_with_signed_scale( integer: i128, scale: i8, ) -> Result<VariantDecimal16, ArrowError>
Attempts to convert an unscaled arrow decimal value to the indicated variant decimal type. Read more
impl Copy for VariantDecimal16
impl StructuralPartialEq for VariantDecimal16
Auto Trait Implementations§
impl Freeze for VariantDecimal16
impl RefUnwindSafe for VariantDecimal16
impl Send for VariantDecimal16
impl Sync for VariantDecimal16
impl Unpin for VariantDecimal16
impl UnwindSafe for VariantDecimal16
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more