mirror of
https://github.com/microsoft/vscode-extension-samples.git
synced 2026-04-27 16:55:44 +08:00
28 lines
419 B
Plaintext
28 lines
419 B
Plaintext
// wit/calculator.wit
|
|
package vscode:example;
|
|
|
|
interface types {
|
|
record operands {
|
|
left: u32,
|
|
right: u32
|
|
}
|
|
|
|
variant operation {
|
|
add(operands),
|
|
sub(operands),
|
|
mul(operands),
|
|
div(operands)
|
|
}
|
|
|
|
enum error-code {
|
|
none,
|
|
overflow,
|
|
divide-by-zero
|
|
}
|
|
}
|
|
world calculator {
|
|
use types.{ operation, error-code };
|
|
import log: func(msg: string);
|
|
|
|
export calc: func(o: operation) -> result<u32, error-code>;
|
|
} |