pub struct SpecFile {
pub model: String,
pub set: BTreeMap<String, SpecValue>,
pub run: RunTable,
pub measure: MeasureTable,
pub seeds: SeedsTable,
pub actions: Vec<ActionTable>,
pub blocks: Vec<BlockTable>,
pub search: Option<SearchTable>,
pub execution: ExecutionTable,
}Expand description
A sweep spec as written in a TOML file.
Fields§
§model: StringId of the model to run.
set: BTreeMap<String, SpecValue>Values every config shares, by parameter id.
run: RunTableLength and end of each run, the [run] table.
measure: MeasureTableSampling cadence and reducers, the [measure] table.
seeds: SeedsTableRoot seed and seed scheme, the [seeds] table.
actions: Vec<ActionTable>Actions every run fires, each an [[action]] table.
blocks: Vec<BlockTable>Blocks in order, each a [[block]] table.
search: Option<SearchTable>Search that picks the configs instead of blocks.
execution: ExecutionTableSettings that spread the runs over the machine and never change a result.
Implementations§
Source§impl SpecFile
impl SpecFile
Sourcepub fn load(path: &Path) -> Result<(Self, String), SpecFileError>
pub fn load(path: &Path) -> Result<(Self, String), SpecFileError>
Reads the spec file at path, and the design tables that its blocks refer to, and returns it with its text as
written.
A table’s path is relative to the directory of path and cannot leave it. Only a table design’s file is read.
§Errors
Returns SpecFileError::Read when the file or a table cannot be read, SpecFileError::TablePath for a
table path that is absolute or holds a component other than a name, and the errors of Self::parse.
Sourcepub fn tables(&self) -> Vec<DesignTableFile>
pub fn tables(&self) -> Vec<DesignTableFile>
Returns the design tables Self::load read, in block order.
Sourcepub fn parse(text: &str) -> Result<Self, SpecFileError>
pub fn parse(text: &str) -> Result<Self, SpecFileError>
Reads a spec file from its text.
§Errors
Returns SpecFileError::Parse for text that is not TOML, or a key or value that no table accepts.
Sourcepub fn from_json(value: &Value) -> Result<Self, SpecFileError>
pub fn from_json(value: &Value) -> Result<Self, SpecFileError>
Reads a spec file from value, the JSON form a manifest records.
§Errors
Returns SpecFileError::Json for a value that no table accepts.
Sourcepub fn to_toml(&self) -> Result<String, Error>
pub fn to_toml(&self) -> Result<String, Error>
Returns the file as TOML text.
§Errors
Returns the serializer’s error. Every field of a spec file has a TOML form, so no error is expected.
Sourcepub fn into_spec(self) -> Result<SweepSpec, SpecFileError>
pub fn into_spec(self) -> Result<SweepSpec, SpecFileError>
Returns the sweep spec the file describes, leaving its execution settings behind.
§Errors
Returns SpecFileError for a factor without exactly one target or one form of levels, block keys that do
not fit the design, a table that was never read, a reducer kind, stop condition or timeout that cannot be
read, or a [search] table beside blocks or with settings of a different algorithm. Everything else is checked
when the spec is planned.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for SpecFile
impl<'de> Deserialize<'de> for SpecFile
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl From<&SweepSpec> for SpecFile
impl From<&SweepSpec> for SpecFile
Source§fn from(spec: &SweepSpec) -> Self
fn from(spec: &SweepSpec) -> Self
Writes each value as SpecValue::from_text converts it, and each consecutive group of reducers over one
column as one entry.
impl StructuralPartialEq for SpecFile
Auto Trait Implementations§
impl Freeze for SpecFile
impl RefUnwindSafe for SpecFile
impl Send for SpecFile
impl Sync for SpecFile
impl Unpin for SpecFile
impl UnsafeUnpin for SpecFile
impl UnwindSafe for SpecFile
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more