Struct koto_runtime::KotoVmSettings
source · pub struct KotoVmSettings {
pub run_import_tests: bool,
pub execution_limit: Option<Duration>,
pub module_imported_callback: Option<Box<dyn ModuleImportedCallback>>,
pub stdin: Ptr<dyn KotoFile>,
pub stdout: Ptr<dyn KotoFile>,
pub stderr: Ptr<dyn KotoFile>,
}
Expand description
The configurable settings that should be used by the Koto runtime
Fields§
§run_import_tests: bool
Whether or not tests should be run when importing modules
execution_limit: Option<Duration>
An optional duration that limits how long execution is allowed to take.
If the limit is reached without execution ending, then a Timeout error will be returned.
The VM will check against the execution deadline periodically, with an interval of roughly one tenth of the overall limit’s duration.
The check is performed between VM instructions, so external functions will still be able to block execution.
module_imported_callback: Option<Box<dyn ModuleImportedCallback>>
An optional callback that is called whenever a module is imported by the runtime
This allows you to track the runtime’s dependencies, which might be useful if you want to reload the script when one of its dependencies has changed.
stdin: Ptr<dyn KotoFile>
The runtime’s stdin
stdout: Ptr<dyn KotoFile>
The runtime’s stdout
stderr: Ptr<dyn KotoFile>
The runtime’s stderr
Trait Implementations§
Auto Trait Implementations§
impl Freeze for KotoVmSettings
impl !RefUnwindSafe for KotoVmSettings
impl Send for KotoVmSettings
impl Sync for KotoVmSettings
impl Unpin for KotoVmSettings
impl !UnwindSafe for KotoVmSettings
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.