Skip to content

Instantly share code, notes, and snippets.

@kyleheadley
Created July 10, 2017 16:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kyleheadley/8a25a08e44c226202aa6a3f221a23bf8 to your computer and use it in GitHub Desktop.
Save kyleheadley/8a25a08e44c226202aa6a3f221a23bf8 to your computer and use it in GitHub Desktop.
Possible alternative for missing type equality in rust trait impl's
trait F<V,X> {}
struct D;
trait TheV2 {
type IsThis;
}
impl<V1,V2> TheV2 for F<V1,V2> {
type IsThis = V2;
}
impl<V1,V2> F<V1,V2> for D where
V1:F<V2,bool>,
V2:F<usize,V1>,
//V1==V2 // not implemented in compiler
F<V1,V2>: TheV2<IsThis=V1> // alternative!?
{}
fn main() {
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment