Skip to content

Instantly share code, notes, and snippets.

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