Skip to main content

BuildFunction

Type Alias BuildFunction 

Source
pub type BuildFunction<T, B = DefaultBackend> = Box<dyn Fn(&[Layout]) -> Skeleton<T, B> + Send + Sync>;
Expand description

Builds a Skeleton for a given set of input layouts

Called on a cache miss with the layouts of the current inputs. It must create its slots from those layouts and bind them in the same order, so the resulting skeleton accepts exactly that shape.

§Examples

use candela::skeleton::{BuildFunction, SkeletonSlot};
use candela::Layout;

// Doubles whatever single input it is handed, whatever its shape.
let build: BuildFunction<f32> = Box::new(|inputs: &[Layout]| {
    let a = SkeletonSlot::new(inputs[0].clone());
    (&a * 2.0).into_skeleton(&[a]).unwrap()
});

Aliased Type§

pub struct BuildFunction<T, B = DefaultBackend>(/* private fields */);