Skip to main content

ProjectConfig

Struct ProjectConfig 

Source
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

Source

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.

Source

pub fn project_root(&self) -> &Path

Returns the project root exactly as supplied at load time.

Source

pub fn configuration_directory(&self) -> &Path

Returns the standard config/ directory derived from the project root.

Source

pub fn parameters(&self) -> &ParameterSpace

Borrows the validated fixed-and-swept parameter space.

Source

pub fn paths(&self) -> &ProjectPaths

Borrows the validated named project-path dictionary.

Source

pub fn task_count(&self) -> u64

Returns the checked number of complete task configurations.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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

Source§

fn clone(&self) -> ProjectConfig

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ProjectConfig

Source§

fn fmt(&self, formatter: &mut Formatter<'_>) -> Result

Formats only bounded roots and component counts.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.