# [−][src]Trait typenum::marker_traits::PowerOfTwo

    pub trait PowerOfTwo { }

The marker trait for type-level numbers which are a power of two.

This trait should not be implemented for anything outside this crate.

# Examples

Here's a working example:

    use typenum::{P4, P8, PowerOfTwo};

    fn only_p2<P: PowerOfTwo>() { }

    only_p2::<P4>();
    only_p2::<P8>();

Numbers which are not a power of two will fail to compile in this example:

ⓘThis example deliberately fails to compile

    use typenum::{P9, P511, P1023, PowerOfTwo};

    fn only_p2<P: PowerOfTwo>() { }

    only_p2::<P9>();
    only_p2::<P511>();
    only_p2::<P1023>();

## Implementors

### `impl PowerOfTwo for B1`[src]

### `impl PowerOfTwo for UInt<UTerm, B1>`[src]

### `impl<U: Unsigned + NonZero + PowerOfTwo> PowerOfTwo for PInt<U>`[src]

### `impl<U: Unsigned + PowerOfTwo> PowerOfTwo for UInt<U, B0>`[src]

Loading content...

# 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`)