Skip to content

Commit b2dc87b

Browse files
committed
make tests in readme compile
1 parent 7bf7824 commit b2dc87b

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ and in order to avoid passing `&Interned` which will require double-dereference
3333
Same data will be held in the same address
3434

3535
```rust
36+
use intern_mint::interned::Interned;
37+
3638
let a = Interned::new(b"hello");
3739
let b = Interned::new(b"hello");
3840

@@ -45,8 +47,9 @@ Note that the pointer is being used for hashing and comparing (see `Hash` and `P
4547
as opposed to hashing and comparing the actual data - because the pointers are unique for the same data as long as it "lives" in memory
4648

4749
```rust
50+
use intern_mint::{borrow::BorrowedInterned, interned::Interned};
4851

49-
let map = HashMap::<Interned, u64>::from_iter([(Interned::new(b"key"), 1)]);
52+
let map = std::collections::HashMap::<Interned, u64>::from_iter([(Interned::new(b"key"), 1)]);
5053

5154
let key = Interned::new(b"key");
5255
assert_eq!(map.get(&key), Some(&1));
@@ -58,8 +61,9 @@ assert_eq!(map.get(borrowed_key), Some(&1));
5861
`&BorrowedInterned` can be used with btree-maps
5962

6063
```rust
64+
use intern_mint::{borrow::BorrowedInterned, interned::Interned};
6165

62-
let map = BTreeMap::<Interned, u64>::from_iter([(Interned::new(b"key"), 1)]);
66+
let map = std::collections::BTreeMap::<Interned, u64>::from_iter([(Interned::new(b"key"), 1)]);
6367

6468
let key = Interned::new(b"key");
6569
assert_eq!(map.get(&key), Some(&1));

0 commit comments

Comments
 (0)