I'm looking for a way to implement the strategy pattern in Rust. I wish to implement something similar to this pseudo-code:
class StrategyBase {
Data data;
def abstract methodAWorkingOnData();
def abstract methodBWorkingOnData();
}
class StrategyImplOne {
def methodAWorkingOnData()
... method code ...
def methodBWorkingOnData()
... method code ....
}
class StrategyImplTwo {
def methodAWorkingOnData()
... method code ...
def methodBWorkingOnData()
... method code ....
}
I expected I could have a structure with two traits bound with it, but I can't find a way to implement such a pattern.