Skip to content

maybe_async complicates isomorphic use-cases #559

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

Closed
cryptoquick opened this issue Mar 7, 2022 · 6 comments
Closed

maybe_async complicates isomorphic use-cases #559

cryptoquick opened this issue Mar 7, 2022 · 6 comments
Assignees
Labels
bug Something isn't working

Comments

@cryptoquick
Copy link

The maybe_async macro makes the function signature of each method different depending on whether the dependency is compiled for wasm32 or not. This isn't ideal for libraries that might be used in isomoprhic app frameworks like iced, which can compile to either web or desktop-native targets.

I'm not sure what the best approach would be to fix this since Rust's async story is so complex right now. If at some point we enter the shiny future, we can just remove usage of the bdk-macros crate altogether.

For now, I think it's possible to bypass this issue by also using the bdk-macros crate, but this is imperfect because it essentially perpetuates the problem, and "infects" all upstream dependents.

@cryptoquick cryptoquick added the bug Something isn't working label Mar 7, 2022
@cryptoquick cryptoquick changed the title maybe_async prevents isomorphic use-cases maybe_async complicates isomorphic use-cases Mar 7, 2022
@LLFourn
Copy link
Contributor

LLFourn commented Mar 8, 2022

@cryptoquick fwiw I am working on this as part of #165. My plan is to have a sync blockchain traits in blockchain and async versions in blockchain::async. Would this work for your use case?

@cryptoquick
Copy link
Author

Maybe! I might be able to finagle conditional compilation to accomplish that. Is your branch ready to try? Also, is it merged with main? (I'm typing this on mobile, otherwise I'd check, myself)

@cryptoquick
Copy link
Author

Just got back to my machine to check, and it looks like that's just an issue, not a pull request. Still, this might work, and it's idiomatic to how other libraries in the Rust ecosystem works. I'd be willing to close this in light of the work being done there, if you think that makes sense, @LLFourn ?

@LLFourn
Copy link
Contributor

LLFourn commented Mar 8, 2022

We are starting work on this change today. Won't be ready for testing this week I suspect. I'll keep you updated.

@cryptoquick
Copy link
Author

Sounds good. I've also subscribed to the other thread, and also, let me know if you need any help testing your work.

@notmandatory
Copy link
Member

The core Wallet type is now Send+Sync and any async or blocking client can be used for blockchain syncing or persistence, see #1873.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants