Crate cl_aux

Crate cl_aux 

Source
Expand description

§Auxiliary elements for collections

CI crates.io Documentation License Rustc

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§

ArrayWrapper
Used for serialization, de-serialization or to construct custom arrays.
ArrayWrapperRef
Immutable array reference wrapper similar to crate::ArrayWrapper.
AutoClear
Any mutable item wrapped in this structure is automatically cleaned when dropped.
FullAutoClear
Any mutable item wrapped in this structure is automatically cleaned when initialized and dropped.
IterWrapper
A wrapper around I: Iterator to workaround trait implementation conflicts
SingleItemStorage
A structure that holds one, and only one T.

Enums§

Error
Groups all possible crate errors

Traits§

Capacity
See Capacity::capacity for more information.
CapacityUpperBound
See CapacityUpperBound::capacity_upper_bound for more information.
Clear
See Clear::clear for more information.
DynContigColl
Dynamic Contiguous Collection
DynString
Dynamic String
Extend
See Extend::extend for more information.
Get
See Get::get for more information.
GetMut
See GetMut::get_mut for more information.
Insert
See Insert::insert for more information.
Iter
See Iter::iter for more information.
Length
See Length::length for more information.
Push
See Push::push for more information.
Remove
See Remove::remove for more information.
Retain
See Retain::retain for more information.
SingleTypeStorage
Anything that can hold a collection of items
SizeHint
See SizeHint::size_hint for more information.
Swap
See Swap::swap for more information.
Truncate
See Truncate::truncate for more information.
WithCapacity
See WithCapacity::with_capacity for more information.

Type Aliases§

Result
Alias of core::result::Result<T, Error>.