Struct block_aligner::scan_block::PaddedBytes
source · pub struct PaddedBytes { /* private fields */ }Expand description
A padded string that helps avoid out of bounds access when using SIMD.
A single padding byte in inserted before the start of the string,
and block_size bytes are inserted after the end of the string.
Implementations
sourceimpl PaddedBytes
impl PaddedBytes
sourcepub fn new<M: Matrix>(len: usize, block_size: usize) -> Self
pub fn new<M: Matrix>(len: usize, block_size: usize) -> Self
Create an empty PaddedBytes instance that can hold byte strings
of a specific size.
sourcepub fn set_bytes<M: Matrix>(&mut self, b: &[u8], block_size: usize)
pub fn set_bytes<M: Matrix>(&mut self, b: &[u8], block_size: usize)
Modifies the bytes in place, filling in the rest of the memory with padding bytes.
sourcepub fn from_bytes<M: Matrix>(b: &[u8], block_size: usize) -> Self
pub fn from_bytes<M: Matrix>(b: &[u8], block_size: usize) -> Self
Create from a byte slice.
Make sure that block_size is greater than or equal to the upper bound
block size used in the Block::align function.
sourcepub fn from_str<M: Matrix>(s: &str, block_size: usize) -> Self
pub fn from_str<M: Matrix>(s: &str, block_size: usize) -> Self
Create from the bytes in a string slice.
Make sure that block_size is greater than or equal to the upper bound
block size used in the Block::align function.
sourcepub fn from_string<M: Matrix>(s: String, block_size: usize) -> Self
pub fn from_string<M: Matrix>(s: String, block_size: usize) -> Self
Create from the bytes in a string.
Make sure that block_size is greater than or equal to the upper bound
block size used in the Block::align function.
Trait Implementations
sourceimpl Clone for PaddedBytes
impl Clone for PaddedBytes
sourcefn clone(&self) -> PaddedBytes
fn clone(&self) -> PaddedBytes
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more