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
Save jimmycuadra/d652fa9a944bb5f8a7f5 to your computer and use it in GitHub Desktop.
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