[][src]Module smart_access::stdlib_impls

Implementation of At for stdlib collections. Toggled with std_collections feature.

The following traits are implemented:

  • At<usize, View=T> for Vec<T>: simple indexing
  • At<range, View=Vec<T>> for Vec<T>: subvector (its size can be changed); Warning: access is O(n), wrap vector in &mut[..] to get O(1) access
  • At<K, View=V> for <Some>Map<K,V>: access value if it is present
  • At<(K,V), View=V> for <Some>Map<K,V>: ensure that the value is present (using the provided default) then access it

Though in normal circumstances these implementations do not panic there exists a possibility of panicking. For example At<range> for Vec<T> splits vector into (at most) three parts then glues them back after the update. Every one of these actions can panic on Out Of Memory.