[][src]Struct pgnumeric::Typmod

pub struct Typmod(_);

Type modifier.

For numeric, Typmod is composed by precision and scale. They are converted into a internal integer value.

Implementations

impl Typmod[src]

pub unsafe fn new_unchecked(precision: i32, scale: i32) -> Self[src]

Creates a Typmod.

Safety

Callers have to guarantee that:

  • 1 <= precision <= NUMERIC_MAX_PRECISION
  • 0 <= scale <= precision

pub unsafe fn with_precision_unchecked(precision: i32) -> Self[src]

Creates a Typmod. scale defaults to zero.

Safety

Callers have to guarantee that:

  • 1 <= precision <= NUMERIC_MAX_PRECISION

pub fn new(precision: i32, scale: i32) -> Option<Self>[src]

Creates a Typmod.

Returns None:

  • if 1 <= precision <= NUMERIC_MAX_PRECISION
  • if 0 <= scale <= precision

pub fn with_precision(precision: i32) -> Option<Self>[src]

Creates a Typmod. scale defaults to zero.

Returns None:

  • if 1 <= precision <= NUMERIC_MAX_PRECISION

pub unsafe fn from_value_unchecked(value: i32) -> Self[src]

Creates a Typmod from a Typmod's value.

Safety

Callers have to guarantee that the value is valid.

pub const fn value(self) -> i32[src]

Returns Typmod's value in i32.

pub const fn extract(self) -> (i32, i32)[src]

Extracts (precision, scale) from Typmod.

Trait Implementations

impl Clone for Typmod[src]

impl Copy for Typmod[src]

impl Debug for Typmod[src]

impl Default for Typmod[src]

impl Display for Typmod[src]

impl Eq for Typmod[src]

impl PartialEq<Typmod> for Typmod[src]

impl StructuralEq for Typmod[src]

impl StructuralPartialEq for Typmod[src]

Auto Trait Implementations

impl RefUnwindSafe for Typmod

impl Send for Typmod

impl Sync for Typmod

impl Unpin for Typmod

impl UnwindSafe for Typmod

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.