diff --git a/fuzz/fuzz_targets/roundtrip.rs b/fuzz/fuzz_targets/roundtrip.rs index e2a15e81..10c19cd1 100644 --- a/fuzz/fuzz_targets/roundtrip.rs +++ b/fuzz/fuzz_targets/roundtrip.rs @@ -1,7 +1,7 @@ #![no_main] use libfuzzer_sys::fuzz_target; -use std::collections::{BTreeMap, BTreeSet, HashMap, VecDeque}; +use std::collections::{BTreeMap, BTreeSet, HashMap, HashSet, VecDeque}; use std::ffi::CString; use std::net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr, SocketAddrV4, SocketAddrV6}; use std::num::{NonZeroI128, NonZeroI32, NonZeroU128, NonZeroU32}; @@ -14,6 +14,7 @@ use std::time::{Duration, SystemTime}; enum AllTypes { BTreeMap(BTreeMap), HashMap(HashMap), + HashSet(HashSet), BTreeSet(BTreeSet), VecDeque(VecDeque), Vec(Vec), diff --git a/src/lib.rs b/src/lib.rs index a6a2817f..d9c59362 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -17,7 +17,7 @@ //! //! |Name |Default?|Supported types for Encode/Decode|Enabled methods |Other| //! |------|--------|-----------------------------------------|-----------------------------------------------------------------|-----| -//! |std | Yes |`HashMap`|`decode_from_std_read` and `encode_into_std_write`| +//! |std | Yes |`HashMap` and `HashSet`|`decode_from_std_read` and `encode_into_std_write`| //! |alloc | Yes |All common containers in alloc, like `Vec`, `String`, `Box`|`encode_to_vec`| //! |atomic| Yes |All `Atomic*` integer types, e.g. `AtomicUsize`, and `AtomicBool`|| //! |derive| Yes |||Enables the `BorrowDecode`, `Decode` and `Encode` derive macros| diff --git a/tests/alloc.rs b/tests/alloc.rs index 484c56f3..84bffe09 100644 --- a/tests/alloc.rs +++ b/tests/alloc.rs @@ -129,6 +129,7 @@ fn test_container_limits() { #[cfg(feature = "std")] { validate_fail::>(slice); + validate_fail::>(slice); } } } diff --git a/tests/std.rs b/tests/std.rs index 528fa1fa..658a4211 100644 --- a/tests/std.rs +++ b/tests/std.rs @@ -101,6 +101,11 @@ fn test_std_commons() { map.insert("you".to_owned(), "doing?".to_owned()); the_same(map); + let mut set = std::collections::HashSet::new(); + set.insert("Hello".to_string()); + set.insert("World".to_string()); + the_same(set); + // Borrowed values let config = bincode::config::standard(); let mut buffer = [0u8; 1024];