remove old declarative macros

This commit is contained in:
🪞👃🪞 2025-05-08 22:07:10 +03:00
parent bcbcc387a2
commit b7bb6119aa
9 changed files with 33 additions and 408 deletions

View file

@ -41,23 +41,24 @@ handle!(TuiIn: |self: Example, input|{
})
});
defcom! { |self, state: Example|
ExampleCommand {
Next => {
state.0 = (state.0 + 1) % EXAMPLES.len();
None
}
Prev => {
state.0 = if state.0 > 0 { state.0 - 1 } else { EXAMPLES.len() - 1 };
None
}
}
#[tengri_proc::expose]
impl Example {
//[bool] => {}
//[u16] => {}
//[usize] => {}
}
atom_command!(ExampleCommand: |app: Example| {
("prev" [] Some(Self::Prev))
("next" [] Some(Self::Next))
});
#[tengri_proc::command(Example)]
impl ExampleCommand {
fn next (state: &mut Example) -> Perhaps<Self> {
state.0 = (state.0 + 1) % EXAMPLES.len();
Ok(None)
}
fn prev (state: &mut Example) -> Perhaps<Self> {
state.0 = if state.0 > 0 { state.0 - 1 } else { EXAMPLES.len() - 1 };
Ok(None)
}
}
view!(TuiOut: |self: Example|{
let index = self.0 + 1;
@ -77,11 +78,3 @@ view!(TuiOut: |self: Example|{
":map-e" => Map::east(5u16, ||0..5u16, |n, i|format!("{n}")).boxed(),
":map-s" => Map::south(5u16, ||0..5u16, |n, i|format!("{n}")).boxed(),
});
expose! {
[self: Example] {
[bool] => {}
[u16] => {}
[usize] => {}
}
}