layout 0.1.0

Optimized memory layout using struct of array, Data-oriented design in Rust, DOD SOA
Documentation
use core::fmt::Debug;

use itertools::Itertools;
use layout::*;

#[derive(Debug, Clone, PartialOrd, PartialEq, SOA)]
#[layout(Debug, Clone, PartialOrd, PartialEq)]
pub struct Particle {
    pub name: String,
    pub mass: f64,
}

impl Particle {
    pub fn new(name: String, mass: f64) -> Self {
        Particle { name, mass }
    }
}

impl ParticleVec {
    pub fn extend(&mut self, other: &ParticleVec) {
        self.extend_from_slice(other.as_slice());
    }
}

#[test]
fn use_iterator_tools_get() {
    let vec = ParticleVec::new();
    let particle = vec.iter().get(..0).find_or_first(|_| true);
    assert_eq!(particle, None);
}