I have three traits that are dependent on each other, but I can't find a way to define these traits statically without using dyn
.
Defining two seems very simple:
pub trait TA<B: TB<Self>> {
fn getB() -> Option<B>;
}
pub trait TB<A: TA<Self>> {
fn getA() -> Option<A>;
}
But defining similar thing with three traits seems impossible (the code bellow doesn't compile):
pub trait TA<B: TB, C: TC> {
fn getB() -> Option<B>;
fn getC() -> Option<C>;
}
pub trait TB<A: TA, C: TC> {
fn getA() -> Option<A>;
fn getC() -> Option<C>;
}
pub trait TC<A: TA, B: TB> {
fn getA() -> Option<A>;
fn getB() -> Option<B>;
}