pub trait CompilationArg:
Serialize
+ DeserializeOwned
+ Clone
+ PartialEq
+ Eq
+ Hash
+ Debug
+ Send
+ Sync
+ 'static {
// Provided method
fn dynamic_cast<Arg: CompilationArg>(&self) -> Arg { ... }
}
Expand description
Argument used during the compilation of kernels.
Provided Methods§
Sourcefn dynamic_cast<Arg: CompilationArg>(&self) -> Arg
fn dynamic_cast<Arg: CompilationArg>(&self) -> Arg
Compilation args should be the same even with different element types. However, it isn’t possible to enforce it with the type system. So, we make the compilation args serializable and dynamically cast them.
Without this, the compilation time is unreasonable. The performance drop isn’t a concern since this is only done once when compiling a kernel for the first time.
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.