Struct CommandTemplate
pub struct CommandTemplate { /* private fields */ }Expand description
A program plus its argument templates: the recipe for one child process.
The program is a literal path or name; each argument may embed {name}
holes that a trial’s sampled parameters fill (see the executor
documentation for the substitution rules and the trust model).
use atune_core::exec::CommandTemplate;
// `./train.sh --lr={lr} --opt {opt}` — three argv elements, two of which
// carry a hole. Nothing is a shell string.
let template = CommandTemplate::new("./train.sh", ["--lr={lr}", "--opt", "{opt}"])?;
assert_eq!(template.placeholder_names(), ["lr", "opt"]);Implementations§
§impl CommandTemplate
impl CommandTemplate
pub fn new<P, I, S>(program: P, args: I) -> Result<Self>
pub fn new<P, I, S>(program: P, args: I) -> Result<Self>
Builds a command template from a program and its argument templates.
§Errors
Error::InvalidSpace if any argument has an unterminated, empty, or
unbalanced brace.
pub fn placeholder_names(&self) -> Vec<String>
pub fn placeholder_names(&self) -> Vec<String>
Every placeholder name the arguments reference, in order, deduplicated.
The executor uses this to check, once, that the template only names parameters the search space declares.
Trait Implementations§
§impl Clone for CommandTemplate
impl Clone for CommandTemplate
§fn clone(&self) -> CommandTemplate
fn clone(&self) -> CommandTemplate
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read more§impl Debug for CommandTemplate
impl Debug for CommandTemplate
impl Eq for CommandTemplate
§impl PartialEq for CommandTemplate
impl PartialEq for CommandTemplate
impl StructuralPartialEq for CommandTemplate
Auto Trait Implementations§
impl Freeze for CommandTemplate
impl RefUnwindSafe for CommandTemplate
impl Send for CommandTemplate
impl Sync for CommandTemplate
impl Unpin for CommandTemplate
impl UnsafeUnpin for CommandTemplate
impl UnwindSafe for CommandTemplate
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
Mutably borrows from an owned value. Read more