@@ -2677,7 +2677,10 @@ impl GlobalType {
2677
2677
} ;
2678
2678
GlobalType :: new ( ty, mutability)
2679
2679
}
2680
+ /// Construct a new global import with this type’s default value.
2680
2681
///
2682
+ /// This creates a host `Global` in the given store initialized to the
2683
+ /// type’s zero/null default (e.g. `0` for numeric globals, `null_ref` for refs).
2681
2684
pub fn default_value ( & self , store : impl AsContextMut ) -> Result < RuntimeGlobal > {
2682
2685
let val = self
2683
2686
. content ( )
@@ -2819,7 +2822,10 @@ impl TableType {
2819
2822
pub ( crate ) fn wasmtime_table ( & self ) -> & Table {
2820
2823
& self . ty
2821
2824
}
2825
+ /// Construct a new table import whose entries are filled with this type’s default.
2822
2826
///
2827
+ /// Creates a host `Table` in the store with its initial size and element
2828
+ /// type’s default (e.g. `null_ref` for nullable refs).
2823
2829
pub fn default_value ( & self , store : impl AsContextMut ) -> Result < RuntimeTable > {
2824
2830
let val: ValType = self . element ( ) . clone ( ) . into ( ) ;
2825
2831
let init_val = val
@@ -3160,7 +3166,10 @@ impl MemoryType {
3160
3166
pub ( crate ) fn wasmtime_memory ( & self ) -> & Memory {
3161
3167
& self . ty
3162
3168
}
3169
+ /// Construct a new memory import initialized to this memory type’s default state
3163
3170
///
3171
+ /// Returns a host `Memory` in the given store with the configured initial
3172
+ /// page size and zeroed contents.
3164
3173
pub fn default_value ( & self , store : impl AsContextMut ) -> Result < RuntimeMemory > {
3165
3174
RuntimeMemory :: new ( store, self . clone ( ) )
3166
3175
}
0 commit comments