How to implement macro with async function inside?
See original GitHub issuebabel-plugin-macros
version: 2.1.0node
version: 8.6npm
(oryarn
) version: yarn 1.5.1
Relevant code or config
What you did:
What happened:
Reproduction repository:
https://github.com/stereobooster/lqip.macro
Problem description:
I want to implement lqip.macro
. I’m not sure how to use async lqip
in babel-plugin-macros
, which seems to be expecting synchronous code. Am I wrong here? What is the way to work with async functions? Thanks
Suggested solution:
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (7 by maintainers)
Top Results From Across the Web
Use macro within implementation of trait with async functions
Here's a minimal example for using an async function in a trait: use async_trait::async_trait; macro_rules! default_f { () => { async fn f() ......
Read more >futures-await-await-macro — async Rust library // Lib.rs
The await! macro allows blocking on a future to completion. This does not actually block the thread though, it just "blocks" the future...
Read more >futures_macro_await::await - Rust - Docs.rs
Await a sub-future inside an #[async] function. You should pass an object implementing [ Future ] or [ StableFuture ] to this macro,...
Read more >Using async-trait macro to have sync function inside a trait
In the above code I have two fun() variants.one is a basic fun() and other is bind to a async-trait . basic function...
Read more >better-async-await.macro - npm
In async /await functions we often use try/catch blocks to catch errors. For example:- async function ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’ve made @kentcdodds solution into a more generic & cleaner micro library: https://github.com/Zemnmez/do-sync
Very cool @Zemnmez! Thank you 💯