pub struct Table { /* private fields */ }
Expand description
A Wasm table entity.
Implementations§
Source§impl Table
impl Table
Sourcepub fn new(
ty: TableType,
init: TypedVal,
limiter: &mut ResourceLimiterRef<'_>,
) -> Result<Self, TableError>
pub fn new( ty: TableType, init: TypedVal, limiter: &mut ResourceLimiterRef<'_>, ) -> Result<Self, TableError>
Sourcepub fn dynamic_ty(&self) -> TableType
pub fn dynamic_ty(&self) -> TableType
Sourcepub fn grow(
&mut self,
delta: u64,
init: TypedVal,
fuel: Option<&mut Fuel>,
limiter: &mut ResourceLimiterRef<'_>,
) -> Result<u64, TableError>
pub fn grow( &mut self, delta: u64, init: TypedVal, fuel: Option<&mut Fuel>, limiter: &mut ResourceLimiterRef<'_>, ) -> Result<u64, TableError>
Sourcepub fn grow_untyped(
&mut self,
delta: u64,
init: UntypedVal,
fuel: Option<&mut Fuel>,
limiter: &mut ResourceLimiterRef<'_>,
) -> Result<u64, TableError>
pub fn grow_untyped( &mut self, delta: u64, init: UntypedVal, fuel: Option<&mut Fuel>, limiter: &mut ResourceLimiterRef<'_>, ) -> Result<u64, TableError>
Sourcepub fn get(&self, index: u64) -> Option<TypedVal>
pub fn get(&self, index: u64) -> Option<TypedVal>
Returns the Table
element value at index
.
Returns None
if index
is out of bounds.
Sourcepub fn get_untyped(&self, index: u64) -> Option<UntypedVal>
pub fn get_untyped(&self, index: u64) -> Option<UntypedVal>
Returns the untyped Table
element value at index
.
Returns None
if index
is out of bounds.
§Note
This is a more efficient version of Table::get
for
internal use only.
Sourcepub fn set_untyped(
&mut self,
index: u64,
value: UntypedVal,
) -> Result<(), TableError>
pub fn set_untyped( &mut self, index: u64, value: UntypedVal, ) -> Result<(), TableError>
Sourcepub fn init(
&mut self,
element: ElementSegmentRef<'_>,
dst_index: u64,
src_index: u32,
len: u32,
fuel: Option<&mut Fuel>,
) -> Result<(), TableError>
pub fn init( &mut self, element: ElementSegmentRef<'_>, dst_index: u64, src_index: u32, len: u32, fuel: Option<&mut Fuel>, ) -> Result<(), TableError>
Initialize len
elements from src_element[src_index..]
into self[dst_index..]
.
§Errors
Returns an error if the range is out of bounds of either the source or destination tables.
§Panics
If the ElementSegment
element type does not match the Table
element type.
Note: This is a panic instead of an error since it is asserted at Wasm validation time.
Sourcepub fn copy(
dst_table: &mut Self,
dst_index: u64,
src_table: &Self,
src_index: u64,
len: u64,
fuel: Option<&mut Fuel>,
) -> Result<(), TableError>
pub fn copy( dst_table: &mut Self, dst_index: u64, src_table: &Self, src_index: u64, len: u64, fuel: Option<&mut Fuel>, ) -> Result<(), TableError>
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 copy_within(
&mut self,
dst_index: u64,
src_index: u64,
len: u64,
fuel: Option<&mut Fuel>,
) -> Result<(), TableError>
pub fn copy_within( &mut self, dst_index: u64, src_index: u64, len: u64, fuel: Option<&mut Fuel>, ) -> Result<(), TableError>
Copy len
elements from self[src_index..]
into self[dst_index..]
.
§Errors
Returns an error if the range is out of bounds of the table.