pub struct SChunk(/* private fields */);Expand description
Wrapper to blosc2_schunk
Implementations§
Source§impl SChunk
impl SChunk
pub fn new(storage: Storage) -> Self
pub fn copy(&self) -> Self
pub fn frame(&self) -> Result<&[u8]>
Sourcepub fn append_buffer<T>(&mut self, data: &[T]) -> Result<usize>
pub fn append_buffer<T>(&mut self, data: &[T]) -> Result<usize>
Append data to SChunk, returning new number of chunks
Sourcepub fn decompress_chunk<T>(
&mut self,
nchunk: usize,
dst: &mut [T],
) -> Result<usize>
pub fn decompress_chunk<T>( &mut self, nchunk: usize, dst: &mut [T], ) -> Result<usize>
Decompress a chunk, returning number of elements of T written to output buffer
pub fn decompress_chunk_vec<T>(&mut self, nchunk: usize) -> Result<Vec<T>>
Sourcepub fn set_slice_buffer(
&self,
start: usize,
stop: usize,
buf: &[u8],
) -> Result<()>
pub fn set_slice_buffer( &self, start: usize, stop: usize, buf: &[u8], ) -> Result<()>
Set slice buffer
Sourcepub fn get_slice_buffer(&self, start: usize, stop: usize) -> Result<Vec<u8>>
pub fn get_slice_buffer(&self, start: usize, stop: usize) -> Result<Vec<u8>>
Get uncompressed slice of data from start until stop. Returned as bytes, which can be transmuted/casted into the concrete item type. start/stop is by items, not by bytes
Sourcepub fn get_slice_buffer_as_type<T>(
&self,
start: usize,
stop: usize,
) -> Result<Vec<T>>
pub fn get_slice_buffer_as_type<T>( &self, start: usize, stop: usize, ) -> Result<Vec<T>>
Convenience method to get_slice_buffer which will transmute resulting bytes buffer into Vec<T> for you.
NB This will check T is same size as schunk’s typesize so is fairly safe.
pub fn get_chunk(&self, nchunk: usize) -> Result<Chunk>
Sourcepub fn from_vec(buf: Vec<u8>) -> Result<Self>
pub fn from_vec(buf: Vec<u8>) -> Result<Self>
Create a Schunk from an owned Vec<u8>. Data will be owned by the Schunk and released
via normal Rust semantics.
Sourcepub fn is_contiguous(&self) -> bool
pub fn is_contiguous(&self) -> bool
Check if storage of Schunk is contiguous.
Sourcepub fn compression_ratio(&self) -> f32
pub fn compression_ratio(&self) -> f32
Compression ratio of the Schunk
Sourcepub fn chunk_shape(&self) -> usize
pub fn chunk_shape(&self) -> usize
Chunk shape
pub fn is_empty(&self) -> bool
Trait Implementations§
Source§impl Write for SChunk
impl Write for SChunk
Source§fn write(&mut self, buf: &[u8]) -> Result<usize>
fn write(&mut self, buf: &[u8]) -> Result<usize>
Writes a buffer into this writer, returning how many bytes were written. Read more
Source§fn flush(&mut self) -> Result<()>
fn flush(&mut self) -> Result<()>
Flushes this output stream, ensuring that all intermediately buffered
contents reach their destination. Read more
Source§fn is_write_vectored(&self) -> bool
fn is_write_vectored(&self) -> bool
🔬This is a nightly-only experimental API. (
can_vector)1.0.0 · Source§fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
Attempts to write an entire buffer into this writer. Read more
Source§fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
🔬This is a nightly-only experimental API. (
write_all_vectored)Attempts to write multiple buffers into this writer. Read more
impl Send for SChunk
Auto Trait Implementations§
impl Freeze for SChunk
impl !RefUnwindSafe for SChunk
impl !Sync for SChunk
impl Unpin for SChunk
impl !UnwindSafe for SChunk
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more