Function parse_schema
pub fn parse_schema<I, N, S>(entries: I) -> Result<SpaceSchema>Expand description
Parses an ordered sequence of (name, spec) pairs into a SpaceSchema.
This is the entry point the CLI and the TOML overlay call: a TOML table or a
--param name=spec list is exactly a sequence of (name, spec-string) pairs.
Declaration order is preserved (the schema keeps a Vec plus a name
index), and duplicate names are rejected.
use atune_core::space::dsl;
let schema = dsl::parse_schema([
("lr", "loguniform(1e-5, 1e-2)"),
("batch", "int(16, 512, step=16)"),
("amp", "bool"),
])?;
assert_eq!(schema.names().collect::<Vec<_>>(), ["lr", "batch", "amp"]);ยงErrors
Error::InvalidSpace if any spec fails to parse (prefixed with its
parameter name), a name is empty, or a name is declared twice.