pub struct StaticBackendToken { /* private fields */ }Expand description
Non-forgeable, thread-bound proof that a static SIMD backend passed its KAT.
The token bypasses runtime CPU probing only. It does not bypass bounds, canonicality, backend health, quarantine, or reporting. Kernel operations are added to this contract by the architecture admission commits that follow Commit 24.
The raw-pointer marker deliberately makes this value neither Send nor
Sync; deployment evidence applies to the thread that constructed it.
let token = base64_ng::StaticBackendToken::for_compiled_target().unwrap();
std::thread::spawn(move || drop(token));Implementations§
Source§impl StaticBackendToken
impl StaticBackendToken
Sourcepub fn for_compiled_target() -> Option<Self>
pub fn for_compiled_target() -> Option<Self>
Selects the strongest backend proven by compile-time target features.
Returns None when the build lacks a complete feature bundle,
pointer-width atomics, or a passing known-answer test.
Sourcepub unsafe fn assume_supported(backend: Backend) -> Option<Self>
pub unsafe fn assume_supported(backend: Backend) -> Option<Self>
Constructs a token from deployment-supplied backend evidence.
§Safety
Before calling, the deployment must prove that this thread’s CPU and OS
vector state support every feature returned by
Backend::required_cpu_features, that the ABI preserves the required
vector state, and that migration cannot move this thread to an
incompatible CPU. A false attestation can execute an unsupported
instruction during the mandatory KAT and terminate the process.
Sourcepub const fn health_generation(&self) -> usize
pub const fn health_generation(&self) -> usize
Returns the health generation borrowed by this token.
Sourcepub fn is_valid(&self) -> bool
pub fn is_valid(&self) -> bool
Returns whether quarantine and generation state still validate it.
This is an admission snapshot, not synchronous cancellation. An invocation that already observed a healthy generation may finish while another thread quarantines that backend.
Sourcepub fn encode_standard<const PAD: bool>(
&self,
input: &[u8],
output: &mut [u8],
) -> Result<usize, EncodeError>
pub fn encode_standard<const PAD: bool>( &self, input: &[u8], output: &mut [u8], ) -> Result<usize, EncodeError>
Encodes with the statically admitted Standard-alphabet backend.
Commits 25, 26, and 29 enable direct SSSE3/SSE4.1, AVX2, AVX-512 VBMI,
and little-endian AArch64 NEON execution. Other token backends, or a
token invalidated by quarantine, use the scalar encoder.
The checked-backend feature applies the same per-call redundant
scalar comparison and quarantine policy as automatic dispatch.
Sourcepub fn encode_url_safe<const PAD: bool>(
&self,
input: &[u8],
output: &mut [u8],
) -> Result<usize, EncodeError>
pub fn encode_url_safe<const PAD: bool>( &self, input: &[u8], output: &mut [u8], ) -> Result<usize, EncodeError>
Encodes with the statically admitted URL-safe-alphabet backend.
Commits 25, 26, and 29 enable direct SSSE3/SSE4.1, AVX2, AVX-512 VBMI,
and little-endian AArch64 NEON execution. Other token backends, or a
token invalidated by quarantine, use the scalar encoder.
The checked-backend feature applies the same per-call redundant
scalar comparison and quarantine policy as automatic dispatch.
Sourcepub fn decode_standard<const PAD: bool>(
&self,
input: &[u8],
output: &mut [u8],
) -> Result<usize, DecodeError>
pub fn decode_standard<const PAD: bool>( &self, input: &[u8], output: &mut [u8], ) -> Result<usize, DecodeError>
Decodes strict Standard Base64 with the statically admitted backend.
Commits 27, 28, and 29 enable direct SSSE3/SSE4.1, AVX2, AVX-512 VBMI,
and little-endian AArch64 NEON execution. Invalid input retains the
ordinary strict decoder’s exact diagnostics. Direct SIMD blocks are
whole-input prevalidated, but short scalar fallbacks retain the ordinary
decoder’s partial-output-on-error behavior.
Sourcepub fn decode_url_safe<const PAD: bool>(
&self,
input: &[u8],
output: &mut [u8],
) -> Result<usize, DecodeError>
pub fn decode_url_safe<const PAD: bool>( &self, input: &[u8], output: &mut [u8], ) -> Result<usize, DecodeError>
Decodes strict URL-safe Base64 with the statically admitted backend.
Commits 27, 28, and 29 enable direct SSSE3/SSE4.1, AVX2, AVX-512 VBMI,
and little-endian AArch64 NEON execution. Invalid input retains the
ordinary strict decoder’s exact diagnostics. Direct SIMD blocks are
whole-input prevalidated, but short scalar fallbacks retain the ordinary
decoder’s partial-output-on-error behavior.