seekable_reader 0.1.2

Seek implementation for every Read
Documentation
  • Coverage
  • 50%
    4 out of 8 items documented0 out of 4 items with examples
  • Size
  • Source code size: 28.19 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.54 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • Documentation
  • UgnilJoZ/seekable_reader
    4 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • UgnilJoZ

Crates.io Documentation Dependency Status

seekable_reader

This crate introduces the SeekableReader, which provides Seek if wrapped around a Read instance.

An example:

use std::io::{Read, Seek, SeekFrom};
use seekable_reader::SeekableReader;

let source = vec![1, 2, 3, 4, 5];
let mut reader = SeekableReader::new(source.as_slice(), 1);
let mut buffer = vec![0; 5];
// Read one byte and seek back
reader.read(&mut buffer[..1]).unwrap();
reader.seek(SeekFrom::Start(0)).unwrap();
// First byte can be read again!
let bytes: Vec<_> = reader.bytes().map(|b| b.unwrap()).collect();
assert_eq!(&source, &bytes);