entrait icon indicating copy to clipboard operation
entrait copied to clipboard

Associated types fail to compile

Open austinjones opened this issue 1 year ago • 6 comments

Hey @audunhalland, another associated type issue here!

#[entrait::entrait]
pub trait Client {
    type DatabaseImpl;

    fn database(&self, name: &str) -> Self::DatabaseImpl;
}

The associated type disappears from the generated trait:

pub trait MongoClient {
    fn database(&self, name: &str) -> Self::DatabaseImpl;
}

It also needs to be bound in the entrait::Impl block as:

type DatabaseImpl = <EntraitT as MongoClient>::DatabaseImpl;

austinjones avatar Jan 09 '23 04:01 austinjones