Crates.io | cl-traits |
lib.rs | cl-traits |
version | 7.0.0 |
source | src |
created_at | 2019-03-08 23:08:46.462064 |
updated_at | 2022-05-19 18:42:21.186323 |
description | Provides traits that describe collections |
homepage | |
repository | https://github.com/c410-f3r/cl-traits |
max_upload_size | |
id | 119547 |
size | 110,693 |
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.
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);
}