Skip to main content

TuneInputs

Trait TuneInputs 

Source
pub trait TuneInputs:
    Send
    + Sync
    + 'static {
    type At<'a>: Clone + Send;
}
Expand description

Describes the set of inputs a TunableSet accepts.

The associated type At gives the concrete input type at a specific lifetime. The indirection exists because TunableSet must be 'static (to live in LocalTuner’s Arc<dyn Any> cache), but some callers want to pass borrowed inputs. A 'static marker type with a lifetime-parameterized works here: the set is 'static, but every tunable function accepts Self::At<'a> for any 'a via HRTB.

Implementing it manually is needed when the inputs genuinely borrowed. Example: burn’s fusion autotune passes TuneInput<'a, R, O> (which wraps &'a mut Context) by defining a FusionTuneInputs<R, O> marker with At<'a> = TuneInput<'a, R, O>. Such a marker must not implement Clone, otherwise it would overlap with the blanket impl below.

Required Associated Types§

Source

type At<'a>: Clone + Send

The concrete input type at lifetime 'a.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<T: Clone + Send + Sync + 'static> TuneInputs for T

Source§

type At<'a> = T