type-toppings

Crates.iotype-toppings
lib.rstype-toppings
version0.2.1
sourcesrc
created_at2023-11-08 20:24:47.697658
updated_at2024-10-04 11:57:28.725603
descriptionOpinionated extensions to standard types
homepage
repositoryhttps://github.com/plul/type-toppings
max_upload_size
id1029387
size32,261
Asger Juul Brunshøj (plul)

documentation

README

Type Toppings

Opinionated collection of utility extensions for several of Rust's standard types, including:

  • Result
  • Iterator
  • futures::Steam

Documentation

https://docs.rs/type-toppings/latest/type_toppings/

Example

# 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)]);
Commit count: 17

cargo fmt