4 releases
new 0.1.0 | Mar 21, 2025 |
---|---|
0.0.3 | Feb 20, 2025 |
0.0.2 | Feb 12, 2025 |
0.0.1 | Jan 24, 2025 |
#41 in #open-harmony
208 downloads per month
5KB
openharmony-ability-derive
Introduce
openharmony-ability-derive is a macro crate for the openharmony-ability project. It provides a macro for generating code to accept the OpenHarmony/HarmonyNext ability's lifecycle callbacks.
Install
cargo add openharmony-ability-derive
Example
use openharmony_ability_derive::ability;
#[ability]
fn openharmony_app(app: OpenHarmonyApp) {
app.run_loop(|types| match types {
Event::Input(k) => match k {
InputEvent::TextInputEvent(s) => {
hilog_info!(format!("ohos-rs macro input_text: {:?}", s).as_str());
}
_ => {
hilog_info!(format!("ohos-rs macro input:").as_str());
}
},
Event::WindowRedraw(_) => {}
_ => {
hilog_info!(format!("ohos-rs macro: {:?}", types.as_str()).as_str());
}
});
}
Dependencies
~200–630KB
~15K SLoC