mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-06 04:08:40 +00:00
Add some comments.
This commit is contained in:
parent
2469ed0142
commit
a61a85eb24
@ -8,6 +8,8 @@ use std::sync::atomic::{AtomicUsize, Ordering};
|
|||||||
|
|
||||||
pub(super) type Handle = NonZeroU32;
|
pub(super) type Handle = NonZeroU32;
|
||||||
|
|
||||||
|
/// A store that associates values of type `T` with numeric handles. A value can
|
||||||
|
/// be looked up using its handle.
|
||||||
pub(super) struct OwnedStore<T: 'static> {
|
pub(super) struct OwnedStore<T: 'static> {
|
||||||
counter: &'static AtomicUsize,
|
counter: &'static AtomicUsize,
|
||||||
data: BTreeMap<Handle, T>,
|
data: BTreeMap<Handle, T>,
|
||||||
@ -49,6 +51,7 @@ impl<T> IndexMut<Handle> for OwnedStore<T> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Like `OwnedStore`, but avoids storing any value more than once.
|
||||||
pub(super) struct InternedStore<T: 'static> {
|
pub(super) struct InternedStore<T: 'static> {
|
||||||
owned: OwnedStore<T>,
|
owned: OwnedStore<T>,
|
||||||
interner: HashMap<T, Handle>,
|
interner: HashMap<T, Handle>,
|
||||||
|
Loading…
Reference in New Issue
Block a user