pub struct BackendSelector { /* private fields */ }Expand description
Poka-Yoke: Type-safe backend selection
Provides compile-time and runtime guarantees for correct backend selection based on input size and operation type.
Implementations§
Source§impl BackendSelector
impl BackendSelector
Sourcepub const fn new(
gpu_threshold: usize,
parallel_threshold: usize,
) -> BackendSelector
pub const fn new( gpu_threshold: usize, parallel_threshold: usize, ) -> BackendSelector
Create a new backend selector with custom thresholds
Sourcepub const fn gpu_threshold(&self) -> usize
pub const fn gpu_threshold(&self) -> usize
Get the GPU threshold
Sourcepub const fn parallel_threshold(&self) -> usize
pub const fn parallel_threshold(&self) -> usize
Get the parallel threshold
Sourcepub fn select_for_size(
&self,
size: usize,
gpu_available: bool,
) -> BackendCategory
pub fn select_for_size( &self, size: usize, gpu_available: bool, ) -> BackendCategory
Select backend based on input size
§Decision Logic (TRUENO-SPEC-012)
- N < 1,000: Pure SIMD (no parallelization overhead)
- 1,000 <= N < 100,000: SIMD + Parallel (Rayon)
- N >= 100,000: GPU (if available), else SIMD + Parallel
Sourcepub fn is_at_gpu_boundary(&self, size: usize) -> bool
pub fn is_at_gpu_boundary(&self, size: usize) -> bool
Check if size is at GPU threshold boundary (for testing)
Sourcepub fn is_at_parallel_boundary(&self, size: usize) -> bool
pub fn is_at_parallel_boundary(&self, size: usize) -> bool
Check if size is at parallel threshold boundary (for testing)
Trait Implementations§
Source§impl Clone for BackendSelector
impl Clone for BackendSelector
Source§fn clone(&self) -> BackendSelector
fn clone(&self) -> BackendSelector
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for BackendSelector
impl Debug for BackendSelector
Source§impl Default for BackendSelector
impl Default for BackendSelector
Source§fn default() -> BackendSelector
fn default() -> BackendSelector
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for BackendSelector
impl RefUnwindSafe for BackendSelector
impl Send for BackendSelector
impl Sync for BackendSelector
impl Unpin for BackendSelector
impl UnwindSafe for BackendSelector
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more