AddU

Trait AddU 

Source
pub trait AddU<U>
where U: Unsigned,
{ type Output; }
Expand description

typenum doesn’t currently allow you to easily add an Integer with an Unsigned. The AddU trait lets you add some Unsigned to both Integers and Unsigneds.

Example:

use typenum::*;
use ranged_num::AddU;
 
assert_type_eq!(<U6 as AddU<U3>>::Output, U9);
assert_type_eq!(<P6 as AddU<U3>>::Output, P9);
assert_type_eq!(<N6 as AddU<U3>>::Output, N3);

Required Associated Types§

Implementations on Foreign Types§

Source§

impl<U, B, T> AddU<T> for UInt<U, B>
where T: Unsigned, UInt<U, B>: Add<T>,

Source§

type Output = <UInt<U, B> as Add<T>>::Output

Source§

impl<U, T> AddU<T> for NInt<U>
where T: Unsigned + NonZero, U: Unsigned + NonZero, NInt<U>: Add<PInt<T>>,

Source§

type Output = <NInt<U> as Add<PInt<T>>>::Output

Source§

impl<U, T> AddU<T> for PInt<U>
where T: Unsigned + NonZero, U: Unsigned + NonZero, PInt<U>: Add<PInt<T>>,

Source§

type Output = <PInt<U> as Add<PInt<T>>>::Output

Implementors§