Hey there,
I want to abstract away some functionality and return an object that encapsulates methods.
For this I have a struct Client
that is meant to hold a reference to its parent:
pub struct Client<'a, P:'a + HasClient + ?Sized> {
inner: &'a P,
}
and a trait at I want to implement for this parent:
pub trait HasClient: ProvidesData {
///Returns the content of `/client/email`
fn client<'a, P:HasClient+ ?Sized>(&'a self) -> Client<'a, P> {
Client { // line 101
inner: self
}
}
//...
Could you tell me how to do this correctly? because I keep getting ambiguous errors:
--> src/project/spec.rs:101:13
|
101 | Client {
| ^ expected type parameter, found Self
|
= note: expected type `project::spec::client::Client<'a, P>`
= note: found type `project::spec::client::Client<'_, Self>`
thank you