async-result-ext
Async extensions for Rust’s [Result<T, E>].
This crate provides asynchronous counterparts of the standard Result methods (map, and_then, map_err, inspect), allowing you to use async closures seamlessly.
✨ Motivation
The standard library’s Result methods (map, and_then, etc.) only work with synchronous closures.
When writing async code, you often need to .await inside these transformations. This crate fills that gap.
Instead of:
let res: = Ok;
let mapped = match res ;
You can just write:
use AsyncResultExt;
let res: = Ok;
let mapped = res.async_map.await;
assert_eq!;
📦 Installation
Add this to your Cargo.toml:
[]
= "0.1.0"
🚀 Usage
use AsyncResultExt;
async
📖 Provided Methods
async_map– async version of [Result::map]async_and_then– async version of [Result::and_then]async_map_or– async version of [Result::map_or]async_map_or_else– async version of [Result::map_or_else]async_map_err– async version of [Result::map_err]async_inspect– async version of [Result::inspect]async_inspect_err– async version of [Result::inspect_err]async_is_ok_and- async version of [Result::is_ok_and]async_is_err_and- async version of [Result::is_err_and]
⚡ Features
- Minimal and lightweight
- No dependencies (except your async runtime, e.g. Tokio or async-std)
- Familiar API – mirrors the standard library’s
Resultmethods
🔧 License
MIT License. See LICENSE for details.