1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
//! This crate generalises traits over the `len` and `capacity` methods found in most collections.
//!
//! Methods that are included:
//!
//! * [`capacity`]
//! * [`clear`]
//! * [`is_empty`]
//! * [`len`]
//! * [`reserve_exact`]
//! * [`reserve`]
//! * [`shrink_to_fit`]
//! * [`split_at_mut`]
//! * [`split_at`]
//! * [`split_off`]
//! * [`truncate`]
//! * [`with_capacity`]
//!
//! 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:
//!
//! * [`LenMut`], which requires `Clear`
//! * [`Clear`], which requires `Len`
//! * [`Len`], which requires `Empty`
//! * [`Empty`]
//!
//! The `capacity` module provides:
//!
//! * [`CapacityMut`], which requires `WithCapacity`
//! * [`WithCapacity`], which requires `Capacity`
//! * [`Capacity`], which requires `Len`.
//!
//! The `index` module provides:
//!
//! * [`IndexRange<Idx>`], automatically implemented from `Index<Idx>`
//! * [`IndexRangeMut<Idx>`], automatically implemented from `IndexMut<Idx>`
//! * [`SplitAt<Idx>`], which requires `IndexRange<Idx>`
//! * [`SplitAtMut<Idx>`], which requires `IndexRangeMut<Idx>`
//!
//! # 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`.
//!
//! [`LenMut`]: len/trait.LenMut.html
//! [`Clear`]: len/trait.Clear.html
//! [`Len`]: len/trait.Len.html
//! [`Empty`]: len/trait.Empty.html
//! [`CapacityMut`]: capacity/trait.CapacityMut.html
//! [`WithCapacity`]: capacity/trait.WithCapacity.html
//! [`Capacity`]: capacity/trait.Capacity.html
//! [`SplitAt<Idx>`]: index/trait.SplitAt.html
//! [`SplitAtMut<Idx>`]: index/trait.SplitAtMut.html
//! [`IndexRange<Idx>`]: index/trait.IndexRange.html
//! [`IndexRangeMut<Idx>`]: index/trait.IndexRangeMut.html
//! [`capacity`]: capacity/trait.Capacity.html#tymethod.capacity
//! [`clear`]: len/trait.Clear.html#tymethod.clear
//! [`is_empty`]: len/trait.Empty.html#tymethod.is_empty
//! [`len`]: len/trait.Len.html#tymethod.len
//! [`reserve_exact`]: capacity/trait.CapacityMut.html#method.reserve_exact
//! [`reserve`]: capacity/trait.CapacityMut.html#tymethod.reserve
//! [`shrink_to_fit`]: capacity/trait.CapacityMut.html#method.shrink_to_fit
//! [`split_at_mut`]: index/trait.SplitAtMut.html#tymethod.split_at_mut
//! [`split_at`]:  index/trait.SplitAt.html#tymethod.split_at
//! [`split_off`]: len/trait.LenMut.html#tymethod.split_off
//! [`truncate`]: len/trait.LenMut.html#tymethod.truncate
//! [`with_capacity`]: capacity/trait.WithCapacity.html#tymethod.with_capacity
#![cfg_attr(all(not(feature = "std"), feature = "alloc"), feature(alloc))]
#![cfg_attr(not(feature = "std"), feature(core_slice_ext, core_str_ext))]
#![cfg_attr(not(feature = "std"), no_std)]
#![doc(html_root_url = "https://docs.charr.xyz/len-trait/")]
#![cfg_attr(test, deny(warnings))]

#[macro_use]
extern crate cfg_if;

#[cfg(feature = "bit-set")]
extern crate bit_set;

#[cfg(feature = "bit-vec")]
extern crate bit_vec;

#[cfg(feature = "blist")]
extern crate blist;

#[cfg(feature = "enum-set")]
extern crate enum_set;

#[cfg(feature = "interval-heap")]
extern crate interval_heap;

#[cfg(feature = "linear-map")]
extern crate linear_map;

#[cfg(feature = "linked-hash-map")]
extern crate linked_hash_map;

#[cfg(feature = "lru-cache")]
extern crate lru_cache;

#[cfg(feature = "vec_map")]
extern crate vec_map;

#[cfg(all(not(feature = "std"), feature = "alloc"))]
extern crate alloc;

pub mod capacity;
pub mod index;
pub mod len;

pub use capacity::*;
pub use index::*;
pub use len::*;

mod impls;