Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
Enet4 committed Jan 3, 2021
1 parent 6fe222c commit b5adeef
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
18 changes: 9 additions & 9 deletions src/greedy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ use std::ops::Bound;
use std::ops::RangeBounds;

/// A buffered reader that greedily retains all memory read into a buffer.
///
///
/// Like [`std::io::BufReader`], it fetches bytes from the source in bulk to
/// reduce the number of actual reads. Moreover, it provides methods for
/// reading a byte or slice of bytes at an arbitrary position, reading as many
/// bytes as required to reach that position of the data stream, if they are
/// not in memory already. The position indices are always relative to the
/// position of the data source when it was passed to this construct via
/// [`new`] or [`with_capacity`].
///
///
/// [`std::io::BufReader`]: https://doc.rust-lang.org/std/io/struct.BufReader.html
/// [`new`]: ./struct.GreedyAccessReader.html#method.new
/// [`with_capacity`]: ./struct.GreedyAccessReader.html#method.with_capacity
Expand All @@ -37,7 +37,7 @@ where

/// Creates a new greedy buffered reader with the given byte source and
/// the specified buffer capacity.
///
///
/// The buffer will be able to read approximately `capacity` bytes without
/// reallocating.
pub fn with_capacity(src: R, capacity: usize) -> Self {
Expand Down Expand Up @@ -66,7 +66,7 @@ where
(self.inner, self.buf)
}

/// Fetches a single byte from the buffered data source.
/// Fetches a single byte from the buffered data source.
pub fn get(&mut self, index: usize) -> IoResult<u8> {
if let Some(v) = self.buf.get(index) {
Ok(*v)
Expand All @@ -81,15 +81,15 @@ where
}

/// Obtains a slice of bytes.
///
///
/// The range's end must be bound (e.g. `5..` is not supported).
///
///
/// # Error
///
///
/// Returns an I/O error if the range is out of the boundaries
///
///
/// # Panics
///
///
/// Panics if the range is not end bounded.
pub fn slice<T>(&mut self, range: T) -> IoResult<&[u8]>
where
Expand Down
6 changes: 3 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
//! source to the beginning for multiple passes.
//!
//! # Examples
//!
//!
//! [`GreedyAccessReader`] can be either used as a buffered reader or as
//! a random memory access descriptor. The amount of data read does
//! not influence the relative index of the data unless the method
//! [`clear`] is called.
//!
//!
//! [`GreedyAccessReader`]: ./struct.GreedyAccessReader.html
//! [`clear`]: ./struct.GreedyAccessReader.html#method.clear
//!
Expand All @@ -22,7 +22,7 @@
//! # fn run() -> Result<(), Box<dyn std::error::Error>> {
//! let reader = get_reader();
//! let mut reader = GreedyAccessReader::new(reader);
//!
//!
//! // random access to bytes!
//! let k: u8 = reader.get(12)?;
//! // random slicing!
Expand Down

0 comments on commit b5adeef

Please sign in to comment.