arora-module 2.1.0

Write an Arora module in Rust: the declaration macros and the traits they implement.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// rustc checks that an implementation provides every function of its contract.
#[arora_module::contract]
pub trait Speak {
    #[export(id = "5e1f0000-0000-4000-8000-000000000001")]
    fn say(&mut self, #[param(id = "5e1f0000-0000-4000-8000-000000000002")] text: String);

    #[export(id = "5e1f0000-0000-4000-8000-000000000003")]
    fn whisper(&mut self, #[param(id = "5e1f0000-0000-4000-8000-000000000004")] text: String);
}

struct Loud;

impl Speak for Loud {
    fn say(&mut self, _text: String) {}
}

fn main() {}