Skip to main content

Tunable

Struct Tunable 

Source
pub struct Tunable<K, F: TuneInputs, Output> { /* private fields */ }
Expand description

A single candidate for autotune: a named TuneFn plus the groups it belongs to. A tunable is autotuned whenever any of its groups is prioritized.

Implementations§

Source§

impl<K, F: TuneInputs, Output: 'static> Tunable<K, F, Output>

Source

pub fn new<Func, Err>(name: &str, func: Func) -> Self
where Err: Into<String> + 'static, Func: for<'a> Fn(<F as TuneInputs>::At<'a>) -> Result<Output, Err> + Send + Sync + 'static,

Create a tunable from a closure.

The for<'a> Fn(F::At<'a>) -> _ bound is spelled out directly in the where-clause (rather than hidden behind a helper trait) so that Rust closure inference sees it: otherwise move |input| … picks a single concrete lifetime and fails with implementation of FnOnce is not general enough whenever F::At<'a> actually depends on 'a.

For multi-input kernels, destructure a tuple: Tunable::new("name", |(lhs, rhs, out)| body).

Source

pub fn group( self, group: &TuneGroup<K>, priority: impl Fn(&K) -> i8 + Send + Sync + 'static, ) -> Self

Add this tunable to a TuneGroup with the given intra-group priority.

Groups are autotuned in order of their priority; within each group, tunables are tried in order of priority(key). A negative priority skips the tunable for this key.

Auto Trait Implementations§

§

impl<K, F, Output> Freeze for Tunable<K, F, Output>

§

impl<K, F, Output> !RefUnwindSafe for Tunable<K, F, Output>

§

impl<K, F, Output> Send for Tunable<K, F, Output>

§

impl<K, F, Output> Sync for Tunable<K, F, Output>

§

impl<K, F, Output> Unpin for Tunable<K, F, Output>

§

impl<K, F, Output> UnsafeUnpin for Tunable<K, F, Output>

§

impl<K, F, Output> !UnwindSafe for Tunable<K, F, Output>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.