I have multiple levels of traits and can't work out how to reference the types in the top level object. I get messages about parameters not used, but if I remove them I get messages about them missing! An example:
struct User {
name: String,
}
trait UserStore {
fn get_user(&self) -> User;
}
struct Tenant<U>
where
U: UserStore,
{
user_store: U,
}
trait TenantStore<U>
where
U: UserStore
{
fn get_tenant(&self) -> Tenant<U>;
}
// what to do here??
struct Application<T, U>
where
T: TenantStore<U>,
U: UserStore
{
tenant_store: T,
}
Error:
parameter `U` is never used
unused parameter
help: consider removing `U`, referring to it in a field, or using a marker such as `std::marker::PhantomData`rustc(E0392)
If I remove the U
I get:
cannot find type `U` in this scope