From b5adeefea548b840f1946d7007e3f30a184515a3 Mon Sep 17 00:00:00 2001 From: Eduardo Pinho Date: Sun, 3 Jan 2021 15:05:10 +0000 Subject: [PATCH] fmt --- src/greedy.rs | 18 +++++++++--------- src/lib.rs | 6 +++--- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/greedy.rs b/src/greedy.rs index 6e07d88..7e1b9a0 100644 --- a/src/greedy.rs +++ b/src/greedy.rs @@ -3,7 +3,7 @@ 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 @@ -11,7 +11,7 @@ use std::ops::RangeBounds; /// 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 @@ -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 { @@ -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 { if let Some(v) = self.buf.get(index) { Ok(*v) @@ -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(&mut self, range: T) -> IoResult<&[u8]> where diff --git a/src/lib.rs b/src/lib.rs index 20e20d5..ca693b9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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 //! @@ -22,7 +22,7 @@ //! # fn run() -> Result<(), Box> { //! let reader = get_reader(); //! let mut reader = GreedyAccessReader::new(reader); -//! +//! //! // random access to bytes! //! let k: u8 = reader.get(12)?; //! // random slicing!