pub trait Has<T1> {
fn get(&self) -> &T1;}
pub struct C1<T1> {
c1: T1,}
impl<T1> Has<T1> for C1<T1> {
fn get(&self) -> &T1 {
&self.c1}}
pub struct C2<T1, T2> {
c1: T1,
c2: T2,}
impl<T1, T2> Has<T1> for C2<T1, T2> {
fn get(&self) -> &T1 {
&self.c1}}
impl<T1, T2> Has<T2> for C2<T1, T2> {
fn get(&self) -> &T1 {
&self.c2}}
What is the simplest way to make this work? In the case of T1 == T2, I don't care which is returned (as long as it does not cause Rust UB).