Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lifetime issues with <airup_sdk::nonblocking::Connection as airup_sdk::Connection>::invoke #25

Open
sisungo opened this issue Feb 27, 2024 · 1 comment
Labels
enhancement New feature or request sdk This issue or pull request is mainly related to the public API

Comments

@sisungo
Copy link
Owner

sisungo commented Feb 27, 2024

It's hard to use the following pattern with current implementation due to lifetime issues:

async fn with_connection<T, F: Future<Output = Result<T, airup_sdk::ipc::Error>>>(
    &self,
    f: impl FnOnce(&mut Connection) -> F,
) {
    /* ... */
}

self.with_connection(|conn| conn.trigger_event(&event)).await;

The plan is:

  • When async keyword generics is added to Rust, current emulation is rewritten.
  • When related unstable features are stabilized, use unboxed futures to replace boxed ones.
  • Fix the issue.
@sisungo sisungo added the enhancement New feature or request label Feb 27, 2024
@sisungo
Copy link
Owner Author

sisungo commented Feb 27, 2024

Priority: Low-Medium.

@sisungo sisungo added the sdk This issue or pull request is mainly related to the public API label Aug 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request sdk This issue or pull request is mainly related to the public API
Projects
None yet
Development

No branches or pull requests

1 participant