Compare commits

..

No commits in common. '139f0963143c6bfe99786bb3667f4ccf022b03b6' and '21e8a7085ff5e051e689caa97f8ea286aac7f024' have entirely different histories.

@ -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.2"
version = "1.4.1"
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.163", default-features = false, features = ["derive", "alloc"], optional = true}
serde = {version = "1.0.116", 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.96"
serde_json = "1.0.59"
[build-dependencies]
rustc_version = "0.4"
rustc_version = "0.2"

@ -28,6 +28,7 @@
//! 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;
@ -309,7 +310,19 @@ where K: Collapse
/// Remove all empty pages from this instance.
pub fn clean(&mut self)
{
self.0.retain(|x| x.len() >= 1);
#[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;
}
}
}
}
/// The number of entries currently in this map

Loading…
Cancel
Save