0.3.0
Huge thanks to Rinde van Lon for implementing the bulk of these new changes and additions. Thanks to him, the various non-empty collections now have much better performance characteristics.
Changed
- BREAKING: Redesign of
NonEmptyIterator:NonEmptyIteratoris now bounded byIntoIteratorand has default
implementations of all methods (i.e. it is a marker trait).NonEmptyIterator::first()is renamed tonext()and the old implementation ofnext()is removed.NonEmptyIterator::all()now consumes selfNonEmptyIterator::any()now consumes selfNonEmptyIterator::nth()now consumes selfNonEmptyIterator::take(usize)->NonEmptyIterator::take(NonZeroUsize)and doesn't panic anymore
- BREAKING:
NEVec::truncate(usize)->NEVec::truncate(NonZeroUsize)and doesn't panic anymore - BREAKING: Capacities for all collections now use
NonZeroUsizeinstead ofusize:with_capacity(NonZeroUsize)with_capacity_and_hasher(NonZeroUsize)capacity() -> NonZeroUsize
- BREAKING: All fields are now private for
NEVec,NEMap,NESet, andNESlice - BREAKING: Removed:
NESlice::new(&T, &[T])IntoIteratorProxy
- BREAKING: Methods that are no longer
const:NEVec::new()NEVec::first()
- BREAKING: non-empty maps and sets now behave similarly to their possibly
empty counter parts: when created from an iterator with duplicates, the last
occurence is kept. - BREAKING: Consistent API, new naming to align with Rust's naming
conventions and indicate the fallibility of the function:from_vectotry_from_vecfrom_maptotry_from_mapfrom_slicetotry_from_slicefrom_settotry_from_set.
- BREAKING:
IteratorExtis removed in favor ofIntoIteratorExt. Now it's
possible to calltry_into_nonempty_iter()instead ofto_nonempty_iter()on
all regular iterators because regular iterators also implementIntoIterator. - BREAKING:
.iter(),.iter_mut(), etc, are now prefixed withnonempty_ FromNonEmptyIterator<T>is now implemented forHashSet<T, S>instead of
HashSet<T>(with the default hasher).
Fixed
- Fixes bug in
PartialEq for NEIndexMap, previously, maps with unequal lengths
would be considered equal if the shorter map would contain the same values as
the longer map. - Fixes bug in
NEMap::with_capacity()andNESet::with_capacity(), it wasn't
possible to call this method without explicitly specifying the type forS
(the hasher). For this method it is assumed that it always uses the default
hasher (just like instd), in case the user wants to specify the hasher
with_capacity_and_hasher()can be used. The fix moved the method into the
properimplblock.
Added
- New feature
either: addsNEEitheran extension toeither::Either. - New feature
itertools: adds a newNonEmptyItertoolstrait that is an
extension of theNonEmptyIteratorsimilar to howItertoolsextends
Iterator. So far,cartesian_product(),sorted_by_key(), and
all_unique()are implemented. NonEmptyIterator::find()the equivalent ofIterator::find().IntoNonEmptyIterator for &NEVec,&NEIndexMap,&NEMap,&NESet,
&NESlice,&[T; $i] where $i > 0(these previously only existed for their
owned equivalents)NESlice::from_slice()is nowconstIndex<usize> for NESlice- All public types now implement
Debug - Aliases
ne_vecfornev,ne_hashsetfornes, andne_hashmapfornem. - Strict lint configuration
- The rust version to which the library is build is now pinned, to avoid accidental breakage.
- A
justfilethat allows to run
pre-configured commands to check the codebase. E.g.just lintorjust test. - Benchmarks for
VecversusNEVec. - Added
.iter()methods to all collections returning a regularIterator.