Crate extend_fn

Source
Expand description

§extend-fn

Simple no-alloc library that allows using any arbitrary FnMut that takes a single value, in a place where types implementing Extend are needed.

use extend_fn::ExtendUsing;

let initial = [3, 8, 2usize];

let mut result = 0usize;
let mut extender = ExtendUsing::new(|value: usize| result += value);
extender.extend(initial.iter().copied());

assert_eq!(result, initial.into_iter().sum());

Structs§

ExtendUsing
Use an arbitrary FnMut type to implement Extend.