Compare commits

...

5 Commits

Author SHA1 Message Date
Avril 139f096314
Version number bump: 1.4.2: Remove double-dependency from build dep graph (https://github.com/notflan/smallmap/pull/4). Replace removed nightly `Vec::drain_filter`, replace with stable `Vec::retain` (https://github.com/notflan/smallmap/pull/5).
6 months ago
Avril fa8fc30b1b
Merge pull request #5 from devyn/remove-drain-filter
6 months ago
Avril 3194a85868
Merge pull request #4 from MarcusGrass/mg/bump-deps
6 months ago
Devyn Cairns 00c9d23822 Replace `Vec::drain_filter` removal of empty pages with `Vec::retain`
6 months ago
MarcusGrass 027bffe8de
Update dependencies
11 months ago

@ -4,7 +4,7 @@ description = "Small byte-sized generic key-value map type"
keywords = ["map", "table", "small", "key", "value"]
repository = "https://github.com/notflan/smallmap"
homepage= "https://git.flanchan.moe/flanchan/smallmap"
version = "1.4.1"
version = "1.4.2"
authors = ["Avril <flanchan@cumallover.me>"]
edition = "2018"
license = "MIT"
@ -22,12 +22,12 @@ std = []
# TODO: maybe add an FFI feature, to allow C projects to use it? idk if that's worth it really...
[dependencies]
serde = {version = "1.0.116", default-features = false, features = ["derive", "alloc"], optional = true}
serde = {version = "1.0.163", default-features = false, features = ["derive", "alloc"], optional = true}
# TODO: optional smallvec feature: instead of heap-allocating the first page, it can be placed on the stack.
[dev-dependencies]
serde_json = "1.0.59"
serde_json = "1.0.96"
[build-dependencies]
rustc_version = "0.2"
rustc_version = "0.4"

@ -28,7 +28,6 @@
//! Generally don't use this if your key would have a lot of collisions being represents in 8 bits, otherwise it might be a faster alternative to hash-based maps. You should check yourself before sticking with this crate instead of `std`'s vectorised map implementations.
#![cfg_attr(any(not(test), not(feature = "std")), no_std)]
#![cfg_attr(nightly, feature(test))]
#![cfg_attr(nightly, feature(drain_filter))]
#![cfg_attr(nightly, feature(never_type))]
#[cfg(all(nightly, test))] extern crate test;
@ -310,19 +309,7 @@ where K: Collapse
/// Remove all empty pages from this instance.
pub fn clean(&mut self)
{
#[cfg(nightly)]
self.0.drain_filter(|x| x.len() <1);
#[cfg(not(nightly))]
{
let mut i = 0;
while i != self.0.len() {
if self.0[i].len() <1 {
self.0.remove(i);
} else {
i += 1;
}
}
}
self.0.retain(|x| x.len() >= 1);
}
/// The number of entries currently in this map

Loading…
Cancel
Save