2 releases

0.1.1 Nov 14, 2023
0.1.0 Nov 8, 2023

#517 in Asynchronous

37 downloads per month

MIT license

24KB
460 lines

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

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();

lib.rs:

Type Toppings: Extensions for Standard Rust Types

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

  • Result
  • Iterator
  • futures::Steam

Examples:

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();

For more detailed examples, see the documentation for each trait and method.

Dependencies

~1MB
~16K SLoC