Add example of a resource with hidden immutable data
This commit is contained in:
@@ -1,14 +1,15 @@
|
||||
#[allow(warnings)]
|
||||
mod bindings;
|
||||
|
||||
use bindings::{hello, Guest};
|
||||
use bindings::{hello, Guest, Testresource};
|
||||
use crate::bindings::RecordString;
|
||||
|
||||
struct Component;
|
||||
|
||||
impl Guest for Component {
|
||||
fn greet(hello_string: RecordString) {
|
||||
fn greet(hello_string: RecordString, some_resource: Testresource) {
|
||||
hello(&hello_string);
|
||||
some_resource.hello();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,19 @@
|
||||
package my:project;
|
||||
|
||||
world test {
|
||||
interface types {
|
||||
resource testresource {
|
||||
hello: func();
|
||||
}
|
||||
|
||||
|
||||
record record-string {
|
||||
hello-string: string,
|
||||
}
|
||||
}
|
||||
|
||||
world test {
|
||||
use types.{testresource, record-string};
|
||||
|
||||
import hello: func(hello-string: record-string);
|
||||
export greet: func(hello-string: record-string);
|
||||
export greet: func(hello-string: record-string, input-resource: testresource);
|
||||
}
|
||||
Reference in New Issue
Block a user