#collection #traits

no-std cl-aux

Provides elements that describe collections

13 stable releases (4 major)

5.0.1 Aug 1, 2024
5.0.0 Jul 10, 2024
4.4.0 Oct 23, 2023
3.0.0 Oct 19, 2023
1.1.0 Jul 31, 2022

#226 in Development tools

Download history 137/week @ 2024-08-18 280/week @ 2024-08-25 460/week @ 2024-09-01 370/week @ 2024-09-08 184/week @ 2024-09-15 334/week @ 2024-09-22 470/week @ 2024-09-29 444/week @ 2024-10-06 362/week @ 2024-10-13 368/week @ 2024-10-20 157/week @ 2024-10-27 156/week @ 2024-11-03 165/week @ 2024-11-10 176/week @ 2024-11-17 167/week @ 2024-11-24 148/week @ 2024-12-01

666 downloads per month
Used in 4 crates

Apache-2.0

99KB
3K SLoC

Auxiliary elements for collections

CI crates.io Documentation License Rustc

Provides well-defined traits with single methods that enable the achievement of maximum flexibility and freedom in several different operations instead of imposing abstract subsets.

use cl_aux::Length;

struct SomeCustomArray([i32; 2], [i32; 4]);

impl Length for SomeCustomArray {
  fn length(&self) -> usize {
    self.0.length() + self.1.length()
  }
}

fn main() {
  let v = SomeCustomArray([1, 2], [3, 4, 5, 6]);
  assert_eq!(v.length(), 6);
}

Also provides structures for common use-cases.

use cl_aux::ArrayWrapper;

fn main() {
  let _array: [usize; 1] = ArrayWrapper::from_fn(|idx| idx).0;
}

Dependencies

~0–265KB