pub fn new(store: &Store, ty: TableType, init: Val) -> Result<Table> {
        let item = into_checked_anyfunc(init, store)?;
        let (mut wasmtime_handle, wasmtime_export) = generate_table_export(&ty)?;

        // Initialize entries with the init value.
        match wasmtime_export {
            wasmtime_runtime::Export::Table { definition, .. } => {
                let index = wasmtime_handle.table_index(unsafe { &*definition });
                let len = unsafe { (*definition).current_elements };
                for i in 0..len {
                    set_table_item(&mut wasmtime_handle, index, i, item.clone())?;
                }
            }
            _ => unreachable!("export should be a table"),
        }

        Ok(Table {
            store: store.clone(),
            ty,
            wasmtime_handle,
            wasmtime_export,
        })
    }
/// Creates a new `Table` with the given parameters.
///
/// * `store` - a global cache to store information in
/// * `ty` - the type of this table, containing both the element type as
///   well as the initial size and maximum size, if any.
/// * `init` - the initial value to fill all table entries with, if the
///   table starts with an initial size.
///
/// # Errors
///
/// Returns an error if `init` does not match the element type of the table.
Creates a new `Table` with the given parameters.
`store` - a global cache to store information in
`ty` - the type of this table, containing both the element type as
well as the initial size and maximum size, if any.
`init` - the initial value to fill all table entries with, if the
table starts with an initial size.
Creates a new ` Table ` with the given parameters . ` store ` - a global cache to store information in ` ty ` - the type of this table containing both the element type as well as the initial size and maximum size if any . ` init ` - the initial value to fill all table entries with if the table starts with an initial size .
pub fn new(store: &Store, ty: TableType, init: Val) -> Result<Table> {
        let item = into_checked_anyfunc(init, store)?;
        let (mut wasmtime_handle, wasmtime_export) = generate_table_export(&ty)?;
        // Initialize entries with the init value.
        match wasmtime_export {
            wasmtime_runtime::Export::Table { definition, .. } => {
                let index = wasmtime_handle.table_index(unsafe { &*definition });
                let len = unsafe { (*definition).current_elements };
                for i in 0..len {
                    set_table_item(&mut wasmtime_handle, index, i, item.clone())?;
                }
            }
            _ => unreachable!("export should be a table"),
        }
        Ok(Table {
            store: store.clone(),
            ty,
            wasmtime_handle,
            wasmtime_export,
        })
    }
pub fn new ( store : & Store , ty : TableType , init : Val ) -> Result < Table > { let item = into_checked_anyfunc ( init , store ) ? ; let ( mut wasmtime_handle , wasmtime_export ) = generate_table_export ( & ty ) ? ; // Initialize entries with the init value. match wasmtime_export { wasmtime_runtime :: Export :: Table { definition , .. } => { let index = wasmtime_handle . table_index ( unsafe { & * definition } ) ; let len = unsafe { ( * definition ) . current_elements } ; for i in 0 .. len { set_table_item ( & mut wasmtime_handle , index , i , item . clone ( ) ) ? ; } } _ => unreachable ! ( " " ) , } Ok ( Table { store : store . clone ( ) , ty , wasmtime_handle , wasmtime_export , } ) }
Creates a new `Table` with the given parameters.
Creates a new ` Table ` with the given parameters .
store
&Store
ty
TableType
init
Val
store
&Store
ty
TableType
init
Val
errors
Returns an error if `init` does not match the element type of the table.
Returns an error if ` init ` does not match the element type of the table .