I want to implement a custom trait for &\'a str
and for integer numbers up to i32
, but Rust does not allow me to:
use std::conv
The fact that &'a str
does not implement Into<i32>
is not taken into account, because there is no guarantee that it couldn't be added later. This would then break your code.
So if this were allowed the possible breakage would make it harder to add implementations to library traits.
Unfortunately I couldn't find documentation for that, neither in The Rust Programming Language Book nor in the Reference Manual.
The best I could find is RFC 1023, which says that a crate [...] cannot rely that Type: !Trait
holds unless Type
or Trait
is local.