orx_selfref_col/common_traits/
from.rs1use crate::{CoreCol, MemoryPolicy, MemoryState, Node, SelfRefCol, Variant};
2use orx_pinned_vec::PinnedVec;
3
4impl<V, M, P> From<(P, V::Ends)> for SelfRefCol<V, M, P>
5where
6 V: Variant,
7 M: MemoryPolicy<V>,
8 P: PinnedVec<Node<V>>,
9{
10 fn from(value: (P, V::Ends)) -> Self {
11 let (nodes, ends) = value;
12 let len = nodes.iter().filter(|x| x.is_active()).count();
13 let core = CoreCol::from_raw_parts(nodes, ends, len);
14 SelfRefCol::from_raw_parts(core, M::default(), MemoryState::default())
15 }
16}