Struct grenad::Reader

source ·
pub struct Reader<R> { /* private fields */ }
Expand description

A struct that is able to read a grenad file that has been created by a crate::Writer.

Implementations§

source§

impl<R: Read + Seek> Reader<R>

source

pub fn new(reader: R) -> Result<Reader<R>, Error>

Creates a Reader that will read from the provided io::Read type.

source

pub fn into_cursor(self) -> Result<ReaderCursor<R>, Error>

Converts this Reader into a ReaderCursor.

source

pub fn into_prefix_iter(self, prefix: Vec<u8>) -> Result<PrefixIter<R>, Error>

Converts this Reader into a PrefixIter.

source

pub fn into_rev_prefix_iter( self, prefix: Vec<u8> ) -> Result<RevPrefixIter<R>, Error>

Converts this Reader into a RevPrefixIter.

source

pub fn into_range_iter<S, A>(self, range: S) -> Result<RangeIter<R>, Error>
where S: RangeBounds<A>, A: AsRef<[u8]>,

Converts this Reader into a RangeIter.

source

pub fn into_rev_range_iter<S, A>( self, range: S ) -> Result<RevRangeIter<R>, Error>
where S: RangeBounds<A>, A: AsRef<[u8]>,

Converts this Reader into a RevRangeIter.

source§

impl<R> Reader<R>

source

pub fn file_version(&self) -> FileVersion

Returns the version of this file.

source

pub fn compression_type(&self) -> CompressionType

Returns the compression type of this file.

source

pub fn len(&self) -> u64

Returns the number of entries in this file.

source

pub fn is_empty(&self) -> bool

Returns weither this file contains entries or is empty.

source

pub fn into_inner(self) -> R

Consumes the Reader and returns the underlying io::Read type.

The returned io::Read type has been io::Seeked which means that you must seek it back to the front to read it from the start.

source

pub fn get_ref(&self) -> &R

Gets a reference to the underlying reader.

Trait Implementations§

source§

impl<R: Clone> Clone for Reader<R>

source§

fn clone(&self) -> Reader<R>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

§

impl<R> Freeze for Reader<R>
where R: Freeze,

§

impl<R> RefUnwindSafe for Reader<R>
where R: RefUnwindSafe,

§

impl<R> Send for Reader<R>
where R: Send,

§

impl<R> Sync for Reader<R>
where R: Sync,

§

impl<R> Unpin for Reader<R>
where R: Unpin,

§

impl<R> UnwindSafe for Reader<R>
where R: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.