In the rust guest implementaiton, it would be interesting to explore the idea of having the function return a reference to self if there isn't a return value. This would enable chaining like the following.
interface text {
resource text-component {
text: static func(plain: string) -> text-component;
add-text: func(text: string);
underlined: func(value: bool);
}
}
fn main() {
let text = TextComponent::text("My Component").underlined(true).add_text(" - my additional text here");
}
This could also be put under a feature flag in wit-bindgen.
In the rust guest implementaiton, it would be interesting to explore the idea of having the function return a reference to self if there isn't a return value. This would enable chaining like the following.
This could also be put under a feature flag in wit-bindgen.