[go: up one dir, main page]

inplace_it 0.3.6

Place small arrays on the stack with a low-cost!
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#[test]
fn inplace_or_alloc_from_iter_works_fine() {
    // Don't forget to update 4096 and related constants

    // 0 and 4096 cases should work also fine
    for count in (0..8192).step_by(128) {
        let result = ::inplace_it::inplace_or_alloc_from_iter(0..count, |mem| {
            assert_eq!(mem.len(), count);
            assert!(mem.iter().cloned().eq(0..count));
            return mem.len() * 2;
        });
        assert_eq!(result, count * 2);
    }
}