diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2022-03-06 00:06:18 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2022-03-06 00:06:18 +0000 |
commit | 4fafa9877b8c0ef5160a6d7bc14bbc623defaa00 (patch) | |
tree | 619b140d4e933acdbc6d87f524856c1a682011ad | |
parent | 54e8140356260e876ceed2343c93ed66a4360427 (diff) | |
parent | de61eb3934f4b364865f66c12b1f5149e8f06958 (diff) | |
download | slab-android13-d1-release.tar.gz |
Snap for 8261343 from de61eb3934f4b364865f66c12b1f5149e8f06958 to tm-d1-releaseandroid-13.0.0_r9android-13.0.0_r15android-13.0.0_r14android-13.0.0_r13android-13.0.0_r11android-13.0.0_r10android13-d1-s3-releaseandroid13-d1-s2-releaseandroid13-d1-s1-releaseandroid13-d1-release
Change-Id: I6e321a5d9a503305a97d188ee8ff6995704ae8b7
-rw-r--r-- | .cargo_vcs_info.json | 2 | ||||
-rw-r--r-- | Android.bp | 4 | ||||
-rw-r--r-- | CHANGELOG.md | 6 | ||||
-rw-r--r-- | Cargo.toml | 2 | ||||
-rw-r--r-- | Cargo.toml.orig | 2 | ||||
-rw-r--r-- | METADATA | 10 | ||||
-rw-r--r-- | src/lib.rs | 23 |
7 files changed, 34 insertions, 15 deletions
diff --git a/.cargo_vcs_info.json b/.cargo_vcs_info.json index 820133c..90db974 100644 --- a/.cargo_vcs_info.json +++ b/.cargo_vcs_info.json @@ -1,5 +1,5 @@ { "git": { - "sha1": "76d9ca4e0c0313c1eeafa691e11446906e2bb4a7" + "sha1": "c512385b1a70100c8597f0f519390c80e90c9529" } } @@ -23,7 +23,7 @@ rust_library { host_supported: true, crate_name: "slab", cargo_env_compat: true, - cargo_pkg_version: "0.4.4", + cargo_pkg_version: "0.4.5", srcs: ["src/lib.rs"], edition: "2018", features: [ @@ -44,7 +44,7 @@ rust_test { host_supported: true, crate_name: "slab", cargo_env_compat: true, - cargo_pkg_version: "0.4.4", + cargo_pkg_version: "0.4.5", srcs: ["tests/slab.rs"], test_suites: ["general-tests"], auto_gen_config: true, diff --git a/CHANGELOG.md b/CHANGELOG.md index 5b5edd8..501a25c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +# 0.4.5 (October 13, 2021) + + * Add alternate debug output for listing items in the slab (#108) + * Fix typo in debug output of IntoIter (#109) + * Impl 'Clone' for 'Iter' (#110) + # 0.4.4 (August 06, 2021) * Fix panic in `FromIterator` impl (#102) @@ -12,7 +12,7 @@ [package] edition = "2018" name = "slab" -version = "0.4.4" +version = "0.4.5" authors = ["Carl Lerche <me@carllerche.com>"] exclude = ["/.*"] description = "Pre-allocated storage for a uniform data type" diff --git a/Cargo.toml.orig b/Cargo.toml.orig index b017ada..bc25be8 100644 --- a/Cargo.toml.orig +++ b/Cargo.toml.orig @@ -6,7 +6,7 @@ name = "slab" # - README.md # - Update CHANGELOG.md # - Create git tag -version = "0.4.4" +version = "0.4.5" authors = ["Carl Lerche <me@carllerche.com>"] edition = "2018" license = "MIT" @@ -7,13 +7,13 @@ third_party { } url { type: ARCHIVE - value: "https://static.crates.io/crates/slab/slab-0.4.4.crate" + value: "https://static.crates.io/crates/slab/slab-0.4.5.crate" } - version: "0.4.4" + version: "0.4.5" license_type: NOTICE last_upgrade_date { - year: 2021 - month: 8 - day: 9 + year: 2022 + month: 3 + day: 1 } } @@ -186,6 +186,15 @@ pub struct Iter<'a, T> { len: usize, } +impl<'a, T> Clone for Iter<'a, T> { + fn clone(&self) -> Self { + Self { + entries: self.entries.clone(), + len: self.len, + } + } +} + /// A mutable iterator over the values stored in the `Slab` pub struct IterMut<'a, T> { entries: iter::Enumerate<slice::IterMut<'a, Entry<T>>>, @@ -1253,10 +1262,14 @@ where T: fmt::Debug, { fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { - fmt.debug_struct("Slab") - .field("len", &self.len) - .field("cap", &self.capacity()) - .finish() + if fmt.alternate() { + fmt.debug_map().entries(self.iter()).finish() + } else { + fmt.debug_struct("Slab") + .field("len", &self.len) + .field("cap", &self.capacity()) + .finish() + } } } @@ -1265,7 +1278,7 @@ where T: fmt::Debug, { fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { - fmt.debug_struct("Iter") + fmt.debug_struct("IntoIter") .field("remaining", &self.len) .finish() } |