File: records.wit

package info (click to toggle)
rust-wasmtime 26.0.1%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 48,492 kB
  • sloc: ansic: 4,003; sh: 561; javascript: 542; cpp: 254; asm: 175; ml: 96; makefile: 55
file content (61 lines) | stat: -rw-r--r-- 1,200 bytes parent folder | download
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package foo:foo;

interface records {
  tuple-arg: func(x: tuple<char, u32>);
  tuple-result: func() -> tuple<char, u32>;

  record empty {}

  empty-arg: func(x: empty);
  empty-result: func() -> empty;

  /// A record containing two scalar fields
  /// that both have the same type
  record scalars {
      /// The first field, named a
      a: u32,
      /// The second field, named b
      b: u32,
  }

  scalar-arg: func(x: scalars);
  scalar-result: func() -> scalars;

  /// A record that is really just flags
  /// All of the fields are bool
  record really-flags {
      a: bool,
      b: bool,
      c: bool,
      d: bool,
      e: bool,
      f: bool,
      g: bool,
      h: bool,
      i: bool,
  }

  flags-arg: func(x: really-flags);
  flags-result: func() -> really-flags;

  record aggregates {
      a: scalars,
      b: u32,
      c: empty,
      d: string,
      e: really-flags,
  }

  aggregate-arg: func(x: aggregates);
  aggregate-result: func() -> aggregates;

  type tuple-typedef = tuple<s32>;
  type int-typedef = s32;
  type tuple-typedef2 = tuple<int-typedef>;
  typedef-inout: func(e: tuple-typedef2) -> s32;
}

world the-world {
  import records;
  export records;
}