1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
use wapc_guest::host_call;
use crate::HandlerResult;
pub struct UntypedHostBinding {
binding: String,
}
pub fn host(binding: &str) -> UntypedHostBinding {
UntypedHostBinding {
binding: binding.to_string(),
}
}
pub fn default() -> UntypedHostBinding {
UntypedHostBinding {
binding: "default".to_string(),
}
}
impl UntypedHostBinding {
pub fn call(&self, capid: &str, operation: &str, payload: Vec<u8>) -> HandlerResult<Vec<u8>> {
host_call(&self.binding, capid, operation, &payload).map_err(|e| e.into())
}
}