mlx_rs::transforms::compile

Trait CompileWithState

Source
pub trait CompileWithState<U, A, O, E> {
    type Args<'a>;

    // Required method
    fn compile<'args>(
        self,
        shapeless: bool,
    ) -> impl CallMutWithState<U, Self::Args<'args>, O, E>;
}
Expand description

A trait for functions that can be compiled with state.

This trait is used to compile a function that takes a mutable reference to a state and some arguments and returns a result.

§Generic parameters

  • U: The type of the state.
  • A: The type of the arguments.
  • O: The type of the output.
  • E: The type of the exception.

Required Associated Types§

Source

type Args<'a>

The type of the arguments that the returned closure takes.

This is needed to relax the lifetime requirements of the returned closure. Otherwise, the arguments to the returned closure would have to live longer than the closure itself.

Required Methods§

Source

fn compile<'args>( self, shapeless: bool, ) -> impl CallMutWithState<U, Self::Args<'args>, O, E>

Compile the function.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<F, U> CompileWithState<U, &Array, Array, ()> for F
where F: FnMut(&mut U, &Array) -> Array + 'static, U: Updatable,

Source§

type Args<'a> = &'a Array

Source§

impl<F, U> CompileWithState<U, &Array, Array, Exception> for F
where F: FnMut(&mut U, &Array) -> Result<Array, Exception> + 'static, U: Updatable,

Source§

type Args<'a> = &'a Array

Source§

impl<F, U> CompileWithState<U, &[Array], Vec<Array>, ()> for F
where F: FnMut(&mut U, &[Array]) -> Vec<Array> + 'static, U: Updatable,

Source§

type Args<'a> = &'a [Array]

Source§

impl<F, U> CompileWithState<U, &[Array], Vec<Array>, Exception> for F
where F: FnMut(&mut U, &[Array]) -> Result<Vec<Array>, Exception> + 'static, U: Updatable,

Source§

type Args<'a> = &'a [Array]

Source§

impl<F, U> CompileWithState<U, (&Array, &Array), Array, ()> for F
where F: FnMut(&mut U, (&Array, &Array)) -> Array + 'static, U: Updatable,

Source§

type Args<'a> = (&'a Array, &'a Array)

Source§

impl<F, U> CompileWithState<U, (&Array, &Array), Array, Exception> for F
where F: FnMut(&mut U, (&Array, &Array)) -> Result<Array, Exception> + 'static, U: Updatable,

Source§

type Args<'a> = (&'a Array, &'a Array)

Source§

impl<F, U> CompileWithState<U, (&Array, &Array, &Array), Array, ()> for F
where F: FnMut(&mut U, (&Array, &Array, &Array)) -> Array + 'static, U: Updatable,

Source§

type Args<'a> = (&'a Array, &'a Array, &'a Array)

Source§

impl<F, U> CompileWithState<U, (&Array, &Array, &Array), Array, Exception> for F
where F: FnMut(&mut U, (&Array, &Array, &Array)) -> Result<Array, Exception> + 'static, U: Updatable,

Source§

type Args<'a> = (&'a Array, &'a Array, &'a Array)