1 //! # Embedding API for the Component Model 2 //! 3 //! This module contains the embedding API for the [Component Model] in 4 //! Wasmtime. This module requires the `component-model` feature to be enabled, 5 //! which is enabled by default. The embedding API here is mirrored after the 6 //! core wasm embedding API at the crate root and is intended to have the same 7 //! look-and-feel while handling concepts of the component model. 8 //! 9 //! [Component Model]: https://component-model.bytecodealliance.org 10 //! 11 //! The component model is a broad topic which can't be explained here fully, so 12 //! it's recommended to read over individual items' documentation to see more 13 //! about the capabilities of the embedding API. At a high-level, however, 14 //! perhaps the most interesting items in this module are: 15 //! 16 //! * [`Component`] - a compiled component ready to be instantiated. Similar to 17 //! a [`Module`](crate::Module) for core wasm. 18 //! 19 //! * [`Linker`] - a component-style location for defining host functions. This 20 //! is not the same as [`wasmtime::Linker`](crate::Linker) for core wasm 21 //! modules. 22 //! 23 //! * [`bindgen!`] - a macro to generate Rust bindings for a [WIT] [world]. This 24 //! maps all WIT types into Rust automatically and generates traits for 25 //! embedders to implement. 26 //! 27 //! [WIT]: https://component-model.bytecodealliance.org/design/wit.html 28 //! [world]: https://component-model.bytecodealliance.org/design/worlds.html 29 //! 30 //! Embedders of the component model will typically start by defining their API 31 //! in [WIT]. This describes what will be available to guests and what needs to 32 //! be provided to the embedder by the guest. This [`world`][world] that was 33 //! created is then fed into [`bindgen!`] to generate types and traits for the 34 //! embedder to use. The embedder then implements these traits, adds 35 //! functionality via the generated `add_to_linker` method (see [`bindgen!`] for 36 //! more info), and then instantiates/executes a component. 37 //! 38 //! It's recommended to read over the [documentation for the Component 39 //! Model][Component Model] to get an overview about how to build components 40 //! from various languages. 41 //! 42 //! ## Example Usage 43 //! 44 //! Imagine you have the following WIT package definition in a file called world.wit 45 //! along with a component (my_component.wasm) that targets `my-world`: 46 //! 47 //! ```text,ignore 48 //! package component:my-package; 49 //! 50 //! world my-world { 51 //! import name: func() -> string; 52 //! export greet: func() -> string; 53 //! } 54 //! ``` 55 //! 56 //! You can instantiate and call the component like so: 57 //! 58 //! ``` 59 //! fn main() -> wasmtime::Result<()> { 60 //! # if true { return Ok(()) } 61 //! // Instantiate the engine and store 62 //! let engine = wasmtime::Engine::default(); 63 //! let mut store = wasmtime::Store::new(&engine, ()); 64 //! 65 //! // Load the component from disk 66 //! let bytes = std::fs::read("my_component.wasm")?; 67 //! let component = wasmtime::component::Component::new(&engine, bytes)?; 68 //! 69 //! // Configure the linker 70 //! let mut linker = wasmtime::component::Linker::new(&engine); 71 //! // The component expects one import `name` that 72 //! // takes no params and returns a string 73 //! linker 74 //! .root() 75 //! .func_wrap("name", |_store, _params: ()| { 76 //! Ok((String::from("Alice"),)) 77 //! })?; 78 //! 79 //! // Instantiate the component 80 //! let instance = linker.instantiate(&mut store, &component)?; 81 //! 82 //! // Call the `greet` function 83 //! let func = instance.get_func(&mut store, "greet").expect("greet export not found"); 84 //! let mut result = [wasmtime::component::Val::String("".into())]; 85 //! func.call(&mut store, &[], &mut result)?; 86 //! 87 //! // This should print out `Greeting: [String("Hello, Alice!")]` 88 //! println!("Greeting: {:?}", result); 89 //! 90 //! Ok(()) 91 //! } 92 //! ``` 93 //! 94 //! Manually configuring the linker and calling untyped component exports is 95 //! a bit tedious and error prone. The [`bindgen!`] macro can be used to 96 //! generate bindings eliminating much of this boilerplate. 97 //! 98 //! See the docs for [`bindgen!`] for more information on how to use it. 99 100 // rustdoc appears to lie about a warning above, so squelch it for now. 101 #![allow(rustdoc::redundant_explicit_links)] 102 103 mod component; 104 mod func; 105 mod instance; 106 mod linker; 107 mod matching; 108 mod resource_table; 109 mod resources; 110 mod storage; 111 mod store; 112 pub mod types; 113 mod values; 114 pub use self::component::{Component, ComponentExportIndex}; 115 pub use self::func::{ 116 ComponentNamedList, ComponentType, Func, Lift, Lower, TypedFunc, WasmList, WasmStr, 117 }; 118 pub use self::instance::{Instance, InstanceExportLookup, InstancePre}; 119 pub use self::linker::{Linker, LinkerInstance}; 120 pub use self::resource_table::{ResourceTable, ResourceTableError}; 121 pub use self::resources::{Resource, ResourceAny}; 122 pub use self::types::{ResourceType, Type}; 123 pub use self::values::Val; 124 125 pub(crate) use self::resources::HostResourceData; 126 127 // These items are expected to be used by an eventual 128 // `#[derive(ComponentType)]`, they are not part of Wasmtime's API stability 129 // guarantees 130 #[doc(hidden)] 131 pub mod __internal { 132 pub use super::func::{ 133 bad_type_info, format_flags, lower_payload, typecheck_enum, typecheck_flags, 134 typecheck_record, typecheck_variant, ComponentVariant, LiftContext, LowerContext, Options, 135 }; 136 pub use super::matching::InstanceType; 137 pub use crate::map_maybe_uninit; 138 pub use crate::store::StoreOpaque; 139 pub use crate::MaybeUninitExt; 140 pub use alloc::boxed::Box; 141 pub use alloc::string::String; 142 pub use alloc::vec::Vec; 143 pub use anyhow; 144 #[cfg(feature = "async")] 145 pub use async_trait::async_trait; 146 pub use wasmtime_environ; 147 pub use wasmtime_environ::component::{CanonicalAbiInfo, ComponentTypes, InterfaceType}; 148 } 149 150 pub(crate) use self::store::ComponentStoreData; 151 152 /// Generate bindings for a [WIT world]. 153 /// 154 /// [WIT world]: https://component-model.bytecodealliance.org/design/worlds.html 155 /// [WIT package]: https://component-model.bytecodealliance.org/design/packages.html 156 /// 157 /// This macro ingests a [WIT world] and will generate all the necessary 158 /// bindings for instantiating components that ascribe to the `world`. This 159 /// provides a higher-level representation of working with a component than the 160 /// raw [`Instance`] type which must be manually-type-checked and manually have 161 /// its imports provided via the [`Linker`] type. 162 /// 163 /// # Examples 164 /// 165 /// Examples for this macro can be found in the [`bindgen_examples`] module 166 /// documentation. That module has a submodule-per-example which includes the 167 /// source code, with WIT, used to generate the structures along with the 168 /// generated code itself in documentation. 169 /// 170 /// # Debugging and Exploring 171 /// 172 /// If you need to debug the output of `bindgen!` you can try using the 173 /// `WASMTIME_DEBUG_BINDGEN=1` environment variable. This will write the 174 /// generated code to a file on disk so rustc can produce better error messages 175 /// against the actual generated source instead of the macro invocation itself. 176 /// This additionally can enable opening up the generated code in an editor and 177 /// exploring it (through an error message). 178 /// 179 /// The generated bindings can additionally be explored with `cargo doc` to see 180 /// what's generated. It's also recommended to browse the [`bindgen_examples`] 181 /// for example generated structures and example generated code. 182 /// 183 /// # Syntax 184 /// 185 /// This procedural macro accepts a few different syntaxes. The primary purpose 186 /// of this macro is to locate a WIT package, parse it, and then extract a 187 /// `world` from the parsed package. There are then codegen-specific options to 188 /// the bindings themselves which can additionally be specified. 189 /// 190 /// Usage of this macro looks like: 191 /// 192 /// ```rust 193 /// # macro_rules! bindgen { ($($t:tt)*) => () } 194 /// // Parse the `wit/` folder adjacent to this crate's `Cargo.toml` and look 195 /// // for a single `world` in it. There must be exactly one for this to 196 /// // succeed. 197 /// bindgen!(); 198 /// 199 /// // Parse the `wit/` folder adjacent to this crate's `Cargo.toml` and look 200 /// // for the world `foo` contained in it. 201 /// bindgen!("foo"); 202 /// 203 /// // Parse the folder `other/wit/folder` adjacent to `Cargo.toml`. 204 /// bindgen!(in "other/wit/folder"); 205 /// bindgen!("foo" in "other/wit/folder"); 206 /// 207 /// // Parse the file `foo.wit` as a single-file WIT package with no 208 /// // dependencies. 209 /// bindgen!("foo" in "foo.wit"); 210 /// 211 /// // Specify a suite of options to the bindings generation, documented below 212 /// bindgen!({ 213 /// world: "foo", 214 /// path: "other/path/to/wit", 215 /// // ... 216 /// }); 217 /// ``` 218 /// 219 /// # Options Reference 220 /// 221 /// This is an example listing of all options that this macro supports along 222 /// with documentation for each option and example syntax for each option. 223 /// 224 /// ```rust 225 /// # macro_rules! bindgen { ($($t:tt)*) => () } 226 /// bindgen!({ 227 /// world: "foo", // not needed if `path` has one `world` 228 /// 229 /// // same as in `bindgen!(in "other/wit/folder") 230 /// path: "other/wit/folder", 231 /// 232 /// // Instead of `path` the WIT document can be provided inline if 233 /// // desired. 234 /// inline: " 235 /// package my:inline; 236 /// 237 /// world foo { 238 /// // ... 239 /// } 240 /// ", 241 /// 242 /// // Add calls to `tracing::span!` before each import or export is called 243 /// // to log arguments and return values. 244 /// // 245 /// // This option defaults to `false`. 246 /// tracing: true, 247 /// 248 /// // Imports will be async functions through #[async_trait] and exports 249 /// // are also invoked as async functions. Requires `Config::async_support` 250 /// // to be `true`. 251 /// // 252 /// // Note that this is only async for the host as the guest will still 253 /// // appear as if it's invoking blocking functions. 254 /// // 255 /// // This option defaults to `false`. 256 /// async: true, 257 /// 258 /// // Alternative mode of async configuration where this still implies 259 /// // async instantiation happens, for example, but more control is 260 /// // provided over which imports are async and which aren't. 261 /// // 262 /// // Note that in this mode all exports are still async. 263 /// async: { 264 /// // All imports are async except for functions with these names 265 /// except_imports: ["foo", "bar"], 266 /// 267 /// // All imports are synchronous except for functions with these names 268 /// // 269 /// // Note that this key cannot be specified with `except_imports`, 270 /// // only one or the other is accepted. 271 /// only_imports: ["foo", "bar"], 272 /// }, 273 /// 274 /// // This option is used to indicate whether imports can trap. 275 /// // 276 /// // Imports that may trap have their return types wrapped in 277 /// // `wasmtime::Result<T>` where the `Err` variant indicates that a 278 /// // trap will be raised in the guest. 279 /// // 280 /// // By default imports cannot trap and the return value is the return 281 /// // value from the WIT bindings itself. This value can be set to `true` 282 /// // to indicate that any import can trap. This value can also be set to 283 /// // an array-of-strings to indicate that only a set list of imports 284 /// // can trap. 285 /// trappable_imports: false, // no imports can trap (default) 286 /// // trappable_imports: true, // all imports can trap 287 /// // trappable_imports: ["foo", "bar"], // only these can trap 288 /// 289 /// // This can be used to translate WIT return values of the form 290 /// // `result<T, error-type>` into `Result<T, RustErrorType>` in Rust. 291 /// // Users must define `RustErrorType` and the `Host` trait for the 292 /// // interface which defines `error-type` will have a method 293 /// // called `convert_error_type` which converts `RustErrorType` 294 /// // into `wasmtime::Result<ErrorType>`. This conversion can either 295 /// // return the raw WIT error (`ErrorType` here) or a trap. 296 /// // 297 /// // By default this option is not specified. This option only takes 298 /// // effect when `trappable_imports` is set for some imports. 299 /// trappable_error_type: { 300 /// "wasi:io/streams/stream-error" => RustErrorType, 301 /// }, 302 /// 303 /// // All generated bindgen types are "owned" meaning types like `String` 304 /// // are used instead of `&str`, for example. This is the default and 305 /// // ensures that the same type used in both imports and exports uses the 306 /// // same generated type. 307 /// ownership: Owning, 308 /// 309 /// // Alternative to `Owning` above where borrowed types attempt to be used 310 /// // instead. The `duplicate_if_necessary` configures whether duplicate 311 /// // Rust types will be generated for the same WIT type if necessary, for 312 /// // example when a type is used both as an import and an export. 313 /// ownership: Borrowing { 314 /// duplicate_if_necessary: true 315 /// }, 316 /// 317 /// // Restrict the code generated to what's needed for the interface 318 /// // imports in the inlined WIT document fragment. 319 /// interfaces: " 320 /// import wasi:cli/command; 321 /// ", 322 /// 323 /// // Remap imported interfaces or resources to types defined in Rust 324 /// // elsewhere. Using this option will prevent any code from being 325 /// // generated for interfaces mentioned here. Resources named here will 326 /// // not have a type generated to represent the resource. 327 /// // 328 /// // Interfaces mapped with this option should be previously generated 329 /// // with an invocation of this macro. Resources need to be mapped to a 330 /// // Rust type name. 331 /// with: { 332 /// // This can be used to indicate that entire interfaces have 333 /// // bindings generated elsewhere with a path pointing to the 334 /// // bindinges-generated module. 335 /// "wasi:random/random": wasmtime_wasi::bindings::random::random, 336 /// 337 /// // Similarly entire packages can also be specified. 338 /// "wasi:cli": wasmtime_wasi::bindings::cli, 339 /// 340 /// // Or, if applicable, entire namespaces can additionally be mapped. 341 /// "wasi": wasmtime_wasi::bindings, 342 /// 343 /// // Versions are supported if multiple versions are in play: 344 /// "wasi:http/types@0.2.0": wasmtime_wasi_http::bindings::http::types, 345 /// "wasi:[email protected]": wasmtime_wasi_http::bindings::http, 346 /// 347 /// // The `with` key can also be used to specify the `T` used in 348 /// // import bindings of `Resource<T>`. This can be done to configure 349 /// // which typed resource shows up in generated bindings and can be 350 /// // useful when working with the typed methods of `ResourceTable`. 351 /// "wasi:filesystem/types/descriptor": MyDescriptorType, 352 /// }, 353 /// 354 /// // Additional derive attributes to include on generated types (structs or enums). 355 /// // 356 /// // These are deduplicated and attached in a deterministic order. 357 /// additional_derives: [ 358 /// Hash, 359 /// serde::Deserialize, 360 /// serde::Serialize, 361 /// ], 362 /// 363 /// // A list of WIT "features" to enable when parsing the WIT document that 364 /// // this bindgen macro matches. WIT features are all disabled by default 365 /// // and must be opted-in-to if source level features are used. 366 /// // 367 /// // This option defaults to an empty array. 368 /// features: ["foo", "bar", "baz"], 369 /// 370 /// // An niche configuration option to require that the `T` in `Store<T>` 371 /// // is always `Send` in the generated bindings. Typically not needed 372 /// // but if synchronous bindings depend on asynchronous bindings using 373 /// // the `with` key then this may be required. 374 /// require_store_data_send: false, 375 /// 376 /// // If the `wasmtime` crate is depended on at a nonstandard location 377 /// // or is renamed then this is the path to the root of the `wasmtime` 378 /// // crate. Much of the generated code needs to refer to `wasmtime` so 379 /// // this should be used if the `wasmtime` name is not wasmtime itself. 380 /// // 381 /// // By default this is `wasmtime`. 382 /// wasmtime_crate: path::to::wasmtime, 383 /// 384 /// // This is an in-source alternative to using `WASMTIME_DEBUG_BINDGEN`. 385 /// // 386 /// // Note that if this option is specified then the compiler will always 387 /// // recompile your bindings. Cargo records the start time of when rustc 388 /// // is spawned by this will write a file during compilation. To Cargo 389 /// // that looks like a file was modified after `rustc` was spawned, 390 /// // so Cargo will always think your project is "dirty" and thus always 391 /// // recompile it. Recompiling will then overwrite the file again, 392 /// // starting the cycle anew. This is only recommended for debugging. 393 /// // 394 /// // This option defaults to false. 395 /// include_generated_code_from_file: false, 396 /// }); 397 /// ``` 398 pub use wasmtime_component_macro::bindgen; 399 400 /// Derive macro to generate implementations of the [`ComponentType`] trait. 401 /// 402 /// This derive macro can be applied to `struct` and `enum` definitions and is 403 /// used to bind either a `record`, `enum`, or `variant` in the component model. 404 /// 405 /// Note you might be looking for [`bindgen!`] rather than this macro as that 406 /// will generate the entire type for you rather than just a trait 407 /// implementation. 408 /// 409 /// This macro supports a `#[component]` attribute which is used to customize 410 /// how the type is bound to the component model. A top-level `#[component]` 411 /// attribute is required to specify either `record`, `enum`, or `variant`. 412 /// 413 /// ## Records 414 /// 415 /// `record`s in the component model correspond to `struct`s in Rust. An example 416 /// is: 417 /// 418 /// ```rust 419 /// use wasmtime::component::ComponentType; 420 /// 421 /// #[derive(ComponentType)] 422 /// #[component(record)] 423 /// struct Color { 424 /// r: u8, 425 /// g: u8, 426 /// b: u8, 427 /// } 428 /// ``` 429 /// 430 /// which corresponds to the WIT type: 431 /// 432 /// ```wit 433 /// record color { 434 /// r: u8, 435 /// g: u8, 436 /// b: u8, 437 /// } 438 /// ``` 439 /// 440 /// Note that the name `Color` here does not need to match the name in WIT. 441 /// That's purely used as a name in Rust of what to refer to. The field names 442 /// must match that in WIT, however. Field names can be customized with the 443 /// `#[component]` attribute though. 444 /// 445 /// ```rust 446 /// use wasmtime::component::ComponentType; 447 /// 448 /// #[derive(ComponentType)] 449 /// #[component(record)] 450 /// struct VerboseColor { 451 /// #[component(name = "r")] 452 /// red: u8, 453 /// #[component(name = "g")] 454 /// green: u8, 455 /// #[component(name = "b")] 456 /// blue: u8, 457 /// } 458 /// ``` 459 /// 460 /// Also note that field ordering is significant at this time and must match 461 /// WIT. 462 /// 463 /// ## Variants 464 /// 465 /// `variant`s in the component model correspond to a subset of shapes of a Rust 466 /// `enum`. Variants in the component model have a single optional payload type 467 /// which means that not all Rust `enum`s correspond to component model 468 /// `variant`s. An example variant is: 469 /// 470 /// ```rust 471 /// use wasmtime::component::ComponentType; 472 /// 473 /// #[derive(ComponentType)] 474 /// #[component(variant)] 475 /// enum Filter { 476 /// #[component(name = "none")] 477 /// None, 478 /// #[component(name = "all")] 479 /// All, 480 /// #[component(name = "some")] 481 /// Some(Vec<String>), 482 /// } 483 /// ``` 484 /// 485 /// which corresponds to the WIT type: 486 /// 487 /// ```wit 488 /// variant filter { 489 /// none, 490 /// all, 491 /// some(list<string>), 492 /// } 493 /// ``` 494 /// 495 /// The `variant` style of derive allows an optional payload on Rust `enum` 496 /// variants but it must be a single unnamed field. Variants of the form `Foo(T, 497 /// U)` or `Foo { name: T }` are not supported at this time. 498 /// 499 /// Note that the order of variants in Rust must match the order of variants in 500 /// WIT. Additionally it's likely that `#[component(name = "...")]` is required 501 /// on all Rust `enum` variants because the name currently defaults to the Rust 502 /// name which is typically UpperCamelCase whereas WIT uses kebab-case. 503 /// 504 /// ## Enums 505 /// 506 /// `enum`s in the component model correspond to C-like `enum`s in Rust. Note 507 /// that a component model `enum` does not allow any payloads so the Rust `enum` 508 /// must additionally have no payloads. 509 /// 510 /// ```rust 511 /// use wasmtime::component::ComponentType; 512 /// 513 /// #[derive(ComponentType)] 514 /// #[component(enum)] 515 /// enum Setting { 516 /// #[component(name = "yes")] 517 /// Yes, 518 /// #[component(name = "no")] 519 /// No, 520 /// #[component(name = "auto")] 521 /// Auto, 522 /// } 523 /// ``` 524 /// 525 /// which corresponds to the WIT type: 526 /// 527 /// ```wit 528 /// enum setting { 529 /// yes, 530 /// no, 531 /// auto, 532 /// } 533 /// ``` 534 /// 535 /// Note that the order of variants in Rust must match the order of variants in 536 /// WIT. Additionally it's likely that `#[component(name = "...")]` is required 537 /// on all Rust `enum` variants because the name currently defaults to the Rust 538 /// name which is typically UpperCamelCase whereas WIT uses kebab-case. 539 pub use wasmtime_component_macro::ComponentType; 540 541 /// A derive macro for generating implementations of the [`Lift`] trait. 542 /// 543 /// This macro will likely be applied in conjunction with the 544 /// [`#[derive(ComponentType)]`](macro@ComponentType) macro along the lines 545 /// of `#[derive(ComponentType, Lift)]`. This trait enables reading values from 546 /// WebAssembly. 547 /// 548 /// Note you might be looking for [`bindgen!`] rather than this macro as that 549 /// will generate the entire type for you rather than just a trait 550 /// implementation. 551 /// 552 /// At this time this derive macro has no configuration. 553 /// 554 /// ## Examples 555 /// 556 /// ```rust 557 /// use wasmtime::component::{ComponentType, Lift}; 558 /// 559 /// #[derive(ComponentType, Lift)] 560 /// #[component(record)] 561 /// struct Color { 562 /// r: u8, 563 /// g: u8, 564 /// b: u8, 565 /// } 566 /// ``` 567 pub use wasmtime_component_macro::Lift; 568 569 /// A derive macro for generating implementations of the [`Lower`] trait. 570 /// 571 /// This macro will likely be applied in conjunction with the 572 /// [`#[derive(ComponentType)]`](macro@ComponentType) macro along the lines 573 /// of `#[derive(ComponentType, Lower)]`. This trait enables passing values to 574 /// WebAssembly. 575 /// 576 /// Note you might be looking for [`bindgen!`] rather than this macro as that 577 /// will generate the entire type for you rather than just a trait 578 /// implementation. 579 /// 580 /// At this time this derive macro has no configuration. 581 /// 582 /// ## Examples 583 /// 584 /// ```rust 585 /// use wasmtime::component::{ComponentType, Lower}; 586 /// 587 /// #[derive(ComponentType, Lower)] 588 /// #[component(record)] 589 /// struct Color { 590 /// r: u8, 591 /// g: u8, 592 /// b: u8, 593 /// } 594 /// ``` 595 pub use wasmtime_component_macro::Lower; 596 597 /// A macro to generate a Rust type corresponding to WIT `flags` 598 /// 599 /// This macro generates a type that implements the [`ComponentType`], [`Lift`], 600 /// and [`Lower`] traits. The generated Rust type corresponds to the `flags` 601 /// type in WIT. 602 /// 603 /// Example usage of this looks like: 604 /// 605 /// ```rust 606 /// use wasmtime::component::flags; 607 /// 608 /// flags! { 609 /// Permissions { 610 /// #[component(name = "read")] 611 /// const READ; 612 /// #[component(name = "write")] 613 /// const WRITE; 614 /// #[component(name = "execute")] 615 /// const EXECUTE; 616 /// } 617 /// } 618 /// 619 /// fn validate_permissions(permissions: &mut Permissions) { 620 /// if permissions.contains(Permissions::EXECUTE | Permissions::WRITE) { 621 /// panic!("cannot enable both writable and executable at the same time"); 622 /// } 623 /// 624 /// if permissions.contains(Permissions::READ) { 625 /// panic!("permissions must at least contain read"); 626 /// } 627 /// } 628 /// ``` 629 /// 630 /// which corresponds to the WIT type: 631 /// 632 /// ```wit 633 /// flags permissions { 634 /// read, 635 /// write, 636 /// execute, 637 /// } 638 /// ``` 639 /// 640 /// This generates a structure which is similar to/inspired by the [`bitflags` 641 /// crate](https://crates.io/crates/bitflags). The `Permissions` structure 642 /// generated implements the [`PartialEq`], [`Eq`], [`Debug`], [`BitOr`], 643 /// [`BitOrAssign`], [`BitAnd`], [`BitAndAssign`], [`BitXor`], [`BitXorAssign`], 644 /// and [`Not`] traits - in addition to the Wasmtime-specific component ones 645 /// [`ComponentType`], [`Lift`], and [`Lower`]. 646 /// 647 /// [`BitOr`]: std::ops::BitOr 648 /// [`BitOrAssign`]: std::ops::BitOrAssign 649 /// [`BitAnd`]: std::ops::BitAnd 650 /// [`BitAndAssign`]: std::ops::BitAndAssign 651 /// [`BitXor`]: std::ops::BitXor 652 /// [`BitXorAssign`]: std::ops::BitXorAssign 653 /// [`Not`]: std::ops::Not 654 pub use wasmtime_component_macro::flags; 655 656 #[cfg(any(docsrs, test, doctest))] 657 pub mod bindgen_examples; 658 659 // NB: needed for the links in the docs above to work in all `cargo doc` 660 // configurations and avoid errors. 661 #[cfg(not(any(docsrs, test, doctest)))] 662 #[doc(hidden)] 663 pub mod bindgen_examples {} 664