pub struct Avx2 {
inner: GeneralPurpose,
kind: SimdKind,
}Expand description
A base64 engine that unconditionally uses AVX2, without runtime detection.
This works in no_std builds. Because it does not check for AVX2 support, it must only be used
on a CPU that has it. Only the STANDARD and URL_SAFE alphabets are accelerated, so it is
constructed with the Avx2::standard / Avx2::url_safe (checked) or
Avx2::standard_unchecked / Avx2::url_safe_unchecked constructors.
Fields§
§inner: GeneralPurpose§kind: SimdKindImplementations§
Source§impl Avx2
impl Avx2
Sourcepub fn standard(config: GeneralPurposeConfig) -> Option<Self>
pub fn standard(config: GeneralPurposeConfig) -> Option<Self>
Create an Avx2 engine for the STANDARD alphabet if the running CPU supports AVX2, else
None.
Requires the std feature for the detection; in no_std use Avx2::standard_unchecked.
Sourcepub fn url_safe(config: GeneralPurposeConfig) -> Option<Self>
pub fn url_safe(config: GeneralPurposeConfig) -> Option<Self>
Create an Avx2 engine for the URL_SAFE alphabet if the running CPU supports AVX2, else
None.
Requires the std feature for the detection; in no_std use Avx2::url_safe_unchecked.
Sourcepub const unsafe fn standard_unchecked(config: GeneralPurposeConfig) -> Self
pub const unsafe fn standard_unchecked(config: GeneralPurposeConfig) -> Self
Create an Avx2 engine for the STANDARD alphabet without checking for AVX2 support.
§Safety
The CPU that will run encode/decode must support AVX2. Using the engine on a CPU without AVX2 is undefined behavior.
Sourcepub const unsafe fn url_safe_unchecked(config: GeneralPurposeConfig) -> Self
pub const unsafe fn url_safe_unchecked(config: GeneralPurposeConfig) -> Self
Create an Avx2 engine for the URL_SAFE alphabet without checking for AVX2 support.
§Safety
The CPU that will run encode/decode must support AVX2. Using the engine on a CPU without AVX2 is undefined behavior.
Trait Implementations§
Source§impl Engine for Avx2
Available on x86-64 only.
impl Engine for Avx2
Source§type Config = GeneralPurposeConfig
type Config = GeneralPurposeConfig
Source§type DecodeEstimate = GeneralPurposeEstimate
type DecodeEstimate = GeneralPurposeEstimate
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)
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>
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>
Vec. Read more