Struct zstd_seekable::Seekable

source ·
pub struct Seekable<'a, R> { /* private fields */ }
Expand description

The type of decompressors.

Implementations§

source§

impl<'a> Seekable<'a, ()>

source

pub fn init_buf(input: &'a [u8]) -> Result<Self, Error>

Initialise a decompressor with an input buffer.

source

pub fn init_file(name_: &str) -> Result<Self, Error>

Initialise a decompressor with a file. This method opens the file, and dropping the resulting Seekable closes the file.

source§

impl<'a, R: Read + Seek> Seekable<'a, R>

source

pub fn init(r: Box<R>) -> Result<Self, Error>

Initialise a decompressor with a file. This method opens the file, and dropping the resulting Seekable closes the file.

source

pub fn into_inner(self) -> Box<R>

source§

impl<'a, R> Seekable<'a, R>

source

pub fn decompress( &mut self, out: &mut [u8], offset: u64 ) -> Result<usize, Error>

Decompress starting from an offset. The length of out must be at most the size of the decompressed output.

This function finds the correct frame to start with, and takes care of decompressing multiple frames in a row.

source

pub fn get_num_frames(&self) -> usize

Number of frames in the message.

source

pub fn get_frame_compressed_offset(&self, frame_index: usize) -> c_ulonglong

Offset of the frame in the compressed data.

source

pub fn get_frame_compressed_size(&self, frame_index: usize) -> usize

Size of the frame in the compressed data.

source

pub fn get_frame_decompressed_offset(&self, frame_index: usize) -> u64

Offset of the frame in the decompressed data.

source

pub fn get_frame_decompressed_size(&self, frame_index: usize) -> usize

Size of the frame in the decompressed data.

source

pub fn decompress_frame(&mut self, dest: &mut [u8], index: usize) -> usize

Decompress a single frame. This method internally calls decompress, and dest must be exactly the size of the uncompressed frame.

source

pub fn seekable_offset_to_frame_index(&mut self, offset: u64) -> usize

Perform a binary search to find the frame containing the offset.

Trait Implementations§

source§

impl<'a, R> Drop for Seekable<'a, R>

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl<R> Send for Seekable<'static, R>

Auto Trait Implementations§

§

impl<'a, R> RefUnwindSafe for Seekable<'a, R>where R: RefUnwindSafe,

§

impl<'a, R> !Sync for Seekable<'a, R>

§

impl<'a, R> Unpin for Seekable<'a, R>

§

impl<'a, R> UnwindSafe for Seekable<'a, R>where R: RefUnwindSafe,

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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 Twhere 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 Twhere 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.