fill 0.1.1

Provides the Fill trait, an alternative to Extend for finite containers
Documentation
  • Coverage
  • 100%
    6 out of 6 items documented4 out of 4 items with examples
  • Size
  • Source code size: 14.15 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 886.78 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • 197g/static-alloc
    61 11 4
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • HeroicKatora

fill

Crates.io Status Docs.rs Status License CI Status

Provides the Fill trait, an alternative to Extend for finite containers.

Usage

The official recommendation for the Extend trait is to simulate pushing all items from the iterator, panicking if a resource limit is exceeded. Instead of looping over all items the implementors of Fill should only pull items from the iterator while space is available. For example, an option can be viewed as a collection with a capacity of one. One can fill it with the first item of an iterator if it is empty.

use fill::Fill;
let mut memory = None;

memory.fill(42..);
assert_eq!(memory, Some(42));