# [−][src]Module typenum::uint

Type-level unsigned integers.

Type operators implemented:

From `core::ops`: `BitAnd`, `BitOr`, `BitXor`, `Shl`, `Shr`, `Add`, `Sub`, `Mul`, `Div`, and `Rem`. From `typenum`: `Same`, `Cmp`, and `Pow`.

Rather than directly using the structs defined in this module, it is recommended that you import and use the relevant aliases from the consts module.

# Example

    use std::ops::{BitAnd, BitOr, BitXor, Shl, Shr, Add, Sub, Mul, Div, Rem};
    use typenum::{Unsigned, U1, U2, U3, U4};

    assert_eq!(<U3 as BitAnd<U2>>::Output::to_u32(), 2);
    assert_eq!(<U3 as BitOr<U4>>::Output::to_u32(), 7);
    assert_eq!(<U3 as BitXor<U2>>::Output::to_u32(), 1);
    assert_eq!(<U3 as Shl<U1>>::Output::to_u32(), 6);
    assert_eq!(<U3 as Shr<U1>>::Output::to_u32(), 1);
    assert_eq!(<U3 as Add<U2>>::Output::to_u32(), 5);
    assert_eq!(<U3 as Sub<U2>>::Output::to_u32(), 1);
    assert_eq!(<U3 as Mul<U2>>::Output::to_u32(), 6);
    assert_eq!(<U3 as Div<U2>>::Output::to_u32(), 1);
    assert_eq!(<U3 as Rem<U2>>::Output::to_u32(), 1);

## Re-exports

`pub use marker_traits::PowerOfTwo;`
`pub use marker_traits::Unsigned;`

## Structs

UInt | `UInt` is defined recursively, where `B` is the least significant bit and `U` is the rest of the number. Conceptually, `U` should be bound by the trait `Unsigned` and `B` should be bound by the trait `Bit`, but enforcing these bounds causes linear instead of logrithmic scaling in some places, so they are left off for now. They may be enforced in future.
UTerm | The terminating type for `UInt`; it always comes after the most significant bit. `UTerm` by itself represents zero, which is aliased to `U0`.

## Traits

GetBit |
SetBit | A type operator that, when implemented for unsigned integer `N`, sets the bit at position `I` to `B`.

## Type Definitions

GetBitOut |
SetBitOut | Alias for the result of calling `SetBit`: `SetBitOut<N, I, B> = <N as SetBit<I, B>>::Output`.

# Help

## Keyboard Shortcuts

`?`
  Show this help dialog
`S`
  Focus the search field
`↑`
  Move up in search results
`↓`
  Move down in search results
`↹`
  Switch tab
`⏎`
  Go to active search result
`+`
  Expand all sections
`-`
  Collapse all sections

## Search Tricks

Prefix searches with a type followed by a colon (e.g., `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g., `vec -> usize` or `* -> vec`)

Search multiple things at once by splitting your query with comma (e.g., `str,u8` or `String,struct:Vec,test`)