Struct grenad::WriterBuilder

source ·
pub struct WriterBuilder { /* private fields */ }
Expand description

A struct that is used to configure a Writer.

Implementations§

source§

impl WriterBuilder

source

pub fn new() -> WriterBuilder

Creates a WriterBuilder, it can be used to configure your Writer to better fit your needs.

source

pub fn compression_type( &mut self, compression_type: CompressionType ) -> &mut Self

Defines the CompressionType that will be used to compress the writer blocks.

source

pub fn compression_level(&mut self, level: u32) -> &mut Self

Defines the copression level of the defined CompressionType that will be used to compress the writer blocks.

source

pub fn block_size(&mut self, size: usize) -> &mut Self

Defines the size of the blocks that the writer will writer.

The bigger the blocks are the better they are compressed but the more time it takes to compress and decompress them.

source

pub fn index_key_interval(&mut self, interval: NonZeroUsize) -> &mut Self

The interval at which we store the index of a key in the index footer, used to seek into a block.

source

pub fn index_levels(&mut self, levels: u8) -> &mut Self

The number of levels/indirection we will use to write the index footer.

An indirection of 1 or 2 is sufficient to reduce the impact of decompressing/reading the index block footer.

The default is 0 which means that the index block footer values directly specifies the block where the requested data entries can be found. The disavantage of this is that the index block can be quite big and take time to be decompressed and read.

source

pub fn build<W: Write>(&self, writer: W) -> Writer<W>

Creates the Writer that will write into the provided io::Write type.

source

pub fn memory(&self) -> Writer<Vec<u8>>

Creates the Writer that will write into a Vec of bytes.

Trait Implementations§

source§

impl Default for WriterBuilder

source§

fn default() -> WriterBuilder

Returns the “default value” for a type. Read more

Auto Trait Implementations§

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, 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.