[][src]Struct pgnumeric::NumericBuf

pub struct NumericBuf { /* fields omitted */ }

An owned, mutable numeric.

Implementations

impl NumericBuf[src]

pub fn nan() -> Self[src]

Creates a NaN numeric.

pub fn zero() -> Self[src]

Creates a zero numeric.

pub fn negate_mut(&mut self)[src]

Negate this value.

pub fn abs_mut(&mut self)[src]

Compute the absolute value of self.

pub fn round_mut(&mut self, scale: i32)[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_mut(&mut self, scale: i32)[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 factorial(num: i64) -> Option<Self>[src]

Compute factorial.

Returns None if overflows.

pub fn apply_typmod(&mut self, typmod: Typmod) -> bool[src]

Do bounds checking and rounding according to typmod.

Returns true if overflows.

Notes that no matter whether overflows, self will be rounded.

pub fn as_bytes(&self) -> &[u8][src]

Extracts a byte slice contains the entire numeric.

pub fn as_numeric(&self) -> &Numeric[src]

Gets a Numeric reference by doing a cheap reference-to-reference conversion.

Methods from Deref<Target = 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 if self is NaN

pub fn inc(&self) -> NumericBuf[src]

Increment self by one.

Panics

Panics if overflows.

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]

Return the smallest integer greater than or equal to the argument.

Panics

Panics if overflows.

pub fn floor(&self) -> NumericBuf[src]

Return the largest integer equal to or less than the argument.

Panics

Panics if overflows.

pub fn abs(&self) -> NumericBuf[src]

Compute the absolute value of self.

pub fn sqrt(&self) -> NumericBuf[src]

Compute the square root of a numeric.

Panics

Panics if self is negative.

pub fn ln(&self) -> NumericBuf[src]

Compute the natural logarithm of self.

Panics

Panics if self <= 0.

pub fn log(&self, base: &Self) -> NumericBuf[src]

Compute the logarithm of self in a given base.

Panics

Panics if self <= 0 or base <= 0.

pub fn log2(&self) -> NumericBuf[src]

Compute the base 2 logarithm of self.

Panics

Panics if self <= 0.

pub fn log10(&self) -> NumericBuf[src]

Compute the base 10 logarithm of self.

Panics

Panics if self <= 0.

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 and exp is less than zero
  • self is less than zero and exp 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.

impl<'_> Add<&'_ Numeric> for NumericBuf[src]

type Output = NumericBuf

The resulting type after applying the + operator.

impl<'_, '_> Add<&'_ NumericBuf> for &'_ NumericBuf[src]

type Output = NumericBuf

The resulting type after applying the + operator.

impl<'_> Add<&'_ NumericBuf> for NumericBuf[src]

type Output = NumericBuf

The resulting type after applying the + operator.

impl<'_, '_> Add<&'_ NumericBuf> for &'_ Numeric[src]

type Output = NumericBuf

The resulting type after applying the + operator.

impl Add<NumericBuf> for NumericBuf[src]

type Output = NumericBuf

The resulting type after applying the + operator.

impl<'_> Add<NumericBuf> for &'_ NumericBuf[src]

type Output = NumericBuf

The resulting type after applying the + operator.

impl<'_> Add<NumericBuf> for &'_ Numeric[src]

type Output = NumericBuf

The resulting type after applying the + operator.

impl<'_> AddAssign<&'_ Numeric> for NumericBuf[src]

impl<'_> AddAssign<&'_ NumericBuf> for NumericBuf[src]

impl AddAssign<NumericBuf> for NumericBuf[src]

impl AsRef<Numeric> for NumericBuf[src]

impl Borrow<Numeric> for NumericBuf[src]

impl Clone for NumericBuf[src]

impl Debug for NumericBuf[src]

impl Deref for NumericBuf[src]

type Target = Numeric

The resulting type after dereferencing.

impl Display for NumericBuf[src]

impl<'_, '_> Div<&'_ Numeric> for &'_ NumericBuf[src]

type Output = NumericBuf

The resulting type after applying the / operator.

impl<'_> Div<&'_ Numeric> for NumericBuf[src]

type Output = NumericBuf

The resulting type after applying the / operator.

impl<'_, '_> Div<&'_ NumericBuf> for &'_ NumericBuf[src]

type Output = NumericBuf

The resulting type after applying the / operator.

impl<'_> Div<&'_ NumericBuf> for NumericBuf[src]

type Output = NumericBuf

The resulting type after applying the / operator.

impl<'_, '_> Div<&'_ NumericBuf> for &'_ Numeric[src]

type Output = NumericBuf

The resulting type after applying the / operator.

impl<'_> Div<NumericBuf> for &'_ NumericBuf[src]

type Output = NumericBuf

The resulting type after applying the / operator.

impl Div<NumericBuf> for NumericBuf[src]

type Output = NumericBuf

The resulting type after applying the / operator.

impl<'_> Div<NumericBuf> for &'_ Numeric[src]

type Output = NumericBuf

The resulting type after applying the / operator.

impl<'_> DivAssign<&'_ Numeric> for NumericBuf[src]

impl<'_> DivAssign<&'_ NumericBuf> for NumericBuf[src]

impl DivAssign<NumericBuf> for NumericBuf[src]

impl Drop for NumericBuf[src]

impl Eq for NumericBuf[src]

impl<'a> From<&'a NumericBuf> for Cow<'a, Numeric>[src]

impl<'a> From<NumericBuf> for Cow<'a, Numeric>[src]

impl From<bool> for NumericBuf[src]

impl From<i128> for NumericBuf[src]

impl From<i16> for NumericBuf[src]

impl From<i32> for NumericBuf[src]

impl From<i64> for NumericBuf[src]

impl From<i8> for NumericBuf[src]

impl From<isize> for NumericBuf[src]

impl From<u128> for NumericBuf[src]

impl From<u16> for NumericBuf[src]

impl From<u32> for NumericBuf[src]

impl From<u64> for NumericBuf[src]

impl From<u8> for NumericBuf[src]

impl From<usize> for NumericBuf[src]

impl FromStr for NumericBuf[src]

type Err = NumericParseError

The associated error which can be returned from parsing.

impl Hash for NumericBuf[src]

impl LowerExp for NumericBuf[src]

impl<'_> Mul<&'_ Numeric> for NumericBuf[src]

type Output = NumericBuf

The resulting type after applying the * operator.

impl<'_, '_> Mul<&'_ Numeric> for &'_ NumericBuf[src]

type Output = NumericBuf

The resulting type after applying the * operator.

impl<'_, '_> Mul<&'_ NumericBuf> for &'_ NumericBuf[src]

type Output = NumericBuf

The resulting type after applying the * operator.

impl<'_> Mul<&'_ NumericBuf> for NumericBuf[src]

type Output = NumericBuf

The resulting type after applying the * operator.

impl<'_, '_> Mul<&'_ NumericBuf> for &'_ Numeric[src]

type Output = NumericBuf

The resulting type after applying the * operator.

impl Mul<NumericBuf> for NumericBuf[src]

type Output = NumericBuf

The resulting type after applying the * operator.

impl<'_> Mul<NumericBuf> for &'_ NumericBuf[src]

type Output = NumericBuf

The resulting type after applying the * operator.

impl<'_> Mul<NumericBuf> for &'_ Numeric[src]

type Output = NumericBuf

The resulting type after applying the * operator.

impl<'_> MulAssign<&'_ Numeric> for NumericBuf[src]

impl<'_> MulAssign<&'_ NumericBuf> for NumericBuf[src]

impl MulAssign<NumericBuf> for NumericBuf[src]

impl Neg for NumericBuf[src]

type Output = NumericBuf

The resulting type after applying the - operator.

impl<'_> Neg for &'_ NumericBuf[src]

type Output = NumericBuf

The resulting type after applying the - operator.

impl Ord for NumericBuf[src]

impl<'_> PartialEq<&'_ Numeric> for NumericBuf[src]

impl<'_> PartialEq<&'_ NumericBuf> for NumericBuf[src]

impl PartialEq<Numeric> for NumericBuf[src]

impl PartialEq<NumericBuf> for NumericBuf[src]

impl PartialEq<NumericBuf> for Numeric[src]

impl<'_> PartialEq<NumericBuf> for &'_ Numeric[src]

impl<'_> PartialEq<NumericBuf> for &'_ NumericBuf[src]

impl<'_> PartialOrd<&'_ Numeric> for NumericBuf[src]

impl<'_> PartialOrd<&'_ NumericBuf> for NumericBuf[src]

impl PartialOrd<Numeric> for NumericBuf[src]

impl PartialOrd<NumericBuf> for NumericBuf[src]

impl PartialOrd<NumericBuf> for Numeric[src]

impl<'_> PartialOrd<NumericBuf> for &'_ Numeric[src]

impl<'_> PartialOrd<NumericBuf> for &'_ NumericBuf[src]

impl<'_, '_> Rem<&'_ Numeric> for &'_ NumericBuf[src]

type Output = NumericBuf

The resulting type after applying the % operator.

impl<'_> Rem<&'_ Numeric> for NumericBuf[src]

type Output = NumericBuf

The resulting type after applying the % operator.

impl<'_, '_> Rem<&'_ NumericBuf> for &'_ NumericBuf[src]

type Output = NumericBuf

The resulting type after applying the % operator.

impl<'_> Rem<&'_ NumericBuf> for NumericBuf[src]

type Output = NumericBuf

The resulting type after applying the % operator.

impl<'_, '_> Rem<&'_ NumericBuf> for &'_ Numeric[src]

type Output = NumericBuf

The resulting type after applying the % operator.

impl<'_> Rem<NumericBuf> for &'_ NumericBuf[src]

type Output = NumericBuf

The resulting type after applying the % operator.

impl Rem<NumericBuf> for NumericBuf[src]

type Output = NumericBuf

The resulting type after applying the % operator.

impl<'_> Rem<NumericBuf> for &'_ Numeric[src]

type Output = NumericBuf

The resulting type after applying the % operator.

impl<'_> RemAssign<&'_ Numeric> for NumericBuf[src]

impl<'_> RemAssign<&'_ NumericBuf> for NumericBuf[src]

impl RemAssign<NumericBuf> for NumericBuf[src]

impl Send for NumericBuf[src]

impl<'_> Sub<&'_ Numeric> for NumericBuf[src]

type Output = NumericBuf

The resulting type after applying the - operator.

impl<'_, '_> Sub<&'_ Numeric> for &'_ NumericBuf[src]

type Output = NumericBuf

The resulting type after applying the - operator.

impl<'_, '_> Sub<&'_ NumericBuf> for &'_ NumericBuf[src]

type Output = NumericBuf

The resulting type after applying the - operator.

impl<'_> Sub<&'_ NumericBuf> for NumericBuf[src]

type Output = NumericBuf

The resulting type after applying the - operator.

impl<'_, '_> Sub<&'_ NumericBuf> for &'_ Numeric[src]

type Output = NumericBuf

The resulting type after applying the - operator.

impl Sub<NumericBuf> for NumericBuf[src]

type Output = NumericBuf

The resulting type after applying the - operator.

impl<'_> Sub<NumericBuf> for &'_ NumericBuf[src]

type Output = NumericBuf

The resulting type after applying the - operator.

impl<'_> Sub<NumericBuf> for &'_ Numeric[src]

type Output = NumericBuf

The resulting type after applying the - operator.

impl<'_> SubAssign<&'_ Numeric> for NumericBuf[src]

impl<'_> SubAssign<&'_ NumericBuf> for NumericBuf[src]

impl SubAssign<NumericBuf> for NumericBuf[src]

impl Sync for NumericBuf[src]

impl<'_> TryFrom<&'_ NumericBuf> for i8[src]

type Error = NumericTryFromError

The type returned in the event of a conversion error.

impl<'_> TryFrom<&'_ NumericBuf> for i16[src]

type Error = NumericTryFromError

The type returned in the event of a conversion error.

impl<'_> TryFrom<&'_ NumericBuf> for isize[src]

type Error = NumericTryFromError

The type returned in the event of a conversion error.

impl<'_> TryFrom<&'_ NumericBuf> for usize[src]

type Error = NumericTryFromError

The type returned in the event of a conversion error.

impl<'_> TryFrom<&'_ NumericBuf> for f32[src]

type Error = NumericTryFromError

The type returned in the event of a conversion error.

impl<'_> TryFrom<&'_ NumericBuf> for f64[src]

type Error = NumericTryFromError

The type returned in the event of a conversion error.

impl<'_> TryFrom<&'_ NumericBuf> for i32[src]

type Error = NumericTryFromError

The type returned in the event of a conversion error.

impl<'_> TryFrom<&'_ NumericBuf> for i64[src]

type Error = NumericTryFromError

The type returned in the event of a conversion error.

impl<'_> TryFrom<&'_ NumericBuf> for i128[src]

type Error = NumericTryFromError

The type returned in the event of a conversion error.

impl<'_> TryFrom<&'_ NumericBuf> for u8[src]

type Error = NumericTryFromError

The type returned in the event of a conversion error.

impl<'_> TryFrom<&'_ NumericBuf> for u16[src]

type Error = NumericTryFromError

The type returned in the event of a conversion error.

impl<'_> TryFrom<&'_ NumericBuf> for u32[src]

type Error = NumericTryFromError

The type returned in the event of a conversion error.

impl<'_> TryFrom<&'_ NumericBuf> for u64[src]

type Error = NumericTryFromError

The type returned in the event of a conversion error.

impl<'_> TryFrom<&'_ NumericBuf> for u128[src]

type Error = NumericTryFromError

The type returned in the event of a conversion error.

impl TryFrom<NumericBuf> for i8[src]

type Error = NumericTryFromError

The type returned in the event of a conversion error.

impl TryFrom<NumericBuf> for i16[src]

type Error = NumericTryFromError

The type returned in the event of a conversion error.

impl TryFrom<NumericBuf> for isize[src]

type Error = NumericTryFromError

The type returned in the event of a conversion error.

impl TryFrom<NumericBuf> for usize[src]

type Error = NumericTryFromError

The type returned in the event of a conversion error.

impl TryFrom<NumericBuf> for f32[src]

type Error = NumericTryFromError

The type returned in the event of a conversion error.

impl TryFrom<NumericBuf> for f64[src]

type Error = NumericTryFromError

The type returned in the event of a conversion error.

impl TryFrom<NumericBuf> for i32[src]

type Error = NumericTryFromError

The type returned in the event of a conversion error.

impl TryFrom<NumericBuf> for i64[src]

type Error = NumericTryFromError

The type returned in the event of a conversion error.

impl TryFrom<NumericBuf> for i128[src]

type Error = NumericTryFromError

The type returned in the event of a conversion error.

impl TryFrom<NumericBuf> for u8[src]

type Error = NumericTryFromError

The type returned in the event of a conversion error.

impl TryFrom<NumericBuf> for u16[src]

type Error = NumericTryFromError

The type returned in the event of a conversion error.

impl TryFrom<NumericBuf> for u32[src]

type Error = NumericTryFromError

The type returned in the event of a conversion error.

impl TryFrom<NumericBuf> for u64[src]

type Error = NumericTryFromError

The type returned in the event of a conversion error.

impl TryFrom<NumericBuf> for u128[src]

type Error = NumericTryFromError

The type returned in the event of a conversion error.

impl TryFrom<f32> for NumericBuf[src]

type Error = NumericTryFromError

The type returned in the event of a conversion error.

impl TryFrom<f64> for NumericBuf[src]

type Error = NumericTryFromError

The type returned in the event of a conversion error.

impl UpperExp for NumericBuf[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.