You've already forked wit-bindgen
mirror of
https://github.com/AdaCore/wit-bindgen.git
synced 2026-02-12 13:12:42 -08:00
* Update Rust codegen for new WIT changes * Update the markdown generation for new WIT * more-rust * Update the C generator for new WIT * Get Rust guest tests compiling * Get rust host tests working * Get all C tests passing * Turn off teavm-java and Go tests for now * Fixup lockfile after rebase * Bump crate versions * Update dependency sources * Update to wasmtime dep
67 lines
1.8 KiB
Plaintext
67 lines
1.8 KiB
Plaintext
package my:unions
|
|
|
|
interface unions {
|
|
/// A union of all of the integral types
|
|
union all-integers {
|
|
/// Bool is equivalent to a 1 bit integer
|
|
/// and is treated that way in some languages
|
|
bool,
|
|
u8, u16, u32, u64,
|
|
s8, s16, s32, s64
|
|
}
|
|
union all-floats {
|
|
float32, float64
|
|
}
|
|
union all-text {
|
|
char, string
|
|
}
|
|
|
|
// Returns the same case as the input but with 1 added
|
|
add-one-integer: func(num: all-integers) -> all-integers
|
|
// Returns the same case as the input but with 1 added
|
|
add-one-float: func(num: all-floats) -> all-floats
|
|
// Returns the same case as the input but with the first character replaced
|
|
replace-first-char: func(text: all-text, letter: char) -> all-text
|
|
|
|
// Returns the index of the case provided
|
|
identify-integer: func(num: all-integers) -> u8
|
|
// Returns the index of the case provided
|
|
identify-float: func(num: all-floats) -> u8
|
|
// Returns the index of the case provided
|
|
identify-text: func(text: all-text) -> u8
|
|
|
|
union duplicated-s32 {
|
|
/// The first s32
|
|
s32,
|
|
/// The second s32
|
|
s32,
|
|
/// The third s32
|
|
s32
|
|
}
|
|
|
|
// Returns the same case as the input but with 1 added
|
|
add-one-duplicated: func(num: duplicated-s32) -> duplicated-s32
|
|
|
|
// Returns the index of the case provided
|
|
identify-duplicated: func(num: duplicated-s32) -> u8
|
|
|
|
/// A type containing numeric types that are distinct in most languages
|
|
union distinguishable-num {
|
|
/// A Floating Point Number
|
|
float64,
|
|
/// A Signed Integer
|
|
s64
|
|
}
|
|
|
|
// Returns the same case as the input but with 1 added
|
|
add-one-distinguishable-num: func(num: distinguishable-num) -> distinguishable-num
|
|
|
|
// Returns the index of the case provided
|
|
identify-distinguishable-num: func(num: distinguishable-num) -> u8
|
|
}
|
|
|
|
world the-unions {
|
|
import unions
|
|
export unions
|
|
}
|