2017-02-17から1日間の記事一覧

Associated Types

https://doc.rust-lang.org/book/associated-types.html trait Graph { type N; type E; fn has_edge(&self, &Self::N, &Self::N) -> bool; fn edges(&self, &Self::N) -> Vec<Self::E>; } struct Node; struct Edge; struct MyGraph; impl Graph for MyGraph { type </self::e>…