pub struct Builder { /* private fields */ }Expand description
The compilation of a directory of exported environments.
Implementations§
Source§impl Builder
impl Builder
Sourcepub fn new(dir: impl AsRef<Path>) -> Self
pub fn new(dir: impl AsRef<Path>) -> Self
The environments under dir (each subdirectory with a
manifest.json), compiled with fast math.
Sourcepub fn from_env(dir: impl AsRef<Path>) -> Self
pub fn from_env(dir: impl AsRef<Path>) -> Self
Builder::new with RUXLA_JAX_ENVS in place of dir if it is set,
and the modules of RUXLA_JAX_ENVS_ONLY (separated by commas) only.
A relative dir is taken from CARGO_MANIFEST_DIR.
Sourcepub fn only<S: Into<String>>(self, modules: impl IntoIterator<Item = S>) -> Self
pub fn only<S: Into<String>>(self, modules: impl IntoIterator<Item = S>) -> Self
Compiles only these modules.
Sourcepub fn modules(&self) -> Vec<String>
pub fn modules(&self) -> Vec<String>
The modules to compile: the subdirectories with a manifest, sorted.
Sourcepub fn generate(&self) -> (String, Vec<String>, Vec<(String, String)>)
pub fn generate(&self) -> (String, Vec<String>, Vec<(String, String)>)
Generates the code of every module: (code, compiled modules, failures). A module that fails to import or generate is left out,
with its error among the failures.
Sourcepub fn compile(&self) -> Vec<String>
pub fn compile(&self) -> Vec<String>
Generates the code (see Builder::generate) into
$OUT_DIR/ruxla_envs.rs for ruxla_env::include_envs!, tells Cargo to rerun
when the exports change, and warns about modules that failed. Returns
the compiled modules.
§Panics
Panics outside a build script (without OUT_DIR) or if the file
cannot be written.