#[non_exhaustive]pub struct TsRuntimeConfig {
pub msgpack_module: String,
pub generate_raw_export_wrappers: bool,
pub streaming_instantiation: bool,
}
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.msgpack_module: String
The module from which to import the MessagePack dependency.
By default, “@msgpack/msgpack” is used, which should work with Node.js and most NPM-based bundlers. If you use Deno, you may wish to specify “https://unpkg.com/@msgpack/msgpack/mod.ts”.
generate_raw_export_wrappers: bool
Whether or not to generate raw export wrappers.
Raw export wrappers allow you to call fp_export!
functions from the
runtime while passing raw MessagePack data, which you can use in some
situations to avoid (de)serialization overhead. If you don’t need these
wrappers, you can omit them to optimize your bundle size.
Raw export wrappers are named similarly to the regular wrappers (which
are generated in any case), but with a Raw
suffix.
streaming_instantiation: bool
Use WebAssembly.instantiateStreaming()
instead of
WebAssembly.instantiate()
for optimizing instantiation in browser use
cases. This changes the signature of the createRuntime()
function to
accept a Response
instead of an ArrayBuffer
.
See also: https://developer.mozilla.org/en-US/docs/WebAssembly/JavaScript_interface/instantiateStreaming
This setting is true
by default, since MDN recommends it where
possible. You may wish to opt-out if you’re using the runtime in an
environment that doesn’t support streaming instantiation, such as
Node.js.
Implementations§
Source§impl TsRuntimeConfig
impl TsRuntimeConfig
Sourcepub fn with_msgpack_module(self, msgpack_module: &str) -> Self
pub fn with_msgpack_module(self, msgpack_module: &str) -> Self
Sets the msgpack_module
setting.
Sourcepub fn with_raw_export_wrappers(self) -> Self
pub fn with_raw_export_wrappers(self) -> Self
Enables the generate_raw_export_wrappers
setting.
Sourcepub fn without_streaming_instantiation(self) -> Self
pub fn without_streaming_instantiation(self) -> Self
Disables the streaming_instantiation
setting.
Trait Implementations§
Source§impl Clone for TsRuntimeConfig
impl Clone for TsRuntimeConfig
Source§fn clone(&self) -> TsRuntimeConfig
fn clone(&self) -> TsRuntimeConfig
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
source
. Read more