Struct horde::sync_table::PotentialSlot [−][src]
pub struct PotentialSlot<'a> { /* fields omitted */ }
Represents where a value would be if inserted.
Created by calling get_potential
on Read. All methods on this type takes a table handle
and this must be a handle to the same table get_potential
was called on. Operations also must
be on the same element as given to get_potential
. The operations have a fast path for when
the element is still missing.
Implementations
impl<'a> PotentialSlot<'a>
[src]
impl<'a> PotentialSlot<'a>
[src]pub fn get<'b, Q: ?Sized, K, V, S: BuildHasher>(
self,
table: Read<'b, K, V, S>,
key: &Q,
hash: Option<u64>
) -> Option<(&'b K, &'b V)> where
K: Borrow<Q>,
Q: Eq + Hash,
[src]
self,
table: Read<'b, K, V, S>,
key: &Q,
hash: Option<u64>
) -> Option<(&'b K, &'b V)> where
K: Borrow<Q>,
Q: Eq + Hash,
Gets a reference to an element in the table.
pub fn refresh<Q: ?Sized, K, V, S: BuildHasher>(
self,
table: Read<'a, K, V, S>,
key: &Q,
hash: Option<u64>
) -> Result<(&'a K, &'a V), PotentialSlot<'a>> where
K: Borrow<Q>,
Q: Eq + Hash,
[src]
self,
table: Read<'a, K, V, S>,
key: &Q,
hash: Option<u64>
) -> Result<(&'a K, &'a V), PotentialSlot<'a>> where
K: Borrow<Q>,
Q: Eq + Hash,
Returns a new up-to-date potential slot.
This can be useful if there could have been insertions since the slot was derived
and you want to use try_insert_new
or insert_new_unchecked
.
pub fn insert_new<'b, K: Hash + Send + Clone, V: Send + Clone, S: BuildHasher>(
self,
table: &mut Write<'b, K, V, S>,
key: K,
value: V,
hash: Option<u64>
) -> (&'b K, &'b V)
[src]
self,
table: &mut Write<'b, K, V, S>,
key: K,
value: V,
hash: Option<u64>
) -> (&'b K, &'b V)
Inserts a new element into the table, and returns a reference to it.
This does not check if the given element already exists in the table.
pub fn try_insert_new<'b, K: Hash, V, S: BuildHasher>(
self,
table: &mut Write<'b, K, V, S>,
key: K,
value: V,
hash: Option<u64>
) -> Option<(&'b K, &'b V)>
[src]
self,
table: &mut Write<'b, K, V, S>,
key: K,
value: V,
hash: Option<u64>
) -> Option<(&'b K, &'b V)>
Inserts a new element into the table, and returns a reference to it. Returns None if the potential slot is taken by other insertions or if there’s no spare capacity in the table.
This does not check if the given element already exists in the table.
pub unsafe fn insert_new_unchecked<'b, K: Hash, V, S: BuildHasher>(
self,
table: &mut Write<'b, K, V, S>,
key: K,
value: V,
hash: Option<u64>
) -> (&'b K, &'b V)
[src]
self,
table: &mut Write<'b, K, V, S>,
key: K,
value: V,
hash: Option<u64>
) -> (&'b K, &'b V)
Inserts a new element into the table, and returns a reference to it.
This does not check if the given element already exists in the table.
Safety
Derived refers here to either a value returned by get_potential
or by a refresh
call.
The following conditions must hold for this function to be safe:
table
must be the same table thatself
is derived from.hash
,key
andvalue
must match the value used whenself
was derived.- There must not have been any insertions or
replace
calls to the table sinceself
was derived.
Trait Implementations
impl<'a> Clone for PotentialSlot<'a>
[src]
impl<'a> Clone for PotentialSlot<'a>
[src]fn clone(&self) -> PotentialSlot<'a>
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<'a> Copy for PotentialSlot<'a>
[src]
impl<'a> Copy for PotentialSlot<'a>
[src]Auto Trait Implementations
impl<'a> RefUnwindSafe for PotentialSlot<'a>
impl<'a> RefUnwindSafe for PotentialSlot<'a>
impl<'a> Send for PotentialSlot<'a>
impl<'a> Send for PotentialSlot<'a>
impl<'a> Sync for PotentialSlot<'a>
impl<'a> Sync for PotentialSlot<'a>
impl<'a> Unpin for PotentialSlot<'a>
impl<'a> Unpin for PotentialSlot<'a>
impl<'a> UnwindSafe for PotentialSlot<'a>
impl<'a> UnwindSafe for PotentialSlot<'a>