1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
pub struct Pair<Left, Right>(std::marker::PhantomData<(Left, Right)>); pub trait Left { type Output; } pub trait Right { type Output; } impl<A, B> Left for Pair<A, B> { type Output = A; } impl<A, B> Right for Pair<A, B> { type Output = B; }