Define an alias type/trait within a Struct


I have a generic struct and its implementations uses many times the following callable signature Fn(&SomeType, &SomeOtherType, &T) -> MyResult as argument type in different functions (T is the generic Type). I would like to provide an alias for this, not only to avoid typing but also to avoid errors. But the alias needs to be defined inside the struct. Is there a way to do this?


This is not possible inside the struct, but it’s possible outside:

type MyFn<T>=Fn(&SomeType, &SomeOtherType, &T) -> MyResult;


Thanks for the response. It is not optimal but it is better than my current solution. I tried this in past but I was getting:

error: expected a reference to a trait [E0172]