indexing 0.4.1

Sound unchecked indexing using “generativity”; a type system approach to indices, pointers and ranges that are trusted to be in bounds.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#![cfg(feature="use_std")]

extern crate indexing;

use indexing::scope;


#[test]
fn test_vec() {
    let mut v = vec![0, 1];
    scope(&mut v, |v| {
        let mut v = v.only_index();
        v.push(1);
        let end = v.push(2);
        assert_eq!(v[end], 2);
    });
    assert_eq!(&v, &[0, 1, 1, 2]);
}