collect_array_ext_trait 0.2.0

Collect an iterator into an array.
Documentation
  • Coverage
  • 0%
    0 out of 3 items documented0 out of 2 items with examples
  • Size
  • Source code size: 4.18 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 535.69 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 9s Average build duration of successful builds.
  • all releases: 9s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • JohnScience/collect_array_ext_trait
    2 1 1
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • JohnScience

collect_array_ext_trait

Crates.io Downloads Documentation License Dependency Status

This is a simple library for collecting an instance of It: std::iter::Iterator<Item=T> into an array [T; N] where N is the presumed length of the iterator.

Example

use collect_array_ext_trait::CollectArray;

fn main() {
    let arr = (0..5).collect_array::<5>().unwrap();
    let mut iter = arr.iter().copied();
    assert_eq!(iter.next(), Some(0));
    assert_eq!(iter.next(), Some(1));
    assert_eq!(iter.next(), Some(2));
    assert_eq!(iter.next(), Some(3));
    assert_eq!(iter.next(), Some(4));
    assert_eq!(iter.next(), None);
}