pub struct ArchivedHashIndex { /* private fields */ }
Expand description
An archived hash index.
Implementations§
Source§impl ArchivedHashIndex
impl ArchivedHashIndex
Sourcepub fn hasher(&self) -> HashBuilder
pub fn hasher(&self) -> HashBuilder
Gets the hasher for this hash index. The hasher for all archived hash indexes is the same for reproducibility.
Sourcepub fn index<K: Hash + ?Sized>(&self, k: &K) -> Option<usize>
pub fn index<K: Hash + ?Sized>(&self, k: &K) -> Option<usize>
Returns the index where a key may be located in the hash index.
The hash index does not have access to the keys used to build it, so the key at the returned index must be checked for equality.
Sourcepub unsafe fn resolve_from_len(
len: usize,
pos: usize,
resolver: HashIndexResolver,
out: *mut Self,
)
pub unsafe fn resolve_from_len( len: usize, pos: usize, resolver: HashIndexResolver, out: *mut Self, )
Resolves an archived hash index from a given length and parameters.
§Safety
len
must be the number of elements in the hash indexpos
must be the position ofout
within the archiveresolver
must be the result of building and serializing a hash index
Source§impl ArchivedHashIndex
impl ArchivedHashIndex
Sourcepub unsafe fn build_and_serialize<'a, K, V, S, I>(
iter: I,
serializer: &mut S,
entries: &mut ScratchVec<MaybeUninit<(&'a K, &'a V)>>,
) -> Result<HashIndexResolver, S::Error>where
K: 'a + Hash,
V: 'a,
S: Serializer + ScratchSpace + ?Sized,
I: ExactSizeIterator<Item = (&'a K, &'a V)>,
pub unsafe fn build_and_serialize<'a, K, V, S, I>(
iter: I,
serializer: &mut S,
entries: &mut ScratchVec<MaybeUninit<(&'a K, &'a V)>>,
) -> Result<HashIndexResolver, S::Error>where
K: 'a + Hash,
V: 'a,
S: Serializer + ScratchSpace + ?Sized,
I: ExactSizeIterator<Item = (&'a K, &'a V)>,
Builds and serializes a hash index from an iterator of key-value pairs.
§Safety
- The keys returned by the iterator must be unique.
entries
must have a capacity ofiter.len()
entries.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ArchivedHashIndex
impl RefUnwindSafe for ArchivedHashIndex
impl Send for ArchivedHashIndex
impl Sync for ArchivedHashIndex
impl !Unpin for ArchivedHashIndex
impl UnwindSafe for ArchivedHashIndex
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more