Releases: coriolinus/counter-rs
v0.6.0
What's Changed
- update edition, add
counter
keyword by @chris-ha458 in #34 - refactor tests and impls into distinct modules by @chris-ha458 in #36
- small doc formatting by @chris-ha458 in #38
- deprecate
init
method by @coriolinus in #41 - do not use deprecated
init
method by @coriolinus in #42 - With capacity by @chris-ha458 in #40
- Clippy fixes by @chris-ha458 in #43
- Implement Serialize and Deserialize by @matthewmcintire-savantx in #46
New Contributors
- @chris-ha458 made their first contribution in #34
- @matthewmcintire-savantx made their first contribution in #46
Full Changelog: v0.5.7...v0.5.8
v0.5.7: Counters are Multisets
What's Changed
- Implement is_subset and is_superset tests by @mjpieters in #27
- Implement bitwise and and or assignments by @mjpieters in #28
- Fix spelling error in doc header by @mjpieters in #29
- Multiset bag documentation by @coriolinus in #31
New Contributors
- @mjpieters made their first contribution in #27
Full Changelog: v0.5.6...v0.5.7
v0.5.6: `k_most_common_items` and more relaxed trait bounds
What's Changed
- Relax more trait bounds by @clint-white in #22
- Improve concision by @clint-white in #23
- Fix minor issues in documentation by @clint-white in #24
- Add method to return the
k
most common items and speed upmost_common_*()
methods by @clint-white in #25
Full Changelog: v0.5.5...v0.5.6
v0.5.5: Relax trait bounds, add `.total()` method
What's Changed
- Add method
Counter::total()
by @clint-white in #20 - Relax trait bounds by @clint-white in #21
New Contributors
- @clint-white made their first contribution in #20
Full Changelog: v0.5.4...v0.5.5
v0.5.4: Relax trait bounds for `Default`
more iterators and relax trait bounds
What's Changed
- Added implementations for IntoIter and IterMut by @TinBryn in #16
- <N: Clone> bound is not required on {Add,Sub}{,Assign} by @samueltardieu in #17
- Cleanup redundant references by @samueltardieu in #18
New Contributors
- @TinBryn made their first contribution in #16
- @samueltardieu made their first contribution in #17
Full Changelog: v0.5.2...v0.5.3
impl Extend, IntoIterator for Counter
Implementing these traits gives users more ways to usefully combine their counts.
Remove unnecessary cloning
This release removes self-cloning from the Add, Sub, and BitOr impls.
This also fixes a number of other clippy, minor clippy lints.
Implicit zero for unknown entries
Counters now implement Index
and IndexMut
, so they can have implicit zero counts. In other words:
# use counter::Counter;
let counter = "aaa".chars().collect::<Counter<_>>();
assert_eq!(counter[&'b'], 0);
// panics
// assert_eq!((*counter)[&'b'], 0);
This is a breaking change, causing a minor version bump, because it is not impossible that previous code depended on indexing panicing for unknown entries. Code which does not panic as part of its intended control flow will not be affected.
Bound N on Clone, not Copy
All Copy
types are also Clone
types where the clone bound happens to be really cheap. Bounding N: Clone
instead of N: Copy
means that we can use numeric types like num::BigInteger
, which are not Copy
, and things still work. You pay a bit more runtime cost, but if you're using a non-default counter type, presumably you know the costs of your actions.