### Wasmtime Bindgen Example Structs Source: https://docs.rs/wasmtime/36.0.2/wasmtime/all This section provides a categorized list of structs used in Wasmtime's bindgen examples, demonstrating various component model features. ```rust component::bindgen_examples::_0_hello_world::HelloWorld component::bindgen_examples::_0_hello_world::HelloWorldIndices component::bindgen_examples::_0_hello_world::HelloWorldPre component::bindgen_examples::_1_world_imports::MyWorld component::bindgen_examples::_1_world_imports::MyWorldIndices component::bindgen_examples::_1_world_imports::MyWorldPre component::bindgen_examples::_2_world_exports::HelloWorld component::bindgen_examples::_2_world_exports::HelloWorldIndices component::bindgen_examples::_2_world_exports::HelloWorldPre component::bindgen_examples::_2_world_exports::exports::demo::Guest component::bindgen_examples::_2_world_exports::exports::demo::GuestIndices component::bindgen_examples::_3_interface_imports::WithImports component::bindgen_examples::_3_interface_imports::WithImportsIndices component::bindgen_examples::_3_interface_imports::WithImportsPre component::bindgen_examples::_4_imported_resources::ImportSomeResources component::bindgen_examples::_4_imported_resources::ImportSomeResourcesIndices component::bindgen_examples::_4_imported_resources::ImportSomeResourcesPre component::bindgen_examples::_4_imported_resources::MyLogger component::bindgen_examples::_4_imported_resources::example::imported_resources::logging::Logger component::bindgen_examples::_5_all_world_export_kinds::WithExports component::bindgen_examples::_5_all_world_export_kinds::WithExportsIndices component::bindgen_examples::_5_all_world_export_kinds::WithExportsPre component::bindgen_examples::_5_all_world_export_kinds::exports::environment::Guest component::bindgen_examples::_5_all_world_export_kinds::exports::environment::GuestIndices component::bindgen_examples::_5_all_world_export_kinds::exports::example::world_exports::units::Guest component::bindgen_examples::_5_all_world_export_kinds::exports::example::world_exports::units::GuestIndices component::bindgen_examples::_6_exported_resources::ExportSomeResources component::bindgen_examples::_6_exported_resources::ExportSomeResourcesIndices component::bindgen_examples::_6_exported_resources::ExportSomeResourcesPre component::bindgen_examples::_6_exported_resources::exports::example::exported_resources::logging::Guest component::bindgen_examples::_6_exported_resources::exports::example::exported_resources::logging::GuestIndices component::bindgen_examples::_6_exported_resources::exports::example::exported_resources::logging::GuestLogger component::bindgen_examples::_7_async::ImportSomeResources component::bindgen_examples::_7_async::ImportSomeResourcesIndices component::bindgen_examples::_7_async::ImportSomeResourcesPre component::bindgen_examples::_7_async::MyLogger component::bindgen_examples::_7_async::example::imported_resources::logging::Logger ``` -------------------------------- ### wasmtime Component Bindgen Examples Source: https://docs.rs/wasmtime/36.0.2/wasmtime/component/bindgen_examples/_1_world_imports/index This snippet showcases various examples of using wasmtime's component bindgen functionality. It includes examples for world imports, world exports, interface imports, imported resources, exported resources, and asynchronous operations. ```Rust wasmtime::component::bindgen_examples::_0_hello_world ``` ```Rust wasmtime::component::bindgen_examples::_1_world_imports ``` ```Rust wasmtime::component::bindgen_examples::_2_world_exports ``` ```Rust wasmtime::component::bindgen_examples::_3_interface_imports ``` ```Rust wasmtime::component::bindgen_examples::_4_imported_resources ``` ```Rust wasmtime::component::bindgen_examples::_5_all_world_export_kinds ``` ```Rust wasmtime::component::bindgen_examples::_6_exported_resources ``` ```Rust wasmtime::component::bindgen_examples::_7_async ``` -------------------------------- ### Rust WASI Bindgen: Hello World Example Source: https://docs.rs/wasmtime/36.0.2/wasmtime/component/bindgen_examples/index A basic "hello world" style example demonstrating the output of the `bindgen!` macro for WASI. This snippet is intended for documentation purposes to show simple generated bindings. ```Rust /* Example for _0_hello_world module */ // This is a placeholder for the actual code snippet from the _0_hello_world module. ``` -------------------------------- ### wasmtime Component Bindgen Async Example Source: https://docs.rs/wasmtime/36.0.2/wasmtime/component/bindgen_examples/_7_async/example/imported_resources/index Demonstrates an example of component binding with async runtime support within the wasmtime crate. This functionality is available when the 'runtime', 'component-model', and 'docsrs' features are enabled. ```Rust wasmtime::component::bindgen_examples::_7_async::example::imported_resources ``` -------------------------------- ### Wasmtime Component Bindgen Examples Source: https://docs.rs/wasmtime/36.0.2/wasmtime/component/bindgen_examples/_2_world_exports/my/index Illustrates the structure of Wasmtime's component bindgen examples, specifically within the `_2_world_exports` module. It highlights the nested modules and structs related to world exports, such as HelloWorld. ```Rust ## In wasmtime::component::bindgen_examples::_2_world_exports ### Modules * exports * my ### Structs * HelloWorld * HelloWorldIndices * HelloWorldPre wasmtime::component::bindgen_examples::_2_world_exports # Module my Copy item path Source Search Settings Help Summary Available on **crate feature`runtime` and crate feature `component-model` and `docsrs`** only. ## Modules§ project ``` -------------------------------- ### wasmtime Component Bindgen Examples Source: https://docs.rs/wasmtime/36.0.2/wasmtime/component/bindgen_examples/_5_all_world_export_kinds/index Explores various examples related to WebAssembly component bindgen within the wasmtime crate. This includes modules demonstrating hello world, world imports, world exports, interface imports, imported resources, all world export kinds, exported resources, and async operations. ```Rust wasmtime::component::bindgen_examples::_0_hello_world wasmtime::component::bindgen_examples::_1_world_imports wasmtime::component::bindgen_examples::_2_world_exports wasmtime::component::bindgen_examples::_3_interface_imports wasmtime::component::bindgen_examples::_4_imported_resources wasmtime::component::bindgen_examples::_5_all_world_export_kinds wasmtime::component::bindgen_examples::_6_exported_resources wasmtime::component::bindgen_examples::_7_async ``` -------------------------------- ### wasmtime Component Bindgen Examples Source: https://docs.rs/wasmtime/36.0.2/wasmtime/component/bindgen_examples/_0_hello_world/index Explores the bindgen examples within the wasmtime component module. It lists various sub-modules that demonstrate different aspects of component binding, including imports, exports, resources, and async operations. ```Rust wasmtime::component::bindgen_examples::_0_hello_world wasmtime::component::bindgen_examples::_1_world_imports wasmtime::component::bindgen_examples::_2_world_exports wasmtime::component::bindgen_examples::_3_interface_imports wasmtime::component::bindgen_examples::_4_imported_resources wasmtime::component::bindgen_examples::_5_all_world_export_kinds wasmtime::component::bindgen_examples::_6_exported_resources wasmtime::component::bindgen_examples::_7_async ``` -------------------------------- ### Rust WASI Bindgen: Exported Resources Example Source: https://docs.rs/wasmtime/36.0.2/wasmtime/component/bindgen_examples/index Illustrates a WASI world that exports a resource. This example shows how `bindgen!` facilitates the export of custom resource types from Rust. ```Rust /* Example for _6_exported_resources module */ // This is a placeholder for the actual code snippet from the _6_exported_resources module. ``` -------------------------------- ### Wasmtime Component Bindgen Examples Source: https://docs.rs/wasmtime/36.0.2/wasmtime/component/bindgen_examples/_4_imported_resources/index This section outlines various examples for Wasmtime's component binding functionality. It covers different scenarios like 'hello_world', 'world_imports', 'world_exports', 'interface_imports', 'imported_resources', 'all_world_export_kinds', 'exported_resources', and 'async'. ```Rust wasmtime::component::bindgen_examples::_0_hello_world wasmtime::component::bindgen_examples::_1_world_imports wasmtime::component::bindgen_examples::_2_world_exports wasmtime::component::bindgen_examples::_3_interface_imports wasmtime::component::bindgen_examples::_4_imported_resources wasmtime::component::bindgen_examples::_5_all_world_export_kinds wasmtime::component::bindgen_examples::_6_exported_resources wasmtime::component::bindgen_examples::_7_async ``` -------------------------------- ### wasmtime Component Bindgen Examples - Imported Resources Source: https://docs.rs/wasmtime/36.0.2/wasmtime/component/bindgen_examples/_4_imported_resources/example/index Demonstrates the use of bindgen examples within wasmtime's component module, specifically focusing on imported resources. It lists associated structs and sub-modules relevant to this functionality. ```Rust # Module example Copy item path Source Search Settings Help Summary Available on **crate feature`runtime` and crate feature `component-model` and `docsrs`** only. ## Modules§ imported_resources ``` -------------------------------- ### wasmtime Component Exports Module Source: https://docs.rs/wasmtime/36.0.2/wasmtime/component/bindgen_examples/_5_all_world_export_kinds/exports/example/index Shows the structure of exported items within the wasmtime component bindgen examples, specifically focusing on the 'exports' module and its sub-modules like 'environment' and 'example'. ```Rust world_exports ``` -------------------------------- ### wasmtime Component Bindgen Example: Exported Resources Source: https://docs.rs/wasmtime/36.0.2/wasmtime/component/bindgen_examples/_6_exported_resources/exports/example/index Demonstrates an example of exported resources within the wasmtime component bindgen system. This functionality is available when the 'runtime', 'component-model', and 'docsrs' features are enabled. ```Rust wasmtime::component::bindgen_examples::_6_exported_resources::exports ``` -------------------------------- ### Rust WASI Bindgen: World Imports Example Source: https://docs.rs/wasmtime/36.0.2/wasmtime/component/bindgen_examples/index Demonstrates generated bindings for top-level imported functions and interfaces within a WASI world. This example showcases how `bindgen!` handles importing components from a WASI environment. ```Rust /* Example for _1_world_imports module */ // This is a placeholder for the actual code snippet from the _1_world_imports module. ``` -------------------------------- ### wasmtime Component Model Bindgen Examples Source: https://docs.rs/wasmtime/36.0.2/wasmtime/component/bindgen_examples/_2_world_exports/my/project/index Demonstrates the use of bindgen examples within the wasmtime component model, specifically for world exports. This is available when the 'runtime', 'component-model', and 'docsrs' features are enabled. ```Rust wasmtime::component::bindgen_examples::_2_world_exports::my ``` -------------------------------- ### Rust WASI Bindgen: Imported Resources Example Source: https://docs.rs/wasmtime/36.0.2/wasmtime/component/bindgen_examples/index Showcases generated bindings for imported resources within a WASI world. This example demonstrates how `bindgen!` manages resource types imported from the WASI environment. ```Rust /* Example for _4_imported_resources module */ // This is a placeholder for the actual code snippet from the _4_imported_resources module. ``` -------------------------------- ### wasmtime Component Bindgen Example: Imported Resources Source: https://docs.rs/wasmtime/36.0.2/wasmtime/component/bindgen_examples/_4_imported_resources/example/imported_resources/index Demonstrates the use of imported resources within wasmtime's component model bindgen examples. This functionality is available when the 'runtime', 'component-model', and 'docsrs' features are enabled. ```Rust wasmtime::component::bindgen_examples::_4_imported_resources::example ``` -------------------------------- ### wasmtime Component Bindgen Example Source: https://docs.rs/wasmtime/36.0.2/wasmtime/component/bindgen_examples/_5_all_world_export_kinds/exports/example/index Demonstrates an example related to wasmtime's component bindgen functionality, specifically for exporting kinds from a world. This snippet highlights the structure of exported items. ```Rust wasmtime::component::bindgen_examples::_5_all_world_export_kinds::exports ``` -------------------------------- ### Rust WASI Bindgen: World Exports Example Source: https://docs.rs/wasmtime/36.0.2/wasmtime/component/bindgen_examples/index Illustrates generated bindings for top-level exported functions from a WASI world. This example shows how Rust functions can be exposed to the WASI environment using `bindgen!`. ```Rust /* Example for _2_world_exports module */ // This is a placeholder for the actual code snippet from the _2_world_exports module. ``` -------------------------------- ### wasmtime Component Bindgen Example: Exported Resources Source: https://docs.rs/wasmtime/36.0.2/wasmtime/component/bindgen_examples/_6_exported_resources/exports/example/exported_resources/index Demonstrates the use of exported resources within the wasmtime component bindgen examples. This functionality is available when the 'runtime', 'component-model', and 'docsrs' features are enabled. ```Rust wasmtime::component::bindgen_examples::_6_exported_resources::exports::example ``` -------------------------------- ### wasmtime Component Bindgen Examples: Exported Resources Source: https://docs.rs/wasmtime/36.0.2/wasmtime/component/bindgen_examples/_6_exported_resources/exports/index Demonstrates examples related to component bindgen in wasmtime, specifically focusing on exported resources. This section details structs like `ExportSomeResources`, `ExportSomeResourcesIndices`, and `ExportSomeResourcesPre`. ```Rust struct ExportSomeResources; struct ExportSomeResourcesIndices; struct ExportSomeResourcesPre; ``` -------------------------------- ### Rust WASI Bindgen: Interface Imports Example Source: https://docs.rs/wasmtime/36.0.2/wasmtime/component/bindgen_examples/index Provides an example of generating bindings for imported interfaces within a WASI world. This snippet focuses on how `bindgen!` handles importing specific WASI interfaces. ```Rust /* Example for _3_interface_imports module */ // This is a placeholder for the actual code snippet from the _3_interface_imports module. ``` -------------------------------- ### Get InstancePre Information Source: https://docs.rs/wasmtime/36.0.2/wasmtime/component/bindgen_examples/_0_hello_world/struct Retrieves a reference to the pre-instantiated instance information. ```Rust pub fn instance_pre(&self) -> &InstancePre<_T> ``` -------------------------------- ### wasmtime Component Bindgen Examples: All World Export Kinds Source: https://docs.rs/wasmtime/36.0.2/wasmtime/component/bindgen_examples/_5_all_world_export_kinds/exports/example/world_exports/index Demonstrates various kinds of world exports within the wasmtime component binding examples. This functionality is available when the 'runtime', 'component-model', and 'docsrs' features are enabled. ```Rust wasmtime::component::bindgen_examples::_5_all_world_export_kinds::exports::example ``` -------------------------------- ### Rust WASI Bindgen: All World Export Kinds Example Source: https://docs.rs/wasmtime/36.0.2/wasmtime/component/bindgen_examples/index An example covering all kinds of structures for exports from a WASI world. This snippet demonstrates the versatility of `bindgen!` in exporting various types of data and functions. ```Rust /* Example for _5_all_world_export_kinds module */ // This is a placeholder for the actual code snippet from the _5_all_world_export_kinds module. ``` -------------------------------- ### wasmtime component bindgen examples exported resources logging Source: https://docs.rs/wasmtime/36.0.2/wasmtime/component/bindgen_examples/_6_exported_resources/exports/example/exported_resources/logging/index This snippet outlines the structure of the logging module within the exported resources example of wasmtime's component bindgen. It specifies the available structs, enums, and type aliases related to logging in this context. ```Rust wasmtime::component::bindgen_examples::_6_exported_resources::exports::example::exported_resources # Module logging Copy item path Summary Available on **crate feature`runtime` and crate feature `component-model` and `docsrs`** only. ## Structs§ Guest GuestIndices GuestLogger ## Enums§ Level ## Type Aliases§ Logger ``` -------------------------------- ### Instantiate and Call Wasmtime Component Source: https://docs.rs/wasmtime/36.0.2/wasmtime/component/index Example of instantiating a Wasmtime component from a file, configuring its linker with host functions, and calling an exported function. This demonstrates the core embedding API for the component model. ```rust fn main() -> wasmtime::Result<()> { // Instantiate the engine and store let engine = wasmtime::Engine::default(); let mut store = wasmtime::Store::new(&engine, ()); // Load the component from disk let bytes = std::fs::read("my_component.wasm")?; let component = wasmtime::component::Component::new(&engine, bytes)?; // Configure the linker let mut linker = wasmtime::component::Linker::new(&engine); // The component expects one import `name` that // takes no params and returns a string linker .root() .func_wrap("name", |_store, _params: ()| { Ok((String::from("Alice"),)) })?; // Instantiate the component let instance = linker.instantiate(&mut store, &component)?; // Call the `greet` function let func = instance.get_func(&mut store, "greet").expect("greet export not found"); let mut result = [wasmtime::component::Val::String("".into())]; func.call(&mut store, &[], &mut result)?; // This should print out `Greeting: [String("Hello, Alice!")]` println!("Greeting: {:?}", result); Ok(()) } ``` -------------------------------- ### Get Wasmtime Engine Source: https://docs.rs/wasmtime/36.0.2/wasmtime/component/bindgen_examples/_0_hello_world/struct Retrieves a reference to the Wasmtime Engine associated with the HelloWorldPre bindings. ```Rust pub fn engine(&self) -> &Engine ``` -------------------------------- ### Get Type ID - Wasmtime Type Source: https://docs.rs/wasmtime/36.0.2/wasmtime/component/types/enum Gets the TypeId of the given type. ```Rust fn type_id(&self) -> TypeId ``` -------------------------------- ### Get TypeId Source: https://docs.rs/wasmtime/36.0.2/wasmtime/component/bindgen_examples/_0_hello_world/struct Gets the `TypeId` of the current object, used for runtime type identification. ```Rust fn type_id(&self) -> TypeId ``` -------------------------------- ### Rust Wasmtime Hello World Component Example Source: https://docs.rs/wasmtime/36.0.2/wasmtime/component/bindgen_examples/_0_hello_world/index This Rust code demonstrates how to load and run a Wasm component using Wasmtime. It defines the component's interface using `bindgen!`, sets up host functions, instantiates the component, and calls an exported function. ```rust use wasmtime::component::*; use wasmtime::{Engine, Store}; bindgen!({ inline: r#"package my:project; world hello-world { import name: func() -> string; export greet: func(); }"#, }); struct MyState { name: String, } // Imports into the world, like the `name` import for this world, are // satisfied through traits. impl HelloWorldImports for MyState { fn name(&mut self) -> String { self.name.clone() } } fn main() -> wasmtime::Result<()> { // Compile the `Component` that is being run for the application. let engine = Engine::default(); let component = Component::from_file(&engine, "./your-component.wasm")?; // Instantiation of bindings always happens through a `Linker`. // Configuration of the linker is done through a generated `add_to_linker` // method on the bindings structure. // // Note that the function provided here is a projection from `T` in // `Store` to `&mut U` where `U` implements the `HelloWorldImports` // trait. In this case the `T`, `MyState`, is stored directly in the // structure so no projection is necessary here. // // Note that the second type parameter of `add_to_linker` is chosen here // as the built-in `HasSelf` type in Wasmtime. This effectively says // that our function isn't actually projecting, it's returning the // input, so `HasSelf<_>` is a convenience to avoid writing a custom // `HasData` implementation. let mut linker = Linker::new(&engine); HelloWorld::add_to_linker::<_, HasSelf<_>>(&mut linker, |state| state)?; // As with the core wasm API of Wasmtime instantiation occurs within a // `Store`. The bindings structure contains an `instantiate` method which // takes the store, component, and linker. This returns the `bindings` // structure which is an instance of `HelloWorld` and supports typed access // to the exports of the component. let mut store = Store::new( &engine, MyState { name: "me".to_string(), }, ); let bindings = HelloWorld::instantiate(&mut store, &component, &linker)?; // Here our `greet` function doesn't take any parameters for the component, // but in the Wasmtime embedding API the first argument is always a `Store`. bindings.call_greet(&mut store)?; Ok(()) } ``` -------------------------------- ### Get TypeId Source: https://docs.rs/wasmtime/36.0.2/wasmtime/component/bindgen_examples/_4_imported_resources/struct Gets the `TypeId` of the current type. This is useful for runtime type identification and comparison. ```rust fn type_id(&self) -> TypeId ``` -------------------------------- ### Create HelloWorldPre Bindings Source: https://docs.rs/wasmtime/36.0.2/wasmtime/component/bindgen_examples/_0_hello_world/struct Creates new HelloWorldPre bindings that can be used to instantiate into a store. This may fail if the component lacks required exports. ```Rust pub fn new(instance_pre: InstancePre<_T>) -> Result ``` -------------------------------- ### wasmtime Component Bindgen Examples Source: https://docs.rs/wasmtime/36.0.2/wasmtime/component/bindgen_examples/_6_exported_resources/index This snippet outlines the various sub-modules within the wasmtime::component::bindgen_examples module. These modules demonstrate different aspects of WebAssembly component binding, such as world imports, exports, and resource handling. ```Rust wasmtime::component::bindgen_examples::_0_hello_world wasmtime::component::bindgen_examples::_1_world_imports wasmtime::component::bindgen_examples::_2_world_exports wasmtime::component::bindgen_examples::_3_interface_imports wasmtime::component::bindgen_examples::_4_imported_resources wasmtime::component::bindgen_examples::_5_all_world_export_kinds wasmtime::component::bindgen_examples::_6_exported_resources wasmtime::component::bindgen_examples::_7_async ``` -------------------------------- ### Get TypeId of Self Source: https://docs.rs/wasmtime/36.0.2/wasmtime/component/struct Gets the `TypeId` of the current instance. This is a fundamental method for runtime type identification. ```Rust fn type_id(&self) -> TypeId ``` -------------------------------- ### Instantiate HelloWorld Source: https://docs.rs/wasmtime/36.0.2/wasmtime/component/bindgen_examples/_0_hello_world/struct Instantiates a new HelloWorld instance within the provided store. It uses the pre-instantiated instance to look up exports on the resulting instance. ```Rust pub fn instantiate( &self, store: impl AsContextMut, ) -> Result ``` -------------------------------- ### Rust: Wasmtime Engine Configuration Source: https://docs.rs/wasmtime/36.0.2/wasmtime/index Demonstrates the creation of a Wasmtime Engine with a configurable setup. The Engine is the global compilation and runtime environment for WebAssembly, essential for compiling or executing any WebAssembly code. ```Rust use wasmtime::Config; // Configure Wasmtime let mut config = Config::new(); config.cache_config(Some("my_cache_dir")); // Create an Engine with the configuration let engine = wasmtime::Engine::new(&config); // Modules and Components belong to an Engine // Typically, there's one Engine per process. ``` -------------------------------- ### wasmtime Module Structure Source: https://docs.rs/wasmtime/36.0.2/wasmtime/component/bindgen_examples/_7_async/example/index Details the module hierarchy within the wasmtime crate, specifically focusing on the `wasmtime::component::bindgen_examples::_7_async` module. It lists sub-modules and structs available within this section, such as 'example', 'ImportSomeResources', and 'MyLogger'. ```Rust wasmtime::component::bindgen_examples::_7_async * Modules * example * Structs * ImportSomeResources * ImportSomeResourcesIndices * ImportSomeResourcesPre * MyLogger ``` -------------------------------- ### wasmtime Crate Dependencies Source: https://docs.rs/wasmtime/36.0.2/wasmtime/component/bindgen_examples/_0_hello_world/index Lists the various dependencies for the wasmtime crate, categorized by their type (normal, optional, dev, build). This includes direct dependencies and their versions. ```Rust addr2line ^0.25.0 anýhow ^1.0.93 async-trait ^0.1.71 bitflags ^2.0 bumplao ^3.11.0 bytes ^1.4 cfg-if ^1.0 encoding_rs ^0.8.31 futures ^0.3.27 fxprof-processed-profile ^0.6.0 gimli ^0.32.0 hashbrown ^0.15 indexmap ^2.0.0 libc ^0.2.112 log ^0.4.27 object ^0.37.0 once_cell ^1.12.0 postcard ^1.0.8 pulley-interpreter =36.0.2 rayon ^1.0 semver ^1.0.17 serde ^1.0.215 serde_derive ^1.0.188 serde_json ^1.0.80 smallvec ^1.6.1 target-lexicon ^0.13.0 wasm-encoder ^0.236.0 wasm-wave ^0.236.0 wasmparser ^0.236.0 wasmtime-internal-asm-macros =36.0.2 wasmtime-internal-cache =36.0.2 wasmtime-internal-component-macro =36.0.2 wasmtime-internal-component-util =36.0.2 wasmtime-internal-cranelift =36.0.2 wasmtime-environ =36.0.2 wasmtime-internal-fiber =36.0.2 wasmtime-internal-jit-debug =36.0.2 wasmtime-internal-jit-icache-coherence =36.0.2 wasmtime-internal-math =36.0.2 wasmtime-internal-slab =36.0.2 wasmtime-internal-unwinder =36.0.2 wasmtime-internal-versioned-export-macros =36.0.2 wasmtime-internal-winch =36.0.2 wasmtime-internal-wmemcheck =36.0.2 wat ^1.236.0 cranelift-native ^0.123.2 env_logger ^0.11.5 libtest-mimic ^0.8.1 proptest ^1.0.0 rand ^0.9.2 tempfile ^3.1.0 cc ^1.0 wasmtime-internal-versioned-export-macros =36.0.2 ittapi ^0.4.0 memfd ^0.6.2 windows-sys ^0.60.0 mach2 ^0.4.2 rustix ^1.0.3 ``` -------------------------------- ### wasmtime 36.0.2 Crate Information Source: https://docs.rs/wasmtime/36.0.2/wasmtime/component/bindgen_examples/_3_interface_imports/example/interface_imports/index Provides metadata and links related to the wasmtime 36.0.2 crate, including its license, repository, and owners. ```Rust Project: /websites/rs_wasmtime_36_0_2_wasmtime Content: Docs.rs * wasmtime-36.0.2 * wasmtime 36.0.2 * Docs.rs crate page * Apache-2.0 WITH LLVM-exception * Links * Repository * crates.io * Source * Owners * alexcrichton * sunfishcode * github:bytecodealliance:wasmtime-publish * wasmtime-publish * Dependencies * * addr2line ^0.25.0 _normal_ _optional_ * anyhow ^1.0.93 _normal_ * async-trait ^0.1.71 _normal_ _optional_ * bitflags ^2.0 _normal_ * bumpalo ^3.11.0 _normal_ * bytes ^1.4 _normal_ _optional_ * cfg-if ^1.0 _normal_ * encoding_rs ^0.8.31 _normal_ _optional_ * futures ^0.3.27 _normal_ _optional_ * fxprof-processed-profile ^0.6.0 _normal_ _optional_ * gimli ^0.32.0 _normal_ _optional_ * hashbrown ^0.15 _normal_ * indexmap ^2.0.0 _normal_ * libc ^0.2.112 _normal_ * log ^0.4.27 _normal_ * object ^0.37.0 _normal_ * once_cell ^1.12.0 _normal_ _optional_ * postcard ^1.0.8 _normal_ * pulley-interpreter =36.0.2 _normal_ * rayon ^1.0 _normal_ _optional_ * semver ^1.0.17 _normal_ _optional_ * serde ^1.0.215 _normal_ * serde_derive ^1.0.188 _normal_ * serde_json ^1.0.80 _normal_ _optional_ * smallvec ^1.6.1 _normal_ _optional_ * target-lexicon ^0.13.0 _normal_ * wasm-encoder ^0.236.0 _normal_ _optional_ * wasm-wave ^0.236.0 _normal_ _optional_ * wasmparser ^0.236.0 _normal_ * wasmtime-internal-asm-macros =36.0.2 _normal_ _optional_ * wasmtime-internal-cache =36.0.2 _normal_ _optional_ * wasmtime-internal-component-macro =36.0.2 _normal_ _optional_ * wasmtime-internal-component-util =36.0.2 _normal_ _optional_ * wasmtime-internal-cranelift =36.0.2 _normal_ _optional_ * wasmtime-environ =36.0.2 _normal_ * wasmtime-internal-fiber =36.0.2 _normal_ _optional_ * wasmtime-internal-jit-debug =36.0.2 _normal_ _optional_ * wasmtime-internal-jit-icache-coherence =36.0.2 _normal_ _optional_ * wasmtime-internal-math =36.0.2 _normal_ * wasmtime-internal-slab =36.0.2 _normal_ _optional_ * wasmtime-internal-unwinder =36.0.2 _normal_ _optional_ * wasmtime-internal-versioned-export-macros =36.0.2 _normal_ * wasmtime-internal-winch =36.0.2 _normal_ _optional_ * wasmtime-internal-wmemcheck =36.0.2 _normal_ _optional_ * wat ^1.236.0 _normal_ _optional_ * cranelift-native ^0.123.2 _dev_ * env_logger ^0.11.5 _dev_ * libtest-mimic ^0.8.1 _dev_ * proptest ^1.0.0 _dev_ * rand ^0.9.2 _dev_ * tempfile ^3.1.0 _dev_ * cc ^1.0 _build_ _optional_ * wasmtime-internal-versioned-export-macros =36.0.2 _build_ _optional_ * ittapi ^0.4.0 _normal_ _optional_ * ittapi ^0.4.0 _normal_ _optional_ * ittapi ^0.4.0 _normal_ _optional_ * memfd ^0.6.2 _normal_ _optional_ * windows-sys ^0.60.0 _normal_ _optional_ * mach2 ^0.4.2 _normal_ _optional_ * rustix ^1.0.3 _normal_ _optional_ * Versions * * **68.98%** of the crate is documented * Platform * i686-unknown-linux-gnu * x86_64-unknown-linux-gnu * Feature flags * docs.rs * About docs.rs * Badges * Builds * Metadata * Shorthand URLs * Download * Rustdoc JSON * Build queue * Privacy policy * Rust * Rust website * The Book * Standard Library API Reference * Rust by Example * The Cargo Guide * Clippy Documentation Settings Help ``` -------------------------------- ### Asynchronously Instantiate HelloWorld Source: https://docs.rs/wasmtime/36.0.2/wasmtime/component/bindgen_examples/_0_hello_world/struct Provides an asynchronous version of the `instantiate` function. It performs the same instantiation process but allows for asynchronous operations. ```Rust pub async fn instantiate_async( &self, store: impl AsContextMut, ) -> Result ``` -------------------------------- ### Clone From HelloWorldPre Instance Source: https://docs.rs/wasmtime/36.0.2/wasmtime/component/bindgen_examples/_0_hello_world/struct Performs copy-assignment from a source HelloWorldPre instance to the current one. ```Rust fn clone_from(&mut self, source: &Self) ``` -------------------------------- ### Wasmtime Development Dependencies Source: https://docs.rs/wasmtime/36.0.2/wasmtime/component/bindgen_examples/_5_all_world_export_kinds/exports/example/world_exports/units/index Lists the development dependencies for the Wasmtime crate, used for testing and development purposes. This includes testing frameworks and utilities. ```Rust cranelift-native ^0.123.2 _dev_ env_logger ^0.11.5 _dev_ libtest-mimic ^0.8.1 _dev_ proptest ^1.0.0 _dev_ rand ^0.9.2 _dev_ tempfile ^3.1.0 _dev_ ``` -------------------------------- ### wasmtime: Imported Resources Logging Example Source: https://docs.rs/wasmtime/36.0.2/wasmtime/component/bindgen_examples/_4_imported_resources/example/imported_resources/logging/index This snippet details the logging-related components within the `wasmtime::component::bindgen_examples::_4_imported_resources::example::imported_resources` module. It highlights the Logger struct, Level enum, and various Host traits, along with the `add_to_linker` function. ```Rust wasmtime::component::bindgen_examples::_4_imported_resources::example::imported_resources # Module logging Copy item path Summary Available on **crate feature`runtime` and crate feature `component-model` and `docsrs`** only. ## Structs§ Logger A sample host-defined type which contains arbitrary host-defined data. ## Enums§ Level ## Traits§ Host HostLogger HostLoggerWithStore HostWithStore ## Functions§ add_to_linker ``` -------------------------------- ### wasmtime::component::bindgen_examples::_3_interface_imports::example Module Source: https://docs.rs/wasmtime/36.0.2/wasmtime/component/bindgen_examples/_3_interface_imports/example/interface_imports/index Details the 'interface_imports' module within the wasmtime::component::bindgen_examples::_3_interface_imports::example structure. This module is available when the 'runtime', 'component-model', and 'docsrs' features are enabled. ```Rust ## Module interface_imports ## wasmtime36.0.2 ## Module interface_imports ### Module Items * Modules ## In wasmtime::component::bindgen_examples::_3_interface_imports::example ### Modules * interface_imports wasmtime::component::bindgen_examples::_3_interface_imports::example # Module interface_imports Copy item path Source Search Settings Help Summary Available on **crate feature`runtime` and crate feature `component-model` and `docsrs`** only. ## Modules§ logging ``` -------------------------------- ### wasmtime Component Bindgen Examples: Export Kinds Source: https://docs.rs/wasmtime/36.0.2/wasmtime/component/bindgen_examples/_5_all_world_export_kinds/exports/index Demonstrates various export kinds within the wasmtime component bindgen examples, specifically focusing on 'WithExports' structs and traits. This functionality is available when the 'runtime' and 'component-model' features are enabled. ```Rust wasmtime::component::bindgen_examples::_5_all_world_export_kinds # Module exports Copy item path Source Settings Help Summary Available on **crate feature`runtime` and crate feature `component-model` and `docsrs`** only. ## Modules§ environment example ``` -------------------------------- ### wasmtime Crate Dependencies Source: https://docs.rs/wasmtime/36.0.2/wasmtime/component/bindgen_examples/_4_imported_resources/example/index Lists the various dependencies for the wasmtime crate, categorized by their type (normal, optional, dev, build). This includes core components, optional features, and development dependencies. ```Rust addr2line ^0.25.0 _normal_ _optional_ anylon ^1.0.93 _normal_ async-trait ^0.1.71 _normal_ _optional_ bitflags ^2.0 _normal_ bumpalo ^3.11.0 _normal_ bytes ^1.4 _normal_ _optional_ cfg-if ^1.0 _normal_ encoding_rs ^0.8.31 _normal_ _optional_ futures ^0.3.27 _normal_ _optional_ fxprof-processed-profile ^0.6.0 _normal_ _optional_ gimli ^0.32.0 _normal_ _optional_ hashbrown ^0.15 _normal_ indexmap ^2.0.0 _normal_ libc ^0.2.112 _normal_ log ^0.4.27 _normal_ object ^0.37.0 _normal_ once_cell ^1.12.0 _normal_ _optional_ postcard ^1.0.8 _normal_ pulley-interpreter =36.0.2 _normal_ rayon ^1.0 _normal_ _optional_ semver ^1.0.17 _normal_ _optional_ serde ^1.0.215 _normal_ serde_derive ^1.0.188 _normal_ serde_json ^1.0.80 _normal_ _optional_ smallvec ^1.6.1 _normal_ _optional_ target-lexicon ^0.13.0 _normal_ wasm-encoder ^0.236.0 _normal_ _optional_ wasm-wave ^0.236.0 _normal_ _optional_ wasmparser ^0.236.0 _normal_ wasmtime-internal-asm-macros =36.0.2 _normal_ _optional_ wasmtime-internal-cache =36.0.2 _normal_ _optional_ wasmtime-internal-component-macro =36.0.2 _normal_ _optional_ wasmtime-internal-component-util =36.0.2 _normal_ _optional_ wasmtime-internal-cranelift =36.0.2 _normal_ _optional_ wasmtime-environ =36.0.2 _normal_ wasmtime-internal-fiber =36.0.2 _normal_ _optional_ wasmtime-internal-jit-debug =36.0.2 _normal_ _optional_ wasmtime-internal-jit-icache-coherence =36.0.2 _normal_ _optional_ wasmtime-internal-math =36.0.2 _normal_ wasmtime-internal-slab =36.0.2 _normal_ _optional_ wasmtime-internal-unwinder =36.0.2 _normal_ _optional_ wasmtime-internal-versioned-export-macros =36.0.2 _normal_ wasmtime-internal-winch =36.0.2 _normal_ _optional_ wasmtime-internal-wmemcheck =36.0.2 _normal_ _optional_ wat ^1.236.0 _normal_ _optional_ ``` -------------------------------- ### Get TypeId Source: https://docs.rs/wasmtime/36.0.2/wasmtime/component/bindgen_examples/_2_world_exports/struct Retrieves the TypeId of an object. ```rust fn type_id(&self) -> TypeId ``` -------------------------------- ### wasmtime Crate Dependencies Source: https://docs.rs/wasmtime/36.0.2/wasmtime/component/bindgen_examples/_5_all_world_export_kinds/exports/environment/index Lists the various dependencies required by the wasmtime crate, categorized by their type (normal, optional, dev, build). This includes core components, testing utilities, and build-time tools. ```Rust addr2line ^0.25.0 _normal_ _optional_ anylon ^1.0.93 _normal_ async-trait ^0.1.71 _normal_ _optional_ bitflags ^2.0 _normal_ bumpalo ^3.11.0 _normal_ bytes ^1.4 _normal_ _optional_ cfg-if ^1.0 _normal_ encoding_rs ^0.8.31 _normal_ _optional_ futures ^0.3.27 _normal_ _optional_ fxprof-processed-profile ^0.6.0 _normal_ _optional_ gimli ^0.32.0 _normal_ _optional_ hashbrown ^0.15 _normal_ indexmap ^2.0.0 _normal_ libc ^0.2.112 _normal_ log ^0.4.27 _normal_ object ^0.37.0 _normal_ once_cell ^1.12.0 _normal_ _optional_ postcard ^1.0.8 _normal_ pulley-interpreter =36.0.2 _normal_ rayon ^1.0 _normal_ _optional_ semver ^1.0.17 _normal_ _optional_ serde ^1.0.215 _normal_ serde_derive ^1.0.188 _normal_ serde_json ^1.0.80 _normal_ _optional_ smallvec ^1.6.1 _normal_ _optional_ target-lexicon ^0.13.0 _normal_ wasm-encoder ^0.236.0 _normal_ _optional_ wasm-wave ^0.236.0 _normal_ _optional_ wasmparser ^0.236.0 _normal_ wasmtime-internal-asm-macros =36.0.2 _normal_ _optional_ wasmtime-internal-cache =36.0.2 _normal_ _optional_ wasmtime-internal-component-macro =36.0.2 _normal_ _optional_ wasmtime-internal-component-util =36.0.2 _normal_ _optional_ wasmtime-internal-cranelift =36.0.2 _normal_ _optional_ wasmtime-environ =36.0.2 _normal_ wasmtime-internal-fiber =36.0.2 _normal_ _optional_ wasmtime-internal-jit-debug =36.0.2 _normal_ _optional_ wasmtime-internal-jit-icache-coherence =36.0.2 _normal_ _optional_ wasmtime-internal-math =36.0.2 _normal_ wasmtime-internal-slab =36.0.2 _normal_ _optional_ wasmtime-internal-unwinder =36.0.2 _normal_ _optional_ wasmtime-internal-versioned-export-macros =36.0.2 _normal_ wasmtime-internal-winch =36.0.2 _normal_ _optional_ wasmtime-internal-wmemcheck =36.0.2 _normal_ _optional_ wat ^1.236.0 _normal_ _optional_ cranelift-native ^0.123.2 _dev_ env_logger ^0.11.5 _dev_ libtest-mimic ^0.8.1 _dev_ proptest ^1.0.0 _dev_ rand ^0.9.2 _dev_ tempfile ^3.1.0 _dev_ cc ^1.0 _build_ _optional_ wasmtime-internal-versioned-export-macros =36.0.2 _build_ _optional_ ittapi ^0.4.0 _normal_ _optional_ memfd ^0.6.2 _normal_ _optional_ windows-sys ^0.60.0 _normal_ _optional_ mach2 ^0.4.2 _normal_ _optional_ rustix ^1.0.3 _normal_ _optional_ ``` -------------------------------- ### Get TypeId Source: https://docs.rs/wasmtime/36.0.2/wasmtime/component/bindgen_examples/_3_interface_imports/struct Retrieves the `TypeId` of a given type. ```rust fn type_id(&self) -> TypeId ``` -------------------------------- ### Get TypeId Source: https://docs.rs/wasmtime/36.0.2/wasmtime/component/bindgen_examples/_1_world_imports/struct Retrieves the `TypeId` of the current object. ```Rust fn type_id(&self) -> TypeId ``` -------------------------------- ### Get Alignment - Pointable Type Source: https://docs.rs/wasmtime/36.0.2/wasmtime/component/types/enum The alignment requirement for the type. ```Rust const ALIGN: usize ```