util-cursor 0.1.0

A simple cursor implementation for reading data from array slice.
Documentation
  • Coverage
  • 57.14%
    4 out of 7 items documented4 out of 5 items with examples
  • Size
  • Source code size: 4.81 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 837.71 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • Repository
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • nurmohammed840

A simple cursor implementation for reading data from array slice. It's similar to std::io::Cursor from std library.

Usage

add to your Cargo.toml:

[dependencies]

util-cursor = "0.1"

use util_cursor::Cursor;

let data = [1, 2, 3, 4, 5];
let mut cursor = Cursor::new(data.as_ref());

assert_eq!(cursor.read_slice(3), Some(&[1, 2, 3][..]));

assert_eq!(cursor.offset, 3);
assert_eq!(cursor.remaining_slice(), [4, 5].as_ref());