[−][src]Struct pgnumeric::Numeric
A slice of a numeric.
This is an unsized type, meaning that it must always be used behind a
pointer like &
or Box
. For an owned version of this type,
see NumericBuf
.
Implementations
impl Numeric
[src]
pub unsafe fn from_bytes_unchecked(value: &[u8]) -> &Numeric
[src]
Creates a Numeric
from bytes slice.
Safety
Caller have to guaranteed the value
bytes slice is a valid Numeric
.
pub fn nan() -> &'static Numeric
[src]
Creates a NaN
numeric.
pub fn zero() -> &'static Numeric
[src]
Creates a zero
numeric.
pub fn as_bytes(&self) -> &[u8]
[src]
Extracts a byte slice contains the entire numeric.
pub fn is_nan(&self) -> bool
[src]
Checks if self
is NaN
.
pub fn is_negative(&self) -> bool
[src]
Checks if self
is negative.
pub fn is_positive(&self) -> bool
[src]
Checks if self
is positive.
pub fn scale(&self) -> Option<i32>
[src]
Returns the scale, i.e. the count of decimal digits in the fractional part.
Returns None
if self
is NaN
.
pub fn negate(&self) -> NumericBuf
[src]
Negate this value.
pub fn signum(&self) -> NumericBuf
[src]
Returns a numeric that represents the sign of self.
- -1 if
self
is less than 0 - 0 if
self
is equal to 0 - 1 if
self
is greater than zero NaN
ifself
isNaN
pub fn inc(&self) -> NumericBuf
[src]
pub fn checked_add(&self, other: &Self) -> Option<NumericBuf>
[src]
Add two numerics,
returning None
if overflow occurred.
pub fn checked_sub(&self, other: &Self) -> Option<NumericBuf>
[src]
Subtract one numeric from another,
returning None
if overflow occurred.
pub fn checked_mul(&self, other: &Self) -> Option<NumericBuf>
[src]
Calculate the product of two numerics,
returning None
if overflow occurred.
pub fn checked_div(&self, other: &Self) -> Option<NumericBuf>
[src]
Checked numeric division.
Computes self / other
, returning None
if other == 0
or the division results in overflow.
pub fn checked_div_trunc(&self, other: &Self) -> Option<NumericBuf>
[src]
Computes self / other
, truncating the result to an integer.
Returns None
if other == 0
or the division results in overflow.
pub fn checked_rem(&self, other: &Self) -> Option<NumericBuf>
[src]
Checked numeric remainder.
Computes self % other
, returning None if rhs == 0 or the division results in overflow.
pub fn round(&self, scale: i32) -> NumericBuf
[src]
Round a value to have scale
digits after the decimal point.
We allow negative scale
, implying rounding before the decimal
point --- Oracle interprets rounding that way.
Panics
Panics if overflows.
pub fn trunc(&self, scale: i32) -> NumericBuf
[src]
Truncate a value to have scale
digits after the decimal point.
We allow negative scale
, implying a truncation before the decimal
point --- Oracle interprets truncation that way.
pub fn ceil(&self) -> NumericBuf
[src]
pub fn floor(&self) -> NumericBuf
[src]
pub fn abs(&self) -> NumericBuf
[src]
Compute the absolute value of self
.
pub fn sqrt(&self) -> NumericBuf
[src]
pub fn ln(&self) -> NumericBuf
[src]
pub fn log(&self, base: &Self) -> NumericBuf
[src]
pub fn log2(&self) -> NumericBuf
[src]
pub fn log10(&self) -> NumericBuf
[src]
pub fn exp(&self) -> Option<NumericBuf>
[src]
Raise e to the power of self
(e^(self)
).
Returns None
if overflows.
pub fn pow(&self, exp: &Self) -> Option<NumericBuf>
[src]
Raise self
to the power of exp
.
Returns None
if overflows.
Panics
if arguments are invalid:
self
is zero andexp
is less than zeroself
is less than zero andexp
is not a integer.
pub fn normalize(&self) -> String
[src]
Returns a normalized string, suppressing insignificant trailing zeroes and then any trailing decimal point.
The intent of this is to produce strings that are equal if and only if the input numeric values compare equal.
Trait Implementations
impl<'_, '_> Add<&'_ Numeric> for &'_ NumericBuf
[src]
type Output = NumericBuf
The resulting type after applying the +
operator.
fn add(self, other: &Numeric) -> Self::Output
[src]
impl<'_> Add<&'_ Numeric> for NumericBuf
[src]
type Output = NumericBuf
The resulting type after applying the +
operator.
fn add(self, other: &Numeric) -> Self::Output
[src]
impl<'_, '_> Add<&'_ Numeric> for &'_ Numeric
[src]
type Output = NumericBuf
The resulting type after applying the +
operator.
fn add(self, other: &Numeric) -> Self::Output
[src]
impl<'_, '_> Add<&'_ NumericBuf> for &'_ Numeric
[src]
type Output = NumericBuf
The resulting type after applying the +
operator.
fn add(self, other: &NumericBuf) -> Self::Output
[src]
impl<'_> Add<NumericBuf> for &'_ Numeric
[src]
type Output = NumericBuf
The resulting type after applying the +
operator.
fn add(self, other: NumericBuf) -> Self::Output
[src]
impl<'_> AddAssign<&'_ Numeric> for NumericBuf
[src]
fn add_assign(&mut self, other: &Numeric)
[src]
impl AsRef<Numeric> for NumericBuf
[src]
impl Borrow<Numeric> for NumericBuf
[src]
impl Debug for Numeric
[src]
impl Display for Numeric
[src]
impl<'_, '_> Div<&'_ Numeric> for &'_ NumericBuf
[src]
type Output = NumericBuf
The resulting type after applying the /
operator.
fn div(self, other: &Numeric) -> Self::Output
[src]
impl<'_> Div<&'_ Numeric> for NumericBuf
[src]
type Output = NumericBuf
The resulting type after applying the /
operator.
fn div(self, other: &Numeric) -> Self::Output
[src]
impl<'_, '_> Div<&'_ Numeric> for &'_ Numeric
[src]
type Output = NumericBuf
The resulting type after applying the /
operator.
fn div(self, other: &Numeric) -> Self::Output
[src]
impl<'_, '_> Div<&'_ NumericBuf> for &'_ Numeric
[src]
type Output = NumericBuf
The resulting type after applying the /
operator.
fn div(self, other: &NumericBuf) -> Self::Output
[src]
impl<'_> Div<NumericBuf> for &'_ Numeric
[src]
type Output = NumericBuf
The resulting type after applying the /
operator.
fn div(self, other: NumericBuf) -> Self::Output
[src]
impl<'_> DivAssign<&'_ Numeric> for NumericBuf
[src]
fn div_assign(&mut self, other: &Numeric)
[src]
impl Eq for Numeric
[src]
impl<'a> From<&'a Numeric> for Cow<'a, Numeric>
[src]
impl Hash for Numeric
[src]
fn hash<H: Hasher>(&self, state: &mut H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl LowerExp for Numeric
[src]
impl<'_, '_> Mul<&'_ Numeric> for &'_ Numeric
[src]
type Output = NumericBuf
The resulting type after applying the *
operator.
fn mul(self, other: &Numeric) -> Self::Output
[src]
impl<'_> Mul<&'_ Numeric> for NumericBuf
[src]
type Output = NumericBuf
The resulting type after applying the *
operator.
fn mul(self, other: &Numeric) -> Self::Output
[src]
impl<'_, '_> Mul<&'_ Numeric> for &'_ NumericBuf
[src]
type Output = NumericBuf
The resulting type after applying the *
operator.
fn mul(self, other: &Numeric) -> Self::Output
[src]
impl<'_, '_> Mul<&'_ NumericBuf> for &'_ Numeric
[src]
type Output = NumericBuf
The resulting type after applying the *
operator.
fn mul(self, other: &NumericBuf) -> Self::Output
[src]
impl<'_> Mul<NumericBuf> for &'_ Numeric
[src]
type Output = NumericBuf
The resulting type after applying the *
operator.
fn mul(self, other: NumericBuf) -> Self::Output
[src]
impl<'_> MulAssign<&'_ Numeric> for NumericBuf
[src]
fn mul_assign(&mut self, other: &Numeric)
[src]
impl<'_> Neg for &'_ Numeric
[src]
type Output = NumericBuf
The resulting type after applying the -
operator.
fn neg(self) -> Self::Output
[src]
impl Ord for Numeric
[src]
fn cmp(&self, other: &Self) -> Ordering
[src]
#[must_use]fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn clamp(self, min: Self, max: Self) -> Self
[src]
impl<'_> PartialEq<&'_ Numeric> for NumericBuf
[src]
impl<'_> PartialEq<&'_ Numeric> for Numeric
[src]
impl PartialEq<Numeric> for Numeric
[src]
impl PartialEq<Numeric> for NumericBuf
[src]
impl<'_> PartialEq<Numeric> for &'_ Numeric
[src]
impl PartialEq<NumericBuf> for Numeric
[src]
impl<'_> PartialEq<NumericBuf> for &'_ Numeric
[src]
impl<'_> PartialOrd<&'_ Numeric> for NumericBuf
[src]
fn partial_cmp(&self, other: &&Numeric) -> Option<Ordering>
[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'_> PartialOrd<&'_ Numeric> for Numeric
[src]
fn partial_cmp(&self, other: &&Numeric) -> Option<Ordering>
[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl PartialOrd<Numeric> for Numeric
[src]
fn partial_cmp(&self, other: &Numeric) -> Option<Ordering>
[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl PartialOrd<Numeric> for NumericBuf
[src]
fn partial_cmp(&self, other: &Numeric) -> Option<Ordering>
[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'_> PartialOrd<Numeric> for &'_ Numeric
[src]
fn partial_cmp(&self, other: &Numeric) -> Option<Ordering>
[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl PartialOrd<NumericBuf> for Numeric
[src]
fn partial_cmp(&self, other: &NumericBuf) -> Option<Ordering>
[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'_> PartialOrd<NumericBuf> for &'_ Numeric
[src]
fn partial_cmp(&self, other: &NumericBuf) -> Option<Ordering>
[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'_, '_> Rem<&'_ Numeric> for &'_ NumericBuf
[src]
type Output = NumericBuf
The resulting type after applying the %
operator.
fn rem(self, other: &Numeric) -> Self::Output
[src]
impl<'_> Rem<&'_ Numeric> for NumericBuf
[src]
type Output = NumericBuf
The resulting type after applying the %
operator.
fn rem(self, other: &Numeric) -> Self::Output
[src]
impl<'_, '_> Rem<&'_ Numeric> for &'_ Numeric
[src]
type Output = NumericBuf
The resulting type after applying the %
operator.
fn rem(self, other: &Numeric) -> Self::Output
[src]
impl<'_, '_> Rem<&'_ NumericBuf> for &'_ Numeric
[src]
type Output = NumericBuf
The resulting type after applying the %
operator.
fn rem(self, other: &NumericBuf) -> Self::Output
[src]
impl<'_> Rem<NumericBuf> for &'_ Numeric
[src]
type Output = NumericBuf
The resulting type after applying the %
operator.
fn rem(self, other: NumericBuf) -> Self::Output
[src]
impl<'_> RemAssign<&'_ Numeric> for NumericBuf
[src]
fn rem_assign(&mut self, other: &Numeric)
[src]
impl<'_, '_> Sub<&'_ Numeric> for &'_ Numeric
[src]
type Output = NumericBuf
The resulting type after applying the -
operator.
fn sub(self, other: &Numeric) -> Self::Output
[src]
impl<'_> Sub<&'_ Numeric> for NumericBuf
[src]
type Output = NumericBuf
The resulting type after applying the -
operator.
fn sub(self, other: &Numeric) -> Self::Output
[src]
impl<'_, '_> Sub<&'_ Numeric> for &'_ NumericBuf
[src]
type Output = NumericBuf
The resulting type after applying the -
operator.
fn sub(self, other: &Numeric) -> Self::Output
[src]
impl<'_, '_> Sub<&'_ NumericBuf> for &'_ Numeric
[src]
type Output = NumericBuf
The resulting type after applying the -
operator.
fn sub(self, other: &NumericBuf) -> Self::Output
[src]
impl<'_> Sub<NumericBuf> for &'_ Numeric
[src]
type Output = NumericBuf
The resulting type after applying the -
operator.
fn sub(self, other: NumericBuf) -> Self::Output
[src]
impl<'_> SubAssign<&'_ Numeric> for NumericBuf
[src]
fn sub_assign(&mut self, other: &Numeric)
[src]
impl ToOwned for Numeric
[src]
type Owned = NumericBuf
The resulting type after obtaining ownership.
fn to_owned(&self) -> NumericBuf
[src]
fn clone_into(&self, target: &mut Self::Owned)
[src]
impl<'_> TryFrom<&'_ Numeric> for i8
[src]
type Error = NumericTryFromError
The type returned in the event of a conversion error.
fn try_from(value: &Numeric) -> Result<Self, Self::Error>
[src]
impl<'_> TryFrom<&'_ Numeric> for i16
[src]
type Error = NumericTryFromError
The type returned in the event of a conversion error.
fn try_from(value: &Numeric) -> Result<Self, Self::Error>
[src]
impl<'_> TryFrom<&'_ Numeric> for isize
[src]
type Error = NumericTryFromError
The type returned in the event of a conversion error.
fn try_from(value: &Numeric) -> Result<Self, Self::Error>
[src]
impl<'_> TryFrom<&'_ Numeric> for usize
[src]
type Error = NumericTryFromError
The type returned in the event of a conversion error.
fn try_from(value: &Numeric) -> Result<Self, Self::Error>
[src]
impl<'_> TryFrom<&'_ Numeric> for f32
[src]
type Error = NumericTryFromError
The type returned in the event of a conversion error.
fn try_from(value: &Numeric) -> Result<Self, Self::Error>
[src]
impl<'_> TryFrom<&'_ Numeric> for f64
[src]
type Error = NumericTryFromError
The type returned in the event of a conversion error.
fn try_from(value: &Numeric) -> Result<Self, Self::Error>
[src]
impl<'_> TryFrom<&'_ Numeric> for i32
[src]
type Error = NumericTryFromError
The type returned in the event of a conversion error.
fn try_from(value: &Numeric) -> Result<Self, Self::Error>
[src]
impl<'_> TryFrom<&'_ Numeric> for i64
[src]
type Error = NumericTryFromError
The type returned in the event of a conversion error.
fn try_from(value: &Numeric) -> Result<Self, Self::Error>
[src]
impl<'_> TryFrom<&'_ Numeric> for i128
[src]
type Error = NumericTryFromError
The type returned in the event of a conversion error.
fn try_from(value: &Numeric) -> Result<Self, Self::Error>
[src]
impl<'_> TryFrom<&'_ Numeric> for u8
[src]
type Error = NumericTryFromError
The type returned in the event of a conversion error.
fn try_from(value: &Numeric) -> Result<Self, Self::Error>
[src]
impl<'_> TryFrom<&'_ Numeric> for u16
[src]
type Error = NumericTryFromError
The type returned in the event of a conversion error.
fn try_from(value: &Numeric) -> Result<Self, Self::Error>
[src]
impl<'_> TryFrom<&'_ Numeric> for u32
[src]
type Error = NumericTryFromError
The type returned in the event of a conversion error.
fn try_from(value: &Numeric) -> Result<Self, Self::Error>
[src]
impl<'_> TryFrom<&'_ Numeric> for u64
[src]
type Error = NumericTryFromError
The type returned in the event of a conversion error.
fn try_from(value: &Numeric) -> Result<Self, Self::Error>
[src]
impl<'_> TryFrom<&'_ Numeric> for u128
[src]
type Error = NumericTryFromError
The type returned in the event of a conversion error.
fn try_from(value: &Numeric) -> Result<Self, Self::Error>
[src]
impl UpperExp for Numeric
[src]
Auto Trait Implementations
impl RefUnwindSafe for Numeric
impl Send for Numeric
impl Sync for Numeric
impl Unpin for Numeric
impl UnwindSafe for Numeric
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,