pub unsafe trait HalModuleImpl<BE: Backend>: Backend {
type Config: Default = ();
// Required method
fn new(n: u64) -> Module<BE>;
// Provided method
fn new_with(n: u64, _config: Self::Config) -> Module<BE> { ... }
}Expand description
Module construction extension point.
§Safety
Implementations must return a module handle that is valid for the backend and ring degree, and uphold the backend safety contract.
Provided Associated Types§
Sourcetype Config: Default = ()
type Config: Default = ()
Backend-specific construction parameters.
Host backends leave this at (). A device backend names here whatever
Self::new cannot express, a device ordinal above all: with new
alone, a module on a multi-GPU host lands on whatever the driver calls
the default device, which is not necessarily the one the operator means.
Required Methods§
Provided Methods§
Sourcefn new_with(n: u64, _config: Self::Config) -> Module<BE>
fn new_with(n: u64, _config: Self::Config) -> Module<BE>
Constructs a module under an explicit Self::Config.
Defaults to ignoring the configuration, which is correct for any backend
that leaves Config = (). A backend declaring a real Config must
override this, and should keep new equivalent to
new_with(n, Config::default()).
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".