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) -> FreezeResult<FrozenModule>
pub fn from_globals(globals: &Globals) -> FreezeResult<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 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 moreSource§impl Debug for FrozenModule
impl Debug for FrozenModule
Auto Trait Implementations§
impl Freeze for FrozenModule
impl !RefUnwindSafe for FrozenModule
impl Send for FrozenModule
impl Sync for FrozenModule
impl Unpin for FrozenModule
impl !UnwindSafe for FrozenModule
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