orx_linked_list/list/common_traits/
extend.rs

1use crate::{List, variant::Doubly};
2use orx_pinned_vec::PinnedVec;
3use orx_selfref_col::{MemoryPolicy, Node};
4
5impl<T, M, P> Extend<T> for List<Doubly<T>, M, P>
6where
7    M: MemoryPolicy<Doubly<T>>,
8    P: PinnedVec<Node<Doubly<T>>>,
9{
10    fn extend<I: IntoIterator<Item = T>>(&mut self, iter: I) {
11        for x in iter {
12            self.push_back(x);
13        }
14    }
15}
16
17impl<'a, T: Clone, M, P> Extend<&'a T> for List<Doubly<T>, M, P>
18where
19    M: MemoryPolicy<Doubly<T>>,
20    P: PinnedVec<Node<Doubly<T>>>,
21{
22    fn extend<I: IntoIterator<Item = &'a T>>(&mut self, iter: I) {
23        for x in iter {
24            self.push_back(x.clone());
25        }
26    }
27}