clay_core/
class.rs

1use std::collections::HashSet;
2
3
4/// An interface in OpenCL code.
5pub trait Class {
6    /// Class name (e.g. `shape`)
7    fn name() -> String;
8    /// List of methods of the class.
9    fn methods() -> Vec<String>;
10}
11
12/// An implementation of an interface in OpenCL.
13pub trait Instance<C: Class>: Sized + 'static {
14    // Class of an instance.
15    //type Class: Class = C;
16    
17    /// Associated OpenCL code that contains necessary function definition.
18    fn source(cache: &mut HashSet<u64>) -> String;
19    /// Name of the instance of the class (e.g. `sphere` as instance of class `shape`).
20    fn inst_name() -> String;
21}