Skip to content
masterclass Buddy

Rust · Trait

From

From converts a consumed value into another type without failure. Implement it for clear, lossless, value-preserving conversions; use TryFrom when conversion can fail.

Last updated

Since
1.0.0

Syntax

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

In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.

Subscribe
  • Into
  • TryFrom
  • TryInto
  • AsRef
  • AsMut
  • Result

Source: From in std::convert - Rust. Checked 2026-11-03.