📦 Flexi Func Declarative 🚀
Welcome to Flexi Func Declarative - a Rust crate designed to supercharge your Rust programming experience with two powerful macros: ff (Flexi Func) and fb (Flexi Block) or (Function Builder) 🛠️.
These macros are crafted to simplify and enhance the way you write synchronous and asynchronous code, making your Rust journey smoother and more efficient.
🎁 Features
fb!(Flexi Block) or (Function Builder): Inside the sync function write down your (syncorasync) versions using fb!fb!Reducing the boilerplate for conditional function generation 🔄.
🚀 Getting Started
This crate is meant to be used with and supplement the flexi_func crate.
To start using flexi_func in your project, add it to your Cargo.toml:
[]
= "0.2.6"
Then, import the macros in your Rust file:
use ;
💻 Usage
🛠 ff - Flexi Func
The ff macro simplifies the creation of synchronous and asynchronous function variants, including customizable error handling.
Basic Example
This generates an asynchronous version compute_async alongside the original compute function.
If you need to specify an async version of your code inside your sync function use the fb! declarative macro.
🐞 Custom Error Type
🔄 fb! - Flexi Block or Function Builder
Create asynchronous twin functions & code blocks on the fly with fb!, tailored to reduce redundancy and improve code clarity.
✅ Synchronous Function
fb!;
⚡ Asynchronous Function
fb!;
💡 Advanced Tips
- Use conditional compilation with
fb!to adaptively generate sync or async functions based on your application's needs 🎛️. - Combine
ffwith Rust's powerful error handling to streamline async error management 🚦.
🐳 Contributing
Contributions are welcome! If you'd like to help improve flexi_func, please feel free to create issues or submit pull requests 🤝.
📃 License
This project is licensed under MIT.