I added a type alias to one of my wit files like this:
/// size is a 2-element integer vector.
/// It represents a width and height.
record size {
x: s32,
y: s32,
}
/// point is a 2-element integer vector.
/// It represents a x and y coordinate.
type point = size;
The generated code substituted Size everywhere that the wit file used point which was not incorrect as far as typing/compilation, but did not achieve my objective of code readability which is why I created the alias.
What I expected was some Go code like this:
wit-bindgen for Rust did add named alias to generated code:
/// point is a 2-element integer vector.
/// It represents a x and y coordinate.
pub type Point = Size;
Likewise C
// point is a 2-element integer vector.
// It represents a x and y coordinate.
typedef wasm_cv_types_size_t wasm_cv_types_point_t;
I added a type alias to one of my wit files like this:
The generated code substituted
Sizeeverywhere that the wit file usedpointwhich was not incorrect as far as typing/compilation, but did not achieve my objective of code readability which is why I created the alias.What I expected was some Go code like this:
wit-bindgenfor Rust did add named alias to generated code:Likewise C