util-cursor

Crates.ioutil-cursor
lib.rsutil-cursor
version0.1.0
sourcesrc
created_at2022-04-10 12:04:54.998538
updated_at2022-04-10 12:04:54.998538
descriptionA simple cursor implementation for reading data from array slice.
homepage
repositoryhttps://github.com/nurmohammed840/util-cursor.rs
max_upload_size
id565057
size5,126
Nur (nurmohammed840)

documentation

README

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());
Commit count: 0

cargo fmt