Assorted immutable collection datatypes for Rust
HashSet
now implements From<Vector<A>>
and From<&Vector<A>> where A: Clone
.
Fixed a long standing crash bug in OrdMap
/OrdSet
. (#154, #143, #152, #124)
The union
method on maps/sets will now prefer to mutate the larger set (which leads to less work) rather than the first set. (#163)
Ensure TreeFocus
only implements Send
/Sync
when the underlying type does. (#157, #158)
There was an issue where nodes in very large OrdMap
s could overflow when removing an element and cause a panic, which has now been fixed. (#141)
Assorted doc cleanup. (#150, #173, #186, #194)
(&K, &V)
and (&K, &mut V)
respectively, to be consistent with std::collections
's API. DiffIter
for OrdMap
has also changed in the same manner. (#121)pool
feature flag has been removed from the im
version of the crate, as refpool
no longer supports threadsafe pools.HashSet::iter_mut()
has been removed, because if you modify the hashed values in a hash set, you break the hash set.pool
feature flag was missing from the im-rc
version of the crate, which is the version where it's actually useful. It's been added now.DiffIter
now has a Debug
implementation.Vector::is_inline()
method to determine whether a Vector
is currently inlined. (#129)Vector
has improved the performance of Vector::sort
by approximately 2x. (#126)proptest
strategies have been moved to im::proptest
. The previous locations of the strategies (im::vector::proptest
etc) are still available, but have been deprecated.OrdSet
and OrdMap
now have get_prev
and get_next
methods (with equivalent get_prev_mut
and get_next_mut
methods for OrdMap
) which will return the closest key match to the requested key in the specified direction if the key isn't in the set. (#95)retain
method, inexplicably missing from HashMap
but not HashSet
, has been added. (#120)get_mut
method on OrdMap
was, equally inexplicably, private. It has now been made public.get_key_value()
method, corresponding to the equivalent additions to the standard library.ptr_eq
method has been added to all data types, allowing you to test whether two values refer to the same content in memory, by testing for pointer equality. (#117)HashMap
had lost its Arbitrary
implementation for the quickcheck
feature flag. It's now been restored. (#118)Arbitrary
from the arbitrary
crate have been added behind the arbitrary
feature flag.Vector
by replacing the consuming iterator with a much simpler and slightly more efficient version. (#116)pool
feature flag, im now supports constructing data types using refpool
to speed up chunk allocation. The performance boost will vary between use cases and operating systems, but generally at least a 10% speedup can be expected when constructing a data type from an iterator, and the more complex an operation is, the more likely it is to benefit from being able to quickly reallocate chunks. Note that in order to use this feature, you have to construct your data types using the with_pool(&pool)
constructor, it's not enough just to enable the feature flag.sized-chunks
now requires a slightly more recent version of rustc
to compile, specifically version 1.36.0, so does im
. This is a breaking change, but will of course only affect your code if you're using an older rustc
.Vector
. (#101)Vector
s. (#105, #107)The minimum supported Rust version is now 1.34.0.
im::iter::unfold
now gives you the owned state value rather than an immutable reference to it, which makes it a little more useful.singleton
constructors have been removed. Please use unit
instead.Vector::chunks
and Vector::chunks_mut
have been removed in favour of Vector::leaves
and Vector::leaves_mut
respectively. (#50)sized-chunks
has been removed. If you need it, please use the sized-chunks
crate directly.im::iter::unfold_mut
has been removed, as there's no meaningful difference between it and rust-std 1.34.0's std::iter::from_fn
with a captured state variable.Vector
now uses sized_chunks::InlineArray
instead of an Empty
enum case to avoid allocation at very small sizes, letting you store a handful of elements on the stack before needing to grow into a full chunk. This has a beneficial effect on performance as well, as there's no pointer into the heap to dereference, making it faster than std::vec::Vec
in this configuration.OrdSet::is_subset(&self, other)
now returns immediately when self
is larger than other
and thus could not possibly be a subset of it. (#87)Clone
constraints have been further relaxed on maps and sets, so that you can now lookup and iterate over them without requiring a Clone
constraint (though you do still need Clone
to actually insert data into them to lookup or iterate over). (#81)Vector
's size table handling. (#79)Clone
constraints on all data structures, as well as relevant constraints on maps and sets, have been relaxed where possible, so that you can now construct empty instances and call most query methods without requiring values implement Clone
etc. (#63)Vector
will not allocate any heap memory, instead deferring allocation until you perform an operation that would increase its length. (#65)Vector::append
repeatedly were fixed. (#67, #70)