Skip to content

Instantly share code, notes, and snippets.

@jimmycuadra
Created February 4, 2016 10:00
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
Syntax for constraining an associated type in a generic trait impl
trait Connection;
trait ManageConnection {
type Connection;
type Error;
}
struct ConnectionManager;
struct Error;
/// Associated type `Connection` should be any type that implements the `Connection` trait.
impl<C> ManageConnection for ConnectionManager where ??? {
type Connection = C;
type Error = Error;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment