Closed longshorej closed 5 years ago
Investigate if there are any benefits to preferring associated types over type parameters. If it simplifies impl boilerplate it may be worth it.
(current)
pub trait Actor<M: 'static + Send> { fn receive(&mut self, message: M, context: &mut ActorContext<M>); fn receive_signal(&mut self, signal: Signal, context: &mut ActorContext<M>) { let _ = signal; let _ = context; } }
vs possible alternative
pub trait Actor { type Msg: 'static + Send; fn receive(&mut self, message: self::Msg, context: &mut ActorContext<self::Msg>); fn receive_signal(&mut self, signal: Signal, context: &mut ActorContext<self::Msg>) { let _ = signal; let _ = context; } }
This has been done where appropriate.
Investigate if there are any benefits to preferring associated types over type parameters. If it simplifies impl boilerplate it may be worth it.
(current)
vs possible alternative