11 releases (5 breaking)

Uses old Rust 2015

0.6.1 Jul 6, 2017
0.6.0 Jul 5, 2017
0.5.0 May 9, 2017
0.4.0 Apr 13, 2017
0.1.0 Mar 6, 2017

#1884 in Data structures

Download history 649/week @ 2023-12-10 404/week @ 2023-12-17 65/week @ 2023-12-24 398/week @ 2023-12-31 863/week @ 2024-01-07 410/week @ 2024-01-14 724/week @ 2024-01-21 653/week @ 2024-01-28 801/week @ 2024-02-04 640/week @ 2024-02-11 555/week @ 2024-02-18 952/week @ 2024-02-25 1170/week @ 2024-03-03 1208/week @ 2024-03-10 1356/week @ 2024-03-17 1099/week @ 2024-03-24

4,848 downloads per month
Used in 15 crates (10 directly)

CC0 license

30KB
398 lines

Len trait

Len trait for collections. You may freely use and modify this code under the CC0 1.0 Universal License.

Usage

To use in your own project, just add the below to your Cargo.toml file.

[dependencies]
len-trait = "0.6"

For more formal documentation, you can find the rustdoc here.


lib.rs:

This crate generalises traits over the len and capacity methods found in most collections.

Methods that are included:

Additionally, the traits IndexRange<Idx> and IndexRangeMut<Idx> are provided for "consistent slicing," i.e. slicing over all range types.

Modules

The len module provides:

The capacity module provides:

The index module provides:

Features

The alloc and std features offer different tiers of implementations for different collections. The std feature automatically enables alloc. Although the std feature is the default, disabling it will enable no_std.

Dependencies

~8KB