pub struct ModuleExports { /* private fields */ }Expand description
The exports of a Module.
In addition to the name-to-entity map this maintains sets for exported
globals, memories and tables, such that Module::is_exported_global,
-memory and -table lookups are constant time.
The sets are derived from the map during construction and during de-
serialization (see the custom serde impl).
ModuleExports::insert ensures the map and the sets remain in sync.
Implementations§
Source§impl ModuleExports
impl ModuleExports
Sourcepub fn reserve(&mut self, additional: usize) -> Result<(), OutOfMemory>
pub fn reserve(&mut self, additional: usize) -> Result<(), OutOfMemory>
Reserves capacity for at least additional more exports.
Sourcepub fn insert(
&mut self,
name: Atom,
entity: EntityIndex,
) -> Result<(), OutOfMemory>
pub fn insert( &mut self, name: Atom, entity: EntityIndex, ) -> Result<(), OutOfMemory>
Adds a new export called name which refers to entity.
Export names are unique within a module, so name must not already be
exported.
Sourcepub fn get(&self, name: &Atom) -> Option<&EntityIndex>
pub fn get(&self, name: &Atom) -> Option<&EntityIndex>
Looks up the export called name, if any.
Sourcepub fn iter(&self) -> impl ExactSizeIterator<Item = (&Atom, &EntityIndex)> + '_
pub fn iter(&self) -> impl ExactSizeIterator<Item = (&Atom, &EntityIndex)> + '_
Iterates over all exports in the order that they were inserted.
Trait Implementations§
Source§impl Debug for ModuleExports
impl Debug for ModuleExports
Source§impl Default for ModuleExports
impl Default for ModuleExports
Source§impl<'de> Deserialize<'de> for ModuleExports
impl<'de> Deserialize<'de> for ModuleExports
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Index<&Atom> for ModuleExports
impl Index<&Atom> for ModuleExports
Source§type Output = EntityIndex
type Output = EntityIndex
The returned type after indexing.
Auto Trait Implementations§
impl Forget for ModuleExports
impl Freeze for ModuleExports
impl Move for ModuleExports
impl RefUnwindSafe for ModuleExports
impl Send for ModuleExports
impl Sync for ModuleExports
impl Unpin for ModuleExports
impl UnsafeUnpin for ModuleExports
impl UnwindSafe for ModuleExports
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