3 ms·
> So, specialization? Basically yes. But that works with dynamic dispatch (trait objects) as well as static dispatch (generics). > Not sure I understand. A s
by nicoburns 4y ago
> So, specialization?
Basically yes. But that works with dynamic dispatch (trait objects) as well as static dispatch (generics).
> Not sure I understand.
A specific pattern I'd like to be able to represent is:
trait AlgorithmAInputData {
...
}
trait AlgorithmA {
trait InputData = AlgorithmAInputData;
...
}
trait DataStorage<trait AlgorithmA> {
type InputData : Algorithm::InputData;
fn get_input_data() -> InputData;
}
fn compute_algorithm_a<Storage: DataStorage<AlgorithmA>>() {
...
}