Implement a marker trait for tuple `(L, R)` if either `L` or `R` implements it

Viewed 107

I have a marker trait PoisonPill which is implemented by certain structs. I would like to implement it for a tuple (L, R) if EITHER L or R implements PoisonPill (not necessarily both). Is it possible to do that in Rust 2018, and how? Preferably stable Rust.

I tried the following:

trait PoisonPill {}

impl<L, R: PoisonPill> PoisonPill for (L, R) {}
impl<L: PoisonPill, R> PoisonPill for (L, R) {}

but get the E0119 compiler error because of overlapping definitions.

0 Answers
Related