# dyn-future This is a small crate implementing convenient and fast dynamic Futures in Rust. The `DynFuture` type this library provides is intended as a replacement for the naive `Box>`. ## Usability This library is designed to be dead simple to use and require no setup. You can freely mix the naive boxed futures from dependencies and such without issue. `DynFuture` can be used the same way as `Box>` and most of the time you can just run find and replace on your existing code. `DynFuture` can be awaited like any other future, but it has a fixed size. It should only be used as a replacement for `Box>`. If it is possible you should always prefer statically resolved futures using `async fn`. ## Compilation overhead dyn-future strives to be small and to minimize dependencies. If you have any questions or improvements to make, feel free to open an issue. ## Why? The provided `DynFuture` type is faster than the naive implementation. Exactly how much depends on the global allocator, amount of CPU logical processors and the sizes of the futures sent. Though in general `DynFuture` is always faster. Currently we provide some extremely simple benchmarks. These could absolutely be improved. This is something I would like help with as I am not fantastic at writing benchmarks. There are not representative of real world gains due to the lack of variation of future types. I have done some minor benchmarking of a proprietary codebase using dyn-future with over 8x gains in time spent handling dynamic futures. ## Contributing dyn-future gladly accepts contributions! Open a PR and I will take a look.