pub enum Decimal {
NegativeInf,
Normalized(Decimal),
PositiveInf,
NaN,
}
Variants§
Implementations§
source§impl Decimal
impl Decimal
sourcepub fn to_protobuf(self, output: &mut impl Write) -> ArrayResult<usize>
pub fn to_protobuf(self, output: &mut impl Write) -> ArrayResult<usize>
Used by PrimitiveArray
to serialize the array to protobuf.
sourcepub fn from_protobuf(input: &mut impl Read) -> ArrayResult<Self>
pub fn from_protobuf(input: &mut impl Read) -> ArrayResult<Self>
Used by DecimalValueReader
to deserialize the array from protobuf.
pub fn from_scientific(value: &str) -> Option<Self>
pub fn from_str_radix(s: &str, radix: u32) -> Result<Self>
source§impl Decimal
impl Decimal
pub const MAX_PRECISION: u8 = 28u8
pub fn scale(&self) -> Option<i32>
pub fn rescale(&mut self, scale: u32)
pub fn round_dp_ties_away(&self, dp: u32) -> Self
sourcepub fn round_left_ties_away(&self, left: u32) -> Option<Self>
pub fn round_left_ties_away(&self, left: u32) -> Option<Self>
Round to the left of the decimal point, for example 31.5
-> 30
.
pub fn ceil(&self) -> Self
pub fn floor(&self) -> Self
pub fn trunc(&self) -> Self
pub fn round_ties_even(&self) -> Self
pub fn from_i128_with_scale(num: i128, scale: u32) -> Self
pub fn normalize(&self) -> Self
pub fn unordered_serialize(&self) -> [u8; 16]
pub fn unordered_deserialize(bytes: [u8; 16]) -> Self
pub fn abs(&self) -> Self
pub fn sign(&self) -> Self
pub fn checked_exp(&self) -> Option<Decimal>
pub fn checked_ln(&self) -> Option<Decimal>
pub fn checked_log10(&self) -> Option<Decimal>
pub fn checked_powd(&self, rhs: &Self) -> Result<Self, PowError>
Trait Implementations§
source§impl CheckedAdd for Decimal
impl CheckedAdd for Decimal
source§fn checked_add(&self, other: &Self) -> Option<Self>
fn checked_add(&self, other: &Self) -> Option<Self>
Adds two numbers, checking for overflow. If overflow happens,
None
is
returned.source§impl CheckedDiv for Decimal
impl CheckedDiv for Decimal
source§fn checked_div(&self, other: &Self) -> Option<Self>
fn checked_div(&self, other: &Self) -> Option<Self>
Divides two numbers, checking for underflow, overflow and division by
zero. If any of that happens,
None
is returned.source§impl CheckedMul for Decimal
impl CheckedMul for Decimal
source§fn checked_mul(&self, other: &Self) -> Option<Self>
fn checked_mul(&self, other: &Self) -> Option<Self>
Multiplies two numbers, checking for underflow or overflow. If underflow
or overflow happens,
None
is returned.source§impl CheckedNeg for Decimal
impl CheckedNeg for Decimal
source§fn checked_neg(&self) -> Option<Self>
fn checked_neg(&self) -> Option<Self>
Negates a number, returning
None
for results that can’t be represented, like signed MIN
values that can’t be positive, or non-zero unsigned values that can’t be negative. Read moresource§impl CheckedRem for Decimal
impl CheckedRem for Decimal
source§fn checked_rem(&self, other: &Self) -> Option<Self>
fn checked_rem(&self, other: &Self) -> Option<Self>
Finds the remainder of dividing two numbers, checking for underflow, overflow and division
by zero. If any of that happens,
None
is returned. Read moresource§impl CheckedSub for Decimal
impl CheckedSub for Decimal
source§fn checked_sub(&self, other: &Self) -> Option<Self>
fn checked_sub(&self, other: &Self) -> Option<Self>
Subtracts two numbers, checking for underflow. If underflow happens,
None
is returned.source§impl From<Decimal> for ScalarImpl
impl From<Decimal> for ScalarImpl
source§impl<'scalar> From<Decimal> for ScalarRefImpl<'scalar>
impl<'scalar> From<Decimal> for ScalarRefImpl<'scalar>
source§impl<'a> FromSql<'a> for Decimal
impl<'a> FromSql<'a> for Decimal
source§fn from_sql(
ty: &Type,
raw: &'a [u8],
) -> Result<Self, Box<dyn Error + Sync + Send + 'static>>
fn from_sql( ty: &Type, raw: &'a [u8], ) -> Result<Self, Box<dyn Error + Sync + Send + 'static>>
Creates a new value of this type from a buffer of data of the specified
Postgres
Type
in its binary format. Read moresource§fn accepts(ty: &Type) -> bool
fn accepts(ty: &Type) -> bool
Determines if a value of this type can be created from the specified
Postgres
Type
.source§impl HashKeyDe for Decimal
impl HashKeyDe for Decimal
fn deserialize(_data_type: &DataType, buf: impl Buf) -> Self
source§impl HashKeySer<'_> for Decimal
impl HashKeySer<'_> for Decimal
source§fn serialize_into(self, buf: impl BufMut)
fn serialize_into(self, buf: impl BufMut)
Serialize the scalar into the given buffer.
source§fn exact_size() -> Option<usize>
fn exact_size() -> Option<usize>
Returns
Some
if the serialized size is known for this scalar type.source§fn estimated_size(self) -> usize
fn estimated_size(self) -> usize
Returns the estimated serialized size for this scalar.
source§impl Num for Decimal
impl Num for Decimal
type FromStrRadixErr = Error
source§fn from_str_radix(str: &str, radix: u32) -> Result<Self, Self::FromStrRadixErr>
fn from_str_radix(str: &str, radix: u32) -> Result<Self, Self::FromStrRadixErr>
Convert from a string and radix (typically
2..=36
). Read moresource§impl Ord for Decimal
impl Ord for Decimal
source§impl PartialOrd for Decimal
impl PartialOrd for Decimal
source§impl PrimitiveArrayItemType for Decimal
impl PrimitiveArrayItemType for Decimal
source§fn erase_array_type(arr: PrimitiveArray<Self>) -> ArrayImpl
fn erase_array_type(arr: PrimitiveArray<Self>) -> ArrayImpl
A helper to convert a primitive array to
ArrayImpl
.source§fn try_into_array(arr: ArrayImpl) -> Option<PrimitiveArray<Self>>
fn try_into_array(arr: ArrayImpl) -> Option<PrimitiveArray<Self>>
A helper to convert
ArrayImpl
to self.source§fn try_into_array_ref(arr: &ArrayImpl) -> Option<&PrimitiveArray<Self>>
fn try_into_array_ref(arr: &ArrayImpl) -> Option<&PrimitiveArray<Self>>
A helper to convert
ArrayImpl
to self.source§fn array_type() -> ArrayType
fn array_type() -> ArrayType
Returns array type of the primitive array
fn to_protobuf<T: Write>(self, output: &mut T) -> ArrayResult<usize>
fn from_protobuf(cur: &mut Cursor<&[u8]>) -> ArrayResult<Self>
source§impl Scalar for Decimal
impl Scalar for Decimal
Implement Scalar
for Decimal
.
source§type ScalarRefType<'a> = Decimal
type ScalarRefType<'a> = Decimal
Type for reference of
Scalar
source§fn as_scalar_ref(&self) -> Decimal
fn as_scalar_ref(&self) -> Decimal
Get a reference to current scalar.
fn to_scalar_value(self) -> ScalarImpl
source§impl ScalarRef<'_> for Decimal
impl ScalarRef<'_> for Decimal
Implement ScalarRef
for Decimal
.
source§type ScalarType = Decimal
type ScalarType = Decimal
ScalarType
is the owned type of current ScalarRef
.source§fn to_owned_scalar(&self) -> Decimal
fn to_owned_scalar(&self) -> Decimal
Convert
ScalarRef
to an owned scalar.source§fn hash_scalar<H: Hasher>(&self, state: &mut H)
fn hash_scalar<H: Hasher>(&self, state: &mut H)
A wrapped hash function to get the hash value for this scaler.
source§impl ToBinary for Decimal
impl ToBinary for Decimal
fn to_binary_with_type(&self, ty: &DataType) -> Result<Bytes, ToBinaryError>
source§impl ToSql for Decimal
impl ToSql for Decimal
source§fn accepts(ty: &Type) -> bool
fn accepts(ty: &Type) -> bool
Determines if a value of this type can be converted to the specified
Postgres
Type
.source§fn to_sql_checked(
&self,
ty: &Type,
out: &mut BytesMut,
) -> Result<IsNull, Box<dyn Error + Sync + Send>>
fn to_sql_checked( &self, ty: &Type, out: &mut BytesMut, ) -> Result<IsNull, Box<dyn Error + Sync + Send>>
An adaptor method used internally by Rust-Postgres. Read more
source§fn to_sql(
&self,
ty: &Type,
out: &mut BytesMut,
) -> Result<IsNull, Box<dyn Error + Sync + Send>>where
Self: Sized,
fn to_sql(
&self,
ty: &Type,
out: &mut BytesMut,
) -> Result<IsNull, Box<dyn Error + Sync + Send>>where
Self: Sized,
Converts the value of
self
into the binary format of the specified
Postgres Type
, appending it to out
. Read more§fn encode_format(&self, _ty: &Type) -> Format
fn encode_format(&self, _ty: &Type) -> Format
Specify the encode format
source§impl ToText for Decimal
impl ToText for Decimal
source§fn write<W: Write>(&self, f: &mut W) -> Result
fn write<W: Write>(&self, f: &mut W) -> Result
Write the text to the writer regardless of its data type Read more
source§fn write_with_type<W: Write>(&self, ty: &DataType, f: &mut W) -> Result
fn write_with_type<W: Write>(&self, ty: &DataType, f: &mut W) -> Result
Write the text to the writer according to its data type
source§fn to_text_with_type(&self, ty: &DataType) -> String
fn to_text_with_type(&self, ty: &DataType) -> String
Convert to text according to its data type
source§impl TryFrom<ScalarImpl> for Decimal
impl TryFrom<ScalarImpl> for Decimal
source§type Error = ArrayError
type Error = ArrayError
The type returned in the event of a conversion error.
source§fn try_from(val: ScalarImpl) -> ArrayResult<Self>
fn try_from(val: ScalarImpl) -> ArrayResult<Self>
Performs the conversion.
source§impl<'scalar> TryFrom<ScalarRefImpl<'scalar>> for Decimal
impl<'scalar> TryFrom<ScalarRefImpl<'scalar>> for Decimal
source§type Error = ArrayError
type Error = ArrayError
The type returned in the event of a conversion error.
source§fn try_from(val: ScalarRefImpl<'scalar>) -> ArrayResult<Self>
fn try_from(val: ScalarRefImpl<'scalar>) -> ArrayResult<Self>
Performs the conversion.
source§impl<'a> WithDataType for &'a Decimal
impl<'a> WithDataType for &'a Decimal
source§fn default_data_type() -> DataType
fn default_data_type() -> DataType
Returns the most obvious
DataType
for the rust type.source§impl<'a> WithDataType for &'a mut Decimal
impl<'a> WithDataType for &'a mut Decimal
source§fn default_data_type() -> DataType
fn default_data_type() -> DataType
Returns the most obvious
DataType
for the rust type.source§impl WithDataType for Box<Decimal>
impl WithDataType for Box<Decimal>
source§fn default_data_type() -> DataType
fn default_data_type() -> DataType
Returns the most obvious
DataType
for the rust type.source§impl WithDataType for Decimal
impl WithDataType for Decimal
source§fn default_data_type() -> DataType
fn default_data_type() -> DataType
Returns the most obvious
DataType
for the rust type.impl Copy for Decimal
impl Eq for Decimal
impl StructuralPartialEq for Decimal
impl ZeroHeapSize for Decimal
Auto Trait Implementations§
impl Freeze for Decimal
impl RefUnwindSafe for Decimal
impl Send for Decimal
impl Sync for Decimal
impl Unpin for Decimal
impl UnwindSafe for Decimal
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
§impl<T> BorrowToSql for Twhere
T: ToSql,
impl<T> BorrowToSql for Twhere
T: ToSql,
§fn borrow_to_sql(&self) -> &dyn ToSql
fn borrow_to_sql(&self) -> &dyn ToSql
Returns a reference to
self
as a ToSql
trait object.source§impl<T> CheckedAdd for Twhere
T: CheckedAdd,
impl<T> CheckedAdd for Twhere
T: CheckedAdd,
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
source§impl<T> EstimateSize for Twhere
T: ZeroHeapSize,
impl<T> EstimateSize for Twhere
T: ZeroHeapSize,
source§fn estimated_heap_size(&self) -> usize
fn estimated_heap_size(&self) -> usize
The estimated heap size of the current struct in bytes.
source§fn estimated_size(&self) -> usizewhere
Self: Sized,
fn estimated_size(&self) -> usizewhere
Self: Sized,
The estimated total size of the current struct in bytes, including the
estimated_heap_size
and the size of Self
.§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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 moresource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request
§impl<T> IntoResult<T> for T
impl<T> IntoResult<T> for T
type Err = Infallible
fn into_result(self) -> Result<T, <T as IntoResult<T>>::Err>
source§impl<T> IsNegative for T
impl<T> IsNegative for T
fn is_negative(&self) -> bool
source§impl<M> MetricVecRelabelExt for M
impl<M> MetricVecRelabelExt for M
source§fn relabel(
self,
metric_level: MetricLevel,
relabel_threshold: MetricLevel,
) -> RelabeledMetricVec<M>
fn relabel( self, metric_level: MetricLevel, relabel_threshold: MetricLevel, ) -> RelabeledMetricVec<M>
Equivalent to
RelabeledMetricVec::with_metric_level
.source§fn relabel_n(
self,
metric_level: MetricLevel,
relabel_threshold: MetricLevel,
relabel_num: usize,
) -> RelabeledMetricVec<M>
fn relabel_n( self, metric_level: MetricLevel, relabel_threshold: MetricLevel, relabel_num: usize, ) -> RelabeledMetricVec<M>
Equivalent to
RelabeledMetricVec::with_metric_level_relabel_n
.source§fn relabel_debug_1(
self,
relabel_threshold: MetricLevel,
) -> RelabeledMetricVec<M>
fn relabel_debug_1( self, relabel_threshold: MetricLevel, ) -> RelabeledMetricVec<M>
Equivalent to
RelabeledMetricVec::with_metric_level_relabel_n
with metric_level
set to
MetricLevel::Debug
and relabel_num
set to 1.§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<T> ScalarPartialOrd for Twhere
T: PrimitiveArrayItemType + Scalar,
impl<T> ScalarPartialOrd for Twhere
T: PrimitiveArrayItemType + Scalar,
fn scalar_cmp(&self, other: T) -> Option<Ordering>
source§impl<T> ToOwnedDatum for Twhere
T: Into<ScalarImpl>,
impl<T> ToOwnedDatum for Twhere
T: Into<ScalarImpl>,
source§fn to_owned_datum(self) -> Option<ScalarImpl>
fn to_owned_datum(self) -> Option<ScalarImpl>
Convert the datum to an owned
Datum
.