#collection #traits

yanked 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

#46 in #collections

Download history 5/week @ 2024-07-18 259/week @ 2024-07-25 53/week @ 2024-08-01 1/week @ 2024-08-22 4/week @ 2024-08-29 4/week @ 2024-09-19 4/week @ 2024-09-26

77 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–345KB