You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am facing code generation issue with simple rust code involving async_trait. I may be wrong, but could not fix it. The frb_generated.rs file has lots of error in it. I have added enable_lifetime: true in flutter_rust_bridge.yaml file.
Steps to reproduce
Modify the simple.rs file from the code generated by the template as follows:
// simple.rsuse std::fmt::Display;use std::io::Error;use async_trait::async_trait;use flutter_rust_bridge::frb;#[frb]// Synchronous mode for simplicity of the demopubasyncfngreet(name:String) -> String{//sleep
tokio::time::sleep(tokio::time::Duration::from_secs(2)).await;format!("Hello, {name}!")}#[frb(init)]pubfninit_app(){// Default utilities - feel free to customize
flutter_rust_bridge::setup_default_user_utils();}#[frb]pubstructEmail{}implDisplayforEmail{fnfmt(&self,f:&mut std::fmt::Formatter<'_>) -> std::fmt::Result{write!(f, "Email")}}#[frb]#[async_trait]pubtraitEmailService{asyncfnsend_email(&self,email:Email) -> Result<(),Error>;}#[frb]pubstructEmailServiceImpl{pubdummy:i32,}#[frb]#[async_trait]implEmailServiceforEmailServiceImpl{asyncfnsend_email(&self,email:Email) -> Result<(),Error>{
tokio::time::sleep(tokio::time::Duration::from_secs(2)).await;println!("Email sent {}", email);Ok(())}}
Add below dependenciies in Cargo.toml file
tokio = { version = "1.34.0", features = ["time"] }
async-trait = "0.1.82"
Run below command
flutter_rust_bridge_codegen generate
At this point the frb_generated.rs file has lots of error.
Try running the flutter app. It will display error logs and fails
Describe the bug
I am facing code generation issue with simple rust code involving
async_trait
. I may be wrong, but could not fix it. Thefrb_generated.rs
file has lots of error in it. I have addedenable_lifetime: true
in flutter_rust_bridge.yaml file.Steps to reproduce
simple.rs
file from the code generated by the template as follows:At this point the
frb_generated.rs
file has lots of error.Logs
Due to max character length restriction in github issues, log is pasted here - https://gist.github.com/anidotnet/bec9c144c81e7270fc458e053397419d
Expected behavior
No response
Generated binding code
OS
MacOS
Version of
flutter_rust_bridge_codegen
2.4.0
Flutter info
Version of
clang++
16
Additional context
No response
The text was updated successfully, but these errors were encountered: