-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathresp.wit
More file actions
27 lines (24 loc) · 797 Bytes
/
resp.wit
File metadata and controls
27 lines (24 loc) · 797 Bytes
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
interface resp {
type error = string;
variant value {
%string(string),
error(string),
integer(s64),
bulk-string(string),
array(list<nested-value>),
null,
boolean(bool),
double(f64),
big-number(string),
bulk-error(string),
verbatim-string(tuple<string, string>),
%map(list<tuple<nested-value, nested-value>>),
set(list<nested-value>),
push(list<nested-value>),
}
/// Values nested within an aggregate type. Since WIT types are not allowed to depend on
/// themselves, nested values are stored as encoded RESP.
type nested-value = list<u8>;
decode: func(data: list<u8>) -> result<value, error>;
encode: func(value: value) -> result<list<u8>, error>;
}