bivec 0.1.0

A Rust implementation of Bivec, two vecs in one, with the same length.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use super::*; 

impl <F, S> BiVec<F, S> {
    pub fn as_slice(&self) -> (&[F], &[S]) {
        unsafe {
            let first = std::slice::from_raw_parts(self.first.as_ptr(), self.len); 
            let second = std::slice::from_raw_parts(self.second.as_ptr(), self.len); 
            (first, second)
        } 
    }
    pub fn as_slice_mut(&mut self) -> (&mut [F], &mut [S]) {
        unsafe {
            let first = std::slice::from_raw_parts_mut(self.first.as_ptr(), self.len); 
            let second = std::slice::from_raw_parts_mut(self.second.as_ptr(), self.len); 
            (first, second)
        } 
    } 
}