Struct starlark::environment::Module
source · [−]pub struct Module { /* private fields */ }
Expand description
A container for user values, used during execution.
A module contains both a FrozenHeap
and Heap
on which different values are allocated.
You can get references to these heaps with frozen_heap
and
heap
. Be careful not to use these values after the Module
has been
released unless you obtain a reference to the frozen heap.
Implementations
sourceimpl Module
impl Module
sourcepub fn frozen_heap(&self) -> &FrozenHeap
pub fn frozen_heap(&self) -> &FrozenHeap
Get the frozen heap on which frozen values are allocated by this module.
sourcepub fn get<'v>(&'v self, name: &str) -> Option<Value<'v>>
pub fn get<'v>(&'v self, name: &str) -> Option<Value<'v>>
Get the value of the exported variable name
.
Returns None
if the variable isn’t defined in the module or it is private.
sourcepub fn freeze(self) -> Result<FrozenModule>
pub fn freeze(self) -> Result<FrozenModule>
Freeze the environment, all its value will become immutable afterwards.
sourcepub fn set<'v>(&'v self, name: &str, value: Value<'v>)
pub fn set<'v>(&'v self, name: &str, value: Value<'v>)
Set the value of a variable in the environment. Modifying these variables while executing is ongoing can have surprising effects.
sourcepub fn import_public_symbols(&self, module: &FrozenModule)
pub fn import_public_symbols(&self, module: &FrozenModule)
Import symbols from a module, similar to what is done during load()
.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Module
impl Send for Module
impl !Sync for Module
impl Unpin for Module
impl !UnwindSafe for Module
Blanket Implementations
sourceimpl<T> AsARef<T> for T where
T: ?Sized,
impl<T> AsARef<T> for T where
T: ?Sized,
sourcefn try_as_aref(this: &T) -> Result<ARef<'_, T>, BorrowError>
fn try_as_aref(this: &T) -> Result<ARef<'_, T>, BorrowError>
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more