Is it possible to create associated types that are forced to have a specific trait? I am thinking of something like this:
trait SomeTrait {}
trait SomeOtherTrait {
type assoc_type; // where assoc_type needs to have implemented SomeTrait!
fn f(&self) -> Self::assoc_type;
}
The reason I need this is that I want to be able to use the fact that the return type of f has the trait SomeTrait. Is this possible to achieve somehow or is there a more elegant solution to this problem anyways? Thx!