# Trait num_traits::cast::NumCast [−] [src]

    pub trait NumCast: ToPrimitive {
        fn from<T>(n: T) -> Option<Self>
        where
            T: ToPrimitive;
    }

An interface for casting between machine scalars.

## Required Methods

### `fn from<T>(n: T) -> Option<Self> where
T: ToPrimitive,`

Creates a number from another value that can be converted into a primitive via the `ToPrimitive` trait.

## Implementations on Foreign Types

### `impl NumCast for u32`
[src]

#### `fn from<N>(n: N) -> Option<u32> where
N: ToPrimitive,`
[src]

### `impl NumCast for u8`
[src]

#### `fn from<N>(n: N) -> Option<u8> where
N: ToPrimitive,`
[src]

### `impl NumCast for f64`
[src]

#### `fn from<N>(n: N) -> Option<f64> where
N: ToPrimitive,`
[src]

### `impl NumCast for u16`
[src]

#### `fn from<N>(n: N) -> Option<u16> where
N: ToPrimitive,`
[src]

### `impl NumCast for u64`
[src]

#### `fn from<N>(n: N) -> Option<u64> where
N: ToPrimitive,`
[src]

### `impl NumCast for usize`
[src]

#### `fn from<N>(n: N) -> Option<usize> where
N: ToPrimitive,`
[src]

### `impl<T> NumCast for Wrapping<T> where
T: NumCast,`
[src]

#### `fn from<U>(n: U) -> Option<Wrapping<T>> where
U: ToPrimitive,`
[src]

### `impl NumCast for i8`
[src]

#### `fn from<N>(n: N) -> Option<i8> where
N: ToPrimitive,`
[src]

### `impl NumCast for f32`
[src]

#### `fn from<N>(n: N) -> Option<f32> where
N: ToPrimitive,`
[src]

### `impl NumCast for i16`
[src]

#### `fn from<N>(n: N) -> Option<i16> where
N: ToPrimitive,`
[src]

### `impl NumCast for isize`
[src]

#### `fn from<N>(n: N) -> Option<isize> where
N: ToPrimitive,`
[src]

### `impl NumCast for i32`
[src]

#### `fn from<N>(n: N) -> Option<i32> where
N: ToPrimitive,`
[src]

### `impl NumCast for i64`
[src]

#### `fn from<N>(n: N) -> Option<i64> where
N: ToPrimitive,`
[src]

## Implementors

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