pub struct State {
pub storage: Storage,
pub stdin: Box<dyn BufRead>,
pub stdout: WriteHandle,
pub stderr: WriteHandle,
/* private fields */
}Fields§
§storage: Storage§stdin: Box<dyn BufRead>§stdout: WriteHandle§stderr: WriteHandleImplementations§
Source§impl State
impl State
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new state for running a program.
You must use a method such as with_code or with_source_file
to set the program source code before using run to execute it.
Sourcepub fn with_source_file(self, path: impl AsRef<Path>) -> Result<Self>
pub fn with_source_file(self, path: impl AsRef<Path>) -> Result<Self>
Sourcepub fn with_source_directory(self, dir_path: impl AsRef<Path>) -> Self
pub fn with_source_directory(self, dir_path: impl AsRef<Path>) -> Self
Sets the source directory for resolving imports to the given directory.
Sourcepub fn with_cwd(self) -> Self
pub fn with_cwd(self) -> Self
Sets the current directory to the operating systems current working directory.
§Panics
Panics if env::current_dir returned an error.
Sourcepub fn run(&mut self) -> Result<Atom>
pub fn run(&mut self) -> Result<Atom>
Runs the given program with the details specified by this state.
Returns the result the program returned.
§Panics
Panics if code was not set.
Sourcepub const fn make_type_id(&mut self) -> i64
pub const fn make_type_id(&mut self) -> i64
Returns a new type id for a type call.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for State
impl !RefUnwindSafe for State
impl !Send for State
impl !Sync for State
impl Unpin for State
impl !UnwindSafe for State
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