cglue/
from2.rs

1//! # From on Into
2
3/// Wrapper trait that is implemented on `Into` types.
4///
5/// This trait is purely needed for type parameter inferring purposes, where `Into` can not be used,
6/// but `From` would make it not as versatile. This trait acts like `From`, but is implemented when
7/// only `Into` is implemented.
8pub trait From2<T> {
9    fn from2(other: T) -> Self;
10}
11
12impl<T: Into<F>, F> From2<T> for F {
13    fn from2(other: T) -> Self {
14        other.into()
15    }
16}