pub struct Simd {
inner: GeneralPurpose,
kind: SimdKind,
backend: Backend,
}Expand description
A base64 engine that uses the best SIMD instruction set detected at runtime, falling back to the
scalar GeneralPurpose engine.
Requires the std feature (for runtime CPU-feature detection) and an x86_64 or aarch64
target. On other targets, use GeneralPurpose directly. Only the STANDARD and URL_SAFE
alphabets are accelerated, so it is constructed with Simd::standard / Simd::url_safe.
Fields§
§inner: GeneralPurpose§kind: SimdKind§backend: BackendImplementations§
Source§impl Simd
impl Simd
Sourcepub fn standard(config: GeneralPurposeConfig) -> Self
pub fn standard(config: GeneralPurposeConfig) -> Self
Create a Simd engine for the STANDARD alphabet, detecting the instruction set once.
Sourcepub fn url_safe(config: GeneralPurposeConfig) -> Self
pub fn url_safe(config: GeneralPurposeConfig) -> Self
Create a Simd engine for the URL_SAFE alphabet, detecting the instruction set once.
fn new( kind: SimdKind, alphabet: &Alphabet, config: GeneralPurposeConfig, ) -> Self
Trait Implementations§
Source§impl Engine for Simd
Available on crate feature std and (x86-64 or AArch64) only.
impl Engine for Simd
Available on crate feature
std and (x86-64 or AArch64) only.Source§type Config = GeneralPurposeConfig
type Config = GeneralPurposeConfig
The config type used by this engine
Source§type DecodeEstimate = GeneralPurposeEstimate
type DecodeEstimate = GeneralPurposeEstimate
The decode estimate used by this engine
Source§fn encode_string<T: AsRef<[u8]>>(&self, input: T, output_buf: &mut String)
fn encode_string<T: AsRef<[u8]>>(&self, input: T, output_buf: &mut String)
Encode arbitrary octets as base64 into a supplied
String.
Writes into the supplied String, which may allocate if its internal buffer isn’t big enough. Read moreSource§fn encode_slice<T: AsRef<[u8]>>(
&self,
input: T,
output_buf: &mut [u8],
) -> Result<usize, EncodeSliceError>
fn encode_slice<T: AsRef<[u8]>>( &self, input: T, output_buf: &mut [u8], ) -> Result<usize, EncodeSliceError>
Encode arbitrary octets as base64 into a supplied slice.
Writes into the supplied output buffer. Read more
Source§fn decode<T: AsRef<[u8]>>(&self, input: T) -> Result<Vec<u8>, DecodeError>
fn decode<T: AsRef<[u8]>>(&self, input: T) -> Result<Vec<u8>, DecodeError>
Decode the input into a new
Vec. Read moreSource§fn decode_vec<T: AsRef<[u8]>>(
&self,
input: T,
buffer: &mut Vec<u8>,
) -> Result<(), DecodeError>
fn decode_vec<T: AsRef<[u8]>>( &self, input: T, buffer: &mut Vec<u8>, ) -> Result<(), DecodeError>
Source§fn decode_slice<T: AsRef<[u8]>>(
&self,
input: T,
output: &mut [u8],
) -> Result<usize, DecodeSliceError>
fn decode_slice<T: AsRef<[u8]>>( &self, input: T, output: &mut [u8], ) -> Result<usize, DecodeSliceError>
Decode the input into the provided output slice. Read more
Source§fn decode_slice_unchecked<T: AsRef<[u8]>>(
&self,
input: T,
output: &mut [u8],
) -> Result<usize, DecodeError>
fn decode_slice_unchecked<T: AsRef<[u8]>>( &self, input: T, output: &mut [u8], ) -> Result<usize, DecodeError>
Decode the input into the provided output slice. Read more
Auto Trait Implementations§
impl Freeze for Simd
impl RefUnwindSafe for Simd
impl Send for Simd
impl Sync for Simd
impl Unpin for Simd
impl UnsafeUnpin for Simd
impl UnwindSafe for Simd
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