Expand description
§Auxiliary elements for collections
Provides well-defined traits with single methods that enable the achievement of maximum flexibility and freedom in several different operations instead of imposing abstract subsets.
use cl_aux::Length;
struct SomeCustomArray([i32; 2], [i32; 4]);
impl Length for SomeCustomArray {
fn length(&self) -> usize {
self.0.length() + self.1.length()
}
}
fn main() {
let v = SomeCustomArray([1, 2], [3, 4, 5, 6]);
assert_eq!(v.length(), 6);
}Also provides structures for common use-cases.
use cl_aux::ArrayWrapper;
fn main() {
let _array: [usize; 1] = ArrayWrapper::from_fn(|idx| idx).0;
}Structs§
- Array
Wrapper - Used for serialization, de-serialization or to construct custom arrays.
- Array
Wrapper Ref - Immutable array reference wrapper similar to
crate::ArrayWrapper. - Auto
Clear - Any mutable item wrapped in this structure is automatically cleaned when dropped.
- Full
Auto Clear - Any mutable item wrapped in this structure is automatically cleaned when initialized and dropped.
- Iter
Wrapper - A wrapper around
I: Iteratorto workaround trait implementation conflicts - Single
Item Storage - A structure that holds one, and only one
T.
Enums§
- Error
- Groups all possible crate errors
Traits§
- Capacity
- See
Capacity::capacityfor more information. - Capacity
Upper Bound - See
CapacityUpperBound::capacity_upper_boundfor more information. - Clear
- See
Clear::clearfor more information. - DynContig
Coll - Dynamic Contiguous Collection
- DynString
- Dynamic String
- Extend
- See
Extend::extendfor more information. - Get
- See
Get::getfor more information. - GetMut
- See
GetMut::get_mutfor more information. - Insert
- See
Insert::insertfor more information. - Iter
- See
Iter::iterfor more information. - Length
- See
Length::lengthfor more information. - Push
- See
Push::pushfor more information. - Remove
- See
Remove::removefor more information. - Retain
- See
Retain::retainfor more information. - Single
Type Storage - Anything that can hold a collection of items
- Size
Hint - See
SizeHint::size_hintfor more information. - Swap
- See
Swap::swapfor more information. - Truncate
- See
Truncate::truncatefor more information. - With
Capacity - See
WithCapacity::with_capacityfor more information.
Type Aliases§
- Result
- Alias of
core::result::Result<T, Error>.