Skip to main content

Numeric

Trait Numeric 

Source
pub trait Numeric {
    // Required method
    fn one() -> Value;
}
Expand description

A numeric type that has a representable “one” value.

Used as a bound on crate::stmt::increment and crate::stmt::decrement so the literal 1 is encoded as a stmt::Value variant matching the field type — both backend binding and driver-side arithmetic require it.

Implemented for every primitive numeric type (i8–i64, u8–u64, f32, f64). Implement for custom newtypes around supported numeric values (e.g. wrapping rust_decimal::Decimal) to use them with increment / decrement.

Required Methods§

Source

fn one() -> Value

Return the value 1 for this type as a stmt::Value.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl Numeric for f32

Source§

impl Numeric for f64

Source§

impl Numeric for i8

Source§

impl Numeric for i16

Source§

impl Numeric for i32

Source§

impl Numeric for i64

Source§

impl Numeric for u8

Source§

impl Numeric for u16

Source§

impl Numeric for u32

Source§

impl Numeric for u64

Implementors§