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 set_bytes_rev<M: Matrix>(&mut self, b: &[u8], block_size: usize)
pub fn set_bytes_rev<M: Matrix>(&mut self, b: &[u8], block_size: usize)
Modifies the bytes in place in reverse, 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 more