Note about fallback async methods

implementing-future
Bradlee Speice 2020-07-14 00:52:00 -04:00
parent ca386a4851
commit d7a04fdcb4
1 changed files with 6 additions and 0 deletions

View File

@ -180,3 +180,9 @@ help: consider further restricting this bound
15 | impl<R3: AsyncBufRead + ?Sized + std::marker::Unpin> Future for MyStruct<'_, R3> {
| ^^^^^^^^^^^^^^^^^^^^
```
# Don't feel bad about fallbacks
When used sparingly, either `#[async_trait]` or `Box::pin(async move {})` can enable async
functionality in code that will later not need the allocations. Use the escape hatch when you need
to such that you can continue making incremental improvements later.