# Trait core::convert::From [−] [src]

    pub trait From<T>: Sized {
        fn from(T) -> Self;
    }

Construct `Self` via a conversion.

# Examples

`String` implements `From<&str>`:

fn main() { let string = "hello".to_string(); let other_string = String::from("hello"); assert_eq!(string, other_string); }

    let string = "hello".to_string();
    let other_string = String::from("hello");

    assert_eq!(string, other_string);

## Required Methods

### `fn from(T) -> Self`

Performs the conversion.

## Implementors

- `impl From<u8> for u16`
- `impl From<u8> for u32`
- `impl From<u8> for u64`
- `impl From<u8> for usize`
- `impl From<u16> for u32`
- `impl From<u16> for u64`
- `impl From<u32> for u64`
- `impl From<i8> for i16`
- `impl From<i8> for i32`
- `impl From<i8> for i64`
- `impl From<i8> for isize`
- `impl From<i16> for i32`
- `impl From<i16> for i64`
- `impl From<i32> for i64`
- `impl From<u8> for i16`
- `impl From<u8> for i32`
- `impl From<u8> for i64`
- `impl From<u16> for i32`
- `impl From<u16> for i64`
- `impl From<u32> for i64`
- `impl From<i8> for f32`
- `impl From<i8> for f64`
- `impl From<i16> for f32`
- `impl From<i16> for f64`
- `impl From<i32> for f64`
- `impl From<u8> for f32`
- `impl From<u8> for f64`
- `impl From<u16> for f32`
- `impl From<u16> for f64`
- `impl From<u32> for f64`
- `impl From<f32> for f64`

# Help

## Keyboard Shortcuts

?
  Show this help dialog
S
  Focus the search field
⇤
  Move up in search results
⇥
  Move down in search results
⏎
  Go to active search result

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