- Add
try_insert
method to allow fallible insertion and return shared reference to newly inserted element. - Change
insert
method 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
serde
to allow deriving ofSerialize
andDeserialize
on MultiIndexMap. - Remove feature
trivial_bounds
, the same result can be acheived on stable rust with themulti_index_derive
attribute.
- Add
trivial_bounds
feature to automatically derive Debug and Clone impls if all elements support Debug and Clone. This feature requires nightly rust, because it uses thetrivial_bounds
nightly feature.
- Allow FnMut closures in
modify_by_
methods.
- Remove
Clone
requirement 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 self
but this is not necessary.
- Add
clear()
method to clear the backing storage and all indexes.
- Prevent uniqueness constraints being violated by panicking upon any
insert
ormodify
that 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_index
namespace tomulti_index_<element_name>
to avoid clashes when defining multiple MultiIndexMaps in a single namespace.
- Implement
ordered_non_unique
and provideget_mut_by_
accessors for bothnon_unique
indexes. - Clean up
IndexKind
enum to orthogonally represent Uniqueness and Ordering.
- Remove requirement for all field indexes to implement
Copy
. - Derive
Clone
on the resulting map, in order to give better error messages that all fields need to implementClone
.
- Add
hashed_non_unique
field 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_index
module to be used as indexes.