- Merge @diegomrsantos PR to implement the following changes:
- Issue #65: Fix non-unique iteration over slab holes
- Modify get_mut_by_ methods such that they return only the unindexed fields of the element, allowing full mutable access without risk of breaking the index.
- Allow hasher to be configured for each MultiIndexMap through the
#[multi_index_hash]attribute.
- Allow generics in both indexed and unindexed fields. Unindexed fields can also be references with lifetimes. Generic fields must implement the traits Hash+Eq or Ord+Eq. Indexed generic fields must additionally implement Clone.
- Bump rustc-hash dependency to 2.1 to use newer, faster hash function
- Republish 0.11.1 as 0.12.0 due to SemVer violation caused by accidental inclusion of new Borrowed key type feature.
- Swap proc-macro-error dependency for proc-macro-error2, as the former has been abandoned.
- Update convert-case dependency to 0.8
- Allow callers to use Borrowed key types to access fields, eg. &str can be used rather than &String
- Add
try_insertmethod to allow fallible insertion and return shared reference to newly inserted element. - Change
insertmethod to return shared reference to newly inserted element.
- Allow optional
#[multi_index_derive()]attribute on element, to enable deriving of traits on the generated MultiIndexMap. eg.#[multi_index_derive(Clone, Debug)]. - Add feature
serdeto allow deriving ofSerializeandDeserializeon MultiIndexMap. - Remove feature
trivial_bounds, the same result can be acheived on stable rust with themulti_index_deriveattribute.
- Add
trivial_boundsfeature to automatically derive Debug and Clone impls if all elements support Debug and Clone. This feature requires nightly rust, because it uses thetrivial_boundsnightly feature.
- Allow FnMut closures in
modify_by_methods.
- Remove
Clonerequirement on elements, now only the indexed fields must implement Clone. This should be helpful when storing non-Clonable types in un-indexed fields. - If the MultiIndexMap does need to be Cloned, this must be implemented manually, however this should be fairly simple to do next to where the element is defined. See
examples/main.rs.
- Refactor and cleanup lots of code, also further reduce work done at compile time, by only generating identifiers for each field once.
- Implement work necessary to remove Clone requirement, however this will be fully removed in the next release.
- Add
update_by_methods and deprecateget_mut_by_methods. The new methods are equivalently useful, but safe and equally performant.
- Reduce work done at compile time by only looking up ordering and uniqueness once per field.
- Improve error messages, so all invalid attributes will be highlighted.
- Use version 2 resolver in Cargo.toml
- Merge @wyjin PR to implement the following changes:
- fix issue #27 to support other Derive attributes in any order
- Refactor codebase for a large clean up
- Merge @wyjin PR to implement the following changes:
- add
modify_by_andget_mut_by_for non-unique indexes - use BTreeSet to store equivalent elements in a non-unique index to improve insert/remove/modify performance
- add capacity-adjustment methods
shrink_to_fit,reserve, andwith_capacity - bug fix when modifying non_unique indexes that caused only a single element to be modified
- add benchmarks
- add
- Remove requirement for slab and rustc_hash in dependee's Cargo.toml by restucturing package, splitting it into multi_index_map_derive and multi_index_map
- Set MultiIndexMap to same visibility as provided Element. Set each field's relevant methods to the visibility of that field. This allows finer-grained control of method visibility/privacy.
- Remove inner
multi_index_<element_name>module. Previously this was used to avoid polluting the outer namespace with the Iterators for each field, however now users can now control the visibility per-field, so can create their own inner module if necessary to avoid polluting namespace. - Change
iter_by_methods. Now they take&self, previously they required&mut selfbut this is not necessary.
- Add
clear()method to clear the backing storage and all indexes.
- Prevent uniqueness constraints being violated by panicking upon any
insertormodifythat would result in violation. Previously to this version violations would result in overwriting the indexes to point to the new element, but the old element would remain in the backing storage, accessible only through the generaliter()/iter_mut()methods, and visible in theis_empty()andlen()methods.
- Fix bug with multiple non-unique indexes, whereby removal from one non-unique index could cause elements to become inaccessible through other non-unique indexes.
- Rename
multi_indexnamespace tomulti_index_<element_name>to avoid clashes when defining multiple MultiIndexMaps in a single namespace.
- Implement
ordered_non_uniqueand provideget_mut_by_accessors for bothnon_uniqueindexes. - Clean up
IndexKindenum to orthogonally represent Uniqueness and Ordering.
- Remove requirement for all field indexes to implement
Copy. - Derive
Cloneon the resulting map, in order to give better error messages that all fields need to implementClone.
- Add
hashed_non_uniquefield attribute, with associatedinsert_by_anditer_by_accessors. - Add initial test for
hashed_non_unique. - Ensure non-primitive types (ie. user-defined structs) are imported to the
multi_indexmodule to be used as indexes.