Struct r::object::Environment
source · pub struct Environment {
pub values: RefCell<HashMap<String, Obj>>,
pub parent: Option<Rc<Environment>>,
}
Fields§
§values: RefCell<HashMap<String, Obj>>
§parent: Option<Rc<Environment>>
Implementations§
source§impl Environment
impl Environment
pub fn from_builtins() -> Rc<Environment>
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn insert(&self, name: String, value: Obj)
pub fn append(&self, l: List)
pub fn get(&self, name: String) -> EvalResult
sourcepub fn find(&self, name: String) -> Result<(Obj, Rc<Environment>), Signal>
pub fn find(&self, name: String) -> Result<(Obj, Rc<Environment>), Signal>
Find a variable in the environment or one of its parents. If the variable is found, a mutable view on it is returned.
pub fn get_mut(&self, name: String) -> EvalResult
Trait Implementations§
source§impl Clone for Environment
impl Clone for Environment
source§fn clone(&self) -> Environment
fn clone(&self) -> Environment
Returns a copy 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 Environment
impl Debug for Environment
source§impl Default for Environment
impl Default for Environment
source§fn default() -> Environment
fn default() -> Environment
Returns the “default value” for a type. Read more
source§impl Display for Environment
impl Display for Environment
source§impl PartialEq for Environment
impl PartialEq for Environment
impl StructuralPartialEq for Environment
Auto Trait Implementations§
impl !Freeze for Environment
impl !RefUnwindSafe for Environment
impl !Send for Environment
impl !Sync for Environment
impl Unpin for Environment
impl !UnwindSafe for Environment
Blanket Implementations§
source§impl<T> AsDynCompare for Twhere
T: Any + DynCompare,
impl<T> AsDynCompare for Twhere
T: Any + DynCompare,
fn as_any(&self) -> &(dyn Any + 'static)
fn as_dyn_compare(&self) -> &(dyn DynCompare + 'static)
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<T> DynCompare for T
impl<T> DynCompare for T
fn dyn_eq(&self, other: &(dyn DynCompare + 'static)) -> bool
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