I'm struggling to wrap my head around usage of traits when these have associated types.
Here's a very simplified example:
pub trait Message {}
pub trait SendsMessages {
type Message: Message;
fn send(msg: Self::Message);
}
pub struct ImplementsSendsMessages {
}
impl<T> SendsMessages for ImplementsSendsMessages
where
T: Message,
{
type Message = T;
fn send(id: T) {
todo!()
}
}
Can anyone point me to what I'm doing wrong?