#![no_std]
#![allow(unused_macros)]
#[cfg(feature = "std")]
fn std_enabled() -> CompileError;
extern crate alloc;
mod codegen_tests {
macro_rules! codegen_test {
($id:ident $name:tt $test:tt) => {
mod $id {
wit_bindgen::generate!({
path: $test,
std_feature,
stubs
});
#[test]
fn works() {}
}
};
}
test_helpers::codegen_tests!();
}
mod strings {
use alloc::string::String;
wit_bindgen::generate!({
inline: "
package my:strings
world not-used-name {
import cat: interface {
foo: func(x: string)
bar: func() -> string
}
}
",
std_feature,
});
#[allow(dead_code)]
fn test() {
cat::foo("hello");
let _t: String = cat::bar();
}
}
mod raw_strings {
use alloc::vec::Vec;
wit_bindgen::generate!({
inline: "
package raw:strings
world not-used-name {
import cat: interface {
foo: func(x: string)
bar: func() -> string
}
}
",
raw_strings,
std_feature,
});
#[allow(dead_code)]
fn test() {
cat::foo(b"hello");
let _t: Vec<u8> = cat::bar();
}
}
mod skip {
wit_bindgen::generate!({
inline: "
package foo:foo
world baz {
export exports: interface {
foo: func()
bar: func()
}
}
",
skip: ["foo"],
std_feature,
exports: {
"exports": Component
}
});
struct Component;
impl exports::exports::Guest for Component {
fn bar() {}
}
}