extend-fn 1.0.0

Use arbitrary FnMut when something that must implement Extend is needed
Documentation
  • Coverage
  • 66.67%
    2 out of 3 items documented2 out of 3 items with examples
  • Size
  • Source code size: 20.49 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.02 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 11s Average build duration of successful builds.
  • all releases: 11s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • infomorphic-matti/extend-fn
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • infomorphic-matti

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