| Crates.io | type-toppings |
| lib.rs | type-toppings |
| version | 0.2.1 |
| created_at | 2023-11-08 20:24:47.697658+00 |
| updated_at | 2024-10-04 11:57:28.725603+00 |
| description | Opinionated extensions to standard types |
| homepage | |
| repository | https://github.com/plul/type-toppings |
| max_upload_size | |
| id | 1029387 |
| size | 32,261 |
Opinionated collection of utility extensions for several of Rust's standard types, including:
ResultIteratorfutures::Steamhttps://docs.rs/type-toppings/latest/type_toppings/
# Cargo.toml
[dependencies]
type-toppings = { version = "0.2", features = ["iterator"] }
use type_toppings::IteratorExt;
// Map only the Some values in an iterator of Option<T>:
let data: Vec<_> = vec![Some(1), None, Some(3)]
.into_iter()
.map_opt(|x| x * 2)
.collect();
assert_eq!(data, vec![Some(2), None, Some(6)]);