1use crate::{
2 Doubly, Singly,
3 type_aliases::{DefaultMemory, DefaultPinVec},
4 variant::ListVariant,
5};
6use helper_traits::{
7 HasCol, HasColMut, HasDoublyEnds, HasDoublyEndsMut, HasSinglyEnds, HasSinglyEndsMut,
8};
9use orx_pinned_vec::PinnedVec;
10use orx_selfref_col::{MemoryPolicy, Node, SelfRefCol};
11
12pub(crate) mod ends_traits;
13pub(crate) mod helper_traits;
14pub(crate) mod iter_traits;
15
16mod common_traits;
17mod consuming;
18mod get;
19mod get_doubly;
20mod idx_doubly;
21mod idx_singly;
22mod linear;
23mod linear_eq;
24mod mut_doubly;
25mod mut_doubly_recursive;
26mod mut_singly;
27mod mutate;
28mod new;
29mod reclaim;
30pub(crate) mod slice;
31
32pub struct List<V, M = DefaultMemory<V>, P = DefaultPinVec<V>>(pub(crate) SelfRefCol<V, M, P>)
42where
43 V: ListVariant,
44 M: MemoryPolicy<V>,
45 P: PinnedVec<Node<V>>;
46
47impl<V, M, P> HasCol<V, M, P> for List<V, M, P>
50where
51 V: ListVariant,
52 M: MemoryPolicy<V>,
53 P: PinnedVec<Node<V>>,
54{
55 #[inline(always)]
56 fn col(&self) -> &SelfRefCol<V, M, P> {
57 &self.0
58 }
59}
60
61impl<V, M, P> HasColMut<V, M, P> for List<V, M, P>
62where
63 V: ListVariant,
64 M: MemoryPolicy<V>,
65 P: PinnedVec<Node<V>>,
66{
67 #[inline(always)]
68 fn col_mut(&mut self) -> &mut SelfRefCol<V, M, P> {
69 &mut self.0
70 }
71}
72
73impl<T, M, P> HasDoublyEnds<T, M, P> for List<Doubly<T>, M, P>
74where
75 M: MemoryPolicy<Doubly<T>>,
76 P: PinnedVec<Node<Doubly<T>>>,
77{
78 fn ends(&self) -> &<Doubly<T> as orx_selfref_col::Variant>::Ends {
79 self.0.ends()
80 }
81}
82
83impl<T, M, P> HasDoublyEndsMut<T, M, P> for List<Doubly<T>, M, P>
84where
85 M: MemoryPolicy<Doubly<T>>,
86 P: PinnedVec<Node<Doubly<T>>>,
87{
88 fn ends_mut(&mut self) -> &mut <Doubly<T> as orx_selfref_col::Variant>::Ends {
89 self.0.ends_mut()
90 }
91}
92
93impl<T, M, P> HasSinglyEnds<T, M, P> for List<Singly<T>, M, P>
94where
95 M: MemoryPolicy<Singly<T>>,
96 P: PinnedVec<Node<Singly<T>>>,
97{
98 fn ends(&self) -> &<Singly<T> as orx_selfref_col::Variant>::Ends {
99 self.0.ends()
100 }
101}
102
103impl<T, M, P> HasSinglyEndsMut<T, M, P> for List<Singly<T>, M, P>
104where
105 M: MemoryPolicy<Singly<T>>,
106 P: PinnedVec<Node<Singly<T>>>,
107{
108 fn ends_mut(&mut self) -> &mut <Singly<T> as orx_selfref_col::Variant>::Ends {
109 self.0.ends_mut()
110 }
111}