#rustacians ... HELP! 😅

Maybe I need to unlearn some old OOP habits when working with #rustlang but ... for the following code:

trait Bonus { ... }
trait A { ... }
trait B { ... }
impl<T: A> Bonus for T { ... }
impl<T: B> Bonus for T { ... }

I get the following Rust compiler error:

conflicting implementations of trait `filters::Bonus` [E0119]

Shouldn't I get this error only when I attempt to implement both traits A and B for some type T? As long as they're mutually exclusive, I am not sure I get why the compiler is complaining. How would you go about it?

@gee8sh You can't prove to the compiler that A and B are mutually exclusive; Rust works with open-world assumptions here.
You can wrap your A in a struct BonusFromA<T: A>(T) (a newtype) and impl Bonus for that. You can even impl Deref with target T on BonusFrom to make it still behave like a T: A, although AIU it's discouraged for being non-idiomatic OOP emulation -- but try it, and see for yourself how far you get with the newtype alone, and whether you really need the Deref.
@chrysn Thanks for your reply! I indeed ended up using a wrapper structure. In a way, it's like favoring composition over inheritance, but I guess I wanted to avoid too much verbosity/boilerplate. I will explore the Deref option to see if it works for me.