pub struct Runtime(/* private fields */);Expand description
Scheme-rs core runtime
Practically, the runtime is the core entry point for running Scheme programs with scheme-rs. It initializes the garbage collector and JIT compiler tasks and creates a new library registry.
There is not much you can do with a Runtime beyond creating it and using it to run programs, however a lot of functions require it as an arguments, such as TopLevelEnvironment::new_repl.
You can also use the runtime to define libraries from Rust code.
Runtime is automatically reference counted, so if you have all of the procedures you need you can drop it without any issue.
§Safety:
The runtime contains the only live references to the Cranelift Context and therefore modules and allocated functions in the form a Sender of compilation tasks.
When that sender’s ref count is zero, it will cause the receiver to fail and the compilation task will exit, allowing for a graceful shutdown.
However, this is dropping a lifetime. If we clone a procedure and drop the runtime from whence it was cleaved, we’re left with a dangling pointer.
In order to remedy this it is vitally important the closure has a back pointer to the runtime.
Implementations§
Source§impl Runtime
impl Runtime
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Runtime
impl !RefUnwindSafe for Runtime
impl Send for Runtime
impl Sync for Runtime
impl Unpin for Runtime
impl !UnwindSafe for Runtime
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more