2022-01-19 20:56:39 +00:00
|
|
|
pub use effers_derive::program;
|
|
|
|
|
|
|
|
#[cfg(test)]
|
|
|
|
mod test {
|
|
|
|
use super::*;
|
|
|
|
|
2022-01-21 10:38:02 +00:00
|
|
|
// #[program(Smth => Printer(print as p), Logger(debug, info), inc::Incrementer(increment))]
|
|
|
|
// fn smth(val: u8) -> u8 {
|
|
|
|
// let s = p("hey hi hello");
|
2022-01-19 20:56:39 +00:00
|
|
|
|
2022-01-21 10:38:02 +00:00
|
|
|
// debug("this is a debug-level log");
|
|
|
|
// info("this is a info-level log");
|
2022-01-19 20:56:39 +00:00
|
|
|
|
2022-01-21 10:38:02 +00:00
|
|
|
// let _s = p("hey hi hello");
|
|
|
|
|
|
|
|
// dbg!(s);
|
|
|
|
|
|
|
|
// let x = increment(val);
|
|
|
|
// let y = increment(x);
|
|
|
|
// x + y
|
|
|
|
// }
|
2022-01-19 20:56:39 +00:00
|
|
|
|
|
|
|
trait Printer {
|
2022-01-21 10:38:02 +00:00
|
|
|
fn print(&self, s: &str) -> &str;
|
2022-01-19 20:56:39 +00:00
|
|
|
}
|
|
|
|
trait Logger {
|
|
|
|
fn debug(&mut self, s: &str);
|
|
|
|
fn info(&mut self, s: &str);
|
|
|
|
}
|
2022-01-21 10:38:02 +00:00
|
|
|
mod inc {
|
|
|
|
pub trait Incrementer {
|
|
|
|
fn increment(&mut self, v: u8) -> u8;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// TODO make nameless programs work
|
|
|
|
#[program(Printer(print as p))]
|
|
|
|
fn ohter() {
|
|
|
|
let _s = p("hey hi hello");
|
|
|
|
}
|
2022-01-19 20:56:39 +00:00
|
|
|
}
|