Closed l4l closed 2 years ago
I'm sorry that this was left unattended for so long.
TBH, I don't really undestand this use case. T: From<M>
doesn't really say anything about type T
. Declaring my_test
isn't forbiden as is because you are required to specify T
at function call:
fn my_test<T>(x: MyType)
where T: From<MyType>
{
let _: T = x.into();
}
fn main() {
my_test::<SomeType>();
}
Moreover, in this case validation of conversion from SomeType
is done at compile time, no test_case
needed.
test_case
can't and won't provide your method with concrete implementations of T
as it lacks information of what types implement Into<T>
.
I'm gonna close this, but if you have extra insights feel free to reopen.
It seems that test-case able to handle generic parameters, i.e.:
but is it possible to specify a type parameter explicitly? That's in particular useful for cases, where you need to check conversion for specific trait, e.g.: