Trait DoubleWidth

Source
pub trait DoubleWidth: Sized + Unsigned {
    type Wide: Copy + From<Self> + TryInto<Self> + NumOps + Unsigned;
    type SignedWide: Copy + From<Self> + TryInto<Self> + NumOps + Zero + One + Signed + PartialOrd;
}
Expand description

Encapsulates extension of an unsigned integer type into signed and unsigned double-width types. This allows performing certain operations (e.g., multiplication) without a possibility of integer overflow.

Required Associated Types§

Source

type Wide: Copy + From<Self> + TryInto<Self> + NumOps + Unsigned

Unsigned double-width extension type.

Source

type SignedWide: Copy + From<Self> + TryInto<Self> + NumOps + Zero + One + Signed + PartialOrd

Signed double-width extension type.

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.

Implementations on Foreign Types§

Source§

impl DoubleWidth for u8

Source§

impl DoubleWidth for u16

Source§

impl DoubleWidth for u32

Source§

impl DoubleWidth for u64

Implementors§