mirror of
https://github.com/fluencelabs/wasmer
synced 2025-06-30 00:51:34 +00:00
Add getter to table and other misc changes
This commit is contained in:
@ -89,6 +89,16 @@ impl Table {
|
||||
self.desc
|
||||
}
|
||||
|
||||
/// Get the `Element` at the given index in the table
|
||||
pub fn get(&self, index: u32) -> Option<Element> {
|
||||
let storage = self.storage.lock().unwrap();
|
||||
match &*storage {
|
||||
(TableStorage::Anyfunc(ref anyfunc_table), _) => {
|
||||
anyfunc_table.get(index).map(Element::Anyfunc)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Set the element at index.
|
||||
pub fn set(&self, index: u32, element: Element) -> Result<(), ()> {
|
||||
let mut storage = self.storage.lock().unwrap();
|
||||
|
Reference in New Issue
Block a user