flutter_rust_bridge
flutter_rust_bridge copied to clipboard
Cancelable tasks and object pools
- [ ] cancellable tasks
- [ ] object pools (dependent of cancellable task)
Fix #241 Fix #242
Current status: need some work to make it compile...
Main problem to consider: In my private repo api.rs
I have the following code and let frb generate everything for me. However, now since it is extracted into frb itself, I need to reconsider how to write this code.
#[derive(Debug, PartialEq, Eq, Hash, Clone)]
pub struct CancelTokenHandle(pub i64, pub i64);
impl_pool_object_handle!(Arc<CancelToken>, CancelTokenHandle);
pub fn cancel_token_new(sub_pool_id: i64) -> Result<CancelTokenHandle> {
Ok(pool::put(sub_pool_id, Arc::new(CancelToken::new())))
}
pub fn cancel_token_cancel(cancel_token: CancelTokenHandle) -> Result<()> {
let cancel_token = pool::get_cloned(cancel_token)?;
cancel_token.cancel();
Ok(())
}
pub fn cancel_token_remove(cancel_token: CancelTokenHandle) -> Result<()> {
pool::remove(cancel_token);
Ok(())
}
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
👀
@sagudev You are welcomed to make a PR to make this work :) Because I have already done the main things, and the blocking issue is https://github.com/fzyzcjy/flutter_rust_bridge/pull/333#issuecomment-1037079219
👀
I did this just to prevent stale.
👀
@lattice0 Feel free to implement :) https://github.com/fzyzcjy/flutter_rust_bridge/pull/333#issuecomment-1037079219
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Is there any chance, that cancelable tasks will be implemented in the near future?
@LowLevelSubmarine You can copy-and-paste it into your api.rs currently!