Implement `From` and get `Into` for free. `TryFrom` handles fallible conversions with a Result. `AsRef` and `Borrow` let functions accept many string or path-like inputs, while Deref coercion turns &String into &str automatically.
← Rust theorytheory 0/50 · 0%
Abstraction · medium
29. Traits for Conversion
From, Into, TryFrom and AsRef.
Check your understanding
1. Implementing From gives you…
2. Which conversion can fail?