Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- enum GraphError<T> {
- Invalid(T),
- }
- trait Graph<T> {
- type Vertex;
- type Err = GraphError<Self::Vertex>;
- fn foo(&self) -> Result<(), Self::Err>;
- }
- // ----------------------
- use std::result::Result as stdResult;
- type Result<T> = stdResult<T, GraphError<usize>>;
- impl<T> Graph<T> for SimpleGraph<T> {
- type Vertex = usize;
- fn foo(&self) -> Result<()> {
- unimplemented!();
- }
- // note: expected type `fn(&simple_graph::SimpleGraph<T>) -> std::result::Result<(), <SimpleGraph<T> as Graph<T>>::Err>`
- // found type `fn(&simple_graph::SimpleGraph<T>) -> std::result::Result<(), GraphError<usize>>
- }
Add Comment
Please, Sign In to add comment