pub struct Table { /* private fields */ }
Expand description
A table instance.
Implementations§
Source§impl Table
impl Table
Sourcepub fn new(plan: &TablePlan) -> Self
pub fn new(plan: &TablePlan) -> Self
Create a new table instance with specified minimum and maximum number of elements.
Sourcepub fn grow(&self, delta: u32) -> Option<u32>
pub fn grow(&self, delta: u32) -> Option<u32>
Grow table by the specified amount of elements.
Returns None
if table can’t be grown by the specified amount
of elements. Returns the previous size of the table if growth is
successful.
Sourcepub fn get(&self, index: u32) -> Option<VMCallerCheckedAnyfunc>
pub fn get(&self, index: u32) -> Option<VMCallerCheckedAnyfunc>
Get reference to the specified element.
Returns None
if the index is out of bounds.
Sourcepub fn copy(
dst_table: &Self,
src_table: &Self,
dst_index: u32,
src_index: u32,
len: u32,
) -> Result<(), Trap>
pub fn copy( dst_table: &Self, src_table: &Self, dst_index: u32, src_index: u32, len: u32, ) -> Result<(), Trap>
Copy len
elements from src_table[src_index..]
into dst_table[dst_index..]
.
§Errors
Returns an error if the range is out of bounds of either the source or destination tables.
Sourcepub fn vmtable(&self) -> VMTableDefinition
pub fn vmtable(&self) -> VMTableDefinition
Return a VMTableDefinition
for exposing the table to compiled wasm code.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Table
impl !RefUnwindSafe for Table
impl !Send for Table
impl !Sync for Table
impl Unpin for Table
impl UnwindSafe for Table
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
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>
Converts
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>
Converts
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