CanMake

Trait CanMake 

Source
pub trait CanMake<V> {
    // Required method
    fn make() -> V;
}
Expand description

typenum doesn’t currently allow you to easily specify any numbers (signed or unsigned) that can be converted to a given type. I’ve added CanMake<V> as a trait to indicate which types can easily make a runtime value of type V to use in type bounds.

Required Methods§

Source

fn make() -> V

Create the V that goes with this type.

Example:

use typenum::P5;
use ranged_num::CanMake;
 
let x: i8 = <P5 as CanMake<i8>>::make();
assert_eq!(x, 5);

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<T> CanMake<f32> for T
where T: Integer,

Source§

impl<T> CanMake<f64> for T
where T: Integer,

Source§

impl<T> CanMake<i8> for T
where T: Integer,

Source§

impl<T> CanMake<i16> for T
where T: Integer,

Source§

impl<T> CanMake<i32> for T
where T: Integer,

Source§

impl<T> CanMake<i64> for T
where T: Integer,

Source§

impl<T> CanMake<isize> for T
where T: Integer,

Source§

impl<T> CanMake<u8> for T
where T: Unsigned,

Source§

impl<T> CanMake<u16> for T
where T: Unsigned,

Source§

impl<T> CanMake<u32> for T
where T: Unsigned,

Source§

impl<T> CanMake<u64> for T
where T: Unsigned,

Source§

impl<T> CanMake<usize> for T
where T: Unsigned,