pub struct ScriptOptions { /* private fields */ }
Expand description
Configuration options for script execution.
This struct provides fine-grained control over how OpenScript code is executed, including environment variables, I/O redirection, timeouts, and more.
§Examples
use openrunner_rs::ScriptOptions;
use std::time::Duration;
let options = ScriptOptions::new()
.timeout(Duration::from_secs(30))
.env("DEBUG", "1")
.args(vec!["arg1".to_string(), "arg2".to_string()]);
Implementations§
Source§impl ScriptOptions
impl ScriptOptions
Sourcepub fn openscript_path(self, path: impl Into<PathBuf>) -> Self
pub fn openscript_path(self, path: impl Into<PathBuf>) -> Self
Set the path to the OpenScript interpreter.
If not set, the system will look for openscript
in the PATH.
§Examples
use openrunner_rs::ScriptOptions;
let options = ScriptOptions::new()
.openscript_path("/usr/local/bin/openscript");
Sourcepub fn working_directory(self, path: impl Into<PathBuf>) -> Self
pub fn working_directory(self, path: impl Into<PathBuf>) -> Self
Set the working directory for script execution.
§Examples
use openrunner_rs::ScriptOptions;
let options = ScriptOptions::new()
.working_directory("/tmp");
Sourcepub fn env(self, key: impl Into<String>, val: impl Into<String>) -> Self
pub fn env(self, key: impl Into<String>, val: impl Into<String>) -> Self
Add an environment variable for script execution.
§Examples
use openrunner_rs::ScriptOptions;
let options = ScriptOptions::new()
.env("DEBUG", "1")
.env("LOG_LEVEL", "info");
Sourcepub fn args(self, args: Vec<String>) -> Self
pub fn args(self, args: Vec<String>) -> Self
Set command-line arguments for the script.
§Examples
use openrunner_rs::ScriptOptions;
let options = ScriptOptions::new()
.args(vec!["--verbose".to_string(), "input.txt".to_string()]);
Sourcepub fn stdin(self, opt: IoOptions) -> Self
pub fn stdin(self, opt: IoOptions) -> Self
Configure stdin handling.
§Examples
use openrunner_rs::{types::IoOptions, ScriptOptions};
let options = ScriptOptions::new()
.stdin(IoOptions::Null);
Sourcepub fn timeout(self, duration: Duration) -> Self
pub fn timeout(self, duration: Duration) -> Self
Set a timeout for script execution.
If the script runs longer than the specified duration, it will be terminated.
§Examples
use openrunner_rs::ScriptOptions;
use std::time::Duration;
let options = ScriptOptions::new()
.timeout(Duration::from_secs(60));
Sourcepub fn exit_on_error(self, exit: bool) -> Self
pub fn exit_on_error(self, exit: bool) -> Self
Configure whether to exit on script errors.
Sourcepub fn print_commands(self, print: bool) -> Self
pub fn print_commands(self, print: bool) -> Self
Configure whether to print commands before execution.
Sourcepub fn ai_enabled(self, enabled: bool) -> Self
pub fn ai_enabled(self, enabled: bool) -> Self
Configure whether AI features are enabled.
Trait Implementations§
Source§impl Clone for ScriptOptions
impl Clone for ScriptOptions
Source§fn clone(&self) -> ScriptOptions
fn clone(&self) -> ScriptOptions
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for ScriptOptions
impl Debug for ScriptOptions
Auto Trait Implementations§
impl Freeze for ScriptOptions
impl RefUnwindSafe for ScriptOptions
impl Send for ScriptOptions
impl Sync for ScriptOptions
impl Unpin for ScriptOptions
impl UnwindSafe for ScriptOptions
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