Expand description
§Type Toppings: Extensions for Standard Rust Types
Opinionated collection of utility extensions for several of Rust’s standard types, including:
ResultIteratorfutures::Steam
§Examples:
#[cfg(feature = "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)]);
}For more detailed examples, see the documentation for each trait and method.
Traits§
- Iterator
Ext iterator std::iter::Iteratorextensions.- Result
Ext result std::result::Resultextensions.- Stream
Ext stream futures::Streamextensions.