orx_linked_list/list/common_traits/
eq.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
use crate::{Doubly, DoublyIterable, List, Singly, SinglyIterable};
use orx_pinned_vec::PinnedVec;
use orx_selfref_col::{MemoryPolicy, Node};

// singly

impl<T, M, P> PartialEq for List<Singly<T>, M, P>
where
    T: PartialEq,
    M: MemoryPolicy<Singly<T>>,
    P: PinnedVec<Node<Singly<T>>>,
{
    fn eq(&self, other: &Self) -> bool {
        self.eq_to_iter_refs(other.iter())
    }
}

impl<T, M, P> Eq for List<Singly<T>, M, P>
where
    T: PartialEq,
    M: MemoryPolicy<Singly<T>>,
    P: PinnedVec<Node<Singly<T>>>,
{
}

// doubly

impl<T, M, P> PartialEq for List<Doubly<T>, M, P>
where
    T: PartialEq,
    M: MemoryPolicy<Doubly<T>>,
    P: PinnedVec<Node<Doubly<T>>>,
{
    fn eq(&self, other: &Self) -> bool {
        self.eq_to_iter_refs(other.iter())
    }
}

impl<T, M, P> Eq for List<Doubly<T>, M, P>
where
    T: PartialEq,
    M: MemoryPolicy<Doubly<T>>,
    P: PinnedVec<Node<Doubly<T>>>,
{
}