# Trait bitflags::__core::convert::From [−] [src]

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

Construct `Self` via a conversion.

Note: this trait must not fail. If the conversion can fail, use a dedicated method which returns an `Option<T>` or a `Result<T, E>`.

# Examples

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

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

    assert_eq!(string, other_string);

# Generic impls

- `From<T> for U` implies `Into<U> for T`
- `from()` is reflexive, which means that `From<T> for T` is implemented

## Required Methods

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

Performs the conversion.

## Implementors

- `impl<'a, E> From for Box<Error + 'a> where E: 'a + Error`
- `impl<'a, E> From for Box<Error + 'a + Send + Sync> where E: Send + Sync + 'a + Error`
- `impl From for Box<Error + 'static + Send + Sync>`
- `impl From for Box<Error + 'static>`
- `impl<'a, 'b> From for Box<Error + 'a + Send + Sync>`
- `impl<'a> From for Box<Error + 'static>`
- `impl<T> From for VecDeque<T>`
- `impl<T> From for Vec<T>`
- `impl<T> From for BinaryHeap<T> where T: Ord`
- `impl<T> From for Vec<T>`
- `impl From for Vec<u8>`
- `impl From for Error`
- `impl<'a> From for CString`
- `impl From for OsString`
- `impl<'a, T> From for OsString where T: AsRef<OsStr> + ?Sized`
- `impl<W> From for Error`
- `impl From for u32`
- `impl From for Ipv4Addr`
- `impl From for Ipv4Addr`
- `impl From for Ipv6Addr`
- `impl<'a, T> From for PathBuf where T: AsRef<OsStr> + ?Sized`
- `impl From for PathBuf`
- `impl From for PathBuf`
- `impl<'a> From for Cow<'a, Path>`
- `impl<'a> From for Cow<'a, Path>`
- `impl<T> From for TryLockError<T>`
- `impl<T> From for T`
- `impl<'a, T> From for Vec<T> where T: Clone`
- `impl<'a> From for Vec<u8>`
- `impl<'a, T> From for Cow<'a, [T]> where T: Clone`
- `impl<'a, T> From for Cow<'a, [T]> where T: Clone`
- `impl<T> From for Box<T>`
- `impl<Idx> From for RangeInclusive<Idx> where Idx: One + Sub<Idx, Output=Idx> + PartialOrd<Idx>`
- `impl<T> From for Rc<T>`
- `impl<'a> From for String`
- `impl<'a> From for Cow<'a, str>`
- `impl<'a> From for Cow<'a, str>`
- `impl From for u16`
- `impl From for u32`
- `impl From for u64`
- `impl From for usize`
- `impl From for u32`
- `impl From for u64`
- `impl From for u64`
- `impl From for i16`
- `impl From for i32`
- `impl From for i64`
- `impl From for isize`
- `impl From for i32`
- `impl From for i64`
- `impl From for i64`
- `impl From for i16`
- `impl From for i32`
- `impl From for i64`
- `impl From for i32`
- `impl From for i64`
- `impl From for i64`
- `impl From for f32`
- `impl From for f64`
- `impl From for f32`
- `impl From for f64`
- `impl From for f64`
- `impl From for f32`
- `impl From for f64`
- `impl From for f32`
- `impl From for f64`
- `impl From for f64`
- `impl From for f64`
- `impl<T> From for Arc<T>`

# 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` or `* -> vec`)