Skip to content

Commit

Permalink
Merge #1017
Browse files Browse the repository at this point in the history
1017: Add a 'clear' method to map. r=nlewycky a=nlewycky

# Description
Motivated by work on the `nlewycky/inkwell-lifetimes` branch. No callers yet on master, but we use it on the branch and I'd like to merge in pieces.


Co-authored-by: Nick Lewycky <nick@wasmer.io>
  • Loading branch information
bors[bot] and nlewycky authored Nov 25, 2019
2 parents 95ccd99 + 4e2440d commit 7715be9
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/runtime-core/src/structures/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ where
}
}

/// Clears the map. Keeps the allocated memory for future use.
pub fn clear(&mut self) {
self.elems.clear();
}

/// Returns the size of this map.
pub fn len(&self) -> usize {
self.elems.len()
Expand Down

0 comments on commit 7715be9

Please sign in to comment.