idbag

Check-in Differences
Login

Check-in Differences

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Difference From idbag-0.1.1 To idbag-0.1.2

2024-09-10
03:49
Crate maintenance. Add bacon conf, but don't include it in packaging. check-in: 373e9cdf32 user: jan tags: trunk
2024-01-23
09:51
Crate maintenance. Remove dev-docs feature. check-in: 25207ac9a2 user: jan tags: idbag-0.1.2, trunk
2023-08-30
17:04
Prepare for publish of 0.1.1. check-in: df0812d15e user: jan tags: idbag-0.1.1, trunk
16:57
Enable link to definitions for docs.rs. check-in: a3dd582034 user: jan tags: trunk

Changes to Cargo.toml.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
[package]
name = "idbag"
version = "0.1.1"
edition = "2021"
license = "0BSD"
categories = [ "data-structures" ]
keywords = [ "bag", "identifier" ]
repository = "https://repos.qrnch.tech/pub/idbag"
description = "A bag of u32 identifiers."
rust-version = "1.56"
exclude = [
  ".fossil-settings",
  ".efiles",
  ".fslckout",
  "www",
  "rustfmt.toml"
]

[features]
dev-docs = []

[dependencies]
hashbrown = { version = "0.14.0" }
parking_lot = { version = "0.12.1" }

[package.metadata.docs.rs]
rustdoc-args = ["--generate-link-to-definition"]



|















<
<
<

|





1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18



19
20
21
22
23
24
25
[package]
name = "idbag"
version = "0.1.2"
edition = "2021"
license = "0BSD"
categories = [ "data-structures" ]
keywords = [ "bag", "identifier" ]
repository = "https://repos.qrnch.tech/pub/idbag"
description = "A bag of u32 identifiers."
rust-version = "1.56"
exclude = [
  ".fossil-settings",
  ".efiles",
  ".fslckout",
  "www",
  "rustfmt.toml"
]




[dependencies]
hashbrown = { version = "0.14.3" }
parking_lot = { version = "0.12.1" }

[package.metadata.docs.rs]
rustdoc-args = ["--generate-link-to-definition"]

Changes to src/lib.rs.

36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
};

use parking_lot::Mutex;

use hashbrown::HashSet;

/// Internal representation of the IdBag.
#[cfg_attr(
  feature = "dev-docs",
  doc = r#"
# Internals
This is public only to enable sharing internal state between multible [`IdBag`] objects.
"#
)]
#[derive(Default)]
pub struct InnerBag {
  set: HashSet<u32>,
  idgen: u32
}

/// A collection of all `u32` integers that can be allocated.







<
<
<
<
<
<
<







36
37
38
39
40
41
42







43
44
45
46
47
48
49
};

use parking_lot::Mutex;

use hashbrown::HashSet;

/// Internal representation of the IdBag.







#[derive(Default)]
pub struct InnerBag {
  set: HashSet<u32>,
  idgen: u32
}

/// A collection of all `u32` integers that can be allocated.
209
210
211
212
213
214
215
216
217
218
219

220
221
222
223
224
225
226
227
228
229
230
231
232
233
      let mut g = idbag.lock();
      g.set.remove(&self.id);
    }
  }
}

/// An atomically referenced counted version of [`Id`].
#[cfg_attr(
  feature = "dev-docs",
  doc = r#"
# Internals

This exists primarily because we want to be able to look up `Arc<Id>`'s by
`u32`'s in `HashMap`'s. While it is possible to look up `Id`'s in
`HashMap`'s using `&u32`'s, it doesn't work for `Arc<Id>`'s.  To workaround
we create an `ArcId` newtype that implements `Borrow<u32>`, which passes it
through the `Arc` to it's inner `Id`.
"#
)]
#[derive(Clone, Hash, PartialEq, Eq)]
#[repr(transparent)]
pub struct ArcId(Arc<Id>);

impl fmt::Debug for ArcId {
  fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
    write!(f, "Id:{}", self.0.id)







<
<
<
<
>
|
|
|
|
|
<
<







202
203
204
205
206
207
208




209
210
211
212
213
214


215
216
217
218
219
220
221
      let mut g = idbag.lock();
      g.set.remove(&self.id);
    }
  }
}

/// An atomically referenced counted version of [`Id`].




///
/// This exists primarily because we want to be able to look up `Arc<Id>`'s by
/// `u32`'s in `HashMap`'s.  While it is possible to look up `Id`'s in
/// `HashMap`'s using `&u32`'s, it doesn't work for `Arc<Id>`'s.  To workaround
/// we create an `ArcId` newtype that implements `Borrow<u32>`, which passes it
/// through the `Arc` to it's inner `Id`.


#[derive(Clone, Hash, PartialEq, Eq)]
#[repr(transparent)]
pub struct ArcId(Arc<Id>);

impl fmt::Debug for ArcId {
  fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
    write!(f, "Id:{}", self.0.id)

Changes to www/changelog.md.

1
2
3
4


5
6
7
8
9
10

11










12


13
14
15
16
17

18
19
20
21
22
# Change Log

## [Unreleased]



### Added

### Changed

### Removed













## [0.1.1] - 2023-08-30



### Changed

- [infrastructure] Request that docs.rs generate links to definitions.



## [0.1.0] - 2023-08-29

- Initial release





>
>






>

>
>
>
>
>
>
>
>
>
>

>
>





>





1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# Change Log

## [Unreleased]

[Details](/vdiff?from=idbag-0.1.2&to=trunk)

### Added

### Changed

### Removed

---

## [0.1.2] - 2024-01-23

[Details](/vdiff?from=idbag-0.1.1&to=idbag-0.1.2)

### Removed

- Removed `dev-docs` feature.

---

## [0.1.1] - 2023-08-30

[Details](/vdiff?from=idbag-0.1.0&to=idbag-0.1.1)

### Changed

- [infrastructure] Request that docs.rs generate links to definitions.

---

## [0.1.0] - 2023-08-29

- Initial release