Create a new dynamic (movable) table instance for the specified table plan.
(
ty: &wasmtime_environ::Table,
tunables: &Tunables,
limiter: Option<&mut StoreResourceLimiter<'_>>,
)
| 329 | impl Table { |
| 330 | /// Create a new dynamic (movable) table instance for the specified table plan. |
| 331 | pub async fn new_dynamic( |
| 332 | ty: &wasmtime_environ::Table, |
| 333 | tunables: &Tunables, |
| 334 | limiter: Option<&mut StoreResourceLimiter<'_>>, |
| 335 | ) -> Result<Self> { |
| 336 | let (minimum, maximum) = Self::limit_new(ty, limiter).await?; |
| 337 | match wasm_to_table_type(ty.ref_type) { |
| 338 | TableElementType::Func => Ok(Self::from(DynamicFuncTable { |
| 339 | elements: unsafe { alloc_dynamic_table_elements(minimum)? }, |
| 340 | maximum, |
| 341 | lazy_init: tunables.table_lazy_init, |
| 342 | })), |
| 343 | TableElementType::GcRef => Ok(Self::from(DynamicGcRefTable { |
| 344 | elements: unsafe { alloc_dynamic_table_elements(minimum)? }, |
| 345 | maximum, |
| 346 | })), |
| 347 | TableElementType::Cont => { |
| 348 | let mut elements = TryVec::new(); |
| 349 | elements.resize_with(minimum, || None)?; |
| 350 | Ok(Self::from(DynamicContTable { elements, maximum })) |
| 351 | } |
| 352 | } |
| 353 | } |
| 354 | |
| 355 | /// Create a new static (immovable) table instance for the specified table plan. |
| 356 | pub async unsafe fn new_static( |
nothing calls this directly
no test coverage detected