pub struct TopLevelEnvironment(/* private fields */);Expand description
A top level environment such as a library, program, or REPL.
Implementations§
Source§impl TopLevelEnvironment
impl TopLevelEnvironment
pub fn new_repl(rt: &Runtime) -> Self
pub fn from_spec( rt: &Runtime, spec: LibrarySpec, path: PathBuf, ) -> Result<Self, Exception>
Sourcepub fn eval(
&self,
allow_imports: bool,
code: &str,
) -> Result<Vec<Value>, Exception>
pub fn eval( &self, allow_imports: bool, code: &str, ) -> Result<Vec<Value>, Exception>
Evaluate the scheme expression in the provided environment and return
the values. If allow_imports is false, import expressions are
disallowed and will cause an error.
pub fn eval_sexpr( &self, allow_imports: bool, sexpr: Syntax, ) -> Result<Vec<Value>, Exception>
pub fn import(&self, import_set: ImportSet) -> Result<(), Exception>
pub fn is_repl(&self) -> bool
pub fn def_var(&self, binding: Binding, name: Symbol, value: Value) -> Global
pub fn lookup_var(&self, binding: Binding) -> Result<Option<Global>, Exception>
pub fn lookup_var_inner( &self, binding: Binding, ) -> Result<Option<Global>, Exception>
pub fn def_keyword(&self, binding: Binding, transformer: Procedure)
pub fn lookup_keyword( &self, binding: Binding, ) -> Result<Option<Procedure>, Exception>
pub fn lookup_keyword_inner( &self, binding: Binding, ) -> Result<Option<Procedure>, Exception>
pub fn lookup_primitive(&self, binding: Binding) -> Option<Primitive>
Trait Implementations§
Source§impl Clone for TopLevelEnvironment
impl Clone for TopLevelEnvironment
Source§fn clone(&self) -> TopLevelEnvironment
fn clone(&self) -> TopLevelEnvironment
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 TopLevelEnvironment
impl Debug for TopLevelEnvironment
Source§impl PartialEq for TopLevelEnvironment
impl PartialEq for TopLevelEnvironment
Auto Trait Implementations§
impl Freeze for TopLevelEnvironment
impl !RefUnwindSafe for TopLevelEnvironment
impl Send for TopLevelEnvironment
impl Sync for TopLevelEnvironment
impl Unpin for TopLevelEnvironment
impl !UnwindSafe for TopLevelEnvironment
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
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>
Converts
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>
Converts
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