pub struct Table { /* private fields */ }Expand description
A WebAssembly table instance.
Implementations§
Source§impl Table
impl Table
Sourcepub fn new(ty: TableType, default: Value) -> Option<Self>
pub fn new(ty: TableType, default: Value) -> Option<Self>
Create a table with min entries of default. Dense allocation is
fallible (None on allocation failure); sparse storage never
allocates eagerly.
Sourcepub fn get(&self, idx: u32) -> Option<Value>
pub fn get(&self, idx: u32) -> Option<Value>
Read the entry at idx, or None when out of bounds.
Sourcepub fn set(&mut self, idx: u32, value: Value) -> bool
pub fn set(&mut self, idx: u32, value: Value) -> bool
Write value at idx; false on out of bounds.
Sourcepub fn grow(&mut self, delta: u32, fill: Value) -> Option<u32>
pub fn grow(&mut self, delta: u32, fill: Value) -> Option<u32>
Grow by delta entries filled with fill, returning the previous
length, or None when the declared max (or allocation) rejects.
Sourcepub fn fill(&mut self, start: u32, value: Value, count: u32) -> bool
pub fn fill(&mut self, start: u32, value: Value, count: u32) -> bool
Fill count entries starting at start with value; false on
out of bounds.
Sourcepub fn read_slice(&self, start: u32, count: u32) -> Option<Vec<Value>>
pub fn read_slice(&self, start: u32, count: u32) -> Option<Vec<Value>>
Snapshot entries in start..start + count; None on out of bounds.
Sourcepub fn write_slice(&mut self, start: u32, values: &[Value]) -> bool
pub fn write_slice(&mut self, start: u32, values: &[Value]) -> bool
Write values starting at start; false on out of bounds.
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 UnsafeUnpin 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