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§
source§impl 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§
source§impl Clone for PaddedBytes
impl Clone for PaddedBytes
source§fn clone(&self) -> PaddedBytes
fn clone(&self) -> PaddedBytes
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Debug for PaddedBytes
impl Debug for PaddedBytes
source§impl PartialEq<PaddedBytes> for PaddedBytes
impl PartialEq<PaddedBytes> for PaddedBytes
source§fn eq(&self, other: &PaddedBytes) -> bool
fn eq(&self, other: &PaddedBytes) -> bool
self and other values to be equal, and is used
by ==.