kataglyphis_rustprojecttemplate/api/
simple.rs1#[flutter_rust_bridge::frb(sync)]
2pub fn greet(name: String) -> String {
3 format!("Hello, you {name}!")
4}
5
6pub fn init_app() {
12 crate::platform::init_app();
13}
14
15#[flutter_rust_bridge::frb(sync)]
17pub fn heavy_computation(input: i32) -> i32 {
18 let mut result = input;
19 for _ in 0..1000 {
20 result = (result * 2) % 1000000;
21 }
22 result
23}
24
25#[flutter_rust_bridge::frb()]
27pub async fn async_heavy_work(input: i32) -> i32 {
28 tokio::time::sleep(tokio::time::Duration::from_millis(100)).await;
29 input * 2
30}