#collections #traits

cl-traits

Provides traits that describe collections

26 releases (15 stable)

Uses new Rust 2021

7.0.0 May 19, 2022
6.0.0 Jul 18, 2021
5.0.1 May 3, 2021
5.0.0 Jan 29, 2021
0.1.0 Mar 12, 2019

#302 in Development tools

Download history 130/week @ 2022-04-26 158/week @ 2022-05-03 384/week @ 2022-05-10 104/week @ 2022-05-17 139/week @ 2022-05-24 215/week @ 2022-05-31 64/week @ 2022-06-07 6/week @ 2022-06-14 23/week @ 2022-06-21 12/week @ 2022-06-28 35/week @ 2022-07-05 62/week @ 2022-07-12 41/week @ 2022-07-19 60/week @ 2022-07-26 95/week @ 2022-08-02 37/week @ 2022-08-09

237 downloads per month
Used in 5 crates (4 directly)

Apache-2.0

98KB
2.5K SLoC

Collection Traits (cl-traits)

CI crates.io Documentation License Rustc

Yet another library that generalizes collections.

This crate provides a single method for each trait to achieve maximum flexibility and freedom instead of imposing an abstraction subset for all situations and users.

Examples

use cl_traits::*;

struct SomeCustomVector(Vec<i32>, Vec<i32>);

impl Length for SomeCustomVector {
  #[inline]
  fn length(&self) -> usize {
    self.0.length() + self.1.length()
  }
}

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

Dependencies