fastpfor 0.9.0

FastPFOR lib with C++ Rust wrapper and pure Rust implementation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use std::io::Cursor;

/// Extension trait for `Cursor<u32>` providing position increment operations.
pub trait IncrementCursor {
    /// Increments the cursor position by 1.
    fn increment(&mut self);
    /// Adds `n` to the cursor position.
    fn add(&mut self, n: u32);
}

impl IncrementCursor for Cursor<u32> {
    fn increment(&mut self) {
        self.set_position(self.position() + 1); // Position needs to be a u64
    }
    fn add(&mut self, n: u32) {
        self.set_position(self.position() + u64::from(n));
    }
}