Go ahead and use #[derive(PartialEq)] to compare lists against other lists.
One way to do other types is to just forward everything that Vec knows how to compare:
impl<T, U> PartialEq<U> for List<T>
where Vec<T>: PartialEq<U>
{
fn eq(&self, other: &U) -> bool {
self.memory.eq(other)
}
}
But this exposes the fact that you're using Vec internally, and I don't think you can generically implement the reverse (Something == List). So you might implement just slices instead:
With impl<T, U> PartialEq<U> for List<T>, It's OK for println!("{}", listex == [17, 18, 19, 20]);
I'm newbie with Rust,
impl<'a, T: PartialEq> PartialEq<&'a [T]> for List<T> is for the reverse => [17, 18, 19, 20] == listex, but I do this listex == [17, 18, 19, 20] doesn't work. It's not possible to have two impl PartialEq for List. Is it correct?
I don't understand very well impl<T, U> PartialEq<U> for List<T> where Vec<T>: PartialEq<U>, Can you explain or give some references explaining it?