Skip to content
/ amphi Public

A procedure macro to get blocking code from async implementation for free

License

Notifications You must be signed in to change notification settings

fMeow/amphi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

amphi

Build Status MIT licensed Latest Version amphi

Why bother writing similar code twice for blocking and async code?

When implementing both sync and async versions of API in a crate, most API of the two version are almost the same except for some async/await keyword. amphi provides a macro to get blocking code from async implementation for free, alongside with the async code.

amphi is an English prefix meaning both. This crate copy the async code and strip all async/await keyword to get a blocking implementation.

How to use

  1. place all your async code in a mod. By default, the mod should call amphi, but it can be customize.
  2. apply amphi attribute macro on the mod declaration code.

LICENSE

MIT

About

A procedure macro to get blocking code from async implementation for free

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published