Trait opendp::traits::Primitive

source ·
pub trait Primitive: 'static + Clone + Debug + CheckNull + PartialEq + Default + CheckAtom { }
Expand description

A shorthand to indicate the set of types that implement the most common traits, like Clone and Debug.

The other rollup traits Hashable, Number, Integer and Float inherit from this trait.

Examples: u8, u16, u32, u64, u128, i8, i16, i32, i64, i128, usize, f32, f64, bool, String.

Refer to the constituent traits to see proof definitions on methods.

Example

use opendp::traits::Primitive;
fn test_func<T: Primitive>(value: T) {
    // can be debugged
    println!("{value:?}");

    // default values exist and members of type T can be compared
    assert_eq!(T::default(), T::default());

    // can check if is null
    value.is_null();
}

test_func(1i8);

Implementors§

source§

impl<T> Primitive for Twhere T: 'static + Clone + Debug + CheckNull + PartialEq + Default + CheckAtom,