Skip to content

Instantly share code, notes, and snippets.

Created July 26, 2017 14:06
Show Gist options
  • Save anonymous/39acc531e26e79d9888a67e4135ba1f7 to your computer and use it in GitHub Desktop.
Save anonymous/39acc531e26e79d9888a67e4135ba1f7 to your computer and use it in GitHub Desktop.
Rust code shared from the playground
use std::collections::HashMap;
trait Graph {
type Node;
type Edge;
}
struct GraphImpl<N, E> {
h: HashMap<N, Vec<E>>,
}
type MyNode = i32;
type MyEdge = i32;
type MyGraph = GraphImpl<MyNode, MyEdge>;
impl<N, E> Graph for GraphImpl<N, E> {
type Node = N;
type Edge = E;
}
fn main() {
let x: <MyGraph as Graph>::Node;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment