#collections #traits

no-std cl-traits

Provides traits that describe collections

26 releases (15 stable)

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

#729 in Development tools

Download history 32/week @ 2023-06-14 92/week @ 2023-06-21 43/week @ 2023-06-28 56/week @ 2023-07-05 13/week @ 2023-07-12 51/week @ 2023-07-19 24/week @ 2023-07-26 11/week @ 2023-08-02 20/week @ 2023-08-09 47/week @ 2023-08-16 14/week @ 2023-08-23 63/week @ 2023-08-30 60/week @ 2023-09-06 21/week @ 2023-09-13 14/week @ 2023-09-20

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

Apache-2.0

99KB
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

~0–360KB