pub struct ProjectConfig { /* private fields */ }Expand description
Complete validated configuration for one scientific project.
This facade keeps fixed/sweep expansion and path storage internally distinct
while exposing complete task handles loaded from the same standard root.
Cloning it is lightweight because the component values share their parsed
allocations through std::sync::Arc.
Implementations§
Source§impl ProjectConfig
impl ProjectConfig
Sourcepub fn load(
project_root: impl Into<PathBuf>,
) -> Result<Self, ConfigurationError>
pub fn load( project_root: impl Into<PathBuf>, ) -> Result<Self, ConfigurationError>
Loads all three standard JSON files beneath project_root/config.
Loading is read-only. The supplied project root is retained without canonicalization, and no configured path target needs to exist.
§Errors
Returns the precise ConfigurationError produced by fixed/sweep
loading or path loading. A caller never receives a partially validated
ProjectConfig.
Sourcepub fn project_root(&self) -> &Path
pub fn project_root(&self) -> &Path
Returns the project root exactly as supplied at load time.
Sourcepub fn configuration_directory(&self) -> &Path
pub fn configuration_directory(&self) -> &Path
Returns the standard config/ directory derived from the project root.
Sourcepub fn parameters(&self) -> &ParameterSpace
pub fn parameters(&self) -> &ParameterSpace
Borrows the validated fixed-and-swept parameter space.
Sourcepub fn paths(&self) -> &ProjectPaths
pub fn paths(&self) -> &ProjectPaths
Borrows the validated named project-path dictionary.
Sourcepub fn task_count(&self) -> u64
pub fn task_count(&self) -> u64
Returns the checked number of complete task configurations.
Sourcepub fn task_config(
&self,
ordinal: u64,
) -> Result<TaskConfig, ConfigurationError>
pub fn task_config( &self, ordinal: u64, ) -> Result<TaskConfig, ConfigurationError>
Resolves one complete task configuration by deterministic ordinal.
The returned handle shares all parsed fixed, sweep, and path storage. No merged parameter map or path table is allocated.
Sourcepub fn task_configs(&self) -> TaskConfigIter ⓘ
pub fn task_configs(&self) -> TaskConfigIter ⓘ
Lazily iterates every complete task configuration.
Cartesian sweeps yield their full product in canonical task order, with the final axis changing fastest. Explicit-case sweeps yield exactly the declared cases. Iterator items are cheap owned handles suitable for moving into scoped work queues or other task schedulers.
Sourcepub fn task_configs_matching<V>(
&self,
key: impl Into<String>,
value: V,
) -> Result<MatchingTaskConfigIter, ConfigurationError>where
V: Serialize,
pub fn task_configs_matching<V>(
&self,
key: impl Into<String>,
value: V,
) -> Result<MatchingTaskConfigIter, ConfigurationError>where
V: Serialize,
Lazily yields every task whose selected sweep value exactly matches
value.
Other sweep dimensions remain unconstrained, so a Cartesian project can
yield several configurations. Selection is restricted to sweep keys;
fixed constants and paths do not define task identity. value is
converted to JSON once and compared with exact JSON equality.
Sourcepub fn unique_task_config_matching<V>(
&self,
key: impl Into<String>,
value: V,
) -> Result<TaskConfig, ConfigurationError>where
V: Serialize,
pub fn unique_task_config_matching<V>(
&self,
key: impl Into<String>,
value: V,
) -> Result<TaskConfig, ConfigurationError>where
V: Serialize,
Returns the only task matching one exact sweep key/value pair.
No match and multiple matches are distinct errors. In a multidimensional
Cartesian sweep, callers should normally use
ProjectConfig::task_configs_matching unless the selected key is
known to identify one task uniquely.
Sourcepub fn into_parts(self) -> (ParameterSpace, ProjectPaths)
pub fn into_parts(self) -> (ParameterSpace, ProjectPaths)
Consumes the facade and returns its parameter and path components.
Both returned handles retain their shared source allocations. No source bytes, parsed JSON values, path values, or task parameters are cloned.
Sourcepub fn write_source_config(
&self,
destination_project_root: impl AsRef<Path>,
) -> Result<(), ConfigurationError>
pub fn write_source_config( &self, destination_project_root: impl AsRef<Path>, ) -> Result<(), ConfigurationError>
Writes an exact non-overwriting copy beneath destination_project_root.
The destination root is created when absent. Publication refuses an
existing config/ path. All three files are created exclusively from
the original validated byte slices and synchronized before directory
publication is considered durable.
§Errors
Any root creation, exclusive configuration/file creation, write, or
sync failure is returned as
ConfigurationError::WriteConfigurationFile with the exact path at
which it occurred. Existing destination data is never overwritten.
Trait Implementations§
Source§impl Clone for ProjectConfig
impl Clone for ProjectConfig
Source§fn clone(&self) -> ProjectConfig
fn clone(&self) -> ProjectConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more