Struct starlark::environment::FrozenModule
source · pub struct FrozenModule { /* private fields */ }
Expand description
The result of freezing a Module
, making it and its contained values immutable.
The values of this FrozenModule
are stored on a frozen heap, a reference to which
can be obtained using frozen_heap
. Be careful not to use
these values after the FrozenModule
has been released unless you obtain a reference
to the frozen heap.
Implementations§
source§impl FrozenModule
impl FrozenModule
sourcepub fn dump_debug(&self) -> String
pub fn dump_debug(&self) -> String
Print a lot of module internals for debugging.
source§impl FrozenModule
impl FrozenModule
sourcepub fn from_globals(globals: &Globals) -> Result<FrozenModule>
pub fn from_globals(globals: &Globals) -> Result<FrozenModule>
Convert items in globals
into a FrozenModule
.
This function can be used to implement starlark module
using the #[starlark_module]
attribute.
This function does not return an error, but we prefer not to panic if there’s some high level logic error.
sourcepub fn get_option(&self, name: &str) -> Result<Option<OwnedFrozenValue>>
pub fn get_option(&self, name: &str) -> Result<Option<OwnedFrozenValue>>
Get the value of the exported variable name
.
§Returns
None
if symbol is not found- error if symbol is private
sourcepub fn get(&self, name: &str) -> Result<OwnedFrozenValue>
pub fn get(&self, name: &str) -> Result<OwnedFrozenValue>
Get the value of the exported variable name
.
Returns an error if the variable isn’t defined in the module or it is private.
sourcepub fn names(&self) -> impl Iterator<Item = FrozenStringValue> + '_
pub fn names(&self) -> impl Iterator<Item = FrozenStringValue> + '_
Iterate through all the names defined in this module. Only includes symbols that are publicly exposed.
sourcepub fn frozen_heap(&self) -> &FrozenHeapRef
pub fn frozen_heap(&self) -> &FrozenHeapRef
Obtain the FrozenHeapRef
which owns the storage of all values defined in this module.
sourcepub fn documentation(&self) -> DocModule
pub fn documentation(&self) -> DocModule
The documentation for the module, and all of its top level values
Returns (<module documentation>, { <symbol> : <that symbol's documentation> })
sourcepub fn aggregated_heap_profile_info(&self) -> Result<&AggregateHeapProfileInfo>
pub fn aggregated_heap_profile_info(&self) -> Result<&AggregateHeapProfileInfo>
Retained memory info, or error if not enabled.
sourcepub fn heap_profile(&self) -> Result<ProfileData>
pub fn heap_profile(&self) -> Result<ProfileData>
Retained memory info, or error if not enabled.
sourcepub fn extra_value(&self) -> Option<FrozenValue>
pub fn extra_value(&self) -> Option<FrozenValue>
extra_value
field from Module
, frozen.
sourcepub fn owned_extra_value(&self) -> Option<OwnedFrozenValue>
pub fn owned_extra_value(&self) -> Option<OwnedFrozenValue>
extra_value
field from Module
, frozen.
Trait Implementations§
source§impl Allocative for FrozenModule
impl Allocative for FrozenModule
source§impl Clone for FrozenModule
impl Clone for FrozenModule
source§fn clone(&self) -> FrozenModule
fn clone(&self) -> FrozenModule
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more